Erik de Castro Lopo wrote:
Hi all,Here's a question for all the C++ crack monkeys. Is it possible to return an std::string from a function? Something like: std::string & return_string () { std::string s ; // Do something with s. return s ; }
You can't return a reference to s, because it goes out of scope as soon as the function exits. You could return a copy of s by value, or a pointer to a heap allocated copy.
_______________________________________________ coders mailing list [email protected] http://lists.slug.org.au/listinfo/coders
