首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > C++ >

调试stl时遇到c2678异常

2012-03-30 
调试stl时遇到c2678错误编绎环境:vc6stl库:stlport代码:#includemap#includeiostream.h#pragmawarning

调试stl时遇到c2678错误
编绎环境:vc6
stl库:stlport
代码:
#include   <map>  
#include   <iostream.h>
#pragma   warning(disable:   4786)
typedef   std::map <std::string,   std::string>   CGI_VALUE;
int   main()
{
    CGI_VALUE   cgi;
    cgi.insert(CGI_VALUE::value_type( "a ",   "aaa "));
    const   CGI_VALUE   _cgi   =   cgi;

    //-----------
    CGI_VALUE::const_iterator   pos;
    for(pos=_cgi.begin();   pos!=_cgi.end();   ++pos)
    {
        cout < <pos-> first < <endl;
        cout < <pos-> second < <endl;
    }//     ok!
    //-----------

    cout   < <   cgi[ "a "]   < <   endl;//ok!

    //-----------
    cout   < <   _cgi[ "a "]   < <   endl;//error!!!!
}


跪求高手解答案....

[解决办法]
map的const对象不可以调[]。

热点排行