language: C++11 (gcc-4.7.2)
date: 483 days 7 hours ago
link:
visibility: public
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
template< typename... args >
    struct A {
        template<typename... T> struct Inner;
 
        template< typename head, typename... tags >
        struct Inner<head, tags...> : public Inner<tags...> {
        };
    
        template< typename head >
        struct Inner<head> {
            // assume both args... and tags... must be used to
            // calculate TYPE
            typedef int TYPE;
        };
    };
    
    template< typename... args >
    struct B : A<args...> {
        template<typename... tags>
        typename A<args...>::template Inner<tags...>::TYPE x() {
            return 0;
        }
    };
    
    int main(int argc, const char *argv[]) {
        B<int, int, int> b;
        b.x<char, short, long, double>();
    
        return 0;
    }