Given a type with a variadic template constructor that forwards the arguments to an implementation class, is it possible to restrict the types being forwa
You can put Args inside more complex expressions and expand this like expression(Args).... Therefore
!std::is_same::type>::value...
Will give you a comma seperated list of is_same for each argument. You could use that as template arguments to a template combining the values accordingly, giving you something like the following.
template struct and_;
template
struct and_{
static constexpr bool value = A && and_::value;
};
template
struct and_{
static constexpr bool value = A;
};
//...
template ::type
>::value...>::value
>::type
>
foo(Args&&... args) : impl(std::forward(args)...)
{
std::cout << "uref" << std::endl;
}
I'm not entirely sure how exactly you want to restrict the arguments. Therefore I'm not sure if this will do what you want, but the you should be able to use the principle.