Hello together,
i have a problem with TVectorT.
In my program i am working with a std::vector. I need to save this list to a root file. I could not find a way to save this vector directly (is it possible?), so i converted the std::vector to a TVectorT ( i already read that this is not the root equivalent to the std::vector, is there any?):
[code]
TVectorD charge_root(10);
std::vector charge;
// fill the std::vector with 10 elements
for(int bx=0; bx < 10;bx++)
{
charge_root[bx] = charge.at(bx);
}[/code]
But when i load the list and try to convert it back, i get an error. This is the way i try it:
for(int bxx=0; bxx < 10;bxx++)
{
charge.push_back(charge_root[bxx]);
}
The error i get from the compiler:
no matching function for call to ‘std::vector<double, std::allocator >::push_back(TVectorT&)’
/usr/include/c++/4.3/bits/stl_vector.h:686: note: candidates are: void std::vector<_Tp, _Alloc>::push_back(const _Tp&) [with _Tp = double, _Alloc = std::allocator]
But the operator[] should give as a return value a double&, and not a TVectorT. What do i wrong?
I am using Root 5.28/00 on a Suse11.1 (what information else?)
Thank you for reading
Greeting
Simone