What does pointer_traits provide for types that are neither X <A, T ...> nor provide a member of typedef element_type?
What is the result of the following? Is it unqualified, undefined behavior, or generally recognized and well-formed?
struct A {}; std::pointer_traits<A> x; I ask because I want to know curiosity and because I want to know if an arbitrary type is a pointer. With this, I also want to enable shared_ptr and friends. I wondered if there is a feature type (predicate) for this, or if not, can I use pointer_traits and determine if the type_type is declared or not.
It says that it is poorly formed, as from 20.6.3p1, since it does not have element_type and is not an instance of the class instance
typedef see below element_type;
Type: Ptr :: element_type, if such a type exists; otherwise T, if Ptr is an instance of a class template of the form
SomePointer<T, Args>, where Args has zero or more type arguments; otherwise, specialization is poorly formed .