Hello ladies and gents,
Im reading about working with maps and there is small programm example shown in this chapter. Now, when I write this code into the MS VC C++ compiler and compile the code, I get like over 90 warnings, however, when pressing compile again, they all are gone :?:
#include <iostream>
#include <string>
#include <map>
using namespace std;
int main()
{
typedef map<string, int, less<string> > maptype;
maptype M;
M["Jan"] = 1234;
M["Piet"] = 9999;
M["Piet"] = 3456;
M["Klaas"] = 5678;
for(maptype::iterator i = M.begin(); i != M.end(); ++i)
cout<< (*i).first <<" "<< (*i).second <<endl;
cout<<"Press any key to continue!\n";
cin.get();
return 0;
}
Some examples of warning messages:
main.cpp
c:\program files\microsoft visual studio\vc98\include\xtree(120) : warning C4786: 'std::_Tree<std::basic_string<char,std::char_traits<char>,std::allocator<char> >,std::pair<std::basic_string<char,std::char_traits<char>,std::allocator<char> > const ,
int>,std::map<std::basic_string<char,std::char_traits<char>,std::allocator<char> >,int,std::less<std::basic_string<char,std::char_traits<char>,std::allocator<char> > >,std::allocator<int> >::_Kfn,std::less<std::basic_string<char,std::char_traits<cha
r>,std::allocator<char> > >,std::allocator<int> >' : identifier was truncated to '255' characters in the debug information
c:\program files\microsoft visual studio\vc98\include\map(46) : see reference to class template instantiation 'std::_Tree<std::basic_string<char,std::char_traits<char>,std::allocator<char> >,std::pair<std::basic_string<char,std::char_traits<
char>,std::allocator<char> > const ,int>,std::map<std::basic_string<char,std::char_traits<char>,std::allocator<char> >,int,std::less<std::basic_string<char,std::char_traits<char>,std::allocator<char> > >,std::allocator<int> >::_Kfn,std::less<std::ba
sic_string<char,std::char_traits<char>,std::allocator<char> > >,std::allocator<int> >' being compiled
C:\Program Files\Microsoft Visual Studio\MyProjects\LAVbBoek\main.cpp(12) : see reference to class template instantiation 'std::map<std::basic_string<char,std::char_traits<char>,std::allocator<char> >,int,std::less<std::basic_string<char,std
::char_traits<char>,std::allocator<char> > >,std::allocator<int> >' being compiled
Questions are:
1) What is causing these warnings the first time I compile?
2) How can I make sure that these warnings aren't shown from the first time I compile the code?
3) Why do those warnings don't appear the second time I compile this code?