I meet with some trouble when debugging the following
codes dealing with overloading operator >> in STL.
I have tried my best to resolve it but still failed.
My IDE is VC6.0.
class employee_data {
public:
employee_data() : name (""), skill(0), salary(0) {}
employee_data(string n, int s, long sa) :
name (n), skill (s), salary (sa) {}
defined which takes a right-hand operand of type 'const class std::basic_string<char,struct std::char_traits<char>,class
std::allocator<char> >' (or there is no acceptable conversion)
C:\Program Files\Microsoft Visual Studio\MyProjects\testMap1\testMap1.cpp(56) : error C2679: binary '<<' : no operator
defined which takes a right-hand operand of type 'class std::basic_string<char,struct std::char_traits<char>,class
std::allocator<
char> >' (or there is no acceptable conversion)
--------
How to resolve them?
Thanks in advance,
George
[Gabriel: added CODE tags]
Philip Nicoletti
February 20th, 2003, 08:24 AM
you forgot an include :
#include <string>
George2
February 20th, 2003, 08:31 AM
Thanks, Philip buddie!
I have tried your method. There are no errors but several warning informations. I doubted why the length of characters
is limited. Can you help?
George
--------
C:\Program Files\Microsoft Visual Studio\MyProjects\testMap1\testMap1.cpp(62) : warning C4786: 'std::pair<std::_Tree<employee,employee,std::set<employee,std::less<employee>,std::allocator<employee> >::_Kfn,std::less<employee>,std::allocator<employee
> >::iterator,std::_Tree<employee,employee,std::set<employee,std::less<employee>,std::allocator<employee> >::_Kfn,std::less<employee>,std::allocator<employee> >::iterator>' : identifier was truncated to '255' characters in the debug information
C:\Program Files\Microsoft Visual Studio\MyProjects\testMap1\testMap1.cpp(62) : warning C4786: 'std::pair<std::_Tree<employee,employee,std::set<employee,std::less<employee>,std::allocator<employee> >::_Kfn,std::less<employee>,std::allocator<employee
> >::const_iterator,std::_Tree<employee,employee,std::set<employee,std::less<employee>,std::allocator<employee> >::_Kfn,std::less<employee>,std::allocator<employee> >::const_iterator>' : identifier was truncated to '255' characters in the debug info
rmation
C:\Program Files\Microsoft Visual Studio\MyProjects\testMap1\testMap1.cpp(62) : warning C4786: 'std::pair<std::_Tree<employee,employee,std::multiset<employee,std::less<employee>,std::allocator<employee> >::_Kfn,std::less<employee>,std::allocator<emp
loyee> >::iterator,std::_Tree<employee,employee,std::multiset<employee,std::less<employee>,std::allocator<employee> >::_Kfn,std::less<employee>,std::allocator<employee> >::iterator>' : identifier was truncated to '255' characters in the debug inform
ation
C:\Program Files\Microsoft Visual Studio\MyProjects\testMap1\testMap1.cpp(62) : warning C4786: 'std::pair<std::_Tree<employee,employee,std::multiset<employee,std::less<employee>,std::allocator<employee> >::_Kfn,std::less<employee>,std::allocator<emp
loyee> >::const_iterator,std::_Tree<employee,employee,std::multiset<employee,std::less<employee>,std::allocator<employee> >::_Kfn,std::less<employee>,std::allocator<employee> >::const_iterator>' : identifier was truncated to '255' characters in the
debug information
c:\program files\microsoft visual studio\vc98\include\xtree(182) : warning C4786: 'std::_Tree<employee,employee,std::set<employee,std::less<employee>,std::allocator<employee> >::_Kfn,std::less<employee>,std::allocator<employee> >::~_Tree<employee,em
ployee,std::set<employee,std::less<employee>,std::allocator<employee> >::_Kfn,std::less<employee>,std::allocator<employee> >' : identifier was truncated to '255' characters in the debug information
c:\program files\microsoft visual studio\vc98\include\xtree(182) : warning C4786: 'std::_Tree<employee,employee,std::multiset<employee,std::less<employee>,std::allocator<employee> >::_Kfn,std::less<employee>,std::allocator<employee> >::~_Tree<employ
ee,employee,std::multiset<employee,std::less<employee>,std::allocator<employee> >::_Kfn,std::less<employee>,std::allocator<employee> >' : identifier was truncated to '255' characters in the debug information
c:\program files\microsoft visual studio\vc98\include\xtree(162) : warning C4786: 'std::_Tree<employee,employee,std::set<employee,std::less<employee>,std::allocator<employee> >::_Kfn,std::less<employee>,std::allocator<employee> >::_Tree<employee,emp
loyee,std::set<employee,std::less<employee>,std::allocator<employee> >::_Kfn,std::less<employee>,std::allocator<employee> >' : identifier was truncated to '255' characters in the debug information
c:\program files\microsoft visual studio\vc98\include\xtree(236) : warning C4786: '__ehhandler$?insert@?$_Tree@Vemployee@@V1@U_Kfn@?$set@Vemployee@@U?$less@Vemployee@@@std@@V?$allocator@Vemployee@@@3@@std@@U?$less@Vemployee@@@4@V?$allocator@Vemploye
e@@@4@@std@@QAE?AU?$pair@Viterator@?$_Tree@Vemployee@@V1@U_Kfn@?$set@Vemployee@@U?$less@Vemployee@@@std@@V?$allocator@Vemployee@@@3@@std@@U?$less@Vemployee@@@4@V?$allocator@Vemployee@@@4@@std@@_N@2@ABVemployee@@@Z' : identifier was truncated to '255
' characters in the debug information
c:\program files\microsoft visual studio\vc98\include\xtree(236) : warning C4786: '__unwindfunclet$?insert@?$_Tree@Vemployee@@V1@U_Kfn@?$set@Vemployee@@U?$less@Vemployee@@@std@@V?$allocator@Vemployee@@@3@@std@@U?$less@Vemployee@@@4@V?$allocator@Vemp
loyee@@@4@@std@@QAE?AU?$pair@Viterator@?$_Tree@Vemployee@@V1@U_Kfn@?$set@Vemployee@@U?$less@Vemployee@@@std@@V?$allocator@Vemployee@@@3@@std@@U?$less@Vemployee@@@4@V?$allocator@Vemployee@@@4@@std@@_N@2@ABVemployee@@@Z$0' : identifier was truncated t
o '255' characters in the debug information
c:\program files\microsoft visual studio\vc98\include\xtree(162) : warning C4786: 'std::_Tree<employee,employee,std::multiset<employee,std::less<employee>,std::allocator<employee> >::_Kfn,std::less<employee>,std::allocator<employee> >::_Tree<employe
e,employee,std::multiset<employee,std::less<employee>,std::allocator<employee> >::_Kfn,std::less<employee>,std::allocator<employee> >' : identifier was truncated to '255' characters in the debug information
c:\program files\microsoft visual studio\vc98\include\utility(21) : warning C4786: 'std::pair<std::_Tree<employee,employee,std::set<employee,std::less<employee>,std::allocator<employee> >::_Kfn,std::less<employee>,std::allocator<employee> >::iterato
r,bool>::pair<std::_Tree<employee,employee,std::set<employee,std::less<employee>,std::allocator<employee> >::_Kfn,std::less<employee>,std::allocator<employee> >::iterator,bool>' : identifier was truncated to '255' characters in the debug information
--------
Originally posted by Philip Nicoletti
you forgot an include :
#include <string>
Philip Nicoletti
February 20th, 2003, 08:47 AM
That is a VC++ thing. I think that they got rid of
these warnings in the latest version.
You can disable them by putting this at the top
of your code :
#pragma warning(disable:4786)
PaulWendt
February 20th, 2003, 10:47 AM
I just wanted to note that both of these questions have already
been answered to George2 in an older post. This is why I get
upset with the guy; he not only asks a superfluous number of
questions ... but he asks them over and over....
Here's a link to the older post to refresh your memory, George2:
http://www.codeguru.com/forum/showthread.php?s=&threadid=230206
It wasn't really that long ago, either.
--Paul
George2
February 20th, 2003, 09:00 PM
Thanks, Philip buddie!
George
Originally posted by Philip Nicoletti
That is a VC++ thing. I think that they got rid of
these warnings in the latest version.
You can disable them by putting this at the top
of your code :
#pragma warning(disable:4786)
George2
February 20th, 2003, 09:02 PM
I am really sorry, PaulWendt.
Next time I will try my best, trust me!
George
Originally posted by PaulWendt
I just wanted to note that both of these questions have already
been answered to George2 in an older post. This is why I get
upset with the guy; he not only asks a superfluous number of
questions ... but he asks them over and over....
Here's a link to the older post to refresh your memory, George2:
http://www.codeguru.com/forum/showthread.php?s=&threadid=230206
It wasn't really that long ago, either.
--Paul
codeguru.com
Copyright Internet.com Inc., All Rights Reserved.