Unlike typename T
, which can be deduced to be a reference type, template<typename> class T
can only ever be deduced to be a class template, so T<U>
is always deduced to an object type.
You can write your function templated on T
then unpack the template type in the static_assert
:
template<typename T> struct is_particular_class: std::false_type {};
template<typename U> struct is_particular_class<ParticularClass<U>>: std::true_type {};
template<typename T> void test(T &&) {
static_assert(is_particular_class<std::remove_reference<T>::type>::value, "!");
}