error C2664:...No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called

清泛原创

error C2664: '__thiscall std::list<int,class std::allocator<int> >::std::list<int,class std::allocator<int> >(unsigned int,const int &,

const class std::allocator<int> &)' : cannot convert parameter 1 from 'class std::deque<int,class std::allocator<int> >::iterator' to 'unsigned int'
        No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called

#include <iostream>  
#include <list>  
#include <deque>  
using namespace std;  
void main()  
{       
     //Define a list that holds elements that are deques that hold ints  
     deque<int>   ideque(10,1);  
     list<int>  ilist(ideque.begin(),ideque.end());  
     for(list<int>::const_iterator itbegin=ilist.begin(),itend=ilist.end();itbegin!=itend;++itbegin)  
         cout<<*itbegin<<endl;  
}

解决方法:vc 6.0对模板库支持不够好,使用vs2010编译通过。

error C2664

分享到:
评论加载中,请稍后...
创APP如搭积木 - 创意无限,梦想即时!
回到顶部