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'
|
|