Reputation: 20843
Is the result of decltype
the same as the template identifier? (And what is the correct term when referring to T and its value?). That is are there cases where the assert fails?
template<typename T>
void foo(T x)
{
static_assert(std::is_same<decltype(x), T>::value, "decltype check failed");
}
Upvotes: 0
Views: 72
Reputation: 64223
Type of the variable x
is T, therefore that static_assert is always going to pass.
Upvotes: 1