【发布时间】:2016-05-22 04:51:21
【问题描述】:
我已经阅读了我能找到的关于这个主题的所有帖子,但无法弄清楚我做错了什么。我无法成功初始化我的类的成员变量 2d 向量。头文件是:
class Beam2
{
private:
/*The following unit vectors should never be accessed directly
and are therefore private.*/
std::vector<std::vector<double> > unitVectors;
public:
//constructor
Beam2(
Node * node1PtrInput, Node * node2PtrInput,
double orientAngleInput);
我的 cpp 文件
Beam2::Beam2(
Node * node1PtrInput, Node * node2PtrInput, double orientAngleInput){
node1Ptr = node1PtrInput;
node2Ptr = node2PtrInput;
orientAngle = orientAngleInput;
unitVectors(3, std::vector<double>(3));
updateUnitVectors();
错误是:错误:不匹配调用'(std::vector >) (int, std::vector)' unitVectors(3, std::vector(3)); ^ 任何帮助,将不胜感激。
【问题讨论】:
标签: c++ multidimensional-array vector