DPL: streamline DataAllocator::make - #1970
Conversation
|
@matthiasrichter this is how I would streamline the This is WIP because there is something which needs to change in order to be able to use |
matthiasrichter
left a comment
There was a problem hiding this comment.
This looks very nice, I have nothing to add for the moment.
4231fbd to
1b0587b
Compare
|
As discussed privately, there is an issue with references, IIRC. We should resolve that before merging this. |
|
I think we also see it in the CI, will try to have a look |
|
yes, exactly. |
1b0587b to
2b1191e
Compare
matthiasrichter
left a comment
There was a problem hiding this comment.
Using decltype(auto) allows to deduce from the expression whether to return reference or value.
This supports the current case for the arrow::ipc::RecordBatchWriter and will enable to return unique_ptr or similar objects by move in the future.
Using `decltype(auto)` to deduce the return type from the expression. It will be lvalue reference for the framework-owned objects. Instances of local variables like shared_ptr will be returned by value/move/return value optimization. Not all branches of allocator API function `make` will return references to objects owned by an allocator context. E.g. shared_ptr objects are returned by return value optimization. Currently there is one use case for the arrow schema, but similar arguments apply if unique_ptr with custom dealloator will be used in the future to control the scope of the objects in the code and allow immediate sending once an object goes out of scope
3a64ff0 to
6b82ff3
Compare
|
Look good to me. Thanks. I am merging this. |
This uses C++ if constexpr to simplify and unify the `DataAllocator::make` logic, hopefully resulting in more readable code. Notice how it uses `decltype(auto)` to deduce the return type from the expression. The original commit 6b82ff3 has an exhaustive description of why this is needed.
This uses C++ if constexpr to simplify and unify the `DataAllocator::make` logic, hopefully resulting in more readable code. Notice how it uses `decltype(auto)` to deduce the return type from the expression. The original commit 6b82ff3 has an exhaustive description of why this is needed.
This uses C++ if constexpr to simplify and unify the `DataAllocator::make` logic, hopefully resulting in more readable code. Notice how it uses `decltype(auto)` to deduce the return type from the expression. The original commit 6b82ff3 has an exhaustive description of why this is needed.
…eO2Group#1970) * Added gamma trigger * Added gamma, allows qa to only consider jets in EMCAL Added max spectra --------- Co-authored-by: Gijs van Weelden <g.van.weelden@nikhef.nl>
No description provided.