Namespaces
Variants

Talk:cpp/types/is default constructible

From cppreference.com

I am willing to see implementation of

template<typename T> std::is_default_constructible

since it's possible declaration is given as template< class T> struct is_default_constructible : std::is_constructible<T> {};

but question is does it actually create object with default constructor of it and state of operation set to it's member value as bool value and here it might release again created object. But not sure what exactly it's implementation is.

Please help or provide as such case example with implementation.

I am believing it basically analyses error if occur during creation of object and some how it comes out of that error with set value as false to member of is_default_constructible.

no, it does not create an object, all types traits act in compile time. A complete implementation of std::is_default_constructible is already shown here. A complete implementation of std::is_constructible is 200-300 lines of code, too long to fit here, but you can see how it is implemented in open-source implementations: libc++ (lines 2358-2667) or libstdc++ (lines 889-1103).

'default' suffix is missing in the descriptions after the declarations

Descriptions mentions classes without 'default' suffix:

td::is_constructible<T>::value

std::is_trivially_constructible<T>::value

std::is_nothrow_constructible<T>::value

yes, that's what it's meant to say. --Cubbi (talk) 14:12, 20 November 2018 (PST)