problème avec la STL sous solaris
bonjour,
le cmpilateur CC sous solaris n'aime pas les insert avec indication de position sur las map:
le code suivant compile très bien sous VS2005, gcc linux (redhat) mais pas sous solaris avec comme compilo CC 5.5 .
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35
|
#include <iostream>
#include <vector>
#include <map>
#include <string>
using namespace std;
int main(int argc, char* argv[])
{
map<string ,int> m;
map<string ,int>::iterator it;
m.insert ( pair<string,int>("sofiane",100) );
m.insert ( pair<string,int>("balabla",200) );
it=m.end();
m.insert (it, pair<string,int>("last",300)); //la ligne qui cause le problème
for ( it=m.begin() ; it != m.end(); it++ )
cout << (*it).first << " => " << (*it).second << endl;
cout << endl;
return 0;
} |
voila ce que raconte le compilateur :
Code:
1 2 3 4 5
|
sofiane: CC -o exampl exampl.cpp
"exampl.cpp", line 27: Error: Could not find a match for std::map<std::string,int>::insert(__rwstd::__rb_tree<std::string, std::pair<const std::string, int>, __rwstd::__select1st<std::pair<const std::string, int>, std::string>, std::less<std::string>, std::allocator<std::pair<const std::string, int>>>::iterator, std::pair<std::string, int>).
1 Error(s) detected.
sofiane: |
Merci d'avance