The compiler does not know T
of your templated get()
since it is only a return value (and even if you were to assign the return value to a variable, C++ does not infer T
based on return values). So you must explicitly tell compiler what is T
. Also, you do not need to create the temp string, since there is only one parameter type possible (const std::string&
), so try this:
script.get<std::string>("test");