This imposes a constraint on the implementation, but it would be nice if the type was const std::string& and the member function itself is const. You can use a static var in the functions below.