On 10/13/2010 12:51 PM, Hyrum K. Wright wrote:
At this point, it's my turn to get confused. I'm speaking specifically of cases where we return STL classes. Brane's earlier suggestion to create an implicit bool conversion works fine for our custom classes. The problem I'm trying to solve is "how does one return the equivalent of '(const char *) NULL' in an std::string?" It's a this point that pointers start coming into play, because a NULL std::string * is quite feasible, whereas a NULL std::string isn't.
It may not be of interest, but the Boost::Optional library was designed as a potential solution to this type of situation.
http://www.boost.org/doc/libs/1_44_0/libs/optional/doc/html/index.html