标题:list<char*>和vector<string>容器使用assign在VC运行出错
取消只看楼主
renhao153
Rank: 1
等 级:新手上路
帖 子:8
专家分:0
注 册:2007-11-10
 问题点数:0 回复次数:1 
list<char*>和vector<string>容器使用assign在VC运行出错
#include <iostream>
#include <string>
#include <vector>
#include <list>
#include<deque>
#include<algorithm>

using namespace std;
void main()
{
    list<char*> cd;
    char df[2][3];
    for(int i=0;i<2;++i)
    {
        cin>>*(df+i);
        cd.push_front (*(df+i));
    }

    vector<string> er;
    er.assign(cd.begin(),cd.end());
}
E:\电子图书\VC制作\C测试\cs1.cpp(20) : error C2664: 'void __thiscall std::vector<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,class std::allocator<class std::basic_string<char,struct std::char_traits<char>,
class std::allocator<char> > > >::assign(const class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > *,const class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > *)' : cannot conve
rt parameter 1 from 'class std::list<char *,class std::allocator<char *> >::iterator' to 'const class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > *'
        No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called
急求高手解释一下原因
搜索更多相关主题的帖子: vector list assign 容器 运行 
2008-09-06 23:46
renhao153
Rank: 1
等 级:新手上路
帖 子:8
专家分:0
注 册:2007-11-10
得分:0 
回复 2# xyt_bluesky 的帖子
我的是vc++6.0运行出错了
2008-09-07 10:41



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-231867-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.357343 second(s), 10 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved