deducing a tuple's types

Viewed 318

I have code something like this:

template <typename T>
inline typename ::std::enable_if<
  is_std_tuple<T>{},
  T
>::type
get()
{
  // pull tuple's elements from somewhere
}

In order to deduce the template type parameters the tuple was instantiated with, I did this casting:

static_cast<T*>(nullptr)

and pass this as a parameter to a function

template <typename ...A>
void deduce_tuple(::std::tuple<A...>* const);

Am I committing UB? Is there a better way?

1 Answers
Related