FairRootGroup / FairRoot

C++ simulation, reconstruction and analysis framework for particle physics experiments
http://fairroot.gsi.de
Other
57 stars 96 forks source link

feature: Introduce `maybe_owning_ptr` #1442

Closed ChristianTackeGSI closed 1 year ago

ChristianTackeGSI commented 1 year ago

See the doxygen comments for some details.

Will be needed in #1416, #1430.


Checklist:

dennisklein commented 1 year ago

Can you post a pseudo code example on how you want to use this?

ChristianTackeGSI commented 1 year ago

Real code example of usage options: https://godbolt.org/z/5EG5qz55j

Or did you mean on how this will end up in FairRoot?

See both #1416 and #1430: Both have naive T* fFoo; unique_ptr<T> fFooOwned; way of handling the problamatic parts. I want to replace that with a maybe_owning_ptr<T> fFoo;.

dennisklein commented 1 year ago

Real code example of usage options: https://godbolt.org/z/5EG5qz55j

Or did you mean on how this will end up in FairRoot?

No, thx, the above was what I was looking for :)

ChristianTackeGSI commented 1 year ago

Can you post a pseudo code example on how you want to use this?

Should we have examples in the doxygen docs?

dennisklein commented 1 year ago

Should we have examples in the doxygen docs?

Would be a bonus exercise, not required from my point of view. If you want to add more docs, I'd prefer some unit test coverage - as "living" usage documentation.

ChristianTackeGSI commented 1 year ago

Yes, let's create a catch2 test for this, after your catch2 PR gets merged. :-)