FairRoot icon indicating copy to clipboard operation
FairRoot copied to clipboard

Can `FairRootManager::RegisterAny` consume `T*` instead of `T*&` as second argument?

Open dennisklein opened this issue 7 years ago • 1 comments

Followup on one aspect identified in #789.

Disadvantages of T*&:

  • If people want to register object that are referenced by a smart pointer, they are currently told to extract the raw pointer and extend its lifetime with a local static variable.
  • The calling method will effectively only work once.
  • You cannot pass rvalues.

dennisklein avatar Jun 08 '18 09:06 dennisklein

I agree that there is room for improvement here and I appreciate the initiative. I remember it simply did not work with just T*. Some limitations come in my understanding from the way you need to pass addresses to the TBranch.

sawenzel avatar Jun 08 '18 10:06 sawenzel