The safe_pointer_conversion
type trait has the same syntax as std::is_constructible.
It determines the behavior of safely_constructible
for pointer types.
|
expression |
value |
|---|---|
|
|
any types |
|
|
|
U* to T* requires that T
= U
or const T
= U.
T
and U is implicit in
the definition of safely_constructible.
So this trait also governs conversions like const
char *
foo =
"foo";.
template <typename A, typename B> struct safe_pointer_conversion; template <typename A, typename B> struct safe_pointer_conversion<A *, B *> { static constexpr bool value = (std::is_same<A, B>::value || std::is_same<A, const B>::value) && std::is_constructible<A *, B *>::value; };
![]() |
Note |
|---|---|
You are welcome to specialize this trait to modify the behavior of |