Hi,
I have a problem with my class:
class myClass : public TNamed
{
private:
TList lst_;
public:
myClass(Double_t * arr);
};
I would like to have the possibility to add a list of Double_t values in the TList and sort them;
As it’s impossible to add Double_t values in TList, I have made an other class with a Double_t attribute and compare method.
but my problem is in constructor of myClass. How can i give a list of double values without giving the number of elements?
First idea:
Double_t lst[] = {8.1, 1.0 , 3.2};
myClass * m = new myClass(lst);
But with this, i can’t have the number of elements (sizeof(lst) returns 4), and i have to use two lines of code, and i prefer one line.
myClass * m = new myClass({8.1, 1.0 , 3.2}} is not possible
Second idea:
I have tried the vector class, but you have to give the number of elements too.
Third idea:
myClass * m = new myClass("7.1 1.0 3.2");
I use then the Tokenize method of TString, but it returns an TObjArray of TObjString, and then i can’t convert the TObjStrings in Double_t.
Any Idea?