Daily bit(e) of C++ | std::unreachable
Daily bit(e) of C++ #425, The C++23 undefined behaviour injection tool: std::unreachable.
The C++23 std::unreachable is a tool for injecting undefined behaviour into a program. A typical use case is in an else branch or the default case of a switch.
Compilers can use this undefined behaviour and optimise the corresponding branch away.
While we can achieve the same behaviour with [[assume(false)]], std::unreachable provides a more readable and logical name.