I would like to iterate through a members of a struct. In other words my bigger struct vector have a smaller struct inside. I would like to access all of the inside structs which is small_strcut_subject
in this case:
#include <iostream>
#include <vector>
#include "../common/myheader.h"
using namespace std;
struct small_struct {
string name;
};
struct big_struct {
struct small_struct small_struct_obj;
};
int main() {
std::vector<big_struct> big_struct_obj;
big_struct_obj.push_back(big_struct());
big_struct_obj[0].small_struct_obj.name = "english";
for (std::vector<big_struct>::iterator it = big_struct_obj.begin(); it != big_struct_obj.end(); ++it){
// cout << big_struct_obj[*it].small_struct_obj.name << endl;
}
}
There is question about how to iterate through a sttuct but if it is multiple struct such as mine, I coudnt find any solution.