Are C++ recursive type definitions possible, in particular can I put a vector within the definition of T?

前端 未结 6 2113
轻奢々
轻奢々 2020-11-27 21:32

For one of my projects, what I really wanted to do was this (simplifying it to the bare minimum);

struct Move
{
    int src;
    int dst;
};

struct MoveTree         


        
6条回答
  •  庸人自扰
    2020-11-27 22:01

    The MoveTree elements in std::vector are in an allocated (as in new []) array. Only the control information (the pointer to the array, the size, etc) are stored within the std::vector within MoveTree.

提交回复
热议问题