2

我很感激帮助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;
}
4

0 回答 0