Trait class that identifies whether T is a trivial type. A trivial type is a type whose storage is contiguous (trivially copyable) and which only supports static default initialization (trivially default constructible), either cv-qualified or not. It includes scalar types, trivial classes and arrays of any such types.
A trivial class is a class (defined with class, struct or union) that is both trivially default constructible and trivially copyable, which implies that:
- It uses the implicitly defined default, copy and move constructors, copy and move assignments, and destructor.
- It has no virtual members.
- It has no non-static data members with brace- or equal- initializers.
- Its base class and non-static data members (if any) are themselves also trivial types.
is_trivial inherits from integral_constant as being either true_type or false_type, depending on whether T is a trivial type
template struct is_trivial;
std::is_trivial::value Here A is a class which has been passed as a parameter to the function is_trivial and it will return a value of integral constant type bool i.e. either true or false
A: true B: false C: false D: false
This article is contributed by Mohak Agrawal. If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above.
- Function Overloading vs Function Overriding in C++
- What happens when a virtual function is called inside a non-virtual function in C++
- Difference between Virtual function and Pure virtual function in C++
- div() function in C++
- exp() function C++
- log() function in C++
- fma() function in C++
- mbrlen() function in C/C++
- array at() function in C++ STL
- iswspace() function in C/C++
- array get() function in C++ STL
- towlower() function in C/C++
- iswxdigit() function in C/C++
- unordered_map end( ) function in C++ STL
- strcspn() function in C/C++