I’m working on a ROOT class and need to store/pass(via function arguments) a list of strings. Is there a preference for how to do this when writing code for use in ROOT? For example, is there a preference as to which of the following I ought to use.
Char_t * names[N];
TObjArray names; // with TObjString stored inside
TList names; // with TObjString stored inside
std::vector<std::string> names; are similar (i.e. pick TString or std::string which ever you most comfortable with). The TObjArray solution is interesting if you also need to store the collection in another ROOT collection.
TList names; // with TObjString stored insideis more comparable to list and the choice between that one and the ‘vector’ type (vector or TObjArray) depend on whether you will do a lots of inserts and if you will do a look of random access int the array.
[quote]Char_t * names[N];
TString names[N];[/quote]I would not use those as they are slightly harder to manage unless you have extremely strict performance requirement (but in this case you also might want to review whether to even use the strings at all).