What is the difference between is_convertible is_assignable

前端 未结 2 1018
盖世英雄少女心
盖世英雄少女心 2020-12-16 10:42

What is the difference between is_convertible and is_assignable?

Why,

in vs2012

is_convertible         


        
2条回答
  •  温柔的废话
    2020-12-16 11:30

    Seems like a bug in gcc, is_convertible in this context means that:

    int& foo()
    {
        return 3; //invalid
    }
    

    On the other hand is_assignable in this context means that:

    void foo(int& x, int y)
    {
        y = x; // valid
    }
    

提交回复
热议问题