I have the following template:
variable = config["variable"] ? config["variable"].as<type>() : default;
I want to create a macro to have this done for me faster, since writing this many times becomes boring. I would try something like:
#define CONFIG_PARAM(config, key, type, alt) config["key"] ? config["key"].as<type> : alt;
title = CONFIG_PARAM(root, "title", std::string, "")
It's obvious that that wouldn't work. How can I get this done?