下面代碼在vc7.1都不能編譯通過,不知道bcb6能不能?
#include <hash_map>
struct stUpdateItem
{
std::string _strPath;
bool _bDownloadSucceeded;
stUpdateItem(const std::string& path)
: _bDownloadSucceeded(false)
, _strPath(path)
{
}
};
typedef std::hash_map<std::string, stUpdateItem> tUpdateItems;
void ChangeValue(bool* pDownloadSucceeded )
{
if (pDownloadSucceeded)
{
*pDownloadSucceeded = true;
}
}
void ProcessPackFile(stUpdateItem& item)
{
ChangeValue(&(item._bDownloadSucceeded));
}
int _tmain(int argc, _TCHAR* argv[])
{
stUpdateItem item1("data\\model.pak");
stUpdateItem item2("date\\texture.pak");
tUpdateItems items;
items.insert(tUpdateItems::value_type(item1._strPath, item1));
items.insert(tUpdateItems::value_type(item2._strPath, item2));
for (tUpdateItems::const_iterator it = items.begin(); it != items.end(); ++it)
{
ProcessPackFile(it->second);
}
return 0;
}
vc7.1 編譯錯誤:
f:\Practise\Practise_2003\hash_map_const_iterator_test\hash_map_const_iterator_test.cpp(46) : error C2664: “ProcessPackFile” : 不能將參數 1 從“const stUpdateItem”轉換為“stUpdateItem &”
轉換丟失限定符
posted on 2007-11-01 17:26
七星重劍 閱讀(2077)
評論(2) 編輯 收藏 引用 所屬分類:
PL--c/c++