Click here to Skip to main content
16,015,393 members
Home / Discussions / ATL / WTL / STL
   

ATL / WTL / STL

 
Generalproblem with STL map, string (ignore earlier post) Pin
Matthew Fleming15-Apr-03 7:49
Matthew Fleming15-Apr-03 7:49 
GeneralRe: problem with STL map, string (ignore earlier post) Pin
Joaquín M López Muñoz15-Apr-03 8:03
Joaquín M López Muñoz15-Apr-03 8:03 
GeneralRe: problem with STL map, string (ignore earlier post) Pin
Matthew Fleming15-Apr-03 8:13
Matthew Fleming15-Apr-03 8:13 
GeneralRe: problem with STL map, string (ignore earlier post) Pin
Mike Dimmick16-Apr-03 4:17
Mike Dimmick16-Apr-03 4:17 
GeneralRe: problem with STL map, string (ignore earlier post) Pin
Matthew Fleming16-Apr-03 6:30
Matthew Fleming16-Apr-03 6:30 
GeneralRe: problem with STL map, string (ignore earlier post) Pin
Matthew Fleming16-Apr-03 6:32
Matthew Fleming16-Apr-03 6:32 
GeneralRe: problem with STL map, string (ignore earlier post) Pin
Mike Dimmick16-Apr-03 23:43
Mike Dimmick16-Apr-03 23:43 
Generalproblem with STL map, string Pin
Matthew Fleming15-Apr-03 7:48
Matthew Fleming15-Apr-03 7:48 
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
#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.

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: problem with STL map, string Pin
valikac16-Apr-03 5:38
valikac16-Apr-03 5:38 
QuestionWhy the function istringstream.getline is not working? Pin
George215-Apr-03 3:56
George215-Apr-03 3:56 
AnswerRe: Why the function istringstream.getline is not working? Pin
Tim Smith15-Apr-03 4:47
Tim Smith15-Apr-03 4:47 
GeneralRe: Why the function istringstream.getline is not working? Pin
George215-Apr-03 16:06
George215-Apr-03 16:06 
GeneralRe: Why the function istringstream.getline is not working? Pin
Tim Smith16-Apr-03 2:17
Tim Smith16-Apr-03 2:17 
GeneralRe: Why the function istringstream.getline is not working? Pin
George217-Apr-03 15:41
George217-Apr-03 15:41 
QuestionHow to use ActiveX controls in WTL? Pin
Ernesto D.14-Apr-03 14:02
Ernesto D.14-Apr-03 14:02 
AnswerRe: How to use ActiveX controls in WTL? Pin
Stephane Rodriguez.14-Apr-03 21:33
Stephane Rodriguez.14-Apr-03 21:33 
GeneralRe: How to use ActiveX controls in WTL? Pin
Ernesto D.14-Apr-03 23:00
Ernesto D.14-Apr-03 23:00 
GeneralRe: How to use ActiveX controls in WTL? Pin
Stephane Rodriguez.16-Apr-03 11:19
Stephane Rodriguez.16-Apr-03 11:19 
GeneralRe: How to use ActiveX controls in WTL? Pin
Ernesto D.16-Apr-03 15:36
Ernesto D.16-Apr-03 15:36 
GeneralInterface not showing in COM+ Pin
Le centriste14-Apr-03 5:18
Le centriste14-Apr-03 5:18 
GeneralRe: Interface not showing in COM+ Pin
Brian Shifrin15-Apr-03 1:54
Brian Shifrin15-Apr-03 1:54 
GeneralRe: Interface not showing in COM+ Pin
Le centriste15-Apr-03 8:25
Le centriste15-Apr-03 8:25 
GeneralConverting strings. Pin
Martin Marvinski12-Apr-03 11:14
Martin Marvinski12-Apr-03 11:14 
GeneralRe: Converting strings. Pin
ian mariano13-Apr-03 12:21
ian mariano13-Apr-03 12:21 
GeneralI can't Insert a ATL object when using New ATL Object?(It is not about tech, just for help!) Pin
white jungle11-Apr-03 16:33
white jungle11-Apr-03 16:33 

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.