Thanks very much for this.
That is indeed something I had in mind as a possibility.
The reason why I actually put it first is because I want to use later this variable (numPFCands) to declare the followings arrays with variable lengths based on the value of numPFCands.
So, while I am testing what you suggested, I may ask the following question :
“Is it possible to have variable length arrays in the structure ??”
If not, I would be really grateful to you showing me how to create a dictionary and library and how that works, i.e. do i need to create it each time i run my executable or once for all ???
thank you very much for this. I know however how to create fxed and variable length size arrays in general. My question was more related to the structures. Is it possible to have branches that can hold structures of variable size arrays? If yes, do I necessarily have to declare numPFCands at the beginning of the structure or can i put it anywhere ???
Having variable size array in the middle of a leaflist is not supported. You can either create a separate branch for each of the arrays (they still can be inside the same structure though), or you go via the object-method of branch creation (in which case you only need to generate the dictionary for the struct.
In all the cases, the member determining the size of the array should come before the arrays.
Just to make it clear. You don’t really expect this to be working (no matter which “method” one chooses), do you: struct MyStruct {
int n;
double x[n];
};
Do you expect this makes any sense for the streamer (in the “object-method of branch creation” case): struct MyStruct {
int n;
double x[1000]; //[n]
};
Yes, thank you pcanal. I knew that the size determining the array length had to come first in the leaflist for “normal” variable length arrays but in structures, I thought that it could go anywhere, hence my question Pepe le Pew but i just tried and it did not work.
I guess I’m gonna have to generate dictionary then.