so that myclass gets compiled and added to the list of classes which can be used interactively. However, if I try to make an STL vector from this class:
vector <myclass> x;
x.resize(10);
then the system will crash, displaying messages like “Shared object disappeared from memory”, etc.
Is this because STL vectors of non-basic type cannot be used in the interactive sesions (only in compiled programs) ? I have written several classes which read and write trees with classes which encapsulate STL vectors of my own classes and didn’t have any trouble untill I tried to access the vectors interactively to get out some numeric values. It seems that in order to display the values stored, each time I have to write corresponding methods in my (g++ compiled) analysis classes … I made sure that I’m including and using namespace std. If I try
I have tried to use a _linkdef.h - file with the following:
#pragma link C++ class myclass;
#pragma link C++ class std::vector<myclass> and now this seems to be working. Is this the only thing that I was missing in the above code? Or should I expect more surprises (unexpected memory leaks) once I start processing large STL vectors?
Hi Dmitri,
the dictionary for your STL collection is all you need. There are large amounts of data written with STL collections, so you should be fine.
Cheers, Axel.