C++ template compilation error: expected primary-expression before ‘>’ token
Solution 1:
You need to do:
std::cout << pt.template get<std::string>("path");
Use template
in the same situation as typename
, except for template members instead of types.
(That is, since pt::get
is a template member dependent on a template parameter, you need to tell the compiler it's a template.)