Given a possibly cv-qualified, possibly ref-qualified, possibly varargs function type, is it possible to write a type trait that strips all the qualifiers without writing 4 * 3 * 2 = 24 partial specializations?
template<class T>
struct strip_function_qualifiers;
template<class R, class... Args>
struct strip_function_qualifiers<R(Args...)> { using type = R(Args...); };
template<class R, class... Args>
struct strip_function_qualifiers<R(Args..., ...)> { using type = R(Args..., ...); };
template<class R, class... Args>
struct strip_function_qualifiers<R(Args...) const> { using type = R(Args...); };
template<class R, class... Args>
struct strip_function_qualifiers<R(Args..., ...) const > { using type = R(Args..., ...); };
template<class R, class... Args>
struct strip_function_qualifiers<R(Args...) const &> { using type = R(Args...); };
template<class R, class... Args>
struct strip_function_qualifiers<R(Args..., ...) const & > { using type = R(Args..., ...); };
// etc. etc. for each possible combination (24 in total)
And with the new transactional memory TS adding transaction_safe
to the mix, does that mean we'll need to write 48 partial specializations for this?
Aucun commentaire:
Enregistrer un commentaire