diff options
Diffstat (limited to 'boost/intrusive/circular_slist_algorithms.hpp')
-rw-r--r-- | boost/intrusive/circular_slist_algorithms.hpp | 136 |
1 files changed, 68 insertions, 68 deletions
diff --git a/boost/intrusive/circular_slist_algorithms.hpp b/boost/intrusive/circular_slist_algorithms.hpp index b843590c15..c39b3d0c5a 100644 --- a/boost/intrusive/circular_slist_algorithms.hpp +++ b/boost/intrusive/circular_slist_algorithms.hpp @@ -1,7 +1,7 @@ ///////////////////////////////////////////////////////////////////////////// // // (C) Copyright Olaf Krzikalla 2004-2006. -// (C) Copyright Ion Gaztanaga 2006-2009 +// (C) Copyright Ion Gaztanaga 2006-2012 // // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at @@ -42,7 +42,7 @@ namespace intrusive { //! <b>Static functions</b>: //! //! <tt>static node_ptr get_next(const_node_ptr n);</tt> -//! +//! //! <tt>static void set_next(node_ptr n, node_ptr next);</tt> template<class NodeTraits> class circular_slist_algorithms @@ -64,37 +64,37 @@ class circular_slist_algorithms //! <b>Effects</b>: Constructs an non-used list element, putting the next //! pointer to null: //! <tt>NodeTraits::get_next(this_node) == node_ptr()</tt> - //! - //! <b>Complexity</b>: Constant - //! + //! + //! <b>Complexity</b>: Constant + //! //! <b>Throws</b>: Nothing. static void init(node_ptr this_node); //! <b>Requires</b>: this_node must be in a circular list or be an empty circular list. - //! + //! //! <b>Effects</b>: Returns true is "this_node" is the only node of a circular list: //! or it's a not inserted node: //! <tt>return node_ptr() == NodeTraits::get_next(this_node) || NodeTraits::get_next(this_node) == this_node</tt> - //! + //! //! <b>Complexity</b>: Constant - //! + //! //! <b>Throws</b>: Nothing. static bool unique(const_node_ptr this_node); //! <b>Effects</b>: Returns true is "this_node" has the same state as //! if it was inited using "init(node_ptr)" - //! - //! <b>Complexity</b>: Constant - //! + //! + //! <b>Complexity</b>: Constant + //! //! <b>Throws</b>: Nothing. static bool inited(const_node_ptr this_node); //! <b>Requires</b>: prev_node must be in a circular list or be an empty circular list. - //! + //! //! <b>Effects</b>: Unlinks the next node of prev_node from the circular list. - //! - //! <b>Complexity</b>: Constant - //! + //! + //! <b>Complexity</b>: Constant + //! //! <b>Throws</b>: Nothing. static void unlink_after(node_ptr prev_node); @@ -103,28 +103,28 @@ class circular_slist_algorithms //! //! <b>Effects</b>: Unlinks the range (prev_node, last_node) from the circular list. //! - //! <b>Complexity</b>: Constant + //! <b>Complexity</b>: Constant //! //! <b>Throws</b>: Nothing. static void unlink_after(node_ptr prev_node, node_ptr last_node); //! <b>Requires</b>: prev_node must be a node of a circular list. - //! + //! //! <b>Effects</b>: Links this_node after prev_node in the circular list. - //! - //! <b>Complexity</b>: Constant - //! + //! + //! <b>Complexity</b>: Constant + //! //! <b>Throws</b>: Nothing. static void link_after(node_ptr prev_node, node_ptr this_node); //! <b>Requires</b>: b and e must be nodes of the same circular list or an empty range. //! and p must be a node of a different circular list. - //! + //! //! <b>Effects</b>: Removes the nodes from (b, e] range from their circular list and inserts //! them after p in p's circular list. - //! - //! <b>Complexity</b>: Constant - //! + //! + //! <b>Complexity</b>: Constant + //! //! <b>Throws</b>: Nothing. static void transfer_after(node_ptr p, node_ptr b, node_ptr e); @@ -133,53 +133,53 @@ class circular_slist_algorithms //! <b>Effects</b>: Constructs an empty list, making this_node the only //! node of the circular list: //! <tt>NodeTraits::get_next(this_node) == this_node</tt>. - //! - //! <b>Complexity</b>: Constant - //! + //! + //! <b>Complexity</b>: Constant + //! //! <b>Throws</b>: Nothing. static void init_header(const node_ptr &this_node) - { NodeTraits::set_next(this_node, this_node); } + { NodeTraits::set_next(this_node, this_node); } //! <b>Requires</b>: this_node and prev_init_node must be in the same circular list. - //! + //! //! <b>Effects</b>: Returns the previous node of this_node in the circular list starting. //! the search from prev_init_node. The first node checked for equality //! is NodeTraits::get_next(prev_init_node). - //! + //! //! <b>Complexity</b>: Linear to the number of elements between prev_init_node and this_node. - //! + //! //! <b>Throws</b>: Nothing. static node_ptr get_previous_node(const node_ptr &prev_init_node, const node_ptr &this_node) { return base_t::get_previous_node(prev_init_node, this_node); } //! <b>Requires</b>: this_node must be in a circular list or be an empty circular list. - //! + //! //! <b>Effects</b>: Returns the previous node of this_node in the circular list. - //! + //! //! <b>Complexity</b>: Linear to the number of elements in the circular list. - //! + //! //! <b>Throws</b>: Nothing. static node_ptr get_previous_node(const node_ptr & this_node) { return base_t::get_previous_node(this_node, this_node); } //! <b>Requires</b>: this_node must be in a circular list or be an empty circular list. - //! + //! //! <b>Effects</b>: Returns the previous node of the previous node of this_node in the circular list. - //! + //! //! <b>Complexity</b>: Linear to the number of elements in the circular list. - //! + //! //! <b>Throws</b>: Nothing. static node_ptr get_previous_previous_node(const node_ptr & this_node) { return get_previous_previous_node(this_node, this_node); } //! <b>Requires</b>: this_node and prev_prev_init_node must be in the same circular list. - //! + //! //! <b>Effects</b>: Returns the previous node of the previous node of this_node in the //! circular list starting. the search from prev_init_node. The first node checked //! for equality is NodeTraits::get_next((NodeTraits::get_next(prev_prev_init_node)). - //! + //! //! <b>Complexity</b>: Linear to the number of elements in the circular list. - //! + //! //! <b>Throws</b>: Nothing. static node_ptr get_previous_previous_node(const node_ptr & prev_prev_init_node, const node_ptr & this_node) { @@ -195,14 +195,14 @@ class circular_slist_algorithms } //! <b>Requires</b>: this_node must be in a circular list or be an empty circular list. - //! + //! //! <b>Effects</b>: Returns the number of nodes in a circular list. If the circular list //! is empty, returns 1. - //! - //! <b>Complexity</b>: Linear - //! + //! + //! <b>Complexity</b>: Linear + //! //! <b>Throws</b>: Nothing. - static std::size_t count(const const_node_ptr & this_node) + static std::size_t count(const const_node_ptr & this_node) { std::size_t result = 0; const_node_ptr p = this_node; @@ -214,11 +214,11 @@ class circular_slist_algorithms } //! <b>Requires</b>: this_node must be in a circular list, be an empty circular list or be inited. - //! + //! //! <b>Effects</b>: Unlinks the node from the circular list. - //! - //! <b>Complexity</b>: Linear to the number of elements in the circular list - //! + //! + //! <b>Complexity</b>: Linear to the number of elements in the circular list + //! //! <b>Throws</b>: Nothing. static void unlink(const node_ptr & this_node) { @@ -227,24 +227,24 @@ class circular_slist_algorithms } //! <b>Requires</b>: nxt_node must be a node of a circular list. - //! + //! //! <b>Effects</b>: Links this_node before nxt_node in the circular list. - //! - //! <b>Complexity</b>: Linear to the number of elements in the circular list. - //! + //! + //! <b>Complexity</b>: Linear to the number of elements in the circular list. + //! //! <b>Throws</b>: Nothing. static void link_before (const node_ptr & nxt_node, const node_ptr & this_node) { base_t::link_after(get_previous_node(nxt_node), this_node); } //! <b>Requires</b>: this_node and other_node must be nodes inserted //! in circular lists or be empty circular lists. - //! + //! //! <b>Effects</b>: Swaps the position of the nodes: this_node is inserted in //! other_nodes position in the second circular list and the other_node is inserted //! in this_node's position in the first circular list. - //! - //! <b>Complexity</b>: Linear to number of elements of both lists - //! + //! + //! <b>Complexity</b>: Linear to number of elements of both lists + //! //! <b>Throws</b>: Nothing. static void swap_nodes(const node_ptr & this_node, const node_ptr & other_node) { @@ -279,14 +279,14 @@ class circular_slist_algorithms } } - //! <b>Effects</b>: Reverses the order of elements in the list. - //! + //! <b>Effects</b>: Reverses the order of elements in the list. + //! //! <b>Throws</b>: Nothing. - //! + //! //! <b>Complexity</b>: This function is linear to the contained elements. static void reverse(const node_ptr & p) { - node_ptr i = NodeTraits::get_next(p), e(p); + node_ptr i = NodeTraits::get_next(p), e(p); for (;;) { node_ptr nxt(NodeTraits::get_next(i)); if (nxt == e) @@ -301,7 +301,7 @@ class circular_slist_algorithms //! Null if n leads to no movement. //! //! <b>Throws</b>: Nothing. - //! + //! //! <b>Complexity</b>: Linear to the number of elements plus the number moved positions. static node_ptr move_backwards(const node_ptr & p, std::size_t n) { @@ -348,12 +348,12 @@ class circular_slist_algorithms } //! <b>Effects</b>: Moves the node p n positions towards the beginning of the list. - //! + //! //! <b>Returns</b>: The previous node of p after the function if there has been any movement, //! Null if n leads equals to no movement. - //! + //! //! <b>Throws</b>: Nothing. - //! + //! //! <b>Complexity</b>: Linear to the number of elements plus the number moved positions. static node_ptr move_forward(const node_ptr & p, std::size_t n) { @@ -382,7 +382,7 @@ class circular_slist_algorithms std::size_t new_before_last_pos = (distance - (n % distance))% distance; //If the shift is a multiple of the size there is nothing to do if(!new_before_last_pos) return node_ptr(); - + for( new_last = p ; new_before_last_pos-- ; new_last = node_traits::get_next(new_last)){ @@ -397,8 +397,8 @@ class circular_slist_algorithms } }; -} //namespace intrusive -} //namespace boost +} //namespace intrusive +} //namespace boost #include <boost/intrusive/detail/config_end.hpp> |