std::convertible_to

Header: <concepts>

The concept convertible_to<From, To> specifies that an expression of the same type and value category as those of std::declval() can be implicitly and explicitly converted to the type To, and the two forms of conversion produce equal results.

# Declarations

template< class From, class To >
concept convertible_to =
std::is_convertible_v<From, To> &&
requires {
static_cast<To>(std::declval<From>());
};

(since C++20)

# See also