The std::is_trivially_copy_constructible template is a type that can be trivially constructed from a value or reference of the same type. This includes scalar types, trivially copy constructible classes and arrays of such types. This algorithm is about to test whether a type is trivially copied constructible or not. It returns the boolean value showing the same.
template <class T> struct is_trivially_copy_constructible;
If T is_trivially_copy_constructible, then it inherits from true_type else inherits from false_type.
std::is_trivially_copy_constructible<int>::value std::is_trivially_copy_constructible<class T>::value
Parameter: This template accepts a single parameter T(Trait class) to check if T is trivially copy constructible or not.
Return Value: This template return a boolean variable as shown below:
- True: If the type is trivially copy constructible.
- False: If the type is not trivially copy constructible.
Below programs illustrates the std::is_trivially_copy_constructible template in C/C++:
is_trivially_copy_constructible: int: true A: true B: false C: false
Ex1 is copy-constructible? true Ex1 is trivially copy-constructible? false Ex2 is trivially copy-constructible? true Ex2 is nothrow copy-constructible? true
GeeksforGeeks has prepared a complete interview preparation course with premium videos, theory, practice problems, TA support and many more features. Please refer Placement 100 for details
- basic_istream::readsome() in C++ with Examples
- std::is_function template in C++ with Examples
- type_traits::is_null_pointer in C++
- std::extent() template in C++ with Examples
- basic_istream::swap() in C++ with Examples
- basic_istream::peek() in C++ with Examples
- basic_istream::unget() in C++ with Examples
- exception::bad_exception in C++ with Examples
- std::bad_array_new_length class in C++ with Examples
- basic_istream::seekg() in C++ with Examples
- functional::bad_function_call in C++ with Examples
- basic_istream::get() in C++ with Examples
- typeinfo::bad_cast in C++ with Examples
- basic_istream::putback() in C++ with Examples
- exception::what() in C++ with Examples
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.