Some cpp class accept initializer_list as input, for example:
std::map<std::string, int> m{{"CPU", 10}, {"GPU", 15}, {"RAM", 20}}; or
std::map<std::string, int> m={{"CPU", 10}, {"GPU", 15}, {"RAM", 20}}; Is it possible, to define an initializer_list variable, then use it to call the constructor? i.e. something like:
auto il = {{"CPU", 10}, {"GPU", 15}, {"RAM", 20}}; std::map<std::string, int> m = il;
initializer_listis a proxy object, it does not actually hold values. So using it as a universal storage to pass stuff around is not a good idea.