Boost logo

Boost :

From: Peter Dimov (pdimov_at_[hidden])
Date: 2023-01-10 17:08:00


Alexander Grund wrote:
> > See `std::map::try_emplace(k, args…)`.
> >
> > https://en.cppreference.com/w/cpp/container/map/try_emplace
> >
> > Notes:
> > Unlike insert or emplace, these functions do not move from rvalue
> arguments if the insertion does not happen.
>
> Yes, however at the callsite you can clearly see the different
> semantics: "try_"
> That's much harder for a constructor. Although a well-named factory method
> might be a solution if this semantic is useful.

For a constructor example, see https://eel.is/c++draft/util.smartptr.shared.const#29.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk