在CPP中互相访问的两个结构
Two structs that access eachother in cpp
我有两个相互访问的结构。我向前宣布它们,但仍然存在编译器错误。
'node'在此范围中没有声明,而'node'未命名类型。
struct Node;
struct Edge;
struct Node
{
unsigned intersectionID;
bool visited;
std::vector <Edge*> leavingedges;
};
struct Edge
{
unsigned streetsegmentID;
double weight;
Node* endingnode;
};
您忘记了#include <vector>
。当我添加时,您的代码会罚款。
相关文章:
- 在两个结构之间共享数组
- C++ 如何从函数传递两个结构?
- 如何认为两个结构相等,而不管它们的第二个属性如何?
- 使用用户函数在 C++ 中交换两个结构
- 在CPP中互相访问的两个结构
- 如何实现 std::map::查找包含两个结构'Pos'结构的比较逻辑,每个结构包含 x 和 y 坐标
- 当我们在两个结构上使用它时,= 运算符会做什么
- 合并/连接两个结构
- C++(SDL2)中的碰撞函数.如何传递存储在不同向量中的两个结构
- 具有相同名称和不同模板参数的两个结构如何工作
- 复制两个结构指针时出现分段错误
- Xcode 不链接两个结构
- 在两个结构(函子)中理解typedef的作用域
- 如何在c++中比较两个结构字符串
- 设置两个结构体相等后,指针为NULL
- 如何声明具有other类型成员的两个结构体
- 如何在c++中连接两个结构体类型变量
- C++ stl 列出了两个结构交叉引用
- 有两个结构在C++中相互引用彼此的变量
- 为什么我的两个结构数组没有相互作用?