Here you are, but...
Are you really sure you want this?
#include <iostream>
#include <map>
using namespace std;
struct Test
{
string name;
int id;
};
struct Test1
{
int errCode;
string errName;
map<int, Test > mapOfTest;
};
struct Test2
{
map < string, Test1> mapOfTest1;
};
int main()
{
Test test[] =
{
{"foo", 4},
{"bar", 2}
};
Test1 test1[] =
{
5, "error five",
{
{5, test[0]} ,
{25, test[1]}
},
6, "error six",
{
{6, test[1]} ,
{36, test[1]}
}
};
Test2 test2 = { {{ "goo", test1[0] }, { "boo", test1[0] }, {"woo", test1[1]}}};
cout << test2.mapOfTest1["woo"].mapOfTest[6].name << endl;
}
[update]
As per OP request, here it is the code using iterators
auto it1 = test2.mapOfTest1.find("woo");
if ( it1 != test2.mapOfTest1.end() )
{
auto & mof = it1->second.mapOfTest; auto it = mof.find(6);
if ( it != mof.end() )
cout << it->second.name << endl;
}
[/update]