⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 subject_62439.htm

📁 vc
💻 HTM
字号:
<p>
序号:62439 发表者:许然 发表日期:2003-11-26 20:30:34
<br>主题:问个sort的简单问题。
<br>内容:程序如下:<BR>#include&lt;vector&gt;<BR>#include&lt;algorithm&gt;<BR>......<BR>vector&lt;string&gt; vecInvec;<BR>......<BR>vecInvec.sort(vecInvec.begin(),vecInvec.end());&nbsp;&nbsp;&nbsp;&nbsp;<BR>应该可以的啊,可是编译的时候提示错误。<BR>:\Code\CppProg\Chap5Pra\main.cpp(40) : error C2039: 'sort' : is not a member of 'vector&lt;class std::basic_string&lt;char,struct std::char_traits&lt;char&gt;,class std::allocator&lt;char&gt; &gt;,class std::allocator&lt;class std::basic_string&lt;char,struct std::char_trait<BR>s&lt;char&gt;,class std::allocator&lt;char&gt; &gt; &gt; &gt;'<BR>好像是说sort不是vector的成员<BR>可是vector不是标准库里面的嘛,应该包含sort算法的啊。<BR>哪位帮忙看一下,谢谢!!<BR>
<br><a href="javascript:history.go(-1)">返回上页</a><br><a href=http://www.copathway.com/cndevforum/>访问论坛</a></p>
<hr size=1>
<blockquote><p>
回复者:凯凯 回复日期:2003-11-26 21:49:58
<br>内容:是不是没有指定名字空间呀。
<br>
<a href="javascript:history.go(-1)">返回上页</a><br><a href=http://www.copathway.com/cndevforum/>访问论坛</a></p></blockquote>
<hr size=1>
<blockquote><p>
回复者:bbsbbs2003 回复日期:2003-11-26 22:04:13
<br>内容:'sort' : is not a member of 'vector'
<br>
<a href="javascript:history.go(-1)">返回上页</a><br><a href=http://www.copathway.com/cndevforum/>访问论坛</a></p></blockquote>
<hr size=1>
<blockquote><p>
<font color=red>答案被接受</font><br>回复者:zzjhsj 回复日期:2003-11-27 11:22:46
<br>内容:把<BR>vecInvec.sort(vecInvec.begin(),vecInvec.end());&nbsp;&nbsp;&nbsp;&nbsp;<BR>修改为<BR>sort(vecInvec.begin(),vecInvec.end());<BR>
<br>
<a href="javascript:history.go(-1)">返回上页</a><br><a href=http://www.copathway.com/cndevforum/>访问论坛</a></p></blockquote>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -