std::is_move_assignable C++ with Examples

The std::is_move_assignable template of C++ STL is present in the <type_traits> header file. The std::is_move_assignable template of C++ STL is used to check whether the T is a move assignable type(that can be assigned an rvalue reference of the same type) or not. It return the boolean value true if T is move assignable type otherwise return false.

Header File:


Template Class:

template <class T>
struct is_move_assignable;



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

Return Value: This template returns a boolean variable as shown below:

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

Below is the program to illustrates the std::is_move_assignable template in C/C++:






// C++ program to illustrate
// std::is_move_assignable
#include <bits/stdc++.h>
#include <type_traits>
using namespace std;
// Declare structures
struct A {
struct B {
    B& operator=(B&) = delete;
struct C {
    ~C() = delete;
// Driver Code
int main()
    cout << boolalpha;
    // Check if int is move
    // assignable or not
    cout << "int: "
         << is_move_assignable<int>::value
         << endl;
    // Check if struct A is move
    // assignable or not
    cout << "struct A: "
         << is_move_assignable<A>::value
         << endl;
    // Check if struct B is move
    // assignable or not
    cout << "struct B: "
         << is_move_assignable<B>::value
         << endl;
    // Check if struct C is move
    // assignable or not
    cout << "struct C: "
         << is_move_assignable<C>::value
         << endl;
    // Declare an map
    unordered_multimap<int, string> m;
    m.insert({ 1, "GfG" });
    // Check if map m is move
    // assignable or not?
    cout << "Map m: "
         << is_move_assignable<decltype(*m.begin())>::value;
    return 0;



int: true
struct A: true
struct B: false
struct C: true
Map m: true


Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the DSA Self Paced Course at a student-friendly price and become industry ready.

My Personal Notes arrow_drop_up

Check out this Author's contributed articles.

If you like GeeksforGeeks and would like to contribute, you can also write an article using or mail your article to 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.

Article Tags :
Practice Tags :

Be the First to upvote.

Please write to us at to report any issue with the above content.