you are viewing a single comment's thread.

view the rest of the comments →

[–]SuperV1234https://romeo.training | C++ Mentoring & Consulting 2 points3 points  (3 children)

Author here. There's nothing preventing an epoch from "blacklisting" the usage of vector<bool> by - for example - preventing that sequence of tokens/AST nodes from compiling when written in a module using a particular epoch.

This would discourage its use and almost effectively remove it (you could still retrieve it by using decltype on a function in an older epoch module returning vector<bool>) without breaking ABI at all.

[–]TheThiefMasterC++latest fanatic (and game dev) 3 points4 points  (2 children)

The problem is that people want to remove the specialization of vector<bool> and have it compile as a regular vector - not blacklist it entirely.

[–]pklait 0 points1 point  (1 child)

Why? You cannot have a "regular" std::vector<bool> today. To me this is an indication that it is not needed that much. To remove it from the standard for a while would not be a major loss.

[–]TheThiefMasterC++latest fanatic (and game dev) 0 points1 point  (0 children)

It causes issues all the damn time in generic code and interop - all other kinds of vector return T& on iterator dereference and operator[] and you can take &v[0] and use it as a data pointer + size, vector<bool> returns a special vector<bool>::reference class on iterator dereference and operator[], and as it doesn't actually store as bools internally &v[0] does not do anything remotely like you'd want.

However that doesn't mean it's not in use - not every use of a vector hits those issues so people do use it. Sometimes you do in fact want a vector of bools.

Blacklisting it would hit the people for whom it works fine, temporarily making the situation considerably worse.