That's not really what static_assert
is for, but you can do it like this:
template<typename T>
struct Type
{
static_assert(std::is_same<T, unsigned int>::value, "bad T");
};
Or, if you just want T
to be an unsigned integral type of some sort (not specifically unsigned int
):
template<typename T>
struct Type
{
static_assert(std::is_unsigned<T>::value, "bad T");
};