🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

1 total messages Started by Wim Hoogstad Sun, 28 Mar 1999 00:00
How to get an element from a stl map
#167
Author: Wim Hoogstad
Date: Sun, 28 Mar 1999 00:00
32 lines
1028 bytes
Does enyone know how to get an element from a map
When you use STL

I have the following C++ code.


typedef  map< int, int*, less < int > >  TMyMap;

int *n = NULL;
TMyMap MyMap;
// struct pair<int,int *> n;

int function() {
 TMyMap::iterator i;

 for ( i = MyMap.begin();
  i != MyMap.end() ;
  ++i) {
  n = *i;

 }
 return 0;
}

It produces the following error:
error C2679:
  binary '=' : no operator defined which takes a right-hand operand of
     type 'struct pair<int,int *>' (or there is no acceptable conversion)


In the row with "n = *i;"
Can anyone give mi a hind.
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads