c++ - std::is_same<A,B>::value == true in line 1, false in line 2 -
i have code returns true in 1 line, false in other.
for example,
struct z{ static const int value = 10; }; struct : z{ }; struct b : z{ }; int main(){ if(std::is_same<a,b>::value){ static_assert(std::is_same<a,b>::value , "why here?"); } return 0; }
can please explain why throws static assert error?
this because static_assert
static (that is: compile time) assert. not care if
statement (evaluated @ run-time) above.
Comments
Post a Comment