我很感激帮助部分专门化模板(Manufacturer
)的模板模板参数?这是我当前(不成功)的尝试。
#include <iostream>
enum FORMAT{ A , B };
template<typename D , FORMAT F>
struct Manufacturer
{
Manufacturer(){ std::cout << "Generic" << std::endl; }
};
template<
template<FORMAT> class D , FORMAT F
>
struct Manufacturer<D<F>,F> : Manufacturer<void,F>
{
Manufacturer(){ std::cout << "Specialization" << std::endl; }
};
template<FORMAT F>
struct Device : Manufacturer<Device,F>
{
};
int main()
{
Device<A> device;
}