On Friday, 27 November 2015 at 04:21:41 UTC, Nicholas Wilson wrote:
AA are weird in that AFAIK you need to "initialise" them before you try to look suff up in them else they crash. i.e.
int[string] foo;
// auto e = "1" in foo; // crash AA not initialised
foo[ "blah"] = 0;
foo.remove("blah");
auto e = "1" in foo; //doesn't crash

have you tried using aa.get(key,default);?
i.e. contentAA.get(language,"english").get(section, "somedefault").get(section,0);

That doesn't work for my use case unfortunately. The object I am getting of this call isn't the one I would like update at [language][chapter][section]. I really need a pointer or reference to the object that is held my the map.


other than that are you likey to have missing sections? (i.e. do you need an AA for section or can you just use an array?) similarly; does chapter need to be indexed by string? can you get away with indexing by chapter number and storing an array of chapter names and looking that up when needed?

Chapter is indeed the chapter's title. But you are right - the sections could be an usual array. Still the problem still is the same for the first two dimensions.

Reply via email to