Click here to Skip to main content
15,906,708 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: gethostbyaddr problem Pin
Tom Wright16-Apr-03 5:05
Tom Wright16-Apr-03 5:05 
GeneralFile Comparisons Pin
Colin Davidson15-Apr-03 10:06
Colin Davidson15-Apr-03 10:06 
GeneralRe: File Comparisons Pin
Joe Woodbury15-Apr-03 14:02
professionalJoe Woodbury15-Apr-03 14:02 
GeneralEdit Ctrl Style(ES_CENTER) Pin
Mr. Maan15-Apr-03 9:53
Mr. Maan15-Apr-03 9:53 
GeneralRe: Edit Ctrl Style(ES_CENTER) Pin
Miszou15-Apr-03 10:54
Miszou15-Apr-03 10:54 
GeneralRe: Edit Ctrl Style(ES_CENTER) Pin
Mr. Maan15-Apr-03 11:14
Mr. Maan15-Apr-03 11:14 
GeneralRe: Edit Ctrl Style(ES_CENTER) Pin
Gary R. Wheeler18-Apr-03 5:35
Gary R. Wheeler18-Apr-03 5:35 
Generalstring, map STL problem Pin
Matthew Fleming15-Apr-03 8:55
Matthew Fleming15-Apr-03 8:55 
Netmeisters,

I am trying to do something which should be simple. Using Visual C++ I want to create a map containing an STL string as a key and my own type as a value.

#include <string>
#include <map>
#include <iostream>

using namespace std;
map<string,CReport>slips;

Then to add a pair to the map:

string str;
pair<map<string,CReport>::iterator, bool> ret =
slips.insert(map<string,CReport>::value_type(str,report));

But this produces a host of error messages that I've included below.
Can't figure these out at all. When I comment out the pair<map etc line the messages go away.

Any assistance much appreciated.

Matthew Fleming
mgf@mcw.edu

c:\Program Files\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 Files\Microsoft Visual Studio .NET\Vc7\include\functional(138) : while compiling class-template member function 'bool std::less<_Ty>::operator ()(const _Ty &,const std::string &) const'
with
[
_Ty=std::string
]
c:\Program Files\Microsoft Visual Studio .NET\Vc7\include\map(36) : see reference to class template instantiation 'std::less<_Ty>' being compiled
with
[
_Ty=std::string
]
c:\Program Files\Microsoft Visual Studio .NET\Vc7\include\xtree(19) : see reference to class template instantiation 'std::_Tmap_traits<_Kty,_Ty,_Pr,_Alloc,_Mfl>' being compiled
with
[
_Kty=std::string,
_Ty=CReport,
_Pr=std::less<std::string>,
_Alloc=std::allocator<std::pair<const std::string,CReport>>,
_Mfl=false
]
c:\Program Files\Microsoft Visual Studio .NET\Vc7\include\xtree(61) : see reference to class template instantiation 'std::_Tree_nod<_Traits>' being compiled
with
[
_Traits=std::_Tmap_traits<std::string,CReport,std::less<std::string>,std::allocator<std::pair<const std::string,CReport>>,false>
]
c:\Program Files\Microsoft Visual Studio .NET\Vc7\include\xtree(83) : see reference to class template instantiation 'std::_Tree_ptr<_Traits>' being compiled
with
[
_Traits=std::_Tmap_traits<std::string,CReport,std::less<std::string>,std::allocator<std::pair<const std::string,CReport>>,false>
]
c:\Program Files\Microsoft Visual Studio .NET\Vc7\include\xtree(101) : see reference to class template instantiation 'std::_Tree_val<_Traits>' being compiled
with
[
_Traits=std::_Tmap_traits<std::string,CReport,std::less<std::string>,std::allocator<std::pair<const std::string,CReport>>,false>
]
c:\Program Files\Microsoft Visual Studio .NET\Vc7\include\map(77) : see reference to class template instantiation 'std::_Tree<_Traits>' being compiled
with
[
_Traits=std::_Tmap_traits<std::string,CReport,std::less<std::string>,std::allocator<std::pair<const std::string,CReport>>,false>
]
c:\Palm\dpCold\DpCGenCond.cpp(201) : see reference to class template instantiation 'std::map<_Kty,_Ty,_Pr,_Alloc>' being compiled
with
[
_Kty=std::string,
_Ty=CReport,
_Pr=std::less<std::string>,
_Alloc=std::allocator<std::pair<const std::string,CReport>>
]
c:\Program Files\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 Files\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 Files\Microsoft Visual Studio .NET\Vc7\include\functional(139) : error C2784: 'bool std::operator <(const std::list<_Ty,_Alloc> &,const std::list<_Ty,_Alloc> &)' : could not deduce template argument for 'const std::list<_Ty,_Ax> &' from 'const std::string'
c:\Program Files\Microsoft Visual Studio .NET\Vc7\include\functional(139) : error C2784: 'bool std::operator <(const std::list<_Ty,_Alloc> &,const std::list<_Ty,_Alloc> &)' : could not deduce template argument for 'const std::list<_Ty,_Ax> &' from 'const std::string'
c:\Program Files\Microsoft Visual Studio .NET\Vc7\include\functional(139) : error C2784: 'bool std::operator <(const std::list<_Ty,_Alloc> &,const std::list<_Ty,_Alloc> &)' : could not deduce template argument for 'const std::list<_Ty,_Ax> &' from 'const std::string'
c:\Program Files\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 Files\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 Files\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 Files\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 Files\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 Files\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 Files\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 Files\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 Files\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 Files\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




