Add an `insert` method to `KeyedContainer`
Mentioned by @graven at lhcb/Rec!4423 (merged):
in order to avoid mistakes like this, we should add an insert
method to KeyedContainer
which accepts a std::unique_ptr<T>
as argument, and deprecate the method that takes a plain pointer. That way, one is forced to write:
output.insert( std::move(outp) );
instead, at which point there is no reason to call release()
on an std::unique_ptr
when inserting into the container, which then makes the remaining uses of release()
more suspect, and thus easier/faster/more likely to spot mistakes like this.
Edited by Miroslav Saur