由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Programming版 - compile error
相关主题
C++一个string的小问题请教boost::any compile错误。
C++ templatea string define question (c++)
一个c++小问题make 时候遇到 undefined reference 怎么办?
C++ template problem[合集] 请问-fno-implicit-templates的用处
templatetypedef basic_string string;
sizeof(string)这段C++代码有啥问题
C++ linking 弱问 (one file)问一个C++ set和unordered_set iterator的问题
一个关于C++ template和overload的问题[合集] 为什么 const member 不能是 static.
相关话题的讨论汇总
话题: std话题: traits话题: string话题: mvs8话题: template
进入Programming版参与讨论
1 (共1页)
c*******9
发帖数: 6411
1
get compile error from following code, any ideas?
thanks...
.....
set seen;
.....
pair::iterator, bool> res = seen.insert(str);
c:\apps\mvs8\vc\include\functional(143) : error C2784: 'bool
std::operator <(const std::_Tree<_Traits> &,const std::_Tree<_Traits>
&)' : could not deduce template argument for 'const std::_Tree<_Traits>
&' from 'const std::string'
1> c:\apps\mvs8\vc\include\xtree(1372) : see declaration of
'std::operator <'
1> c:\apps\mvs8\vc\include\functional(142) : while compiling
class template member function 'bool std::less<_Ty>::operator ()(const
_Ty &,const _Ty &) const'
1> with
1> [
1> _Ty=std::string
1> ]
1> c:\apps\mvs8\vc\include\set(60) : see reference to class
template instantiation 'std::less<_Ty>' being compiled
1> with
1> [
1> _Ty=std::string
1> ]
1> c:\apps\mvs8\vc\include\xtree(26) : see reference to class
template instantiation 'std::_Tset_traits<_Kty,_Pr,_Alloc,_Mfl>' being
compiled
1> with
1> [
1> _Kty=std::string,
1> _Pr=std::less,
1> _Alloc=std::allocator,
1> _Mfl=false
1> ]
1> c:\apps\mvs8\vc\include\xtree(68) : see reference to class
template instantiation 'std::_Tree_nod<_Traits>' being compiled
1> with
1> [
1>
_Traits=std::_Tset_traits,std::alloca
tor,false>
1> ]
1> c:\apps\mvs8\vc\include\xtree(94) : see reference to class
template instantiation 'std::_Tree_ptr<_Traits>' being compiled
1> with
1> [
1>
_Traits=std::_Tset_traits,std::alloca
tor,false>
1> ]
1> c:\apps\mvs8\vc\include\xtree(112) : see reference to class
template instantiation 'std::_Tree_val<_Traits>' being compiled
1> with
1> [
1>
_Traits=std::_Tset_traits,std::alloca
tor,false>
1> ]
1> c:\apps\mvs8\vc\include\set(69) : see reference to class
template instantiation 'std::_Tree<_Traits>' being compiled
1> with
1> [
1>
_Traits=std::_Tset_traits,std::alloca
tor,false>
1> ]
1> d:\cplus\careercup\careercup\careercup\careercup.cpp(319) :
see reference to class template instantiation 'std::set<_Kty>' being
compiled
1> with
1> [
1> _Kty=std::string
1> ]
...
N***m
发帖数: 4460
2
for this snippet, no error was reported on gcc.
It could be some error elsewhere. As C2784 says:
'declaration' : could not deduce template argument for 'type' from 'type.'
The compiler cannot deduce a template argument from the supplied
function arguments.

【在 c*******9 的大作中提到】
: get compile error from following code, any ideas?
: thanks...
: .....
: set seen;
: .....
: pair::iterator, bool> res = seen.insert(str);
: c:\apps\mvs8\vc\include\functional(143) : error C2784: 'bool
: std::operator <(const std::_Tree<_Traits> &,const std::_Tree<_Traits>
: &)' : could not deduce template argument for 'const std::_Tree<_Traits>
: &' from 'const std::string'

1 (共1页)
进入Programming版参与讨论
相关主题
[合集] 为什么 const member 不能是 static.template
一个partial specialization的问题sizeof(string)
[合集] 关于template和inheritance的问题请教C++ linking 弱问 (one file)
一个C++ template的问题一个关于C++ template和overload的问题
C++一个string的小问题请教boost::any compile错误。
C++ templatea string define question (c++)
一个c++小问题make 时候遇到 undefined reference 怎么办?
C++ template problem[合集] 请问-fno-implicit-templates的用处
相关话题的讨论汇总
话题: std话题: traits话题: string话题: mvs8话题: template