Map template

Hi, I have some problems with a template extension.
I wrote a cmap class as extension of std::map to have the constant operator[].
I have a class foo which contains a cmap<int, int> and I would like to store it to a root file:

class foo: public TObject { pulic: ... const cmap<int,int> & get_table () const { return map; } foo (): TObject (), map("foo") {} private: cmap <int, int> map; ... };
The point is that when I try to write the foo object to root I get an segmentation fault (in TEmulatedMapProxy::WriteMap () root v 5.04 with gcc 4). Using a standard map instead of cmad does not crash.
Do you have any idea?
cmap.h (5.44 KB)

Thanks for reporting this problem
It is now fixed in the CVS repository.

You can work around the problem by adding

#ifdef __MAKECINT__ #pragma link C++ class map<int,int>; #endif
in your header or linkdef file

Cheers,
Philippe