I am working on a class that has a method with the following signature:
operator const std::string & () const
It's documented as "cast to string operator". I am wondering how to effectively invoke it. Unfortunately the following expression:
std::string(foo)
produces this error:
some_test.cpp:13:41: error: no matching function for call to'
std::basic_string<char>::basic_string(Foo (&)(std::string))'
Considering that foo
is of type Foo
, declared and instantiated as Foo foo(std::string(filename))
being a begginner of C++, this leaves me a bit confused. Any hints on what this means?
Aucun commentaire:
Enregistrer un commentaire