I don’t quite understand, you use GetObject() in CINT, but here:>>> file.Get ("names", svec) you use Get(), and yes, in that case there are too many arguments. AFAIK GetObject() should do the trick, but instead of passing it a live std::vector, it should receive a typed null pointer (your original code, with GetObject() works, but the vector pointer will be replaced, leading to a leak). That is, svec = ROOT.MakeNullPointer( ROOT.vector("string") )
file.Get ("names", svec)
As for the crash, is there further information after the segfault?
I don’t quite understand, you use GetObject() in CINT, but here:>>> file.Get ("names", svec) you use Get(), and yes, in that case there are too many arguments. AFAIK GetObject() should do the trick, but instead of passing it a live std::vector, it should receive a typed null pointer (your original code, with GetObject() works, but the vector pointer will be replaced, leading to a leak).
[/quote]
I don’t think it will since
vector<string> *svecPtr;
just declares the pointer, but doesn’t new it any memory. It looks a little cleaner (i.e., no casting) than
actually, I do know what’s going on … the return value of Get() is a TObject pointer, but an std::vector< std::string > does not derive from TObject, hence the dynamic casting fails. Not sure how I can detect that, though, given that the interface contract is broken by passing an std::vector< std::string >* through a TObject* …