Given I can do this:
template <class T>
struct foo {
typedef T type;
};
template <template <size_t> class B>
struct foo2 {
typedef B<0> type;
};
struct bar1 {};
template <size_t N = 1>
struct bar2 {};
// usage
foo<bar1>::type // ok, = bar1
foo<bar2<> >::type // ok, = bar2<1>
foo2<bar2>::type // ok, = bar2<0>
Can I partially specialize foo to accept unspecialized class argument bar2? Like:
foo<bar2>::type // should give me bar2<0>
I've tried something below, but it doesn't work:
// compile error
template <template <size_t> class B>
struct foo<B> {
typedef B<0> type;
};