Why does std::get for std::tuple have so many overloads (http://ift.tt/1MPYEjt)? One corresponding to every possible combination of const & and &&? With each combination the const ref qualifiers on the return value is the same. Why not have just one single overload that accepts the tuple type by forwarding reference and then simply forward the return value based on the signature of the input? Something like so
template <int Index, typename TupleType>
decltype(auto) get(TupleType&& tup);
This sort of thing would make it really easy for people to reason about what the get function does and would avoid bugs like Issue 2485 (http://ift.tt/2ovCTCh)
Aucun commentaire:
Enregistrer un commentaire