RE: STL Map

From: Philippe Canal <pcanal_at_fnal.gov>
Date: Wed, 28 Jun 2006 16:18:20 -0500


Hi Justace,

We do not provide a dictionary for std::map<const char*, int> by default and currently the interpreted stl container are not fullproof. You will need to generated a dictionary for the map by using the following file (named for example mymap.C):

// mymap.C
#include <map>
#ifdef __MAKECINT__
#pragma link C++ class map<const char*,int>;
#endif

// end of mymap.C

and do

root [0] .L mymap.C+
root [1] std::map<const char*, int> months;
root [2] months["january"] = 31;

Cheers,
Philippe.

-----Original Message-----
From: owner-roottalk_at_pcroot.cern.ch [mailto:owner-roottalk_at_pcroot.cern.ch] On Behalf Of Justace Clutter
Sent: Wednesday, June 28, 2006 3:28 PM
To: roottalk_at_cern.ch
Subject: [ROOT] STL Map

I was trying to just test to see about using a map, so I went to the SGI page
for the STL and was just kind of going though the example. The following is

what I got.. Do I need to load a special version of root to do this?

Justace

P.S. I am at FNAL running D0RunII p18.07.00


Compiled on 16 March 2006 for linux with thread support.

CINT/ROOT C/C++ Interpreter version 5.15.169, Mar 14 2005 Type ? for help. Commands must be C++ statements. Enclose multiple statements between { }.

root [0] #include <map>
root [1] std::map<const char*, int> months;
root [2] months["january"] = 31;

Error: Can't call map<const char*,int,less<const char*>,allocator<pair<const

char* const,int> > >::operator[]((char*)0x8fde40c) in current scope FILE: (tmpfile) LINE:1
Possible candidates are...
filename line:size busy function type and name (in map<const char*,int,less<const char*>,allocator<pair<const char* const,int> > >) Error: improper lvalue FILE:(tmpfile) LINE:1 *** Interpreter error recovered *** Received on Wed Jun 28 2006 - 23:22:40 MEST

This archive was generated by hypermail 2.2.0 : Mon Jan 01 2007 - 16:31:59 MET