void ASolidView::setParam(std::string const &k, std::string const &v) { static std::unordered_map<std::string, void (*)(ASolidView*, std::string const&)> param_map { {"backgroundColor", [](ASolidView *v, std::string const &str) { v->setBackgroundColor(std::stoul(str, NULL, 16)); }}, {"borderColor", [](ASolidView *v, std::string const &str) { v->setBorderColor(std::stoul(str, NULL, 16)); }}, {"borderWidth", [](ASolidView *v, std::string const &str) { v->setBorderWidth(std::stoi(str, NULL)); }} }; auto const &it = param_map.find(k); if (it != param_map.end()) it->second(this, v); else AView::setParam(k, v); }