Click here to Skip to main content
15,897,273 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Windows Messages and Pixel colors.. Pin
__Cerb10-Jan-04 5:33
__Cerb10-Jan-04 5:33 
GeneralRe: Windows Messages and Pixel colors.. Pin
__Cerb10-Jan-04 7:05
__Cerb10-Jan-04 7:05 
GeneralRe: Windows Messages and Pixel colors.. Pin
Hesham Amin10-Jan-04 7:57
Hesham Amin10-Jan-04 7:57 
GeneralRe: Windows Messages and Pixel colors.. Pin
__Cerb10-Jan-04 8:33
__Cerb10-Jan-04 8:33 
GeneralRe: Windows Messages and Pixel colors.. Pin
__Cerb10-Jan-04 10:22
__Cerb10-Jan-04 10:22 
GeneralRe: Windows Messages and Pixel colors.. Pin
Hesham Amin10-Jan-04 21:01
Hesham Amin10-Jan-04 21:01 
GeneralFlexgrid Pin
Rane9-Jan-04 17:30
Rane9-Jan-04 17:30 
Generalmap<string,string> just won't work Pin
luddet9-Jan-04 16:47
luddet9-Jan-04 16:47 
Hi,

I've banged my forehead against this problem for several hours now and I cant' for the life of me figure out why this doesn't work.

All I'm trying to do is use a std::map as a dictionary, like: map<string,string>

Here's the very simple code that just won't work:

#include <map>
using namespace std;

int main(int argc, char* argv[]) {

map<string, string> m;
m["a"] = "b";

return 0;
}


I'm getting these error messages:
c:\Program\Microsoft Visual Studio .NET\Vc7\include\functional(139): error C2784: 'bool std::operator <(const std::reverse_iterator<_RanIt> &,const std::reverse_iterator<_RanIt> &)' : could not deduce template argument for 'const std::reverse_iterator<_RanIt> &' from 'const std::string'
c:\Program\Microsoft Visual Studio .NET\Vc7\include\functional(139): error C2676: binary '<' : 'const std::string' does not define this operator or a conversion to a type acceptable to the predefined operator
c:\Program\Microsoft Visual Studio .NET\Vc7\include\functional(139): error C2784: 'bool std::operator <(const std::_Ptrit<_Ty,_Diff,_Pointer2,_Reference2,_Pointer2,_Reference2> &,const std::_Ptrit<_Ty,_Diff,_Pointer,_Reference,_Pointer2,_Reference2> &)' : could not deduce template argument for 'const std::_Ptrit<_Ty,_Diff,_Pointer2,_Reference2,_Pointer2,_Reference2> &' from 'const std::string'
c:\Program\Microsoft Visual Studio .NET\Vc7\include\functional(139): error C2784: 'bool std::operator <(const std::_Ptrit<_Ty,_Diff,_Pointer2,_Reference2,_Pointer2,_Reference2> &,const std::_Ptrit<_Ty,_Diff,_Pointer,_Reference,_Pointer2,_Reference2> &)' : could not deduce template argument for 'const std::_Ptrit<_Ty,_Diff,_Pointer2,_Reference2,_Pointer2,_Reference2> &' from 'const std::string'
c:\Program\Microsoft Visual Studio .NET\Vc7\include\functional(139): error C2784: 'bool std::operator <(const std::_Ptrit<_Ty,_Diff,_Pointer2,_Reference2,_Pointer2,_Reference2> &,const std::_Ptrit<_Ty,_Diff,_Pointer,_Reference,_Pointer2,_Reference2> &)' : could not deduce template argument for 'const std::_Ptrit<_Ty,_Diff,_Pointer2,_Reference2,_Pointer2,_Reference2> &' from 'const std::string'
c:\Program\Microsoft Visual Studio .NET\Vc7\include\functional(139): 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'
c:\Program\Microsoft Visual Studio .NET\Vc7\include\functional(139): 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'
c:\Program\Microsoft Visual Studio .NET\Vc7\include\functional(139): 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'
c:\Program\Microsoft Visual Studio .NET\Vc7\include\functional(139): error C2784: 'bool std::operator <(const std::pair<_Ty1,_Ty2> &,const std::pair<_Ty1,_Ty2> &)' : could not deduce template argument for 'const std::pair<_Ty1,_Ty2> &' from 'const std::string'
c:\Program\Microsoft Visual Studio .NET\Vc7\include\functional(139): error C2784: 'bool std::operator <(const std::pair<_Ty1,_Ty2> &,const std::pair<_Ty1,_Ty2> &)' : could not deduce template argument for 'const std::pair<_Ty1,_Ty2> &' from 'const std::string'
c:\Program\Microsoft Visual Studio .NET\Vc7\include\functional(139): error C2784: 'bool std::operator <(const std::pair<_Ty1,_Ty2> &,const std::pair<_Ty1,_Ty2> &)' : could not deduce template argument for 'const std::pair<_Ty1,_Ty2> &' from 'const std::string'
c:\Program\Microsoft Visual Studio .NET\Vc7\include\functional(139): error C2784: 'bool std::operator <(const std::reverse_iterator<_RanIt> &,const std::reverse_iterator<_RanIt> &)' : could not deduce template argument for 'const std::reverse_iterator<_RanIt> &' from 'const std::string'
c:\Program\Microsoft Visual Studio .NET\Vc7\include\functional(139): error C2784: 'bool std::operator <(const std::reverse_iterator<_RanIt> &,const std::reverse_iterator<_RanIt> &)' : could not deduce template argument for 'const std::reverse_iterator<_RanIt> &' from 'const std::string'

