I'm currently binding a C++ method as follows:
RegisterObjectMethod("Foo", "const string& GetName() const", asMETHODPR(Foo, GetName, (void) const, const std::string&), asCALL_THISCALL) );
This project uses std::string, so we've also registered that add-on.
I know that it's been suggested (on this forum) that when dealing with a reference type, you want to return a handle and not a reference from the script function, even if your semantics are that the reference is always valid. Is that not the case with a value type? Should I be returning the string by const value (or just a non-const string, at that point)? I'm pretty sure the above has worked fine in script... but is it doing what I think it's doing (what returning a const reference would do in C++)?
Thank you very much.