I would like to do something like the following (in c++11, c++14; not c++17):
template <class T>
using partner = void;
template<>
using partner<A> = X;
template<>
using partner<B> = Y;
template<>
using partner<C> = Z;
But I get a compilation error---
error: expected unqualified-id before ‘using’
---on the first template specialization.
Is such a thing possible? (I already know I can use a templated class with a using
statement inside it. I'm hoping directly use the using
statement without the class wrapper, since it's simpler and more elegant. If there's another simple, elegant solution, please share!)
Aucun commentaire:
Enregistrer un commentaire