Skip to content
Related Articles

Related Articles

std::is_trivially_move_assignable in C++ with Examples
  • Last Updated : 12 Jun, 2020

The std::is_trivially_move_assignable template of C++ STL is present in the <type_traits> header file. The std::is_trivially_move_assignable template of C++ STL is used to check whether the T is a trivially move assignable type or not. It return the boolean value true if T is trivially move assignable type, otherwise return false.

Header File:


Template Class:

template <class T>
struct is_trivially_move_assignable;



Parameter: The template std::is_trivially_move_assignable accepts a single parameter T(Trait class) to check whether T is trivially move assignable or not.

Return Value: The template std::is_trivially_move_assignable returns a boolean variable as shown below:

  • True: If the type T is a trivially move assignable.
  • False: If the type T is not a trivially move assignable.

Below is the program to demonstrate std::is_trivially_move_assignable in C++:


// C++ program to illustrate
// std::is_trivially_move_assignable
#include <bits/stdc++.h>
#include <type_traits>
using namespace std;
// Declare Structures
class A {
struct B {
    B& operator=(B&&) = delete;
// Driver Code
int main()
    cout << boolalpha;
    cout << "int is_trivially_move_assignable? "
         << is_trivially_move_assignable<int>::value
         << endl;
    cout << "A is_trivially_move_assignable? "
         << is_trivially_move_assignable<A>::value
         << endl;
    cout << "B is_trivially_move_assignable? "
         << is_trivially_move_assignable<B>::value
         << endl;
    cout << "int[2] is triviallay move assignable? "
         << is_trivially_move_assignable<int[2]>::value
         << endl;
    return 0;
int is_trivially_move_assignable? true
A is_trivially_move_assignable? true
B is_trivially_move_assignable? false
int[2] is triviallay move assignable? false


Want to learn from the best curated videos and practice problems, check out the C++ Foundation Course for Basic to Advanced C++ and C++ STL Course for foundation plus STL.  To complete your preparation from learning a language to DS Algo and many more,  please refer Complete Interview Preparation Course.
My Personal Notes arrow_drop_up
Recommended Articles
Page :