Open OlafvdSpek opened 6 years ago
I'm confused. Are you asking for "consistent undefined behavior"?
Maybe A debug assert or maybe even a trap in release might be nice to avoid any surprises when substituting boost::string_view for the std one.
The whole point of undefined behavior is that you have no guarantees - of anything. The C people used to say "and demons will fly out of my nose". You can run a program with UB twice in a row on the same machine with the same inputs, and once it might give you the right answer, and the second time it might cause your cat to become pregnant.
I know. The problem is that boost::string_view::remove_prefix(npos)
is well-defined, while std::string_view::remove_prefix(npos)
is undefined.
So people that rely on the boost one and will be bitten when they switch to the std one.
Undefined behavior for std, defined behavior for Boost.
Wouldn't it be better to have the same behavior for both?