As of Boost 1.56, Boost optional supports move semantics. In that case, is the following construct meaningful?
boost::optional<SomeType> getValue()
{
if (value_available) { // value_available is a boolean
return std::move(value); // value is of type SomeType
} else {
return boost::none;
}
}
Aucun commentaire:
Enregistrer un commentaire