I have the problem with redefining operator[] in my class which has vector as private member. So plan is to have vector of bools which is going to contain only true or false value. Here is minimal code that you could understand problem that i have.
class A{
private:
std::vector<bool> _object;
public:
bool& operator[](size_t i) {return _object[i];};
};
Compiler error is: Non-cost lvalue reference to type bool cannot be bind to a temporary of 'reference' (aka 'std::_Bit_reference')
I don't understand how _object[i] can be temporary in this situation.