Daily bit(e) of C++ | Conditional explicit
Daily bit(e) of C++ #258, C++20 conditional explicit specifier.
Since C++20, the explicit specifier can be conditional. This allows for generic code that permits implicit conversions in safe cases.
In this example, the wrapper for integral types permits implicit conversion only when the destination type can represent the full range of the source type.
Thanks for reading Daily bit(e) of C++! Subscribe for free to receive new posts and support my work.