I would like to check that if a list of arguments is convertible to size_t or not. I think maybe the std::is_convertible_v is the right tool from STL. Here is what I imagine it should be (which is wrong):
#include <type_traits>
template<typename... Args>
constexpr bool check_all_convertible ()
{
return std::is_convertible_v<Args,size_t>;
}
I finally want to use the check_all_convertible() to enable another function:
template<typename... Args>
std::enable_if_t<check_all_convertible<Args...>(), void>
some_function (Args... args) {}
Question
- How can I use
std::is_convertible_vfor variadic arguments? - Do you suggest a better approach from STL?
I appreciate any suggestion to improve the code above.