Returning a const T is not better than returning a T. In fact it is worse because it prevents moving the returned temporary. So let value_or_reference_return_t be either T or const T&, and not const T or const T& (which would be a good match for an in parameter, but not for a return value).
Returning a
const T
is not better than returning aT
. In fact it is worse because it prevents moving the returned temporary. So letvalue_or_reference_return_t
be eitherT
orconst T&
, and notconst T
orconst T&
(which would be a good match for an in parameter, but not for a return value).