[haiku-commits] r34783 - haiku/trunk/headers/private/kernel/util

  • From: ingo_weinhold@xxxxxx
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Sun, 27 Dec 2009 16:19:17 +0100 (CET)

Author: bonefish
Date: 2009-12-27 16:19:17 +0100 (Sun, 27 Dec 2009)
New Revision: 34783
Changeset: http://dev.haiku-os.org/changeset/34783/haiku

Modified:
   haiku/trunk/headers/private/kernel/util/SplayTree.h
Log:
* Added assignment operators.
* Some automatic whitespace cleanup.


Modified: haiku/trunk/headers/private/kernel/util/SplayTree.h
===================================================================
--- haiku/trunk/headers/private/kernel/util/SplayTree.h 2009-12-27 08:58:50 UTC 
(rev 34782)
+++ haiku/trunk/headers/private/kernel/util/SplayTree.h 2009-12-27 15:19:17 UTC 
(rev 34783)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2008, Ingo Weinhold <ingo_weinhold@xxxxxx>.
+ * Copyright 2008-2009, Ingo Weinhold <ingo_weinhold@xxxxxx>.
  * Distributed under the terms of the MIT License.
  *
  * Original Java implementation:
@@ -23,12 +23,12 @@
        struct SplayTreeDefinition {
                typedef xxx KeyType;
                typedef yyy NodeType;
-       
+
                static const KeyType& GetKey(const NodeType* node);
                static SplayTreeLink<NodeType>* GetLink(NodeType* node);
-       
+
                static int Compare(const KeyType& key, const NodeType* node);
-       
+
                // for IteratableSplayTree only
                static NodeType** GetListLink(NodeType* node);
        };
@@ -255,16 +255,22 @@
                return closestNode;
        }
 
+       SplayTree& operator=(const SplayTree& other)
+       {
+               fRoot = other.fRoot;
+               return *this;
+       }
+
 private:
        /*!
                Internal method to perform a top-down splay.
-               
+
                _Splay(key) does the splay operation on the given key.
                If key is in the tree, then the node containing
                that key becomes the root.  If key is not in the tree,
                then after the splay, key.root is either the greatest key
                < key in the tree, or the least key > key in the tree.
-               
+
                This means, among other things, that if you splay with
                a key that's larger than any in the tree, the rightmost
                node of the tree becomes the root.  This property is used
@@ -587,6 +593,13 @@
                return ConstIterator(this, FindClosest(key, greater, orEqual));
        }
 
+       IteratableSplayTree& operator=(const IteratableSplayTree& other)
+       {
+               fTree = other.fTree;
+               fFirst = other.fFirst;
+               return *this;
+       }
+
 protected:
        friend class Iterator;
        friend class ConstIterator;


Other related posts:

  • » [haiku-commits] r34783 - haiku/trunk/headers/private/kernel/util - ingo_weinhold