[問題] 請問關於stl的iterator的問題
開發平台(Platform): (Ex: VC++, GCC, Linux, ...)
vc2005
程式碼(Code):(請善用置底文網頁, 記得排版)
程式片斷如下:
ResourceGroupManager* rsm = ResourceGroupManager::getSingletonPtr();
StringVector groupNamesList = rsm->getResourceGroups();
for(std::vector<Ogre::String>::iterator iter = groupNamesList.begin() ; iter!=resourceNames.end() ; ++itResourceName)
{
}
在.h裡定義了:
typedef vector<String>::type StringVector;
StringVector getResourceGroups(void);
*[36m問題(Question):*[m
在for迴圈的那一行出錯了,不是很能理解那裡錯了,iterator格式不對?宣告不對?
*[36m錯誤結果(Wrong Output):*[m
error C2440: '正在初始化' : 無法由 'std::_Vector_iterator<_Ty,_Alloc>' 轉換為 'std::_Vector_iterator<_Ty,_Alloc>'
with
[
_Ty=Ogre::String,
_Alloc=Ogre::STLAllocator<Ogre::String,Ogre::GeneralAllocPolicy>
]
and
[
_Ty=Ogre::String,
_Alloc=std::allocator<std::basic_string<char,std::char_traits<char>,std::allocator<char>>>
]
沒有可以取得來源型別的建構函式,或建構函式多載解析模稜兩可
這裡看起來有兩個不同的東西,STLAllocator跟allocator
可是getResource的時候,明明回傳的是String型態..
補充說明(Supplement):
是Ogre的程式碼sample
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 111.249.155.240
→
04/27 22:48, , 1F
04/27 22:48, 1F
→
04/27 22:51, , 2F
04/27 22:51, 2F
→
04/27 23:49, , 3F
04/27 23:49, 3F
→
04/28 00:04, , 4F
04/28 00:04, 4F
→
04/28 00:05, , 5F
04/28 00:05, 5F