If I change the key to int, like this:
map<int,string> m;
there's no problem doing this:
m[6] = "ashahshd";

But the map<string,string> just won't work.

Please help me, I'm getting desperate!

thanks
Ludde

GeneralRe: map&lt;string,string&gt; just won't work Pin
ZoogieZork9-Jan-04 17:14
ZoogieZork9-Jan-04 17:14 
GeneralRe: map<string,string> just won't work Pin
luddet9-Jan-04 17:17
luddet9-Jan-04 17:17 
GeneralRe: map&lt;string,string&gt; just won't work Pin
ZoogieZork9-Jan-04 17:50
ZoogieZork9-Jan-04 17:50 
GeneralRe: map&lt;string,string&gt; just won't work Pin
luddet9-Jan-04 17:53
luddet9-Jan-04 17:53 
GeneralRe: map&lt;string,string&gt; just won't work Pin
Garth J Lancaster9-Jan-04 17:18
professionalGarth J Lancaster9-Jan-04 17:18 
GeneralRe: map&lt;string,string&gt; just won't work Pin
luddet9-Jan-04 17:19
luddet9-Jan-04 17:19 
GeneralRe: map&lt;string,string&gt; just won't work Pin
Jörgen Sigvardsson10-Jan-04 7:20
Jörgen Sigvardsson10-Jan-04 7:20 
GeneralRe: map&lt;string,string&gt; just won't work Pin
Garth J Lancaster11-Jan-04 16:00
professionalGarth J Lancaster11-Jan-04 16:00 
GeneralRe: map&lt;string,string&gt; just won't work Pin
Jörgen Sigvardsson11-Jan-04 23:29
Jörgen Sigvardsson11-Jan-04 23:29 
GeneralRe: map&lt;string,string&gt; just won't work Pin
Michael Dunn9-Jan-04 17:20
sitebuilderMichael Dunn9-Jan-04 17:20 
GeneralRe: map&lt;string,string&gt; just won't work Pin
Garth J Lancaster9-Jan-04 17:24
professionalGarth J Lancaster9-Jan-04 17:24 
GeneralRe: map&lt;string,string&gt; just won't work Pin
luddet9-Jan-04 17:24
luddet9-Jan-04 17:24 
GeneralRe: map&lt;string,string&gt; just won't work Pin
Prakash Nadar10-Jan-04 1:02
Prakash Nadar10-Jan-04 1:02 
GeneralRe: map&lt;string,string&gt; just won't work Pin
Jörgen Sigvardsson10-Jan-04 7:30
Jörgen Sigvardsson10-Jan-04 7:30 
Generalshortcut using installshield Pin
Anonymous9-Jan-04 12:56
Anonymous9-Jan-04 12:56 
GeneralRe: shortcut using installshield Pin
Stefan Pedersen9-Jan-04 13:53
Stefan Pedersen9-Jan-04 13:53 
GeneralCATEGORYINFO &amp; ICatRegister Pin
suiram409-Jan-04 11:25
suiram409-Jan-04 11:25 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.