GeneralRe: string, map STL problem Pin
Ben Burnett15-Apr-03 9:18
Ben Burnett15-Apr-03 9:18 
GeneralRe: string, map STL problem Pin
jhwurmbach15-Apr-03 21:38
jhwurmbach15-Apr-03 21:38 
GeneralRe: string, map STL problem Pin
richard_k1-Jun-10 15:19
richard_k1-Jun-10 15:19 
GeneralURGENT: Sending Fax !!! Pin
Hadi Rezaee15-Apr-03 8:52
Hadi Rezaee15-Apr-03 8:52 
GeneralRe: URGENT: Sending Fax !!! Pin
Michael P Butler15-Apr-03 22:18
Michael P Butler15-Apr-03 22:18 
GeneralRe: URGENT: Sending Fax !!! Pin
Hadi Rezaee17-Apr-03 15:09
Hadi Rezaee17-Apr-03 15:09 
GeneralKilling processes using TerminateProcess() Pin
Jonathan.Oakley15-Apr-03 8:29
Jonathan.Oakley15-Apr-03 8:29 
GeneralRe: Killing processes using TerminateProcess() Pin
Erik Juhl15-Apr-03 9:16
Erik Juhl15-Apr-03 9:16 
GeneralRe: Killing processes using TerminateProcess() Pin
Jonathan.Oakley15-Apr-03 9:48
Jonathan.Oakley15-Apr-03 9:48 
GeneralFiles Pin
d.f15-Apr-03 7:53
d.f15-Apr-03 7:53 
GeneralRe: Files Pin
Joaquín M López Muñoz15-Apr-03 8:09
Joaquín M López Muñoz15-Apr-03 8:09 
GeneralMenu in Dialog Pin
bobthemonkey15-Apr-03 7:48
bobthemonkey15-Apr-03 7:48 
GeneralRe: Menu in Dialog Pin
Joaquín M López Muñoz15-Apr-03 8:05
Joaquín M López Muñoz15-Apr-03 8:05 
GeneralRe: Menu in Dialog Pin
bobthemonkey15-Apr-03 8:16
bobthemonkey15-Apr-03 8:16 
GeneralMsgWaitForMultipleObjects Pin
Dave_15-Apr-03 7:07
Dave_15-Apr-03 7:07 
GeneralRe: MsgWaitForMultipleObjects Pin
Joaquín M López Muñoz15-Apr-03 7:46
Joaquín M López Muñoz15-Apr-03 7:46 
GeneralRe: MsgWaitForMultipleObjects Pin
Dave_15-Apr-03 8:23
Dave_15-Apr-03 8:23 

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.