I got a weird one. I am trying to find a way to store every templated method's argument type to make it avaiable to class' users. A simple example may be:
template <typename... Ts>
struct Types {};
template <typename... Lhs, typename... Rhs>
constexpr auto operator+(Types<Lhs...>, Types<Rhs...>) {
return Types<Lhs..., Rhs...>{};
}
class User {
public:
template <typename Event, typename... New, typename... Old>
void run(const Event& event) {
// Something along the lines of:
types_<New...> = types_<Old...> + Types<Event>{};
/* Do stuff.. */
}
private:
template <typename... T>
static constexpr Types<T...> types_{};
};
I'm trying to store every Event type from each generated run() method, basically I'm looking for the variadic template's arguments <T...> form the types_ attribute. Is this even allowed by the language?
P.S. The Types struct is just a failed attempt to hopefully makes the intent of the question clear, any other solution would be more than welcome.