On Thu, Jan 7, 2010 at 2:46 PM, Darin Fisher <da...@chromium.org> wrote:
> > > On Thu, Jan 7, 2010 at 1:34 PM, Jeremy Orlow <jor...@chromium.org> wrote: > >> (As discussed during lunch...) Why not just do this in this case and >> remove EmptyString() altogether? >> >> const std::string& MyClass::foo() const { >> static std::string empty = EmptyString(); >> return (everything == OK) ? member_string : empty; >> } >> >> > This is not thread safe. EmptyString() uses Singleton<T> to basically > achieve the same thing in a thread safe manner. > Is there something wrong with returning by copy, and relying on the compiler to execute a return value optimization? -Albert
-- Chromium Developers mailing list: chromium-dev@googlegroups.com View archives, change email options, or unsubscribe: http://groups.google.com/group/chromium-dev