As the subject, many experienced programmers told me "the reference of std::vector is a prvalue"(i.e. std::vector<bool> vec; for(x&: vec)
does not compile.). I thought and thought about it, but I still can't understand. I would be very grateful to have some help with this question.
In addition, as per the documentation(https://en.cppreference.com/w/cpp/container/vector_bool/reference), which clearly says that [emphasis mine]:
The std::vector specialization defines std::vector::reference as a publicly-accessible nested class. std::vector::reference proxies the behavior of references to a single bit in std::vector.
The primary use of std::vector::reference is to provide an l-value that can be returned from operator[].