| The author seems to be writing about a dream language that isn’t actually C++. For example: > In my streams I showed how RAII can thereby also be applied to database operations: a connection exists as long as it is in scope. Only if that connection object doesn’t support move — we’re 12 years of C++ standards past the arrival of move, and it still leaves its source in an indeterminate state. > With std::variant, C++ gained a tool that allows dynamic states without giving up type safety. variant is not quite type-safe: https://en.cppreference.com/w/cpp/utility/variant/valueless_... > With C++20, std::ranges decisively extends this principle: it integrates the notions of iterator, container, and algorithm into a unified model that combines type safety and readability. Ranges may be type-safe, but they’re not safe. Like string_view, a range is a reference, and the language does not help ensure that the referent remains valid. |
I haven’t watched the streams he referred to, but… I am fairly certain the language itself says no such thing. You may be thinking of the standard library, which states that certain classes of moved-from objects have unspecified state. If you’re writing your own DB connection class, you can define moves to leave the object in whatever state you prefer, or disallow moves.
Admittedly it’s still a weird example IMO, because external factors can sever the connection while the object is in scope.