为什么is_assignable_v<int, int>
和is_assignable_v<int& int>
有不同的结果? is_assignable_v<int& int>
Return real but is_assignable_v<int, int>
回报不实。 它不是非常直观的。
is_assignable_v
is std::declval<T>() = std::declval<U>()
by definition from cppreference.com.
That means, std:declval<int>() = std::declval<int>()
return false but std:declval<int&>() = std::declval<int>()
returns true.
std::declval<int>()
is rvalue of int. Then what does std::declval<int&>()
mean? If it means reference to rvalue int, then Is is possible reference to int without const can refer rvalue?
I totally confused about is_assignable_v
.
Could you explain it for me?