【发布时间】:2014-05-27 23:10:29
【问题描述】:
让我们考虑以下非常简化的示例
#include <array>
template<typename T, F>
class GenericColor {
protected:
std::array<T, F> components;
}
class RGB : public GenericColor<int, 3> { // three components, red, green...
}
class CMYK : public GenericColor<int, 4> { // four components, cyan, magenta....
}
我的问题是如何使第二个参数指向 std::array 大小,只是为了使这个示例正常工作。
【问题讨论】:
标签: c++ templates standard-library