I'm developing a recursive method for a class which will return a complicated data structure (a list of dictionaries which will contain lists of dictionaries as values).

The data structure could be something like that:

list<map <string,list<map <string,list< map<string,list<...> > > >

How can I refer to this structure while defining returning types or parameters in the method? The problem I don't know how deep the structure is going to be.

Could something like list<map<string,T> > work??

BTW, maybe the data structure is no-sense, but I'm translating some code from Python and I have to do it like that.

Thanks in advance!

Recommended Answers

All 4 Replies

metzenes,
Use typedef.

typedef vector<vector<vector<string> > > Mat;
Mat getData() { ... }
Member Avatar for jencas

@adatapost

I think you haven't read metzenes's post thoroughly. Your recommendation will not work for him.

Thank you jencas,

I regret.

I read those lines:

How can I refer to this structure while defining returning types or parameters in the method?

and bypassed,

The problem I don't know how deep the structure is going to be.
Could something like list<map<string,T> > work??

Sorry for inconvenience.

Member Avatar for jencas

Sorry for inconvenience.

No problem at all, have a nice day!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.