相关疑难解决方法(0)

c ++类模板专业化,无需重新实现一切

我有一个像这样的模板化课程:

template<typename T>
class A
{
    protected:
    std::vector<T> myVector;

    public:
    /*
    constructors + a bunch of member functions here
    */
}
Run Code Online (Sandbox Code Playgroud)

我想只添加一个仅适用于1种给定类型的T的成员函数.是否可以完全执行此操作而无需专门化类并重新实现所有其他已存在的方法?

谢谢

c++ templates class specialization

26
推荐指数
3
解决办法
2435
查看次数

标签 统计

c++ ×1

class ×1

specialization ×1

templates ×1