If you are using the main C++ distribution of wxWidgets, Feel free to ask any question related to wxWidgets development here. This means questions regarding to C++ and wxWidgets, not compile problems.
spflanze
Earned some good credits
Posts: 130 Joined: Tue Feb 15, 2011 10:02 pm
Post
by spflanze » Sat Mar 17, 2018 1:07 am
I need to overload wxToString() for use in wxConfigBase::Write() . Here is a sample of how I would do this:
Code: Select all
wxString wxToString( tFileConfigArray A )
{ wxString ret;
return ret;
}
I am concerned about returning a local wxString object. What will happen to the returned wxString object when it is instantiated in the stack?
doublemax
Moderator
Posts: 19160 Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2
Post
by doublemax » Sat Mar 17, 2018 2:00 am
That's safe, the wxString will be copied.
It's only a problem when you return references or pointers to local variables.
Use the source, Luke!