On Thu, 2012-02-16 at 10:48 +0400, Ivan Timofeev wrote: > Whoa, I seem to be too naive for patch-reviewing... > > Is it a safe code? > > pForbiddenCharacters = &maMap[ nLanguage ]; > return pForbiddenCharacters;
Yeah I don't see anything wrong with it. > Will pForbiddenCharacters point to the deleted object, after the return? Nope. As far as I know those STL methods that return its element are guaranteed to return a reference to the stored instance, not its copy. So, in theory, taking the address of a returned object which itself is a reference to the instance stored in the container is very much safe. The only exception is std::vector<bool> which lumps its internal boolean values into bitfield, but by doing it it can no longer meet the requirement of STL container which must return reference to its elements. So, by that definition std::vector<bool> is not a STL container, strictly speaking. For the curious, refer to Item 18 of Effective STL by Scott Meyers. Kohei -- Kohei Yoshida, LibreOffice hacker, Calc _______________________________________________ LibreOffice mailing list LibreOffice@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice