Date: Sun, 8 Aug 2004 18:25:01 -0700
From: Konstantin Olchanski <olchansk@sam.triumf.ca>
To: Rene Brun <Rene.Brun@cern.ch>
Cc: roottalk@pcroot.cern.ch
Subject: Re: [ROOT] Can't use std::map in ROOT macros?
> On Fri, Jul 30, 2004 at 09:12:45AM +0200, Rene Brun wrote:
> This problem with std::map has been fixed in the development version in CVS.
> If you import the source, run
> make cintdlls
I confirm the problem is fixed. Perhaps "make cintdlls" should be
part of the normal "make all" build?
K.O.
> >
> > Rene Brun
> >
> > Konstantin Olchanski wrote:
> > >
> > > We are trying to use std::map in a ROOT macro and it is not working. A similar example using std::vector works fine. Is std::map supposed to work at all?
> > >
> > > With the test script below, I get a variety of results, ranging from "Error: class,struct,union or type string,int,std not defined" to a core dump, depending on which include file I include: "map", "map.h", "_map", etc. I get similar results with root_v3.10.02 and with a (not so recent) CVS snapshot.
> > >
> > > [olchansk@send root]$ cat map.C
> > > #include <string>
> > > #include <map>
> > > #include <function>
> > >
> > > typedef std::string sss;
> > > typedef std::less<std::string> cmp;
> > > //typedef std::map<sss, int, cmp> mmm;
> > >
> > > int map()
> > > {
> > > std::map<std::string, int, std::less<std::string> > age;
> > >
> > > age["Fred"] = 42; // Fred is 42 years old
> > > age["Barney"] = 37; // Barney is 37
> > >
> > > cout << age["Fred"] << endl;
> > > }
> > >
> > > And results from running it:
> > >
> > > [olchansk@send root]$ echo $ROOTSYS
> > > /triumfcs/trshare/olchansk/root/root_v3.10.02_RH9
> > > [olchansk@send root]$ $ROOTSYS/bin/root -l map.C
> > > root [0]
> > > Processing map.C...
> > > Error: class,struct,union or type string,int,std not defined FILE:map.C LINE:13
> > > Error: class,struct,union or type string,int,std not defined FILE:map.C LINE:13
> > > Error: class,struct,union or type string,int,std not defined FILE:map.C LINE:13
> > > Error: Symbol less<std::string> is not defined in current scope FILE:map.C LINE:13
> > > Error: Symbol age is not defined in current scope FILE:map.C LINE:13
> > > (const int)0
> > > *** Interpreter error recovered ***
> > >
> > > --
> > > Konstantin Olchanski
> > > Data Acquisition Systems: The Bytes Must Flow!
> > > Email: olchansk-at-triumf-dot-ca
> > > Snail mail: 4004 Wesbrook Mall, TRIUMF, Vancouver, B.C., V6T 2A3, Canada
>
> --
> Konstantin Olchanski
> Data Acquisition Systems: The Bytes Must Flow!
> Email: olchansk-at-triumf-dot-ca
> Snail mail: 4004 Wesbrook Mall, TRIUMF, Vancouver, B.C., V6T 2A3, Canada
--
Konstantin Olchanski
Data Acquisition Systems: The Bytes Must Flow!
Email: olchansk-at-triumf-dot-ca
Snail mail: 4004 Wesbrook Mall, TRIUMF, Vancouver, B.C., V6T 2A3, Canada
This archive was generated by hypermail 2b29 : Sun Jan 02 2005 - 05:50:09 MET