我希望使用带有模板参数 V 的 Spring 类:
#include "Spring.hpp"
template <typename K, typename L>
struct spring_value {
K spring_constant;
L spring_length;
};
typedef Spring<std::vector<spring_value<double, double>>> Spring;
typedef Spring::value value; // why struct Force does not see this?
struct Force {
value v = {1.0, 2.0}; // error
spring_value<double,double> v = {1.0, 2.0}; // ok, but ...
double s = v.spring_value; // also error
}
春季班:
template <typename V>
class Spring {
public:
typedef V value;
}
但是,该程序会产生missing template arguments before 'v'
错误。为什么没有struct Force
看到spring value
或value
在 Spring 类中?