It is common for libraries to have types which return instances of themselves from member functions to encourage chaining calls. For example, nlohmann json:
auto my_data = my_json_object["first key"]["second key"];
Is there some way to call a member function using the contents of a parameter pack? e.g.:
template<class... Keys>
auto get_elem(json json, Keys... keys)
{
return json([keys]...); // -> json[keys[0]][keys[1]]...[keys[N]]
}
auto my_data = get_elem(my_json_object, "first key", "second key");