Topic: Question on de-referencing iterator
Author: Mark Fischer <MarkF@starwave.com>
Date: 1996/10/31 Raw View
I am having trouble getting MSVC42 to 'operator=' a *iterator to a pair.
Any ideas. Is this a legal move? Thanks:
// Test of map and iterator. Place data in map and use iterator
#include <map>
#include <iterator>
#include <windows.h>
// disable MSVC42 256 byte debug limit warning
#pragma warning( disable : 4786 )
int WINAPI WinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
int nCmdShow )
{
map <long , int, less<long>, allocator< int > > table;
map <long , int, less<long>, allocator< int > >::iterator itable;
pair < long, int > p;
int e1 = {1};
table[100] = e1;
itable = table.find(100);
if (itable != table.end())
{
// The following line produces the following error message from MSVC42:
// Error C2582: 'pair<long,struct Element>' : 'operator =' function is
unavailable
p = *itable; // Error C2582; How do I dereference iterator itable into
pair?
}
return ( FALSE );
}
[ comp.std.c++ is moderated. To submit articles: try just posting with ]
[ your news-reader. If that fails, use mailto:std-c++@ncar.ucar.edu ]
[ FAQ: http://reality.sgi.com/employees/austern_mti/std-c++/faq.html ]
[ Policy: http://reality.sgi.com/employees/austern_mti/std-c++/policy.html ]
[ Comments? mailto:std-c++-request@ncar.ucar.edu ]