Hi John,
Thanks for reporting this problem.
Due to an oversight, the dictionary of map<string,double> is not
generated with the cintdlls in ROOT 4.00/02. This will be fixed
shortly in the CVS repository.
The fact that it works fine for you in a 'ROOT session' indicates
that you have not generated the cintdlls (i.e. do a 'gmake cintdlls'
after building ROOT).
The consequence is that the 'map<string,double>' in the interpreter
is __different__ from the 'map<string,double>' in the compiled code.
Which means that you can NOT pass them between compiled code and
interpreted code.
To work around the problem you should generate the dictionary for
map<string,double>
In addition there is a different problem which prevents cint from
properly executing (we are working on a fix).
m.Param()["hello"]
Please use
map<string,double> &mm(m.Param());
mm["hello"]=3.14149;
instead.
Cheers,
Philippe.
-----Original Message-----
From: owner-roottalk@pcroot.cern.ch
[mailto:owner-roottalk@pcroot.cern.ch]On Behalf Of John Pretz
Sent: Tuesday, March 09, 2004 7:34 AM
To: roottalk@pcroot.cern.ch
Subject: [ROOT] map<string,double> seg fault
Greetings to the ROOT world,
I've been having trouble with map<string,double>.
It works fine from a root session
{
#include <map>
#include <string>
map<string,double> m;
m["string"] = 5.6;
cout<<m["string"]<<endl;
}
but when I've got a map<string,double> as data in some class, and try to
get it out, I get a segmentation fault.
Please see the attached example. It shows off what I can and can't do.
'make' compiles the code and runs the example.
Note that I haven't explicitly instantiated the map<string,double>
template in the LinkDef because my first script works and so it looks like
that template comes pre-instantiated (which is reasonable.)
Thanks for looking,
John
--
---------------Visit my webpage!---------------------
---------http://umdgrb.umd.edu/pretz-----------------
This archive was generated by hypermail 2b29 : Sun Jan 02 2005 - 05:50:06 MET