Why elements of an element access an element from STL containers, for example. std::array::operator[]or std::vector::operator[]don't have overloaded rvalue ref qualifiers? Of course, I can do it std::move(generate_vector()[10]), but I'm curious that when adding a ref-qualifier refvalifier, revaluations of rvalue were taken into account when standardizing ref-qualifiers.
I think std::array<T, N>, and std::tuple<T, T, ..., T>in fact one and the same, as a function of access to the element (ie std::get) "last overloaded for all combinations of const vs non-const and lvalue vs rvalue, Why not be the first?
Is it a good idea to add rvalue ref-qual accessor accessor functions (which return rvalue references) to my custom container?
EDIT
In the commentary of Richard Critin. I think this can be useful sometimes.
For example, you have a function that returns a container constructed inside this function, but you may be interested in only the first element of this container. Yes, this is stupid. In this case, it is definitely better to use a simpler function that only constructs the first element. But if the function is not yours, you have no such choice.
Or there may be more general examples. You have a function that creates a container, and you want to process this container to get a different result. For example, you can execute std::reduceeither std::unique_copyin this container. (It seems that the std::reduceelements could not be modified at runtime , but let's just assume that we have implemented our own, which allows us to change.) In this case, you can use it std::make_move_iterator, but why not let the container itself return to move the iterators?
EDIT2
, "" . , ( lvalue), ( ) (rvalue reference), , : lvalue rvalue ? , rvalue , . ?