I'm working on template MyTemplate that is going to be used in following way:
using Alias = MyTemplate<std::pair<int, char>,
                         std::pair<int, double>,
                         std::pair<int, unsigned int>>;
For now we can assume that MyTemplate will take only list of pair types. Moreover, all pair types should have the same first type and second type have to vary.
I want to "catch" the pairs' first_type in MyTemplate. I came up with following definition:
template<typename... Ts>
struct MyTemplate
{
   using first_type = std::decay_t<decltype((Ts::first_type, ...))>;
   // ...
};
When I use typename MyTemplate::first_type in context of different template everything works fine. I only get a warning:
warning: left operand of comma operator has no effect [-Wunused-value]
    using first_type = std::decay_t<decltype((Ts::first_type, ...))>;
                                                                    ^
However, I cannot create instance of Alias because I get that error:
error: missing 'typename' prior to dependent type name 'std::pair<int, char>::first_type'
Do you gave any idea for "generic" solution? I can use C+17.