With a really subtle trick all_truefrom Columbo , this is a light breeze:
template <bool...> struct bool_pack;
template <bool... v>
using all_true = std::is_same<bool_pack<true, v...>, bool_pack<v..., true>>;
template <class... Args>
std::enable_if_t<
all_true<std::is_convertible<Args, std::size_t>{}...>{}
> check(Args... args) {}
Live on coliru
And in the specific case when Check is a constructor:
template<typename... Args, class = std::enable_if_t<all_true<std::is_convertible<Args, std::size_t>{}...>{}>>
explicit Check(Args... args) {}
source
share