Is it possible to change this C++11 initialization:
const std::map<int, std::map<int, std::string>> test =
{{1,
{{1, "bla"},
{2, "blie"}
}
},
{3,
{{1, "ha"},
{2, "hie"}
}
}
};
To some form with Boost.Assignment without using temporaries? It does not seem possible to nest map_list_of
in this way, unfortunately. Am I wrong?
Note: I am prepared for some terrible macros. As long as it works generally enough it would be fine. Variadic templates are not OK, as the target compiler is Intel C++ 2013 and/or MSVS2012.
EDIT: The "ideal" wrapper interface I would like to use looks something like this:
//header
extern const std::map<int, std::map<int, std::string>> test;
// source file
/*something*/ test
/*something*/ 1,
/*something*/ 1, "bla" /*something*/
/*something*/ 2, "blie" /*something*/
/*something*/ 2 //etc...
Where any /*something*/
can be empty. This should use both C++11 brace init or boost::assign::map_list_of
. I am trying to avoid a manual repetition like here: https://stackoverflow.com/a/1872506/256138