PrevUpHomeNext

Type relationship safe_pointer_conversion

The safe_pointer_conversion type trait has the same syntax as std::is_constructible. It determines the behavior of safely_constructible for pointer types.

Valid Expressions

expression

value

T, U

any types

safe_pointer_conversion<T*, U*>::value

true if a variant for which T* is one of the value types should be constructible from U*.

Notes

Definition

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] Note

You are welcome to specialize this trait to modify the behavior of strict_variant, but it might not always be the simplest way.


PrevUpHomeNext