According to Chapter 4 of the documentation, on page 19, lookup
returns a Setting&
, not a string.
Now, according to page 20, Setting
has a bunch of implicit conversions to various types, including std::string
. Here, the conversion to std::string
is ambiguous in the presence of the conversion to const char*
, since std::string
has constructors accepting both with equal rank.
This problem is actually explicitly described on page 21, wherein resolving the ambiguity with an explicit conversion (or "cast") is suggested, or the use of the member c_str()
rather than of the conversion operators:
target = cfg.lookup("target").c_str();