如何定义矢量

xar*_*rzu -8 c++ stdvector

我在一个类的头文件中有以下内容:

#include <vector>
#include <math.h>
Run Code Online (Sandbox Code Playgroud)

在类描述中,我有以下受保护的成员:

vector<Point2D>         samples;
Run Code Online (Sandbox Code Playgroud)

Point2D被定义为一个类

在编译期间我遇到很多错误(C2143,C4430和C2238)

有任何想法吗?

Pol*_*yov 5

除非在代码的其他部分中定义命名空间,否则需要使用std::vector.

#include <vector>
#include <math.h>
...
std::vector<Point2D> samples;
Run Code Online (Sandbox Code Playgroud)