concept bool D() { return C<T>() and __is_empty(T); }
concept bool D() { return __is_empty(T); }
bool tde1 = __has_trivial_destructor(I); // { dg-error "incomplete type" } bool tde2 = __has_trivial_destructor(C[]); bool tde3 = __has_trivial_destructor(I[]); // { dg-error "incomplete type" } bool tde4 = __has_trivial_destructor(void); bool tde5 = __has_trivial_destructor(const void); bool abs1 = __is_abstract(I); // { dg-error "incomplete type" } bool abs2 = __is_abstract(C[]); bool abs3 = __is_abstract(I[]); // { dg-error "incomplete type" } bool abs4 = __is_abstract(void); bool abs5 = __is_abstract(const void); bool pod1 = __is_pod(I); // { dg-error "incomplete type" } bool pod2 = __is_pod(C[]); bool pod3 = __is_pod(I[]); // { dg-error "incomplete type" } bool pod4 = __is_pod(void); bool pod5 = __is_pod(const void); bool emp1 = __is_empty(I); // { dg-error "incomplete type" } bool emp2 = __is_empty(C[]); bool emp3 = __is_empty(I[]); // { dg-error "incomplete type" } bool emp4 = __is_empty(void); bool emp5 = __is_empty(const void); bool pol1 = __is_polymorphic(I); // { dg-error "incomplete type" } bool pol2 = __is_polymorphic(C[]); bool pol3 = __is_polymorphic(I[]); // { dg-error "incomplete type" } bool pol4 = __is_polymorphic(void); bool pol5 = __is_polymorphic(const void);
concept bool Empty_type() { return __is_empty(T); }
bool f() { return !!__is_empty(T); }
bool f() { return !!__is_empty(T); } }; template<typename T> class My2 { public: static const bool trait = __is_empty(T); }; template<typename T> const bool My2<T>::trait; template<typename T, bool b = __is_empty(T)> struct My3_help { static const bool trait = b; }; template<typename T, bool b> const bool My3_help<T, b>::trait; template<typename T> class My3 { public: bool f() { return My3_help<T>::trait; } };
class DefaultDeleter<T[]> { constexpr DefaultDeleter() = default; constexpr DefaultDeleter(const DefaultDeleter&) = default; void operator()(T* ptr) const { static_assert(sizeof(T) > 0, "Can't delete incomplete type"); delete[] ptr; } }; /* * UniquePointer members are stored in this seperate class in order to employ * empty base class optimization for the deleter object (so that empty deleters * have no memory overhead). */ template<class T, class Deleter, bool = __is_empty(Deleter) && !__is_final(Deleter)> class UniquePointerData : private Deleter { public: UniquePointerData(T* ptr, Deleter deleter) : Deleter(deleter), pointer(ptr) { } T*& ptr() { return pointer; } const T*& ptr() const { return pointer; } Deleter& deleter() { return *this; } const Deleter& deleter() const { return *this; } private: T* pointer; }; template<class T, class Deleter>