diff --git a/doc/reference/ord_indices.html b/doc/reference/ord_indices.html index a1e71f9..6035fe6 100644 --- a/doc/reference/ord_indices.html +++ b/doc/reference/ord_indices.html @@ -443,7 +443,7 @@ section. The complexity signature of ordered indices is:
c(n)=n*log(n)
,i(n)=log(n)
,h(n)=1
(constant) if the hint element
+ h(n)=1
(amortized constant) if the hint element
is immediately after the point of insertion, h(n)=log(n)
otherwise,d(n)=1
(amortized constant),r(n)=1
(constant) if the element position does not
@@ -1341,9 +1341,9 @@ Ranked indices
Revised August 30th 2021
+Revised February 5th 2022
-© Copyright 2003-2021 Joaquín M López Muñoz. +
© Copyright 2003-2022 Joaquín M López Muñoz.
Distributed under the Boost Software
License, Version 1.0. (See accompanying file
LICENSE_1_0.txt or copy at
diff --git a/doc/reference/rnk_indices.html b/doc/reference/rnk_indices.html
index 47d2180..0d6e3b7 100644
--- a/doc/reference/rnk_indices.html
+++ b/doc/reference/rnk_indices.html
@@ -43,6 +43,7 @@ Hashed indices
count
operations, which are actually faster).
As with ordered indices, ranked indices can be unique (no duplicate elements are allowed)
or non-unique: either version is associated to a different index specifier, but
the interface of both index types is the same.
-In what follows, we only describe the extra operations provided by ranked indices: for the +In what follows, we only describe the extra operations provided by ranked indices or those +operations with improved performance: for the rest refer to the documentation for ordered indices, bearing in mind the occasional differences in complexity.
@@ -224,6 +228,8 @@ indices, bearing in mind the occasional differences in complexity. std::reverse_iterator<iterator> reverse_iterator; typedef equivalent to std::reverse_iterator<const_iterator> const_reverse_iterator; + typedef same as owning container node_type; + typedef following [container.insert.return] spec insert_return_type; // construct/copy/destroy: @@ -269,6 +275,11 @@ indices, bearing in mind the occasional differences in complexity. template<typename InputIterator> void insert(InputIterator first,InputIterator last); void insert(std::initializer_list<value_type> list); + insert_return_type insert(node_type&& nh); + iterator insert(const_iterator position,node_type&& nh); + + node_type extract(const_iterator position); + node_type extract(const key_type& x); iterator erase(iterator position); size_type erase(const key_type& x); @@ -286,6 +297,16 @@ indices, bearing in mind the occasional differences in complexity. void swap(index class name& x); void clear()noexcept; + template<typename Index> void merge(Index&& x); + template<typename Index> + std::pair<iterator,bool> merge( + Index&& x,typename std::remove_reference_t<Index>::const_iterator i); + template<typename Index> + void merge( + Index&& x, + typename std::remove_reference_t<Index>::const_iterator first, + typename std::remove_reference_t<Index>::const_iterator last); + // observers: key_from_value key_extractor()const; @@ -441,8 +462,7 @@ section. The complexity signature of ranked indices is:c(n)=n*log(n)
,i(n)=log(n)
,h(n)=1
(constant) if the hint element
- is immediately after the point of insertion, h(n)=log(n)
otherwise,h(n)=log(n)
,d(n)=log(n)
,r(n)=1
(constant) if the element position does not
change, r(n)=log(n)
otherwise,
These complexity guarantees are the same as those of
ordered indices
-except for deletion, which is log(n)
here and amortized constant there.
+except for hinted insertion and deletion, which are log(n)
here and amortized constant there.
Ordered indices are instantiated internally to multi_index_container
and
+
Ranked indices are instantiated internally to multi_index_container
and
specified by means of indexed_by
with index specifiers ranked_unique
and ranked_non_unique
. Instantiations are dependent on the
@@ -484,6 +504,37 @@ These types depend only on node_type
and the position of
the index in the multi_index_container
.
+
+See the documentation of ordered indices for an explanation of the notions of +compatible extension and +compatible key, which are referred to below. +
+ + +template<typename CompatibleKey>
+size_type count(const CompatibleKey& x)const;
+
+
++Requires:+ +CompatibleKey
is a compatible key of +key_compare
.
+Effects: Returns the number of elements with key equivalent tox
.
+Complexity:O(log(n))
.
+
template<typename CompatibleKey,typename CompatibleCompare>
+size_type count(const CompatibleKey& x,const CompatibleCompare& comp)const;
+
+
++Requires: (+CompatibleKey
,CompatibleCompare
) +is a compatible extension ofkey_compare
.
+Effects: Returns the number of elements with key equivalent tox
.
+Complexity:O(log(n))
.
+
@@ -648,9 +699,9 @@ Hashed indices
-
Revised August 30th 2021
+Revised February 5th 2022
-© Copyright 2003-2021 Joaquín M López Muñoz. +
© Copyright 2003-2022 Joaquín M López Muñoz.
Distributed under the Boost Software
License, Version 1.0. (See accompanying file
LICENSE_1_0.txt or copy at
diff --git a/doc/release_notes.html b/doc/release_notes.html
index fb40d38..687b051 100644
--- a/doc/release_notes.html
+++ b/doc/release_notes.html
@@ -30,6 +30,7 @@ Acknowledgements
+Contents
+
+Boost 1.79 release
+
+
+
+count
operations in ranked indices from
+ O(log(n) + count)
to O(log(n))
.
+ Contributed by Damian Sawicki.
+
@@ -724,9 +737,9 @@ Acknowledgements
-
Revised August 30th 2021
+Revised February 5th 2022
-© Copyright 2003-2021 Joaquín M López Muñoz. +
© Copyright 2003-2022 Joaquín M López Muñoz.
Distributed under the Boost Software
License, Version 1.0. (See accompanying file
LICENSE_1_0.txt or copy at
diff --git a/include/boost/multi_index/ranked_index.hpp b/include/boost/multi_index/ranked_index.hpp
index 0293712..cdc3999 100644
--- a/include/boost/multi_index/ranked_index.hpp
+++ b/include/boost/multi_index/ranked_index.hpp
@@ -1,4 +1,4 @@
-/* Copyright 2003-2020 Joaquin M Lopez Munoz.
+/* Copyright 2003-2022 Joaquin M Lopez Munoz.
* Distributed under the Boost Software License, Version 1.0.
* (See accompanying file LICENSE_1_0.txt or copy at
* http://www.boost.org/LICENSE_1_0.txt)
@@ -49,6 +49,21 @@ public:
typedef typename super::iterator iterator;
typedef typename super::size_type size_type;
+ /* set operations */
+
+ template