You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openoffice.apache.org by hd...@apache.org on 2013/05/15 10:24:09 UTC

svn commit: r1482719 - in /openoffice/trunk/main/configmgr/source: partial.cxx partial.hxx

Author: hdu
Date: Wed May 15 08:24:08 2013
New Revision: 1482719

URL: http://svn.apache.org/r1482719
Log:
#i122208# avoid default assignment operator of recursive STL containers

support for recursive STL containers is not required by the standard.
Boost TR1 containers allow them explicitly though but for some compiler/stl
combinations there are constness issues that prevent the default
assignment operator to work. Adding a small helper function solves
this problem in a clean way.

Modified:
    openoffice/trunk/main/configmgr/source/partial.cxx
    openoffice/trunk/main/configmgr/source/partial.hxx

Modified: openoffice/trunk/main/configmgr/source/partial.cxx
URL: http://svn.apache.org/viewvc/openoffice/trunk/main/configmgr/source/partial.cxx?rev=1482719&r1=1482718&r2=1482719&view=diff
==============================================================================
--- openoffice/trunk/main/configmgr/source/partial.cxx (original)
+++ openoffice/trunk/main/configmgr/source/partial.cxx Wed May 15 08:24:08 2013
@@ -98,7 +98,7 @@ Partial::Partial(
             rtl::OUString seg;
             bool end = parseSegment(*i, &n, &seg);
             if (end) {
-                p->children[seg] = Node();
+                p->children[seg].clear();
                 break;
             }
             Node::Children::iterator j(p->children.find(seg));

Modified: openoffice/trunk/main/configmgr/source/partial.hxx
URL: http://svn.apache.org/viewvc/openoffice/trunk/main/configmgr/source/partial.hxx?rev=1482719&r1=1482718&r2=1482719&view=diff
==============================================================================
--- openoffice/trunk/main/configmgr/source/partial.hxx (original)
+++ openoffice/trunk/main/configmgr/source/partial.hxx Wed May 15 08:24:08 2013
@@ -26,14 +26,13 @@
 
 #include "sal/config.h"
 
-#include <map>
+#include <boost/unordered_map.hpp> // using the boost container because it explicitly allows recursive types
 #include <set>
 
 #include "boost/noncopyable.hpp"
 
 #include "path.hxx"
-
-namespace rtl { class OUString; }
+#include "rtl/ustring.hxx"
 
 namespace configmgr {
 
@@ -51,9 +50,10 @@ public:
 
 private:
     struct Node {
-        typedef std::map< rtl::OUString, Node > Children;
+        typedef boost::unordered_map< rtl::OUString, Node > Children;
 
         Node(): startInclude(false) {}
+        void clear() { startInclude=false; children.clear(); }
 
         Children children;
         bool startInclude;