Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions doc/reference/multi_index_container.html
Original file line number Diff line number Diff line change
Expand Up @@ -552,8 +552,11 @@ <h4><a name="instantiation_types">Instantiation types</a></h4>
<code>p</code> shall dereference to <code>*p</code>.
</li>
</ul>
<code>multi_index_container</code>s and all their iterators do not store references
to allocated elements other than through the allocator's pointer type.
</li>
</ol>

Indices of a given <code>multi_index_container</code> instantiation cannot have
duplicate <a href="indices.html#tags">tags</a>, either within a single
index or in two different indices.
Expand Down Expand Up @@ -1069,9 +1072,9 @@ <h4><a name="serialization">Serialization</a></h4>

<br>

<p>Revised October 25th 2025</p>
<p>Revised June 27th 2026</p>

<p>&copy; Copyright 2003-2025 Joaqu&iacute;n M L&oacute;pez Mu&ntilde;oz.
<p>&copy; Copyright 2003-2026 Joaqu&iacute;n M L&oacute;pez Mu&ntilde;oz.
Distributed under the Boost Software
License, Version 1.0. (See accompanying file <a href="../../../../LICENSE_1_0.txt">
LICENSE_1_0.txt</a> or copy at <a href="http://www.boost.org/LICENSE_1_0.txt">
Expand Down
7 changes: 6 additions & 1 deletion doc/release_notes.html
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,11 @@ <h2><a name="boost_1_92">Boost 1.92 release</a></h2>

<p>
<ul>
<li>Fancy pointer support has been extended so that <code>multi_index_container</code>
iterators now store references to the elements through the allocator's pointer type.
In particular, this means that iterators can now be placed in shared memory using
<a href="../../interprocess/index.html">Boost.Interprocess</a> allocators.
</li>
<li>Fixed a performance issue with hashed indices when rehashing at very large
container sizes (<a href="https://github.com/boostorg/multi_index/pull/94">PR#94</a>).
Contributed by Daniel Kr&aacute;l.
Expand Down Expand Up @@ -858,7 +863,7 @@ <h2><a name="boost_1_33">Boost 1.33 release</a></h2>

<br>

<p>Revised April 24th 2026</p>
<p>Revised June 27th 2026</p>

<p>&copy; Copyright 2003-2026 Joaqu&iacute;n M L&oacute;pez Mu&ntilde;oz.
Distributed under the Boost Software
Expand Down
6 changes: 3 additions & 3 deletions doc/tutorial/creation.html
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ <h2><a name="special_allocator">Special allocator support</a></h2>
An important type of non-standard allocators supported are those provided by the
<a href="../../../interprocess/index.html">Boost Interprocess Library</a>;
this opens up the possibility of placing <code>multi_index_container</code>s
in shared memory.
and their iterators in shared memory.
</p>

<blockquote><pre>
Expand Down Expand Up @@ -340,9 +340,9 @@ <h2><a name="serialization">Serialization</a></h2>

<br>

<p>Revised July 17th 2007</p>
<p>Revised June 27th 2026</p>

<p>&copy; Copyright 2003-2007 Joaqu&iacute;n M L&oacute;pez Mu&ntilde;oz.
<p>&copy; Copyright 2003-2026 Joaqu&iacute;n M L&oacute;pez Mu&ntilde;oz.
Distributed under the Boost Software
License, Version 1.0. (See accompanying file <a href="../../../../LICENSE_1_0.txt">
LICENSE_1_0.txt</a> or copy at <a href="http://www.boost.org/LICENSE_1_0.txt">
Expand Down
11 changes: 6 additions & 5 deletions include/boost/multi_index/detail/bidir_node_iterator.hpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Copyright 2003-2023 Joaquin M Lopez Munoz.
/* Copyright 2003-2026 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)
Expand All @@ -14,6 +14,7 @@
#endif

#include <boost/config.hpp> /* keep it first to prevent nasty warns in MSVC */
#include <boost/multi_index/detail/raw_ptr.hpp>
#include <boost/operators.hpp>

#if !defined(BOOST_MULTI_INDEX_DISABLE_SERIALIZATION)
Expand Down Expand Up @@ -77,7 +78,7 @@ class bidir_node_iterator:
template<class Archive>
void save(Archive& ar,const unsigned int)const
{
node_base_type* bnode=node;
node_base_type* bnode=get_node();
ar<<core::make_nvp("pointer",bnode);
}

Expand All @@ -86,18 +87,18 @@ class bidir_node_iterator:
{
node_base_type* bnode;
ar>>core::make_nvp("pointer",bnode);
node=static_cast<Node*>(bnode);
node=typename Node::pointer(static_cast<Node*>(bnode));
}
#endif

/* get_node is not to be used by the user */

typedef Node node_type;

Node* get_node()const{return node;}
Node* get_node()const{return raw_ptr<Node*>(node);}

private:
Node* node;
typename Node::pointer node;
};

template<typename Node>
Expand Down
17 changes: 9 additions & 8 deletions include/boost/multi_index/detail/hash_index_iterator.hpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Copyright 2003-2023 Joaquin M Lopez Munoz.
/* Copyright 2003-2026 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)
Expand All @@ -14,6 +14,7 @@
#endif

#include <boost/config.hpp> /* keep it first to prevent nasty warns in MSVC */
#include <boost/multi_index/detail/raw_ptr.hpp>
#include <boost/operators.hpp>

#if !defined(BOOST_MULTI_INDEX_DISABLE_SERIALIZATION)
Expand Down Expand Up @@ -76,7 +77,7 @@ class hashed_index_iterator:
template<class Archive>
void save(Archive& ar,const unsigned int)const
{
node_base_type* bnode=node;
node_base_type* bnode=get_node();
ar<<core::make_nvp("pointer",bnode);
}

Expand All @@ -92,7 +93,7 @@ class hashed_index_iterator:
{
node_base_type* bnode;
ar>>core::make_nvp("pointer",bnode);
node=static_cast<Node*>(bnode);
node=typename Node::pointer(static_cast<Node*>(bnode));
if(version<1){
BucketArray* throw_away; /* consume unused ptr */
ar>>core::make_nvp("pointer",throw_away);
Expand All @@ -105,13 +106,13 @@ class hashed_index_iterator:
{
node_base_type* bnode;
ar>>core::make_nvp("pointer",bnode);
node=static_cast<Node*>(bnode);
node=typename Node::pointer(static_cast<Node*>(bnode));
if(version<1){
BucketArray* buckets;
ar>>core::make_nvp("pointer",buckets);
if(buckets&&node&&node->impl()==buckets->end()->prior()){
if(buckets&&bnode&&node->impl()==buckets->end()->prior()){
/* end local_iterators used to point to end node, now they are null */
node=0;
node=typename Node::pointer(0);
}
}
}
Expand All @@ -121,7 +122,7 @@ class hashed_index_iterator:

typedef Node node_type;

Node* get_node()const{return node;}
Node* get_node()const{return raw_ptr<Node*>(node);}

private:

Expand All @@ -135,7 +136,7 @@ class hashed_index_iterator:
Node::template increment_local<IndexCategory>(node);
}

Node* node;
typename Node::pointer node;
};

template<
Expand Down
17 changes: 12 additions & 5 deletions include/boost/multi_index/detail/hash_index_node.hpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Copyright 2003-2025 Joaquin M Lopez Munoz.
/* Copyright 2003-2026 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)
Expand Down Expand Up @@ -712,6 +712,13 @@ struct hashed_index_node:
typedef typename trampoline::pointer impl_pointer;
typedef typename trampoline::const_pointer const_impl_pointer;
typedef typename trampoline::difference_type difference_type;
typedef allocator_rebind_t<
typename trampoline::impl_allocator_type,
hashed_index_node> final_allocator_type;
typedef allocator_pointer_t<
final_allocator_type> pointer;
typedef allocator_const_pointer_t<
final_allocator_type> const_pointer;

template<typename Category>
struct node_alg{
Expand Down Expand Up @@ -754,15 +761,15 @@ struct hashed_index_node:
/* interoperability with hashed_index_iterator */

template<typename Category>
static void increment(hashed_index_node*& x)
static void increment(pointer& x)
{
x=from_impl(node_alg<Category>::type::after(x->impl()));
x=pointer(from_impl(node_alg<Category>::type::after(x->impl())));
}

template<typename Category>
static void increment_local(hashed_index_node*& x)
static void increment_local(pointer& x)
{
x=from_impl(node_alg<Category>::type::after_local(x->impl()));
x=pointer(from_impl(node_alg<Category>::type::after_local(x->impl())));
}
};

Expand Down
25 changes: 19 additions & 6 deletions include/boost/multi_index/detail/ord_index_node.hpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Copyright 2003-2025 Joaquin M Lopez Munoz.
/* Copyright 2003-2026 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)
Expand Down Expand Up @@ -131,6 +131,7 @@ struct ordered_index_node_compressed_base
{
typedef ordered_index_node_traits<
AugmentPolicy,Allocator> node_traits;
typedef typename node_traits::allocator node_allocator;
typedef ordered_index_node_impl<
AugmentPolicy,Allocator>* pointer;
typedef const ordered_index_node_impl<
Expand Down Expand Up @@ -608,6 +609,14 @@ struct ordered_index_node:
typedef typename trampoline::const_pointer const_impl_pointer;
typedef typename trampoline::difference_type difference_type;
typedef typename trampoline::size_type size_type;
typedef allocator_rebind_t<
typename trampoline::node_allocator,
ordered_index_node> final_allocator_type;
typedef allocator_pointer_t<
final_allocator_type> pointer;
typedef allocator_const_pointer_t<
final_allocator_type> const_pointer;


impl_color_ref color(){return trampoline::color();}
ordered_index_color color()const{return trampoline::color();}
Expand Down Expand Up @@ -646,20 +655,24 @@ struct ordered_index_node:
raw_ptr<const impl_type*>(x)));
}

/* interoperability with bidir_node_iterator */
/* Interoperability with bidir_node_iterator and index impl.
* Templated for raw-pointer/non-raw-pointer versions.
*/

static void increment(ordered_index_node*& x)
template<typename NodePtr>
static void increment(NodePtr& x)
{
impl_pointer xi=x->impl();
trampoline::increment(xi);
x=from_impl(xi);
x=NodePtr(from_impl(xi));
}

static void decrement(ordered_index_node*& x)
template<typename NodePtr>
static void decrement(NodePtr& x)
{
impl_pointer xi=x->impl();
trampoline::decrement(xi);
x=from_impl(xi);
x=NodePtr(from_impl(xi));
}
};

Expand Down
31 changes: 19 additions & 12 deletions include/boost/multi_index/detail/rnd_index_node.hpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Copyright 2003-2025 Joaquin M Lopez Munoz.
/* Copyright 2003-2026 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)
Expand Down Expand Up @@ -215,11 +215,18 @@ struct random_access_index_node:
typedef random_access_index_node_trampoline<Super> trampoline;

public:
typedef typename trampoline::impl_type impl_type;
typedef typename trampoline::pointer impl_pointer;
typedef typename trampoline::const_pointer const_impl_pointer;
typedef typename trampoline::difference_type difference_type;
typedef typename trampoline::ptr_pointer impl_ptr_pointer;
typedef typename trampoline::impl_type impl_type;
typedef typename trampoline::pointer impl_pointer;
typedef typename trampoline::const_pointer const_impl_pointer;
typedef typename trampoline::difference_type difference_type;
typedef typename trampoline::ptr_pointer impl_ptr_pointer;
typedef allocator_rebind_t<
typename trampoline::node_allocator,
random_access_index_node> final_allocator_type;
typedef allocator_pointer_t<
final_allocator_type> pointer;
typedef allocator_const_pointer_t<
final_allocator_type> const_pointer;

impl_ptr_pointer& up(){return trampoline::up();}
impl_ptr_pointer up()const{return trampoline::up();}
Expand Down Expand Up @@ -254,25 +261,25 @@ struct random_access_index_node:

/* interoperability with rnd_node_iterator */

static void increment(random_access_index_node*& x)
static void increment(pointer& x)
{
impl_pointer xi=x->impl();
trampoline::increment(xi);
x=from_impl(xi);
x=pointer(from_impl(xi));
}

static void decrement(random_access_index_node*& x)
static void decrement(pointer& x)
{
impl_pointer xi=x->impl();
trampoline::decrement(xi);
x=from_impl(xi);
x=pointer(from_impl(xi));
}

static void advance(random_access_index_node*& x,difference_type n)
static void advance(pointer& x,difference_type n)
{
impl_pointer xi=x->impl();
trampoline::advance(xi,n);
x=from_impl(xi);
x=pointer(from_impl(xi));
}

static difference_type distance(
Expand Down
11 changes: 6 additions & 5 deletions include/boost/multi_index/detail/rnd_node_iterator.hpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Copyright 2003-2023 Joaquin M Lopez Munoz.
/* Copyright 2003-2026 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)
Expand All @@ -14,6 +14,7 @@
#endif

#include <boost/config.hpp> /* keep it first to prevent nasty warns in MSVC */
#include <boost/multi_index/detail/raw_ptr.hpp>
#include <boost/operators.hpp>

#if !defined(BOOST_MULTI_INDEX_DISABLE_SERIALIZATION)
Expand Down Expand Up @@ -87,7 +88,7 @@ class rnd_node_iterator:
template<class Archive>
void save(Archive& ar,const unsigned int)const
{
node_base_type* bnode=node;
node_base_type* bnode=get_node();
ar<<core::make_nvp("pointer",bnode);
}

Expand All @@ -96,18 +97,18 @@ class rnd_node_iterator:
{
node_base_type* bnode;
ar>>core::make_nvp("pointer",bnode);
node=static_cast<Node*>(bnode);
node=typename Node::pointer(static_cast<Node*>(bnode));
}
#endif

/* get_node is not to be used by the user */

typedef Node node_type;

Node* get_node()const{return node;}
Node* get_node()const{return raw_ptr<Node*>(node);}

private:
Node* node;
typename Node::pointer node;
};

template<typename Node>
Expand Down
Loading
Loading