开发者

Vector of fixed array in c++98

I need to store an indeterminable number of triangles in a vector, therefore, it would be something like:

std::vector<Point[3]>

But that is not valid C++98. What are other solutions that do not involve a triangle struct?

开发者_运维百科

Thanks


Try a boost::array<Point, 3>. That should do the necessities.


  • You may define a struct
  • You may use pair<pair<Point,Point>,Point> type
  • If you can use latest C++, there are many options and one of them is using std::tuple. If there are more of such cases, you may implement your own tuple class taking 3 or more types.
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