TVectorT<int>

Why I can’t declare a TVectorT?

TVectorT.h:180: undefined reference to `TVectorT<int>::Delete_m(int, int*&)
1 Like

Hi,

At the moment the TVectorT class is provided nor supported (i.e. it has not been test with) ‘int’ as a parameter. The only 2 options are float and double. (Note that TVectorT is for matrix manipulation, you may or may not be looking for TArrayI or std::vector )

Cheers,
Philippe.

[quote=“pcanal”]Hi,

At the moment the TVectorT class is provided nor supported (i.e. it has not been test with) ‘int’ as a parameter. The only 2 options are float and double. (Note that TVectorT is for matrix manipulation, you may or may not be looking for TArrayI or std::vector )

Cheers,
Philippe.[/quote]

The problem is that TArrayI and obviously std::vector doesn’t inherited from TObject, and I need a streameable class. My solution is to use TH1I, but I don’t like it.

1 Like

[quote]doesn’t inherited from and I need a streameable class[/quote]Humm … technically both TArrayI and std::vector are streamable. If you need to put the collection inside a TList, then you could implement a struct like:struct VectorWrapper : public TObject { std::vector<int> fContent; ClassDef(VectorWrapper,2); };for which you generate compile and link a dictionary.

Cheers,
Philippe.

As of 2021 (TVectorT<int>) is not implemented, but it is already possible to store an std::vector<int> or other objects directly in a TFile (see example in the manual).

For built in types use TParameter<double>.

I made a feature request to add integer support to TVectorT, but not sure that is needed now. Adding information to this thread in case someone else finds that.