From 7e2ccd2685db6c7e1e1bf8219599e5d5e69a3812 Mon Sep 17 00:00:00 2001 From: joaquintides Date: Sat, 30 May 2026 11:56:06 +0200 Subject: [PATCH 01/14] added gcc-15, gcc-16 --- .github/workflows/ci.yml | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1dfacdd9..5c126342 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -79,6 +79,18 @@ jobs: os: ubuntu-24.04 install: g++-14-multilib address-model: 32,64 + - toolset: gcc-15 + cxxstd: "11,14,17,20,23,2c" + container: ubuntu:26.04 + os: ubuntu-latest + install: g++-15-multilib + address-model: 32,64 + - toolset: gcc-16 + cxxstd: "11,14,17,20,23,2c" + container: ubuntu:26.04 + os: ubuntu-latest + install: g++-16-multilib + address-model: 32,64 - toolset: clang compiler: clang++-3.9 cxxstd: "11,14" From 79eed57f3ef344f17a7121c118a3a2694a2a01cc Mon Sep 17 00:00:00 2001 From: joaquintides Date: Sat, 30 May 2026 13:05:51 +0200 Subject: [PATCH 02/14] explicitly constructed bfm_header everywhere --- include/boost/multi_index_container.hpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/include/boost/multi_index_container.hpp b/include/boost/multi_index_container.hpp index 5b5de389..cc1870d2 100644 --- a/include/boost/multi_index_container.hpp +++ b/include/boost/multi_index_container.hpp @@ -1,6 +1,6 @@ /* Multiply indexed container. * - * 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) @@ -156,6 +156,7 @@ class multi_index_container: multi_index_container(): bfm_allocator(allocator_type()), + bfm_header(), super(ctor_args_list(),bfm_allocator::member), node_count(0) { @@ -166,6 +167,7 @@ class multi_index_container: const ctor_args_list& args_list, const allocator_type& al=allocator_type()): bfm_allocator(al), + bfm_header(), super(args_list,bfm_allocator::member), node_count(0) { @@ -174,6 +176,7 @@ class multi_index_container: explicit multi_index_container(const allocator_type& al): bfm_allocator(al), + bfm_header(), super(ctor_args_list(),bfm_allocator::member), node_count(0) { @@ -186,6 +189,7 @@ class multi_index_container: const ctor_args_list& args_list=ctor_args_list(), const allocator_type& al=allocator_type()): bfm_allocator(al), + bfm_header(), super(args_list,bfm_allocator::member), node_count(0) { @@ -210,6 +214,7 @@ class multi_index_container: const ctor_args_list& args_list=ctor_args_list(), const allocator_type& al=allocator_type()): bfm_allocator(al), + bfm_header(), super(args_list,bfm_allocator::member), node_count(0) { From 22e0b0753493df526269a2fd95cbc604ba31f655 Mon Sep 17 00:00:00 2001 From: joaquintides Date: Sat, 30 May 2026 18:48:58 +0200 Subject: [PATCH 03/14] reverted, silenced uninitialized warning --- include/boost/multi_index_container.hpp | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/include/boost/multi_index_container.hpp b/include/boost/multi_index_container.hpp index cc1870d2..80a033fa 100644 --- a/include/boost/multi_index_container.hpp +++ b/include/boost/multi_index_container.hpp @@ -156,7 +156,6 @@ class multi_index_container: multi_index_container(): bfm_allocator(allocator_type()), - bfm_header(), super(ctor_args_list(),bfm_allocator::member), node_count(0) { @@ -167,7 +166,6 @@ class multi_index_container: const ctor_args_list& args_list, const allocator_type& al=allocator_type()): bfm_allocator(al), - bfm_header(), super(args_list,bfm_allocator::member), node_count(0) { @@ -176,7 +174,6 @@ class multi_index_container: explicit multi_index_container(const allocator_type& al): bfm_allocator(al), - bfm_header(), super(ctor_args_list(),bfm_allocator::member), node_count(0) { @@ -189,7 +186,6 @@ class multi_index_container: const ctor_args_list& args_list=ctor_args_list(), const allocator_type& al=allocator_type()): bfm_allocator(al), - bfm_header(), super(args_list,bfm_allocator::member), node_count(0) { @@ -214,7 +210,6 @@ class multi_index_container: const ctor_args_list& args_list=ctor_args_list(), const allocator_type& al=allocator_type()): bfm_allocator(al), - bfm_header(), super(args_list,bfm_allocator::member), node_count(0) { @@ -554,11 +549,20 @@ class multi_index_container: BOOST_MULTI_INDEX_CHECK_INVARIANT; } +#if BOOST_WORKAROUND(BOOST_GCC_VERSION,>=160100) +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wuninitialized" +#endif + final_node_type* header()const { return &*bfm_header::member; } +#if BOOST_WORKAROUND(BOOST_GCC_VERSION,>=160100) +#pragma GCC diagnostic pop +#endif + final_node_type* allocate_node() { return &*allocator_allocate(bfm_allocator::member,1); From 993691346bdb7f609ca19fd9440f3f7ab28cecf6 Mon Sep 17 00:00:00 2001 From: joaquintides Date: Sat, 30 May 2026 19:22:16 +0200 Subject: [PATCH 04/14] moved silencing pragma inside header body --- include/boost/multi_index_container.hpp | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/include/boost/multi_index_container.hpp b/include/boost/multi_index_container.hpp index 80a033fa..b664f8a8 100644 --- a/include/boost/multi_index_container.hpp +++ b/include/boost/multi_index_container.hpp @@ -549,19 +549,17 @@ class multi_index_container: BOOST_MULTI_INDEX_CHECK_INVARIANT; } + final_node_type* header()const + { #if BOOST_WORKAROUND(BOOST_GCC_VERSION,>=160100) #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wuninitialized" #endif - - final_node_type* header()const - { return &*bfm_header::member; - } - #if BOOST_WORKAROUND(BOOST_GCC_VERSION,>=160100) #pragma GCC diagnostic pop #endif + } final_node_type* allocate_node() { From 902e4bcb9274416ef89d36d8e82440a45ed03ad2 Mon Sep 17 00:00:00 2001 From: joaquintides Date: Sat, 30 May 2026 19:49:15 +0200 Subject: [PATCH 05/14] made silencing pragma enclose entire multi_index_container definition --- include/boost/multi_index_container.hpp | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/include/boost/multi_index_container.hpp b/include/boost/multi_index_container.hpp index b664f8a8..4d212eab 100644 --- a/include/boost/multi_index_container.hpp +++ b/include/boost/multi_index_container.hpp @@ -87,6 +87,11 @@ struct unequal_alloc_move_ctor_tag{}; #pragma warning(disable:4522) /* spurious warning on multiple operator=()'s */ #endif +#if BOOST_WORKAROUND(BOOST_GCC_VERSION,>=160100) +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wuninitialized" +#endif + template class multi_index_container: private ::boost::base_from_member< @@ -551,14 +556,7 @@ class multi_index_container: final_node_type* header()const { -#if BOOST_WORKAROUND(BOOST_GCC_VERSION,>=160100) -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wuninitialized" -#endif return &*bfm_header::member; -#if BOOST_WORKAROUND(BOOST_GCC_VERSION,>=160100) -#pragma GCC diagnostic pop -#endif } final_node_type* allocate_node() @@ -1123,6 +1121,10 @@ class multi_index_container: size_type node_count; }; +#if BOOST_WORKAROUND(BOOST_GCC_VERSION,>=160100) +#pragma GCC diagnostic pop /* -Wuninitialized */ +#endif + #if BOOST_WORKAROUND(BOOST_MSVC,BOOST_TESTED_AT(1500)) #pragma warning(pop) /* C4522 */ #endif From f4e3eac0336825b95292111c1025cfd295645372 Mon Sep 17 00:00:00 2001 From: joaquintides Date: Sat, 30 May 2026 20:16:14 +0200 Subject: [PATCH 06/14] abandoned pragma, deinlined header() --- include/boost/multi_index_container.hpp | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/include/boost/multi_index_container.hpp b/include/boost/multi_index_container.hpp index 4d212eab..f5c370f3 100644 --- a/include/boost/multi_index_container.hpp +++ b/include/boost/multi_index_container.hpp @@ -87,11 +87,6 @@ struct unequal_alloc_move_ctor_tag{}; #pragma warning(disable:4522) /* spurious warning on multiple operator=()'s */ #endif -#if BOOST_WORKAROUND(BOOST_GCC_VERSION,>=160100) -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wuninitialized" -#endif - template class multi_index_container: private ::boost::base_from_member< @@ -554,6 +549,9 @@ class multi_index_container: BOOST_MULTI_INDEX_CHECK_INVARIANT; } +#if BOOST_WORKAROUND(BOOST_GCC_VERSION,>=160100) + BOOST_NOINLINE /* bogus uninitialized warning otherwise */ +#endif final_node_type* header()const { return &*bfm_header::member; @@ -1121,10 +1119,6 @@ class multi_index_container: size_type node_count; }; -#if BOOST_WORKAROUND(BOOST_GCC_VERSION,>=160100) -#pragma GCC diagnostic pop /* -Wuninitialized */ -#endif - #if BOOST_WORKAROUND(BOOST_MSVC,BOOST_TESTED_AT(1500)) #pragma warning(pop) /* C4522 */ #endif From 600b6d6a4d1578aeaa754f2bd7cc23b047721927 Mon Sep 17 00:00:00 2001 From: joaquintides Date: Sat, 30 May 2026 20:50:09 +0200 Subject: [PATCH 07/14] tried an even more convoluted workaround --- include/boost/multi_index_container.hpp | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/include/boost/multi_index_container.hpp b/include/boost/multi_index_container.hpp index f5c370f3..bebb4e8d 100644 --- a/include/boost/multi_index_container.hpp +++ b/include/boost/multi_index_container.hpp @@ -550,12 +550,30 @@ class multi_index_container: } #if BOOST_WORKAROUND(BOOST_GCC_VERSION,>=160100) - BOOST_NOINLINE /* bogus uninitialized warning otherwise */ -#endif + /* prevents bogus uninitialized warning */ + + template + static BOOST_NOINLINE final_node_type* + header_from_holder(const Holder* p,PtrToMember pm) + { + return &*(p->*pm); + } + + final_node_type* header()const + { + using header_holder = detail::header_holder< + node_pointer, + multi_index_container>; + + return header_from_holder( + static_cast(this),&header_holder::member); + } +#else final_node_type* header()const { return &*bfm_header::member; } +#endif final_node_type* allocate_node() { From 2a8b7359dc94e911cba09cd4abfed0a02fd0027a Mon Sep 17 00:00:00 2001 From: joaquintides Date: Sat, 30 May 2026 22:03:00 +0200 Subject: [PATCH 08/14] type-erased member in header_holder --- .../multi_index/detail/header_holder.hpp | 26 ++++++++++++++--- include/boost/multi_index_container.hpp | 29 +++---------------- 2 files changed, 26 insertions(+), 29 deletions(-) diff --git a/include/boost/multi_index/detail/header_holder.hpp b/include/boost/multi_index/detail/header_holder.hpp index 297c6731..3b2ec1d6 100644 --- a/include/boost/multi_index/detail/header_holder.hpp +++ b/include/boost/multi_index/detail/header_holder.hpp @@ -1,4 +1,4 @@ -/* Copyright 2003-2022 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) @@ -32,13 +32,31 @@ namespace detail{ template struct header_holder:private noncopyable { - header_holder():member(final().allocate_node()){} - ~header_holder(){final().deallocate_node(&*member);} + header_holder() + { + new (&spc) NodeTypePtr(final().allocate_node()); + } - NodeTypePtr member; + ~header_holder() + { + final().deallocate_node(&*member()); + member().~NodeTypePtr(); + } + + const NodeTypePtr& member()const noexcept + { + return *static_cast(static_cast(&spc)); + } + + NodeTypePtr& member()noexcept + { + return *static_cast(static_cast(&spc)); + } private: Final& final(){return *static_cast(this);} + + alignas(NodeTypePtr) unsigned char spc[sizeof(NodeTypePtr)]; }; } /* namespace multi_index::detail */ diff --git a/include/boost/multi_index_container.hpp b/include/boost/multi_index_container.hpp index bebb4e8d..04aa2adf 100644 --- a/include/boost/multi_index_container.hpp +++ b/include/boost/multi_index_container.hpp @@ -549,31 +549,10 @@ class multi_index_container: BOOST_MULTI_INDEX_CHECK_INVARIANT; } -#if BOOST_WORKAROUND(BOOST_GCC_VERSION,>=160100) - /* prevents bogus uninitialized warning */ - - template - static BOOST_NOINLINE final_node_type* - header_from_holder(const Holder* p,PtrToMember pm) - { - return &*(p->*pm); - } - - final_node_type* header()const - { - using header_holder = detail::header_holder< - node_pointer, - multi_index_container>; - - return header_from_holder( - static_cast(this),&header_holder::member); - } -#else final_node_type* header()const { - return &*bfm_header::member; + return &*bfm_header::member(); } -#endif final_node_type* allocate_node() { @@ -924,7 +903,7 @@ class multi_index_container: boost::true_type swap_allocators) { detail::adl_swap(bfm_allocator::member,x.bfm_allocator::member); - std::swap(bfm_header::member,x.bfm_header::member); + std::swap(bfm_header::member(),x.bfm_header::member()); super::swap_(x,swap_allocators); std::swap(node_count,x.node_count); } @@ -933,7 +912,7 @@ class multi_index_container: multi_index_container& x, boost::false_type swap_allocators) { - std::swap(bfm_header::member,x.bfm_header::member); + std::swap(bfm_header::member(),x.bfm_header::member()); super::swap_(x,swap_allocators); std::swap(node_count,x.node_count); } @@ -941,7 +920,7 @@ class multi_index_container: void swap_elements_( multi_index_container& x) { - std::swap(bfm_header::member,x.bfm_header::member); + std::swap(bfm_header::member(),x.bfm_header::member()); super::swap_elements_(x); std::swap(node_count,x.node_count); } From 12f1d7d302b277cea5932646b7f8e3d850570584 Mon Sep 17 00:00:00 2001 From: joaquintides Date: Sat, 30 May 2026 22:21:05 +0200 Subject: [PATCH 09/14] s/static_cast/reinterpret_cast --- include/boost/multi_index/detail/header_holder.hpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/include/boost/multi_index/detail/header_holder.hpp b/include/boost/multi_index/detail/header_holder.hpp index 3b2ec1d6..92b3ed6d 100644 --- a/include/boost/multi_index/detail/header_holder.hpp +++ b/include/boost/multi_index/detail/header_holder.hpp @@ -45,12 +45,13 @@ struct header_holder:private noncopyable const NodeTypePtr& member()const noexcept { - return *static_cast(static_cast(&spc)); + return *reinterpret_cast( + static_cast(&spc)); } NodeTypePtr& member()noexcept { - return *static_cast(static_cast(&spc)); + return *reinterpret_cast(static_cast(&spc)); } private: From 131e5624f3c3e9ee4edb069d13dacf1d62acb6e0 Mon Sep 17 00:00:00 2001 From: joaquintides Date: Sun, 31 May 2026 12:05:20 +0200 Subject: [PATCH 10/14] reverted, passed allocator and header explicitly in construction --- .../multi_index/detail/header_holder.hpp | 27 ++---------- .../boost/multi_index/detail/index_base.hpp | 10 ++++- .../multi_index/detail/ord_index_impl.hpp | 35 +++++++++++----- include/boost/multi_index/hashed_index.hpp | 16 +++++--- .../boost/multi_index/random_access_index.hpp | 23 +++++++---- include/boost/multi_index/ranked_index.hpp | 17 +++++--- include/boost/multi_index/sequenced_index.hpp | 20 +++++---- include/boost/multi_index_container.hpp | 41 ++++++++++--------- 8 files changed, 105 insertions(+), 84 deletions(-) diff --git a/include/boost/multi_index/detail/header_holder.hpp b/include/boost/multi_index/detail/header_holder.hpp index 92b3ed6d..297c6731 100644 --- a/include/boost/multi_index/detail/header_holder.hpp +++ b/include/boost/multi_index/detail/header_holder.hpp @@ -1,4 +1,4 @@ -/* Copyright 2003-2026 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) @@ -32,32 +32,13 @@ namespace detail{ template struct header_holder:private noncopyable { - header_holder() - { - new (&spc) NodeTypePtr(final().allocate_node()); - } + header_holder():member(final().allocate_node()){} + ~header_holder(){final().deallocate_node(&*member);} - ~header_holder() - { - final().deallocate_node(&*member()); - member().~NodeTypePtr(); - } - - const NodeTypePtr& member()const noexcept - { - return *reinterpret_cast( - static_cast(&spc)); - } - - NodeTypePtr& member()noexcept - { - return *reinterpret_cast(static_cast(&spc)); - } + NodeTypePtr member; private: Final& final(){return *static_cast(this);} - - alignas(NodeTypePtr) unsigned char spc[sizeof(NodeTypePtr)]; }; } /* namespace multi_index::detail */ diff --git a/include/boost/multi_index/detail/index_base.hpp b/include/boost/multi_index/detail/index_base.hpp index 591445d0..9aad6de7 100644 --- a/include/boost/multi_index/detail/index_base.hpp +++ b/include/boost/multi_index/detail/index_base.hpp @@ -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) @@ -85,10 +85,16 @@ class index_base typedef allocator_size_type_t size_type; protected: - explicit index_base(const ctor_args_list&,const Allocator&){} + explicit index_base( + const ctor_args_list&,const Allocator&,index_node_type*){} index_base( const index_base&, + const Allocator&,index_node_type*){} + + index_base( + const index_base&, + const Allocator&,index_node_type*, do_not_copy_elements_tag) {} diff --git a/include/boost/multi_index/detail/ord_index_impl.hpp b/include/boost/multi_index/detail/ord_index_impl.hpp index 300052b8..82b460e9 100644 --- a/include/boost/multi_index/detail/ord_index_impl.hpp +++ b/include/boost/multi_index/detail/ord_index_impl.hpp @@ -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) @@ -707,8 +707,10 @@ class ordered_index_impl:protected SuperMeta::type } protected: - ordered_index_impl(const ctor_args_list& args_list,const allocator_type& al): - super(args_list.get_tail(),al), + ordered_index_impl( + const ctor_args_list& args_list, + const allocator_type& al,index_node_type* h): + super(args_list.get_tail(),al,h), key(tuples::get<0>(args_list.get_head())), comp_(tuples::get<1>(args_list.get_head())) @@ -722,8 +724,9 @@ class ordered_index_impl:protected SuperMeta::type ordered_index_impl( const ordered_index_impl< - KeyFromValue,Compare,SuperMeta,TagList,Category,AugmentPolicy>& x): - super(x), + KeyFromValue,Compare,SuperMeta,TagList,Category,AugmentPolicy>& x, + const allocator_type& al,index_node_type* h): + super(x,al,h), key(x.key), comp_(x.comp_) @@ -740,8 +743,9 @@ class ordered_index_impl:protected SuperMeta::type ordered_index_impl( const ordered_index_impl< KeyFromValue,Compare,SuperMeta,TagList,Category,AugmentPolicy>& x, + const allocator_type& al,index_node_type* h, do_not_copy_elements_tag): - super(x,do_not_copy_elements_tag()), + super(x,al,h,do_not_copy_elements_tag()), key(x.key), comp_(x.comp_) @@ -1512,6 +1516,10 @@ class ordered_index: SuperMeta,TagList,Category,AugmentPolicy > >::type super; + +protected: + typedef typename super::index_node_type index_node_type; + public: typedef typename super::ctor_args_list ctor_args_list; typedef typename super::allocator_type allocator_type; @@ -1537,13 +1545,18 @@ class ordered_index: protected: ordered_index( - const ctor_args_list& args_list,const allocator_type& al): - super(args_list,al){} + const ctor_args_list& args_list, + const allocator_type& al,index_node_type* h): + super(args_list,al,h){} - ordered_index(const ordered_index& x):super(x){} + ordered_index( + const ordered_index& x,const allocator_type& al,index_node_type* h): + super(x,al,h){} - ordered_index(const ordered_index& x,do_not_copy_elements_tag): - super(x,do_not_copy_elements_tag()){} + ordered_index( + const ordered_index& x,const allocator_type& al,index_node_type* h, + do_not_copy_elements_tag): + super(x,al,h,do_not_copy_elements_tag()){} }; #if defined(BOOST_MSVC) diff --git a/include/boost/multi_index/hashed_index.hpp b/include/boost/multi_index/hashed_index.hpp index b183e378..d220239e 100644 --- a/include/boost/multi_index/hashed_index.hpp +++ b/include/boost/multi_index/hashed_index.hpp @@ -735,8 +735,10 @@ class hashed_index:protected SuperMeta::type } protected: - hashed_index(const ctor_args_list& args_list,const allocator_type& al): - super(args_list.get_tail(),al), + hashed_index( + const ctor_args_list& args_list, + const allocator_type& al,index_node_type* h): + super(args_list.get_tail(),al,h), key(tuples::get<1>(args_list.get_head())), hash_(tuples::get<2>(args_list.get_head())), eq_(tuples::get<3>(args_list.get_head())), @@ -752,8 +754,9 @@ class hashed_index:protected SuperMeta::type } hashed_index( - const hashed_index& x): - super(x), + const hashed_index& x, + const allocator_type& al,index_node_type* h): + super(x,al,h), key(x.key), hash_(x.hash_), eq_(x.eq_), @@ -773,12 +776,13 @@ class hashed_index:protected SuperMeta::type hashed_index( const hashed_index& x, + const allocator_type& al,index_node_type* h, do_not_copy_elements_tag): - super(x,do_not_copy_elements_tag()), + super(x,al,h,do_not_copy_elements_tag()), key(x.key), hash_(x.hash_), eq_(x.eq_), - buckets(x.get_allocator(),header()->impl(),0), + buckets(x.get_allocator(),h->impl(),0), mlf(1.0f) #if defined(BOOST_MULTI_INDEX_ENABLE_SAFE_MODE) diff --git a/include/boost/multi_index/random_access_index.hpp b/include/boost/multi_index/random_access_index.hpp index 965f507f..7cdb3fc4 100644 --- a/include/boost/multi_index/random_access_index.hpp +++ b/include/boost/multi_index/random_access_index.hpp @@ -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) @@ -741,8 +741,9 @@ class random_access_index:protected SuperMeta::type protected: random_access_index( - const ctor_args_list& args_list,const allocator_type& al): - super(args_list.get_tail(),al), + const ctor_args_list& args_list, + const allocator_type& al,index_node_type* h): + super(args_list.get_tail(),al,h), ptrs(al,header()->impl(),0) #if defined(BOOST_MULTI_INDEX_ENABLE_SAFE_MODE) @@ -752,9 +753,11 @@ class random_access_index:protected SuperMeta::type { } - random_access_index(const random_access_index& x): - super(x), - ptrs(x.get_allocator(),header()->impl(),x.size()) + random_access_index( + const random_access_index& x, + const allocator_type& al,index_node_type* h): + super(x,al,h), + ptrs(al,h->impl(),x.size()) #if defined(BOOST_MULTI_INDEX_ENABLE_SAFE_MODE) ,safe(*this) @@ -766,9 +769,11 @@ class random_access_index:protected SuperMeta::type } random_access_index( - const random_access_index& x,do_not_copy_elements_tag): - super(x,do_not_copy_elements_tag()), - ptrs(x.get_allocator(),header()->impl(),0) + const random_access_index& x, + const allocator_type& al,index_node_type* h, + do_not_copy_elements_tag): + super(x,al,h,do_not_copy_elements_tag()), + ptrs(al,h->impl(),0) #if defined(BOOST_MULTI_INDEX_ENABLE_SAFE_MODE) ,safe(*this) diff --git a/include/boost/multi_index/ranked_index.hpp b/include/boost/multi_index/ranked_index.hpp index e0eaf831..f5ee38de 100644 --- a/include/boost/multi_index/ranked_index.hpp +++ b/include/boost/multi_index/ranked_index.hpp @@ -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) @@ -165,14 +165,19 @@ class ranked_index:public OrderedIndexImpl } protected: - ranked_index(const ranked_index& x):super(x){}; + ranked_index( + const ranked_index& x,const allocator_type& al,index_node_type* h): + super(x,al,h){}; - ranked_index(const ranked_index& x,do_not_copy_elements_tag): - super(x,do_not_copy_elements_tag()){}; + ranked_index( + const ranked_index& x,const allocator_type& al,index_node_type* h, + do_not_copy_elements_tag): + super(x,al,h,do_not_copy_elements_tag()){}; ranked_index( - const ctor_args_list& args_list,const allocator_type& al): - super(args_list,al){} + const ctor_args_list& args_list, + const allocator_type& al,index_node_type* h): + super(args_list,al,h){} private: template diff --git a/include/boost/multi_index/sequenced_index.hpp b/include/boost/multi_index/sequenced_index.hpp index 3d0f5a13..4de4fbc3 100644 --- a/include/boost/multi_index/sequenced_index.hpp +++ b/include/boost/multi_index/sequenced_index.hpp @@ -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) @@ -655,8 +655,10 @@ class sequenced_index:protected SuperMeta::type } protected: - sequenced_index(const ctor_args_list& args_list,const allocator_type& al): - super(args_list.get_tail(),al) + sequenced_index( + const ctor_args_list& args_list, + const allocator_type& al,index_node_type* h): + super(args_list.get_tail(),al,h) #if defined(BOOST_MULTI_INDEX_ENABLE_SAFE_MODE) ,safe(*this) @@ -666,8 +668,10 @@ class sequenced_index:protected SuperMeta::type empty_initialize(); } - sequenced_index(const sequenced_index& x): - super(x) + sequenced_index( + const sequenced_index& x, + const allocator_type& al,index_node_type* h): + super(x,al,h) #if defined(BOOST_MULTI_INDEX_ENABLE_SAFE_MODE) ,safe(*this) @@ -678,8 +682,10 @@ class sequenced_index:protected SuperMeta::type } sequenced_index( - const sequenced_index& x,do_not_copy_elements_tag): - super(x,do_not_copy_elements_tag()) + const sequenced_index& x, + const allocator_type& al,index_node_type* h, + do_not_copy_elements_tag): + super(x,al,h,do_not_copy_elements_tag()) #if defined(BOOST_MULTI_INDEX_ENABLE_SAFE_MODE) ,safe(*this) diff --git a/include/boost/multi_index_container.hpp b/include/boost/multi_index_container.hpp index 04aa2adf..094549dc 100644 --- a/include/boost/multi_index_container.hpp +++ b/include/boost/multi_index_container.hpp @@ -156,7 +156,7 @@ class multi_index_container: multi_index_container(): bfm_allocator(allocator_type()), - super(ctor_args_list(),bfm_allocator::member), + super(ctor_args_list(),bfm_allocator::member,&*bfm_header::member), node_count(0) { BOOST_MULTI_INDEX_CHECK_INVARIANT; @@ -166,7 +166,7 @@ class multi_index_container: const ctor_args_list& args_list, const allocator_type& al=allocator_type()): bfm_allocator(al), - super(args_list,bfm_allocator::member), + super(args_list,bfm_allocator::member,&*bfm_header::member), node_count(0) { BOOST_MULTI_INDEX_CHECK_INVARIANT; @@ -174,7 +174,7 @@ class multi_index_container: explicit multi_index_container(const allocator_type& al): bfm_allocator(al), - super(ctor_args_list(),bfm_allocator::member), + super(ctor_args_list(),bfm_allocator::member,&*bfm_header::member), node_count(0) { BOOST_MULTI_INDEX_CHECK_INVARIANT; @@ -186,7 +186,7 @@ class multi_index_container: const ctor_args_list& args_list=ctor_args_list(), const allocator_type& al=allocator_type()): bfm_allocator(al), - super(args_list,bfm_allocator::member), + super(args_list,bfm_allocator::member,&*bfm_header::member), node_count(0) { BOOST_MULTI_INDEX_CHECK_INVARIANT; @@ -210,7 +210,7 @@ class multi_index_container: const ctor_args_list& args_list=ctor_args_list(), const allocator_type& al=allocator_type()): bfm_allocator(al), - super(args_list,bfm_allocator::member), + super(args_list,bfm_allocator::member,&*bfm_header::member), node_count(0) { BOOST_MULTI_INDEX_CHECK_INVARIANT; @@ -236,8 +236,7 @@ class multi_index_container: bfm_allocator( allocator_select_on_container_copy_construction( x.bfm_allocator::member)), - bfm_header(), - super(x), + super(x,bfm_allocator::member,&*bfm_header::member), node_count(0) { copy_construct_from(x); @@ -245,8 +244,9 @@ class multi_index_container: multi_index_container(multi_index_container&& x): bfm_allocator(std::move(x.bfm_allocator::member)), - bfm_header(), - super(x,detail::do_not_copy_elements_tag()), + super( + x,bfm_allocator::member,&*bfm_header::member, + detail::do_not_copy_elements_tag()), node_count(0) { BOOST_MULTI_INDEX_CHECK_INVARIANT; @@ -258,8 +258,7 @@ class multi_index_container: const multi_index_container& x, const allocator_type& al): bfm_allocator(al), - bfm_header(), - super(x), + super(x,bfm_allocator::member,&*bfm_header::member), node_count(0) { copy_construct_from(x); @@ -269,7 +268,9 @@ class multi_index_container: multi_index_container&& x,const allocator_type& al): bfm_allocator(al), bfm_header(), - super(x,detail::do_not_copy_elements_tag()), + super( + x,bfm_allocator::member,&*bfm_header::member, + detail::do_not_copy_elements_tag()), node_count(0) { BOOST_MULTI_INDEX_CHECK_INVARIANT; @@ -492,8 +493,7 @@ class multi_index_container: const allocator_type& al, detail::unequal_alloc_move_ctor_tag): bfm_allocator(al), - bfm_header(), - super(x), + super(x,bfm_allocator::member,&*bfm_header::member), node_count(0) { BOOST_MULTI_INDEX_CHECK_INVARIANT_OF(x); @@ -524,8 +524,9 @@ class multi_index_container: const multi_index_container& x, detail::do_not_copy_elements_tag): bfm_allocator(x.bfm_allocator::member), - bfm_header(), - super(x,detail::do_not_copy_elements_tag()), + super( + x,bfm_allocator::member,&*bfm_header::member, + detail::do_not_copy_elements_tag()), node_count(0) { BOOST_MULTI_INDEX_CHECK_INVARIANT; @@ -551,7 +552,7 @@ class multi_index_container: final_node_type* header()const { - return &*bfm_header::member(); + return &*bfm_header::member; } final_node_type* allocate_node() @@ -903,7 +904,7 @@ class multi_index_container: boost::true_type swap_allocators) { detail::adl_swap(bfm_allocator::member,x.bfm_allocator::member); - std::swap(bfm_header::member(),x.bfm_header::member()); + std::swap(bfm_header::member,x.bfm_header::member); super::swap_(x,swap_allocators); std::swap(node_count,x.node_count); } @@ -912,7 +913,7 @@ class multi_index_container: multi_index_container& x, boost::false_type swap_allocators) { - std::swap(bfm_header::member(),x.bfm_header::member()); + std::swap(bfm_header::member,x.bfm_header::member); super::swap_(x,swap_allocators); std::swap(node_count,x.node_count); } @@ -920,7 +921,7 @@ class multi_index_container: void swap_elements_( multi_index_container& x) { - std::swap(bfm_header::member(),x.bfm_header::member()); + std::swap(bfm_header::member,x.bfm_header::member); super::swap_elements_(x); std::swap(node_count,x.node_count); } From 71229febefc8e34304325c04ac3dd85fe1cc699c Mon Sep 17 00:00:00 2001 From: joaquintides Date: Sun, 31 May 2026 12:39:04 +0200 Subject: [PATCH 11/14] used passed header in construction rather than header() --- include/boost/multi_index/hashed_index.hpp | 6 +++--- include/boost/multi_index/random_access_index.hpp | 2 +- include/boost/multi_index_container.hpp | 1 - 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/include/boost/multi_index/hashed_index.hpp b/include/boost/multi_index/hashed_index.hpp index d220239e..d33e23d1 100644 --- a/include/boost/multi_index/hashed_index.hpp +++ b/include/boost/multi_index/hashed_index.hpp @@ -742,7 +742,7 @@ class hashed_index:protected SuperMeta::type key(tuples::get<1>(args_list.get_head())), hash_(tuples::get<2>(args_list.get_head())), eq_(tuples::get<3>(args_list.get_head())), - buckets(al,header()->impl(),tuples::get<0>(args_list.get_head())), + buckets(al,h->impl(),tuples::get<0>(args_list.get_head())), mlf(1.0f) #if defined(BOOST_MULTI_INDEX_ENABLE_SAFE_MODE) @@ -760,7 +760,7 @@ class hashed_index:protected SuperMeta::type key(x.key), hash_(x.hash_), eq_(x.eq_), - buckets(x.get_allocator(),header()->impl(),x.buckets.size()), + buckets(al,h->impl(),x.buckets.size()), mlf(x.mlf), max_load(x.max_load) @@ -782,7 +782,7 @@ class hashed_index:protected SuperMeta::type key(x.key), hash_(x.hash_), eq_(x.eq_), - buckets(x.get_allocator(),h->impl(),0), + buckets(al,h->impl(),0), mlf(1.0f) #if defined(BOOST_MULTI_INDEX_ENABLE_SAFE_MODE) diff --git a/include/boost/multi_index/random_access_index.hpp b/include/boost/multi_index/random_access_index.hpp index 7cdb3fc4..9228c1df 100644 --- a/include/boost/multi_index/random_access_index.hpp +++ b/include/boost/multi_index/random_access_index.hpp @@ -744,7 +744,7 @@ class random_access_index:protected SuperMeta::type const ctor_args_list& args_list, const allocator_type& al,index_node_type* h): super(args_list.get_tail(),al,h), - ptrs(al,header()->impl(),0) + ptrs(al,h->impl(),0) #if defined(BOOST_MULTI_INDEX_ENABLE_SAFE_MODE) ,safe(*this) diff --git a/include/boost/multi_index_container.hpp b/include/boost/multi_index_container.hpp index 094549dc..98c4012f 100644 --- a/include/boost/multi_index_container.hpp +++ b/include/boost/multi_index_container.hpp @@ -267,7 +267,6 @@ class multi_index_container: multi_index_container( multi_index_container&& x,const allocator_type& al): bfm_allocator(al), - bfm_header(), super( x,bfm_allocator::member,&*bfm_header::member, detail::do_not_copy_elements_tag()), From aef079105f8b6ac33330c88874a1c3dc669ea84d Mon Sep 17 00:00:00 2001 From: joaquintides Date: Sun, 31 May 2026 13:17:26 +0200 Subject: [PATCH 12/14] investigated if hit by https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119321 --- test/Jamfile.v2 | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/test/Jamfile.v2 b/test/Jamfile.v2 index fd9cfe21..33a39a09 100644 --- a/test/Jamfile.v2 +++ b/test/Jamfile.v2 @@ -1,6 +1,6 @@ # Boost.MultiIndex tests Jamfile # -# Copyright 2003-2025 Joaquín M López Muñoz. +# Copyright 2003-2026 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 # http://www.boost.org/LICENSE_1_0.txt) @@ -37,6 +37,7 @@ project msvc:_CRT_SECURE_NO_WARNINGS msvc:_SILENCE_ALL_CXX17_DEPRECATION_WARNINGS msvc:/wd4494 + gcc-16:-fno-thread-jumps ; obj boost_multi_index_key_supported : check_bmi_key_supported.cpp ; From 046c122bd34db1befa6d4aa7a3118df7c92d908d Mon Sep 17 00:00:00 2001 From: joaquintides Date: Mon, 1 Jun 2026 09:49:44 +0200 Subject: [PATCH 13/14] documented GCC 16.1 flag --- test/Jamfile.v2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/Jamfile.v2 b/test/Jamfile.v2 index 33a39a09..d639fda5 100644 --- a/test/Jamfile.v2 +++ b/test/Jamfile.v2 @@ -37,7 +37,7 @@ project msvc:_CRT_SECURE_NO_WARNINGS msvc:_SILENCE_ALL_CXX17_DEPRECATION_WARNINGS msvc:/wd4494 - gcc-16:-fno-thread-jumps + gcc-16:-fno-thread-jumps # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119321 ; obj boost_multi_index_key_supported : check_bmi_key_supported.cpp ; From a44aa054e43817c207da78ffc15048d1f9ec8e73 Mon Sep 17 00:00:00 2001 From: joaquintides Date: Mon, 1 Jun 2026 09:50:08 +0200 Subject: [PATCH 14/14] avoided VS warning --- test/test_alloc_awareness.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/test_alloc_awareness.cpp b/test/test_alloc_awareness.cpp index b982cfd0..be1b4e1d 100644 --- a/test/test_alloc_awareness.cpp +++ b/test/test_alloc_awareness.cpp @@ -1,6 +1,6 @@ /* Boost.MultiIndex test for allocator awareness. * - * 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) @@ -115,7 +115,7 @@ void test_allocator_awareness_for() BOOST_TEST(element_transfer==(&*c3.begin()==pfirst)); BOOST_TEST(!element_transfer==(c3.begin()->move_cted)); } - if(Propagate||AlwaysEqual){ + BOOST_IF_CONSTEXPR(Propagate||AlwaysEqual){ container c2(c); const move_tracker* pfirst=&*c2.begin(); container c3(root2);