Reputation: 13
I have 2 templated types:
A<int N>
B<int N>
I need these two types to be aliased by a single, third type,
C<int N, bool T>
Basically what I want is this:
template<size_t N, bool T = false>
using C = A<N>;
template<size_t N, bool T = true>
using C = B<N>;
However this throws a conflicting declaration error.
error: conflicting declaration of template 'template using C = B' using C = B;
How can I do this?
Upvotes: 1
Views: 257
Reputation: 119562
template <size_t N, bool T>
using C = std::conditional_t<T, B<N>, A<N>>;
Upvotes: 4