Hi,
Internally, ROOT assumed that you did indeed pass a std::vector, reinterpreted the memory you passed as a std::vector, called resize() on it and then filled the elements. So for all implementations that I am aware of, all but the first few (or one) c-style elements *can* (depending on the type of the elements) look reasonable.
Anyway: you now know how to do it right :-)
Cheers, Axel.
Erkcan Ozcan wrote on 01/19/2011 08:16 AM:
> Hi Philippe,
>
> Thanks for the response. Just to bring this thread to a full conclusion: In my original email that started the thread, I had written that we had found that it did seem to work. Now when you say it doesn't, do you mean, it would crash right away, or it would just work by luck, but would be unreliable?
>
> Cheers,
> e.
>
> On 18 Jan 2011, at 20:09, Philippe Canal wrote:
>
>> Hi, >> >>> Given a branch which is found to be a *vector<POD> by MakeClass(), can I instead call SetBranchAddress with a c-style array? >> >> No this unfortunately does not work. The address passed must be for an actual std::vector object. >> >> Philippe.
This archive was generated by hypermail 2.2.0 : Fri Jan 21 2011 - 17:50:01 CET