我声明如下C++载体 - acessing型结构的矢量大小的结构
#include <vector>
#include <iostream>
using namespace std;
typedef struct _ListofHops_T
{
int macAddrLtr;
int ttlValue;
}ListofHops;
struct ReadActivateLinkTrace
{
typedef std::vector < ListofHops *> ListofHopsList;
bool operationState;
};
int main()
{
ReadActivateLinkTrace readLinkTrace;
for (size_t listItr=0; listItr < readLinkTrace.ListofHopsList.size(); listItr++)
{
.....
}
}
我想一个结构ReadActivateLinkTrace
内申报跳struct
的列表的矢量内声明。
- 上述声明是否有效。
- 我收到以下错误编译
vector.cpp:23: error: invalid use of ReadActivateLinkTrace::ListofHopsList
我是新来的载体。我如何访问/遍历结构中定义的结构向量?
感谢Luchian,这是有很大帮助:) – user1840954
@user接受的答案,如果它回答您的问题 - 给它一个对勾。 – Yakk