From 494626a36191a9d940441122408406270f3cd1c8 Mon Sep 17 00:00:00 2001 From: joaquintides Date: Wed, 5 Nov 2025 22:22:40 +0100 Subject: [PATCH 01/24] removed simulated variadic function args --- .../boost/multi_index/detail/index_base.hpp | 15 +- .../multi_index/detail/ord_index_impl.hpp | 48 ++-- .../multi_index/detail/vartempl_support.hpp | 247 ------------------ include/boost/multi_index/hashed_index.hpp | 48 ++-- .../boost/multi_index/random_access_index.hpp | 69 ++--- include/boost/multi_index/sequenced_index.hpp | 66 ++--- include/boost/multi_index_container.hpp | 40 +-- 7 files changed, 113 insertions(+), 420 deletions(-) delete mode 100644 include/boost/multi_index/detail/vartempl_support.hpp diff --git a/include/boost/multi_index/detail/index_base.hpp b/include/boost/multi_index/detail/index_base.hpp index 48e9d17be..0d0a0a712 100644 --- a/include/boost/multi_index/detail/index_base.hpp +++ b/include/boost/multi_index/detail/index_base.hpp @@ -25,7 +25,6 @@ #include #include #include -#include #include #include #include @@ -241,11 +240,10 @@ class index_base std::pair final_transfer_(Index& x,final_node_type* n) {return final().transfer_(x,n);} - template - std::pair final_emplace_( - BOOST_MULTI_INDEX_FUNCTION_PARAM_PACK) + template + std::pair final_emplace_(Args&&... args) { - return final().emplace_(BOOST_MULTI_INDEX_FORWARD_PARAM_PACK); + return final().emplace_(std::forward(args)...); } std::pair final_insert_( @@ -266,12 +264,11 @@ class index_base final_node_handle_type& nh,final_node_type* position) {return final().insert_nh_(nh,position);} - template + template std::pair final_emplace_hint_( - final_node_type* position,BOOST_MULTI_INDEX_FUNCTION_PARAM_PACK) + final_node_type* position,Args&&... args) { - return final().emplace_hint_( - position,BOOST_MULTI_INDEX_FORWARD_PARAM_PACK); + return final().emplace_hint_(position,std::forward(args)...); } final_node_handle_type final_extract_(final_node_type* x) diff --git a/include/boost/multi_index/detail/ord_index_impl.hpp b/include/boost/multi_index/detail/ord_index_impl.hpp index c9c633431..c712d485c 100644 --- a/include/boost/multi_index/detail/ord_index_impl.hpp +++ b/include/boost/multi_index/detail/ord_index_impl.hpp @@ -66,7 +66,6 @@ #include #include #include -#include #include #include #include @@ -297,11 +296,27 @@ class ordered_index_impl: /* modifiers */ - BOOST_MULTI_INDEX_OVERLOADS_TO_VARTEMPL( - pair_return_type,emplace,emplace_impl) + template + std::pair emplace(Args&&... args) + { + BOOST_MULTI_INDEX_ORD_INDEX_CHECK_INVARIANT; + std::pairp= + this->final_emplace_(std::forward(args)...); + return std::pair(make_iterator(p.first),p.second); + } - BOOST_MULTI_INDEX_OVERLOADS_TO_VARTEMPL_EXTRA_ARG( - iterator,emplace_hint,emplace_hint_impl,iterator,position) + template + iterator emplace_hint(iterator position,Args&&... args) + { + BOOST_MULTI_INDEX_CHECK_VALID_ITERATOR(position); + BOOST_MULTI_INDEX_CHECK_IS_OWNER(position,*this); + BOOST_MULTI_INDEX_ORD_INDEX_CHECK_INVARIANT; + std::pairp= + this->final_emplace_hint_( + static_cast(position.get_node()), + std::forward(args)...); + return make_iterator(p.first); + } std::pair insert(const value_type& x) { @@ -1351,29 +1366,6 @@ class ordered_index_impl: } #endif - template - std::pair emplace_impl(BOOST_MULTI_INDEX_FUNCTION_PARAM_PACK) - { - BOOST_MULTI_INDEX_ORD_INDEX_CHECK_INVARIANT; - std::pairp= - this->final_emplace_(BOOST_MULTI_INDEX_FORWARD_PARAM_PACK); - return std::pair(make_iterator(p.first),p.second); - } - - template - iterator emplace_hint_impl( - iterator position,BOOST_MULTI_INDEX_FUNCTION_PARAM_PACK) - { - BOOST_MULTI_INDEX_CHECK_VALID_ITERATOR(position); - BOOST_MULTI_INDEX_CHECK_IS_OWNER(position,*this); - BOOST_MULTI_INDEX_ORD_INDEX_CHECK_INVARIANT; - std::pairp= - this->final_emplace_hint_( - static_cast(position.get_node()), - BOOST_MULTI_INDEX_FORWARD_PARAM_PACK); - return make_iterator(p.first); - } - template std::pair range(LowerBounder lower,UpperBounder upper,none_unbounded_tag)const diff --git a/include/boost/multi_index/detail/vartempl_support.hpp b/include/boost/multi_index/detail/vartempl_support.hpp deleted file mode 100644 index 06ff430f4..000000000 --- a/include/boost/multi_index/detail/vartempl_support.hpp +++ /dev/null @@ -1,247 +0,0 @@ -/* Copyright 2003-2013 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) - * - * See http://www.boost.org/libs/multi_index for library home page. - */ - -#ifndef BOOST_MULTI_INDEX_DETAIL_VARTEMPL_SUPPORT_HPP -#define BOOST_MULTI_INDEX_DETAIL_VARTEMPL_SUPPORT_HPP - -#if defined(_MSC_VER) -#pragma once -#endif - -/* Utilities for emulation of variadic template functions. Variadic packs are - * replaced by lists of BOOST_MULTI_INDEX_LIMIT_VARTEMPL_ARGS parameters: - * - * - typename... Args --> BOOST_MULTI_INDEX_TEMPLATE_PARAM_PACK - * - Args&&... args --> BOOST_MULTI_INDEX_FUNCTION_PARAM_PACK - * - std::forward(args)... --> BOOST_MULTI_INDEX_FORWARD_PARAM_PACK - * - * Forwarding emulated with Boost.Move. A template functions foo_imp - * defined in such way accepts *exactly* BOOST_MULTI_INDEX_LIMIT_VARTEMPL_ARGS - * arguments: variable number of arguments is emulated by providing a set of - * overloads foo forwarding to foo_impl with - * - * BOOST_MULTI_INDEX_OVERLOADS_TO_VARTEMPL - * BOOST_MULTI_INDEX_OVERLOADS_TO_VARTEMPL_EXTRA_ARG (initial extra arg) - * - * which fill the extra args with boost::multi_index::detail::noarg's. - * boost::multi_index::detail::vartempl_placement_new works the opposite - * way: it acceps a full a pointer x to Value and a - * BOOST_MULTI_INDEX_FUNCTION_PARAM_PACK and forwards to - * new(x) Value(args) where args is the argument pack after discarding - * noarg's. - * - * Emulation decays to the real thing when the compiler supports variadic - * templates and move semantics natively. - */ - -#include - -#if defined(BOOST_NO_CXX11_RVALUE_REFERENCES)||\ - defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#if !defined(BOOST_MULTI_INDEX_LIMIT_VARTEMPL_ARGS) -#define BOOST_MULTI_INDEX_LIMIT_VARTEMPL_ARGS 5 -#endif - -#define BOOST_MULTI_INDEX_TEMPLATE_PARAM_PACK \ -BOOST_PP_ENUM_PARAMS( \ - BOOST_MULTI_INDEX_LIMIT_VARTEMPL_ARGS,typename T) - -#define BOOST_MULTI_INDEX_VARTEMPL_ARG(z,n,_) \ -BOOST_FWD_REF(BOOST_PP_CAT(T,n)) BOOST_PP_CAT(t,n) - -#define BOOST_MULTI_INDEX_FUNCTION_PARAM_PACK \ -BOOST_PP_ENUM( \ - BOOST_MULTI_INDEX_LIMIT_VARTEMPL_ARGS, \ - BOOST_MULTI_INDEX_VARTEMPL_ARG,~) - -#define BOOST_MULTI_INDEX_VARTEMPL_FORWARD_ARG(z,n,_) \ -boost::forward(BOOST_PP_CAT(t,n)) - -#define BOOST_MULTI_INDEX_FORWARD_PARAM_PACK \ -BOOST_PP_ENUM( \ - BOOST_MULTI_INDEX_LIMIT_VARTEMPL_ARGS, \ - BOOST_MULTI_INDEX_VARTEMPL_FORWARD_ARG,~) - -namespace boost{namespace multi_index{namespace detail{ -struct noarg{}; -}}} - -/* call vartempl function without args */ - -#define BOOST_MULTI_INDEX_NULL_PARAM_PACK \ -BOOST_PP_ENUM_PARAMS( \ - BOOST_MULTI_INDEX_LIMIT_VARTEMPL_ARGS, \ - boost::multi_index::detail::noarg() BOOST_PP_INTERCEPT) - -#define BOOST_MULTI_INDEX_TEMPLATE_N(n) \ -template - -#define BOOST_MULTI_INDEX_TEMPLATE_0(n) - -#define BOOST_MULTI_INDEX_OVERLOADS_TO_VARTEMPL_AUX(z,n,data) \ -BOOST_PP_IF(n, \ - BOOST_MULTI_INDEX_TEMPLATE_N, \ - BOOST_MULTI_INDEX_TEMPLATE_0)(n) \ -BOOST_PP_SEQ_ELEM(0,data) /* ret */ \ -BOOST_PP_SEQ_ELEM(1,data) /* name_from */ ( \ - BOOST_PP_ENUM(n,BOOST_MULTI_INDEX_VARTEMPL_ARG,~)) \ -{ \ - return BOOST_PP_SEQ_ELEM(2,data) /* name_to */ ( \ - BOOST_PP_ENUM(n,BOOST_MULTI_INDEX_VARTEMPL_FORWARD_ARG,~) \ - BOOST_PP_COMMA_IF( \ - BOOST_PP_AND( \ - n,BOOST_PP_SUB(BOOST_MULTI_INDEX_LIMIT_VARTEMPL_ARGS,n))) \ - BOOST_PP_ENUM_PARAMS( \ - BOOST_PP_SUB(BOOST_MULTI_INDEX_LIMIT_VARTEMPL_ARGS,n), \ - boost::multi_index::detail::noarg() BOOST_PP_INTERCEPT) \ - ); \ -} - -#define BOOST_MULTI_INDEX_OVERLOADS_TO_VARTEMPL( \ - ret,name_from,name_to) \ -BOOST_PP_REPEAT_FROM_TO( \ - 0,BOOST_PP_ADD(BOOST_MULTI_INDEX_LIMIT_VARTEMPL_ARGS,1), \ - BOOST_MULTI_INDEX_OVERLOADS_TO_VARTEMPL_AUX, \ - (ret)(name_from)(name_to)) - -#define BOOST_MULTI_INDEX_OVERLOADS_TO_VARTEMPL_EXTRA_ARG_AUX( \ - z,n,data) \ -BOOST_PP_IF(n, \ - BOOST_MULTI_INDEX_TEMPLATE_N, \ - BOOST_MULTI_INDEX_TEMPLATE_0)(n) \ -BOOST_PP_SEQ_ELEM(0,data) /* ret */ \ -BOOST_PP_SEQ_ELEM(1,data) /* name_from */ ( \ - BOOST_PP_SEQ_ELEM(3,data) BOOST_PP_SEQ_ELEM(4,data) /* extra arg */\ - BOOST_PP_COMMA_IF(n) \ - BOOST_PP_ENUM(n,BOOST_MULTI_INDEX_VARTEMPL_ARG,~)) \ -{ \ - return BOOST_PP_SEQ_ELEM(2,data) /* name_to */ ( \ - BOOST_PP_SEQ_ELEM(4,data) /* extra_arg_name */ \ - BOOST_PP_COMMA_IF(n) \ - BOOST_PP_ENUM(n,BOOST_MULTI_INDEX_VARTEMPL_FORWARD_ARG,~) \ - BOOST_PP_COMMA_IF( \ - BOOST_PP_SUB(BOOST_MULTI_INDEX_LIMIT_VARTEMPL_ARGS,n)) \ - BOOST_PP_ENUM_PARAMS( \ - BOOST_PP_SUB(BOOST_MULTI_INDEX_LIMIT_VARTEMPL_ARGS,n), \ - boost::multi_index::detail::noarg() BOOST_PP_INTERCEPT) \ - ); \ -} - -#define BOOST_MULTI_INDEX_OVERLOADS_TO_VARTEMPL_EXTRA_ARG( \ - ret,name_from,name_to,extra_arg_type,extra_arg_name) \ -BOOST_PP_REPEAT_FROM_TO( \ - 0,BOOST_PP_ADD(BOOST_MULTI_INDEX_LIMIT_VARTEMPL_ARGS,1), \ - BOOST_MULTI_INDEX_OVERLOADS_TO_VARTEMPL_EXTRA_ARG_AUX, \ - (ret)(name_from)(name_to)(extra_arg_type)(extra_arg_name)) - -namespace boost{ - -namespace multi_index{ - -namespace detail{ - -#define BOOST_MULTI_INDEX_VARTEMPL_TO_PLACEMENT_NEW_AUX(z,n,name) \ -template< \ - typename Value \ - BOOST_PP_COMMA_IF(n) \ - BOOST_PP_ENUM_PARAMS(n,typename T) \ -> \ -Value* name( \ - Value* x \ - BOOST_PP_COMMA_IF(n) \ - BOOST_PP_ENUM(n,BOOST_MULTI_INDEX_VARTEMPL_ARG,~) \ - BOOST_PP_COMMA_IF( \ - BOOST_PP_SUB(BOOST_MULTI_INDEX_LIMIT_VARTEMPL_ARGS,n)) \ - BOOST_PP_ENUM_PARAMS( \ - BOOST_PP_SUB(BOOST_MULTI_INDEX_LIMIT_VARTEMPL_ARGS,n), \ - BOOST_FWD_REF(noarg) BOOST_PP_INTERCEPT)) \ -{ \ - return new(x) Value( \ - BOOST_PP_ENUM(n,BOOST_MULTI_INDEX_VARTEMPL_FORWARD_ARG,~)); \ -} - -#define BOOST_MULTI_INDEX_VARTEMPL_TO_PLACEMENT_NEW(name) \ -BOOST_PP_REPEAT_FROM_TO( \ - 0,BOOST_PP_ADD(BOOST_MULTI_INDEX_LIMIT_VARTEMPL_ARGS,1), \ - BOOST_MULTI_INDEX_VARTEMPL_TO_PLACEMENT_NEW_AUX, \ - name) - -BOOST_MULTI_INDEX_VARTEMPL_TO_PLACEMENT_NEW(vartempl_placement_new) - -#undef BOOST_MULTI_INDEX_VARTEMPL_TO_PLACEMENT_NEW_AUX -#undef BOOST_MULTI_INDEX_VARTEMPL_TO_PLACEMENT_NEW - -} /* namespace multi_index::detail */ - -} /* namespace multi_index */ - -} /* namespace boost */ - -#else - -/* native variadic templates support */ - -#include - -#define BOOST_MULTI_INDEX_TEMPLATE_PARAM_PACK typename... Args -#define BOOST_MULTI_INDEX_FUNCTION_PARAM_PACK Args&&... args -#define BOOST_MULTI_INDEX_FORWARD_PARAM_PACK std::forward(args)... -#define BOOST_MULTI_INDEX_NULL_PARAM_PACK - -#define BOOST_MULTI_INDEX_OVERLOADS_TO_VARTEMPL( \ - ret,name_from,name_to) \ -template ret name_from(Args&&... args) \ -{ \ - return name_to(std::forward(args)...); \ -} - -#define BOOST_MULTI_INDEX_OVERLOADS_TO_VARTEMPL_EXTRA_ARG( \ - ret,name_from,name_to,extra_arg_type,extra_arg_name) \ -template ret name_from( \ - extra_arg_type extra_arg_name,Args&&... args) \ -{ \ - return name_to(extra_arg_name,std::forward(args)...); \ -} - -namespace boost{ - -namespace multi_index{ - -namespace detail{ - -template -Value* vartempl_placement_new(Value*x,Args&&... args) -{ - return new(x) Value(std::forward(args)...); -} - -} /* namespace multi_index::detail */ - -} /* namespace multi_index */ - -} /* namespace boost */ - -#endif -#endif diff --git a/include/boost/multi_index/hashed_index.hpp b/include/boost/multi_index/hashed_index.hpp index 91f2a85d0..6991909b7 100644 --- a/include/boost/multi_index/hashed_index.hpp +++ b/include/boost/multi_index/hashed_index.hpp @@ -38,7 +38,6 @@ #include #include #include -#include #include #include #include @@ -273,11 +272,27 @@ class hashed_index: /* modifiers */ - BOOST_MULTI_INDEX_OVERLOADS_TO_VARTEMPL( - pair_return_type,emplace,emplace_impl) + template + std::pair emplace(Args&&... args) + { + BOOST_MULTI_INDEX_HASHED_INDEX_CHECK_INVARIANT; + std::pairp= + this->final_emplace_(std::forward(args)...); + return std::pair(make_iterator(p.first),p.second); + } - BOOST_MULTI_INDEX_OVERLOADS_TO_VARTEMPL_EXTRA_ARG( - iterator,emplace_hint,emplace_hint_impl,iterator,position) + template + iterator emplace_hint(iterator position,Args&&... args) + { + BOOST_MULTI_INDEX_CHECK_VALID_ITERATOR(position); + BOOST_MULTI_INDEX_CHECK_IS_OWNER(position,*this); + BOOST_MULTI_INDEX_HASHED_INDEX_CHECK_INVARIANT; + std::pairp= + this->final_emplace_hint_( + static_cast(position.get_node()), + std::forward(args)...); + return make_iterator(p.first); + } std::pair insert(const value_type& x) { @@ -1659,29 +1674,6 @@ class hashed_index: } #endif - template - std::pair emplace_impl(BOOST_MULTI_INDEX_FUNCTION_PARAM_PACK) - { - BOOST_MULTI_INDEX_HASHED_INDEX_CHECK_INVARIANT; - std::pairp= - this->final_emplace_(BOOST_MULTI_INDEX_FORWARD_PARAM_PACK); - return std::pair(make_iterator(p.first),p.second); - } - - template - iterator emplace_hint_impl( - iterator position,BOOST_MULTI_INDEX_FUNCTION_PARAM_PACK) - { - BOOST_MULTI_INDEX_CHECK_VALID_ITERATOR(position); - BOOST_MULTI_INDEX_CHECK_IS_OWNER(position,*this); - BOOST_MULTI_INDEX_HASHED_INDEX_CHECK_INVARIANT; - std::pairp= - this->final_emplace_hint_( - static_cast(position.get_node()), - BOOST_MULTI_INDEX_FORWARD_PARAM_PACK); - return make_iterator(p.first); - } - template< typename CompatibleHash,typename CompatiblePred > diff --git a/include/boost/multi_index/random_access_index.hpp b/include/boost/multi_index/random_access_index.hpp index 434cdf29a..9f9a43566 100644 --- a/include/boost/multi_index/random_access_index.hpp +++ b/include/boost/multi_index/random_access_index.hpp @@ -35,7 +35,6 @@ #include #include #include -#include #include #include #include @@ -291,10 +290,12 @@ class random_access_index: void resize(size_type n) { BOOST_MULTI_INDEX_RND_INDEX_CHECK_INVARIANT; - if(n>size()) - for(size_type m=n-size();m--;) - this->final_emplace_(BOOST_MULTI_INDEX_NULL_PARAM_PACK); - else if(nsize()){ + for(size_type m=n-size();m--;)this->final_emplace_(); + } + else if(n + std::pair emplace_front(Args&&... args) + { + return emplace(begin(),std::forward(args)...); + } std::pair push_front(const value_type& x) {return insert(begin(),x);} @@ -334,8 +338,11 @@ class random_access_index: {return insert(begin(),boost::move(x));} void pop_front(){erase(begin());} - BOOST_MULTI_INDEX_OVERLOADS_TO_VARTEMPL( - pair_return_type,emplace_back,emplace_back_impl) + template + std::pair emplace_back(Args&&... args) + { + return emplace(end(),std::forward(args)...); + } std::pair push_back(const value_type& x) {return insert(end(),x);} @@ -343,8 +350,19 @@ class random_access_index: {return insert(end(),boost::move(x));} void pop_back(){erase(--end());} - BOOST_MULTI_INDEX_OVERLOADS_TO_VARTEMPL_EXTRA_ARG( - pair_return_type,emplace,emplace_impl,iterator,position) + template + std::pair emplace(iterator position,Args&&... args) + { + BOOST_MULTI_INDEX_CHECK_VALID_ITERATOR(position); + BOOST_MULTI_INDEX_CHECK_IS_OWNER(position,*this); + BOOST_MULTI_INDEX_RND_INDEX_CHECK_INVARIANT; + std::pair p= + this->final_emplace_(std::forward(args)...); + if(p.second&&position.get_node()!=header()){ + relocate(position.get_node(),p.first); + } + return std::pair(make_iterator(p.first),p.second); + } std::pair insert(iterator position,const value_type& x) { @@ -1080,35 +1098,6 @@ class random_access_index: relocate(position,end()-s,end()); } - template - std::pair emplace_front_impl( - BOOST_MULTI_INDEX_FUNCTION_PARAM_PACK) - { - return emplace_impl(begin(),BOOST_MULTI_INDEX_FORWARD_PARAM_PACK); - } - - template - std::pair emplace_back_impl( - BOOST_MULTI_INDEX_FUNCTION_PARAM_PACK) - { - return emplace_impl(end(),BOOST_MULTI_INDEX_FORWARD_PARAM_PACK); - } - - template - std::pair emplace_impl( - iterator position,BOOST_MULTI_INDEX_FUNCTION_PARAM_PACK) - { - BOOST_MULTI_INDEX_CHECK_VALID_ITERATOR(position); - BOOST_MULTI_INDEX_CHECK_IS_OWNER(position,*this); - BOOST_MULTI_INDEX_RND_INDEX_CHECK_INVARIANT; - std::pair p= - this->final_emplace_(BOOST_MULTI_INDEX_FORWARD_PARAM_PACK); - if(p.second&&position.get_node()!=header()){ - relocate(position.get_node(),p.first); - } - return std::pair(make_iterator(p.first),p.second); - } - template std::pair external_splice( iterator position,Index& x,BOOST_DEDUCED_TYPENAME Index::iterator i, diff --git a/include/boost/multi_index/sequenced_index.hpp b/include/boost/multi_index/sequenced_index.hpp index b2dd866aa..48974757d 100644 --- a/include/boost/multi_index/sequenced_index.hpp +++ b/include/boost/multi_index/sequenced_index.hpp @@ -33,7 +33,6 @@ #include #include #include -#include #include #include #include @@ -265,10 +264,11 @@ class sequenced_index: { BOOST_MULTI_INDEX_SEQ_INDEX_CHECK_INVARIANT; if(n>size()){ - for(size_type m=n-size();m--;) - this->final_emplace_(BOOST_MULTI_INDEX_NULL_PARAM_PACK); + for(size_type m=n-size();m--;)this->final_emplace_(); + } + else if(n + std::pair emplace_front(Args&&... args) + { + return emplace(begin(),std::forward(args)...); + } std::pair push_front(const value_type& x) {return insert(begin(),x);} @@ -296,8 +299,11 @@ class sequenced_index: {return insert(begin(),boost::move(x));} void pop_front(){erase(begin());} - BOOST_MULTI_INDEX_OVERLOADS_TO_VARTEMPL( - pair_return_type,emplace_back,emplace_back_impl) + template + std::pair emplace_back(Args&&... args) + { + return emplace(end(),std::forward(args)...); + } std::pair push_back(const value_type& x) {return insert(end(),x);} @@ -305,8 +311,19 @@ class sequenced_index: {return insert(end(),boost::move(x));} void pop_back(){erase(--end());} - BOOST_MULTI_INDEX_OVERLOADS_TO_VARTEMPL_EXTRA_ARG( - pair_return_type,emplace,emplace_impl,iterator,position) + template + std::pair emplace(iterator position,Args&&... args) + { + BOOST_MULTI_INDEX_CHECK_VALID_ITERATOR(position); + BOOST_MULTI_INDEX_CHECK_IS_OWNER(position,*this); + BOOST_MULTI_INDEX_SEQ_INDEX_CHECK_INVARIANT; + std::pair p= + this->final_emplace_(std::forward(args)...); + if(p.second&&position.get_node()!=header()){ + relink(position.get_node(),p.first); + } + return std::pair(make_iterator(p.first),p.second); + } std::pair insert(iterator position,const value_type& x) { @@ -992,35 +1009,6 @@ class sequenced_index: for(size_type i=0;i - std::pair emplace_front_impl( - BOOST_MULTI_INDEX_FUNCTION_PARAM_PACK) - { - return emplace_impl(begin(),BOOST_MULTI_INDEX_FORWARD_PARAM_PACK); - } - - template - std::pair emplace_back_impl( - BOOST_MULTI_INDEX_FUNCTION_PARAM_PACK) - { - return emplace_impl(end(),BOOST_MULTI_INDEX_FORWARD_PARAM_PACK); - } - - template - std::pair emplace_impl( - iterator position,BOOST_MULTI_INDEX_FUNCTION_PARAM_PACK) - { - BOOST_MULTI_INDEX_CHECK_VALID_ITERATOR(position); - BOOST_MULTI_INDEX_CHECK_IS_OWNER(position,*this); - BOOST_MULTI_INDEX_SEQ_INDEX_CHECK_INVARIANT; - std::pair p= - this->final_emplace_(BOOST_MULTI_INDEX_FORWARD_PARAM_PACK); - if(p.second&&position.get_node()!=header()){ - relink(position.get_node(),p.first); - } - return std::pair(make_iterator(p.first),p.second); - } - template std::pair external_splice( iterator position,Index& x,BOOST_DEDUCED_TYPENAME Index::iterator i, diff --git a/include/boost/multi_index_container.hpp b/include/boost/multi_index_container.hpp index 6d43d50ce..8171309f1 100644 --- a/include/boost/multi_index_container.hpp +++ b/include/boost/multi_index_container.hpp @@ -40,11 +40,11 @@ #include #include #include -#include #include #include #include #include +#include #if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST) #include @@ -650,21 +650,14 @@ class multi_index_container: bfm_allocator::member,static_cast(x),1); } - void construct_value(final_node_type* x,const Value& v) + template + void construct_value(final_node_type* x,Args&&... args) { node_alloc_traits::construct( - bfm_allocator::member,boost::addressof(x->value()),v); - } - - void construct_value(final_node_type* x,BOOST_RV_REF(Value) v) - { - node_alloc_traits::construct( - bfm_allocator::member,boost::addressof(x->value()),boost::move(v)); + bfm_allocator::member,boost::addressof(x->value()), + std::forward(args)...); } - BOOST_MULTI_INDEX_OVERLOADS_TO_VARTEMPL_EXTRA_ARG( - void,construct_value,vartempl_construct_value_impl,final_node_type*,x) - void destroy_value(final_node_type* x) { node_alloc_traits::destroy( @@ -780,13 +773,12 @@ class multi_index_container: } } - template - std::pair emplace_( - BOOST_MULTI_INDEX_FUNCTION_PARAM_PACK) + template + std::pair emplace_(Args&&... args) { final_node_type* x=allocate_node(); BOOST_TRY{ - construct_value(x,BOOST_MULTI_INDEX_FORWARD_PARAM_PACK); + construct_value(x,std::forward(args)...); BOOST_TRY{ final_node_type* res=super::insert_( x->value(),x,detail::emplaced_tag()); @@ -900,14 +892,13 @@ class multi_index_container: } } - template + template std::pair emplace_hint_( - final_node_type* position, - BOOST_MULTI_INDEX_FUNCTION_PARAM_PACK) + final_node_type* position,Args&&... args) { final_node_type* x=allocate_node(); BOOST_TRY{ - construct_value(x,BOOST_MULTI_INDEX_FORWARD_PARAM_PACK); + construct_value(x,std::forward(args)...); BOOST_TRY{ final_node_type* res=super::insert_( x->value(),position,x,detail::emplaced_tag()); @@ -1206,15 +1197,6 @@ class multi_index_container: #endif private: - template - void vartempl_construct_value_impl( - final_node_type* x,BOOST_MULTI_INDEX_FUNCTION_PARAM_PACK) - { - node_alloc_traits::construct( - bfm_allocator::member,boost::addressof(x->value()), - BOOST_MULTI_INDEX_FORWARD_PARAM_PACK); - } - size_type node_count; #if defined(BOOST_MULTI_INDEX_ENABLE_INVARIANT_CHECKING)&&\ From e8dc50ae4d8f79e619d5fb30303a03048346aa50 Mon Sep 17 00:00:00 2001 From: joaquintides Date: Thu, 6 Nov 2025 11:31:24 +0100 Subject: [PATCH 02/24] removed detail/allocator_traits.hpp in favor of Boost.Core functionality --- .../multi_index/detail/allocator_traits.hpp | 173 ------------------ .../boost/multi_index/detail/auto_space.hpp | 20 +- .../boost/multi_index/detail/bucket_array.hpp | 8 +- include/boost/multi_index/detail/copy_map.hpp | 21 +-- .../multi_index/detail/hash_index_node.hpp | 32 ++-- .../boost/multi_index/detail/index_base.hpp | 9 +- .../boost/multi_index/detail/node_handle.hpp | 28 ++- .../multi_index/detail/ord_index_impl.hpp | 16 +- .../multi_index/detail/ord_index_node.hpp | 23 ++- .../multi_index/detail/rnd_index_loader.hpp | 11 +- .../multi_index/detail/rnd_index_node.hpp | 30 ++- .../detail/rnd_index_ptr_array.hpp | 19 +- .../multi_index/detail/seq_index_node.hpp | 25 +-- include/boost/multi_index/hashed_index.hpp | 17 +- .../boost/multi_index/random_access_index.hpp | 17 +- include/boost/multi_index/sequenced_index.hpp | 17 +- include/boost/multi_index_container.hpp | 40 ++-- 17 files changed, 152 insertions(+), 354 deletions(-) delete mode 100644 include/boost/multi_index/detail/allocator_traits.hpp diff --git a/include/boost/multi_index/detail/allocator_traits.hpp b/include/boost/multi_index/detail/allocator_traits.hpp deleted file mode 100644 index 45903b75f..000000000 --- a/include/boost/multi_index/detail/allocator_traits.hpp +++ /dev/null @@ -1,173 +0,0 @@ -/* Copyright 2003-2020 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) - * - * See http://www.boost.org/libs/multi_index for library home page. - */ - -#ifndef BOOST_MULTI_INDEX_DETAIL_ALLOCATOR_TRAITS_HPP -#define BOOST_MULTI_INDEX_DETAIL_ALLOCATOR_TRAITS_HPP - -#if defined(_MSC_VER) -#pragma once -#endif - -#include /* keep it first to prevent nasty warns in MSVC */ - -#if !defined(BOOST_NO_CXX11_ALLOCATOR) -#include -#include -#else -#include -#include -#include -#include -#include -#include -#include -#endif - -namespace boost{ - -namespace multi_index{ - -namespace detail{ - -/* poor man's replacement of std::allocator_traits */ - -#if !defined(BOOST_NO_CXX11_ALLOCATOR) - -template struct void_helper{typedef void type;}; - -template -struct allocator_is_always_equal:boost::is_empty{}; - -template -struct allocator_is_always_equal< - Allocator, - typename void_helper< - typename std::allocator_traits::is_always_equal - >::type ->:std::allocator_traits::is_always_equal{}; - -template -struct allocator_traits:std::allocator_traits -{ - /* wrap std::allocator_traits alias templates for use in C++03 codebase */ - - typedef std::allocator_traits super; - - /* pre-C++17 compatibilty */ - - typedef allocator_is_always_equal is_always_equal; - - template - struct rebind_alloc - { - typedef typename super::template rebind_alloc type; - }; - - template - struct rebind_traits - { - typedef typename super::template rebind_traits type; - }; -}; - -#else - -/* not a full std::allocator_traits rewrite (not needed) */ - -template -struct allocator_traits -{ - typedef Allocator allocator_type; - typedef typename Allocator::value_type value_type; - typedef typename Allocator::pointer pointer; - typedef typename Allocator::const_pointer const_pointer; - - /* [const_]void_pointer not provided as boost::pointer_traits's - * rebind_to has been seen to fail with things like - * boost::interprocess::offset_ptr in relatively old environments. - */ - - typedef typename Allocator::difference_type difference_type; - typedef typename Allocator::size_type size_type; - - typedef boost::false_type propagate_on_container_copy_assignment; - typedef boost::false_type propagate_on_container_move_assignment; - typedef boost::false_type propagate_on_container_swap; - typedef boost::is_empty is_always_equal; - - template - struct rebind_alloc - { - typedef typename Allocator::template rebind::other type; - }; - - template - struct rebind_traits - { - typedef allocator_traits::type> type; - }; - - static pointer allocate(Allocator& a,size_type n){return a.allocate(n);} - static pointer allocate(Allocator& a,size_type n,const_pointer p) - /* should've been const_void_pointer p */ - {return a.allocate(n,p);} - static void deallocate(Allocator& a,pointer p,size_type n) - {a.deallocate(p,n);} - template - static void construct(Allocator&,T* p,const T& x) - {::new (static_cast(p)) T(x);} - template - static void construct(Allocator&,T* p,BOOST_RV_REF(T) x) - {::new (static_cast(p)) T(boost::move(x));} - - template - static void construct(Allocator&,T* p,BOOST_MULTI_INDEX_FUNCTION_PARAM_PACK) - { - vartempl_placement_new(p,BOOST_MULTI_INDEX_FORWARD_PARAM_PACK); - } - -#if BOOST_WORKAROUND(BOOST_MSVC,BOOST_TESTED_AT(1500)) -/* MSVC issues spurious warnings about unreferencend formal parameters in - * destroy when T is a class with trivial dtor. - */ - -#pragma warning(push) -#pragma warning(disable:4100) -#endif - - template - static void destroy(Allocator&,T* p){p->~T();} - -#if BOOST_WORKAROUND(BOOST_MSVC,BOOST_TESTED_AT(1500)) -#pragma warning(pop) -#endif - - static size_type max_size(Allocator& a)BOOST_NOEXCEPT{return a.max_size();} - - static Allocator select_on_container_copy_construction(const Allocator& a) - { - return a; - } -}; - -#endif - -template -struct rebind_alloc_for -{ - typedef typename allocator_traits:: - template rebind_alloc::type type; -}; - -} /* namespace multi_index::detail */ - -} /* namespace multi_index */ - -} /* namespace boost */ - -#endif diff --git a/include/boost/multi_index/detail/auto_space.hpp b/include/boost/multi_index/detail/auto_space.hpp index 449456372..4ebc22740 100644 --- a/include/boost/multi_index/detail/auto_space.hpp +++ b/include/boost/multi_index/detail/auto_space.hpp @@ -1,4 +1,4 @@ -/* Copyright 2003-2022 Joaquin M Lopez Munoz. +/* Copyright 2003-2025 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) @@ -16,8 +16,8 @@ #include /* keep it first to prevent nasty warns in MSVC */ #include #include +#include #include -#include #include #include @@ -46,18 +46,15 @@ namespace detail{ template > struct auto_space:private noncopyable { - typedef typename rebind_alloc_for< - Allocator,T> - ::type allocator; - typedef allocator_traits alloc_traits; - typedef typename alloc_traits::pointer pointer; - typedef typename alloc_traits::size_type size_type; + typedef allocator_rebind_t allocator; + typedef allocator_pointer_t pointer; + typedef allocator_size_type_t size_type; explicit auto_space(const Allocator& al=Allocator(),size_type n=1): - al_(al),n_(n),data_(n_?alloc_traits::allocate(al_,n_):pointer(0)) + al_(al),n_(n),data_(n_?allocator_allocate(al_,n_):pointer(0)) {} - ~auto_space(){if(n_)alloc_traits::deallocate(al_,data_,n_);} + ~auto_space(){if(n_)allocator_deallocate(al_,data_,n_);} Allocator get_allocator()const{return al_;} @@ -68,7 +65,8 @@ struct auto_space:private noncopyable swap( x, boost::integral_constant< - bool,alloc_traits::propagate_on_container_swap::value>()); + bool, + allocator_propagate_on_container_swap_t::value>()); } void swap(auto_space& x,boost::true_type /* swap_allocators */) diff --git a/include/boost/multi_index/detail/bucket_array.hpp b/include/boost/multi_index/detail/bucket_array.hpp index ccab19701..0d4f9ef57 100644 --- a/include/boost/multi_index/detail/bucket_array.hpp +++ b/include/boost/multi_index/detail/bucket_array.hpp @@ -1,4 +1,4 @@ -/* Copyright 2003-2023 Joaquin M Lopez Munoz. +/* Copyright 2003-2025 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) @@ -15,8 +15,8 @@ #include /* keep it first to prevent nasty warns in MSVC */ #include +#include #include -#include #include #include #include @@ -129,10 +129,10 @@ class bucket_array:bucket_array_base<> { typedef bucket_array_base<> super; typedef hashed_index_base_node_impl< - typename rebind_alloc_for< + allocator_rebind_t< Allocator, char - >::type + > > base_node_impl_type; public: diff --git a/include/boost/multi_index/detail/copy_map.hpp b/include/boost/multi_index/detail/copy_map.hpp index 4e79697aa..daaf403d8 100644 --- a/include/boost/multi_index/detail/copy_map.hpp +++ b/include/boost/multi_index/detail/copy_map.hpp @@ -16,11 +16,11 @@ #include /* keep it first to prevent nasty warns in MSVC */ #include #include +#include #include #include #include #include -#include #include #include #include @@ -72,15 +72,12 @@ struct copy_map_value_mover template class copy_map:private noncopyable { - typedef typename rebind_alloc_for< - Allocator,Node - >::type allocator_type; - typedef allocator_traits alloc_traits; - typedef typename alloc_traits::pointer pointer; + typedef allocator_rebind_t allocator_type; + typedef allocator_pointer_t pointer; public: - typedef const copy_map_entry* const_iterator; - typedef typename alloc_traits::size_type size_type; + typedef const copy_map_entry* const_iterator; + typedef allocator_size_type_t size_type; copy_map( const Allocator& al,size_type size,Node* header_org,Node* header_cpy): @@ -92,7 +89,7 @@ class copy_map:private noncopyable { if(!released){ for(size_type i=0;isecond->value())); deallocate((spc.data()+i)->second); } @@ -128,12 +125,12 @@ class copy_map:private noncopyable pointer allocate() { - return alloc_traits::allocate(al_,1); + return allocator_allocate(al_,1); } void deallocate(Node* node) { - alloc_traits::deallocate(al_,static_cast(node),1); + allocator_deallocate(al_,static_cast(node),1); } template @@ -142,7 +139,7 @@ class copy_map:private noncopyable (spc.data()+n)->first=node; (spc.data()+n)->second=raw_ptr(allocate()); BOOST_TRY{ - alloc_traits::construct( + allocator_construct( al_,boost::addressof((spc.data()+n)->second->value()), access(node->value())); } diff --git a/include/boost/multi_index/detail/hash_index_node.hpp b/include/boost/multi_index/detail/hash_index_node.hpp index bcb4745ea..17bd966d1 100644 --- a/include/boost/multi_index/detail/hash_index_node.hpp +++ b/include/boost/multi_index/detail/hash_index_node.hpp @@ -1,4 +1,4 @@ -/* Copyright 2003-2020 Joaquin M Lopez Munoz. +/* Copyright 2003-2025 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) @@ -14,7 +14,7 @@ #endif #include /* keep it first to prevent nasty warns in MSVC */ -#include +#include #include #include @@ -99,19 +99,17 @@ struct hashed_index_node_impl; template struct hashed_index_base_node_impl { - typedef typename rebind_alloc_for< + typedef allocator_rebind_t< Allocator,hashed_index_base_node_impl - >::type base_allocator; - typedef typename rebind_alloc_for< + > base_allocator; + typedef allocator_rebind_t< Allocator,hashed_index_node_impl - >::type node_allocator; - typedef allocator_traits base_alloc_traits; - typedef allocator_traits node_alloc_traits; - typedef typename base_alloc_traits::pointer base_pointer; - typedef typename base_alloc_traits::const_pointer const_base_pointer; - typedef typename node_alloc_traits::pointer pointer; - typedef typename node_alloc_traits::const_pointer const_pointer; - typedef typename node_alloc_traits::difference_type difference_type; + > node_allocator; + typedef allocator_pointer_t base_pointer; + typedef allocator_const_pointer_t const_base_pointer; + typedef allocator_pointer_t pointer; + typedef allocator_const_pointer_t const_pointer; + typedef allocator_difference_type_t difference_type; pointer& prior(){return prior_;} pointer prior()const{return prior_;} @@ -689,14 +687,14 @@ struct hashed_index_node_alg template struct hashed_index_node_trampoline: hashed_index_node_impl< - typename rebind_alloc_for< + allocator_rebind_t< typename Super::allocator_type,char - >::type + > > { - typedef typename rebind_alloc_for< + typedef allocator_rebind_t< typename Super::allocator_type,char - >::type impl_allocator_type; + > impl_allocator_type; typedef hashed_index_node_impl impl_type; }; diff --git a/include/boost/multi_index/detail/index_base.hpp b/include/boost/multi_index/detail/index_base.hpp index 0d0a0a712..c2ea74591 100644 --- a/include/boost/multi_index/detail/index_base.hpp +++ b/include/boost/multi_index/detail/index_base.hpp @@ -15,10 +15,10 @@ #include /* keep it first to prevent nasty warns in MSVC */ #include +#include #include #include #include -#include #include #include #include @@ -62,9 +62,7 @@ class index_base typedef multi_index_container< Value,IndexSpecifierList,Allocator> final_type; typedef tuples::null_type ctor_args_list; - typedef typename rebind_alloc_for< - Allocator,typename Allocator::value_type - >::type final_allocator_type; + typedef Allocator final_allocator_type; typedef node_handle< final_node_type,final_allocator_type> final_node_handle_type; typedef empty_type_list index_type_list; @@ -86,8 +84,7 @@ class index_base private: typedef Value value_type; - typedef allocator_traits alloc_traits; - typedef typename alloc_traits::size_type size_type; + typedef allocator_size_type_t size_type; protected: explicit index_base(const ctor_args_list&,const Allocator&){} diff --git a/include/boost/multi_index/detail/node_handle.hpp b/include/boost/multi_index/detail/node_handle.hpp index d25c73b2a..c3935b854 100644 --- a/include/boost/multi_index/detail/node_handle.hpp +++ b/include/boost/multi_index/detail/node_handle.hpp @@ -1,4 +1,4 @@ -/* Copyright 2003-2022 Joaquin M Lopez Munoz. +/* Copyright 2003-2025 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) @@ -16,11 +16,11 @@ #include /* keep it first to prevent nasty warns in MSVC */ #include #include +#include #include #include #include #include -#include #include #include #include @@ -49,10 +49,6 @@ class node_handle typedef typename Node::value_type value_type; typedef Allocator allocator_type; -private: - typedef allocator_traits alloc_traits; - -public: node_handle()BOOST_NOEXCEPT:node(0){} node_handle(BOOST_RV_REF(node_handle) x)BOOST_NOEXCEPT:node(x.node) @@ -79,7 +75,8 @@ class node_handle delete_node(); if(!x.empty()){ BOOST_MULTI_INDEX_IF_CONSTEXPR( - alloc_traits::propagate_on_container_move_assignment::value){ + allocator_propagate_on_container_move_assignment_t< + allocator_type>::value){ move_assign_allocator(boost::move(x)); } x.destroy_allocator(); @@ -115,13 +112,13 @@ class node_handle void swap(node_handle& x) BOOST_NOEXCEPT_IF( - alloc_traits::propagate_on_container_swap::value|| - alloc_traits::is_always_equal::value) + allocator_propagate_on_container_swap_t::value|| + allocator_is_always_equal_t::value) { if(!empty()){ if(!x.empty()){ BOOST_MULTI_INDEX_IF_CONSTEXPR( - alloc_traits::propagate_on_container_swap::value){ + allocator_propagate_on_container_swap_t::value){ using std::swap; swap(*allocator_ptr(),*x.allocator_ptr()); } @@ -192,15 +189,12 @@ class node_handle void delete_node() { - typedef typename rebind_alloc_for< - allocator_type,Node - >::type node_allocator; - typedef detail::allocator_traits node_alloc_traits; - typedef typename node_alloc_traits::pointer node_pointer; + typedef allocator_rebind_t node_allocator; + typedef allocator_pointer_t node_pointer; - alloc_traits::destroy(*allocator_ptr(),boost::addressof(node->value())); + allocator_destroy(*allocator_ptr(),boost::addressof(node->value())); node_allocator nal(*allocator_ptr()); - node_alloc_traits::deallocate(nal,static_cast(node),1); + allocator_deallocate(nal,static_cast(node),1); } Node* node; diff --git a/include/boost/multi_index/detail/ord_index_impl.hpp b/include/boost/multi_index/detail/ord_index_impl.hpp index c712d485c..bd73b5398 100644 --- a/include/boost/multi_index/detail/ord_index_impl.hpp +++ b/include/boost/multi_index/detail/ord_index_impl.hpp @@ -44,6 +44,7 @@ #include #include #include +#include #include #include #include @@ -52,7 +53,6 @@ #include #include #include -#include #include #include #include @@ -180,15 +180,11 @@ class ordered_index_impl: #endif typedef iterator const_iterator; - -private: - typedef allocator_traits alloc_traits; - -public: - typedef typename alloc_traits::size_type size_type; - typedef typename alloc_traits::difference_type difference_type; - typedef typename alloc_traits::pointer pointer; - typedef typename alloc_traits::const_pointer const_pointer; + typedef allocator_size_type_t size_type; + typedef allocator_difference_type_t< + allocator_type> difference_type; + typedef allocator_pointer_t pointer; + typedef allocator_const_pointer_t const_pointer; typedef typename std::reverse_iterator reverse_iterator; typedef typename diff --git a/include/boost/multi_index/detail/ord_index_node.hpp b/include/boost/multi_index/detail/ord_index_node.hpp index 9dfe24e3d..008e1ea8a 100644 --- a/include/boost/multi_index/detail/ord_index_node.hpp +++ b/include/boost/multi_index/detail/ord_index_node.hpp @@ -41,8 +41,8 @@ #endif #include /* keep it first to prevent nasty warns in MSVC */ +#include #include -#include #include #if !defined(BOOST_MULTI_INDEX_DISABLE_COMPRESSED_ORDERED_INDEX_NODES) @@ -69,15 +69,14 @@ struct ordered_index_node_impl; /* fwd decl. */ template struct ordered_index_node_traits { - typedef typename rebind_alloc_for< + typedef allocator_rebind_t< Allocator, ordered_index_node_impl - >::type allocator; - typedef allocator_traits alloc_traits; - typedef typename alloc_traits::pointer pointer; - typedef typename alloc_traits::const_pointer const_pointer; - typedef typename alloc_traits::difference_type difference_type; - typedef typename alloc_traits::size_type size_type; + > allocator; + typedef allocator_pointer_t pointer; + typedef allocator_const_pointer_t const_pointer; + typedef allocator_difference_type_t difference_type; + typedef allocator_size_type_t size_type; }; template @@ -579,18 +578,18 @@ template struct ordered_index_node_trampoline: ordered_index_node_impl< AugmentPolicy, - typename rebind_alloc_for< + allocator_rebind_t< typename Super::allocator_type, char - >::type + > > { typedef ordered_index_node_impl< AugmentPolicy, - typename rebind_alloc_for< + allocator_rebind_t< typename Super::allocator_type, char - >::type + > > impl_type; }; diff --git a/include/boost/multi_index/detail/rnd_index_loader.hpp b/include/boost/multi_index/detail/rnd_index_loader.hpp index cf6f0690f..aaedbb714 100644 --- a/include/boost/multi_index/detail/rnd_index_loader.hpp +++ b/include/boost/multi_index/detail/rnd_index_loader.hpp @@ -1,4 +1,4 @@ -/* Copyright 2003-2022 Joaquin M Lopez Munoz. +/* Copyright 2003-2025 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) @@ -14,9 +14,9 @@ #endif #include /* keep it first to prevent nasty warns in MSVC */ +#include #include #include -#include #include #include @@ -44,10 +44,10 @@ class random_access_index_loader_base:private noncopyable { protected: typedef random_access_index_node_impl< - typename rebind_alloc_for< + allocator_rebind_t< Allocator, char - >::type + > > node_impl_type; typedef typename node_impl_type::pointer node_impl_pointer; typedef random_access_index_ptr_array ptr_array; @@ -93,8 +93,7 @@ class random_access_index_loader_base:private noncopyable } private: - typedef allocator_traits alloc_traits; - typedef typename alloc_traits::size_type size_type; + typedef allocator_size_type_t size_type; void preprocess() { diff --git a/include/boost/multi_index/detail/rnd_index_node.hpp b/include/boost/multi_index/detail/rnd_index_node.hpp index 9f76eedee..20a827188 100644 --- a/include/boost/multi_index/detail/rnd_index_node.hpp +++ b/include/boost/multi_index/detail/rnd_index_node.hpp @@ -1,4 +1,4 @@ -/* Copyright 2003-2021 Joaquin M Lopez Munoz. +/* Copyright 2003-2025 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) @@ -14,9 +14,9 @@ #endif #include /* keep it first to prevent nasty warns in MSVC */ +#include #include #include -#include #include #include #include @@ -30,18 +30,16 @@ namespace detail{ template struct random_access_index_node_impl { - typedef typename rebind_alloc_for< + typedef allocator_rebind_t< Allocator,random_access_index_node_impl - >::type node_allocator; - typedef allocator_traits node_alloc_traits; - typedef typename node_alloc_traits::pointer pointer; - typedef typename node_alloc_traits::const_pointer const_pointer; - typedef typename node_alloc_traits::difference_type difference_type; - typedef typename rebind_alloc_for< + > node_allocator; + typedef allocator_pointer_t pointer; + typedef allocator_const_pointer_t const_pointer; + typedef allocator_difference_type_t difference_type; + typedef allocator_rebind_t< Allocator,pointer - >::type ptr_allocator; - typedef allocator_traits ptr_alloc_traits; - typedef typename ptr_alloc_traits::pointer ptr_pointer; + > ptr_allocator; + typedef allocator_pointer_t ptr_pointer; ptr_pointer& up(){return up_;} ptr_pointer up()const{return up_;} @@ -195,17 +193,17 @@ struct random_access_index_node_impl template struct random_access_index_node_trampoline: random_access_index_node_impl< - typename rebind_alloc_for< + allocator_rebind_t< typename Super::allocator_type, char - >::type + > > { typedef random_access_index_node_impl< - typename rebind_alloc_for< + allocator_rebind_t< typename Super::allocator_type, char - >::type + > > impl_type; }; diff --git a/include/boost/multi_index/detail/rnd_index_ptr_array.hpp b/include/boost/multi_index/detail/rnd_index_ptr_array.hpp index e758b628d..0eb374441 100644 --- a/include/boost/multi_index/detail/rnd_index_ptr_array.hpp +++ b/include/boost/multi_index/detail/rnd_index_ptr_array.hpp @@ -1,4 +1,4 @@ -/* Copyright 2003-2022 Joaquin M Lopez Munoz. +/* Copyright 2003-2025 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) @@ -14,9 +14,9 @@ #endif #include /* keep it first to prevent nasty warns in MSVC */ +#include #include #include -#include #include #include @@ -32,20 +32,21 @@ template class random_access_index_ptr_array:private noncopyable { typedef random_access_index_node_impl< - typename rebind_alloc_for< + allocator_rebind_t< Allocator, char - >::type + > > node_impl_type; public: typedef typename node_impl_type::pointer value_type; - typedef typename rebind_alloc_for< + typedef allocator_rebind_t< Allocator,value_type - >::type value_allocator; - typedef allocator_traits alloc_traits; - typedef typename alloc_traits::pointer pointer; - typedef typename alloc_traits::size_type size_type; + > value_allocator; + typedef allocator_pointer_t< + value_allocator> pointer; + typedef allocator_size_type_t< + value_allocator> size_type; random_access_index_ptr_array( const Allocator& al,value_type end_,size_type sz): diff --git a/include/boost/multi_index/detail/seq_index_node.hpp b/include/boost/multi_index/detail/seq_index_node.hpp index 626d8d6dc..c6e568b1c 100644 --- a/include/boost/multi_index/detail/seq_index_node.hpp +++ b/include/boost/multi_index/detail/seq_index_node.hpp @@ -1,4 +1,4 @@ -/* Copyright 2003-2019 Joaquin M Lopez Munoz. +/* Copyright 2003-2025 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) @@ -14,8 +14,8 @@ #endif #include /* keep it first to prevent nasty warns in MSVC */ +#include #include -#include #include namespace boost{ @@ -29,13 +29,14 @@ namespace detail{ template struct sequenced_index_node_impl { - typedef typename rebind_alloc_for< + typedef allocator_rebind_t< Allocator,sequenced_index_node_impl - >::type node_allocator; - typedef allocator_traits alloc_traits; - typedef typename alloc_traits::pointer pointer; - typedef typename alloc_traits::const_pointer const_pointer; - typedef typename alloc_traits::difference_type difference_type; + > node_allocator; + typedef allocator_pointer_t pointer; + typedef allocator_const_pointer_t< + node_allocator> const_pointer; + typedef allocator_difference_type_t< + node_allocator> difference_type; pointer& prior(){return prior_;} pointer prior()const{return prior_;} @@ -132,17 +133,17 @@ struct sequenced_index_node_impl template struct sequenced_index_node_trampoline: sequenced_index_node_impl< - typename rebind_alloc_for< + allocator_rebind_t< typename Super::allocator_type, char - >::type + > > { typedef sequenced_index_node_impl< - typename rebind_alloc_for< + allocator_rebind_t< typename Super::allocator_type, char - >::type + > > impl_type; }; diff --git a/include/boost/multi_index/hashed_index.hpp b/include/boost/multi_index/hashed_index.hpp index 6991909b7..e767133ed 100644 --- a/include/boost/multi_index/hashed_index.hpp +++ b/include/boost/multi_index/hashed_index.hpp @@ -17,6 +17,7 @@ #include #include #include +#include #include #include #include @@ -25,7 +26,6 @@ #include #include #include -#include #include #include #include @@ -133,17 +133,14 @@ class hashed_index: typedef Hash hasher; typedef Pred key_equal; typedef typename super::final_allocator_type allocator_type; - -private: - typedef allocator_traits alloc_traits; - -public: - typedef typename alloc_traits::pointer pointer; - typedef typename alloc_traits::const_pointer const_pointer; + typedef allocator_pointer_t pointer; + typedef allocator_const_pointer_t< + allocator_type> const_pointer; typedef value_type& reference; typedef const value_type& const_reference; - typedef typename alloc_traits::size_type size_type; - typedef typename alloc_traits::difference_type difference_type; + typedef allocator_size_type_t size_type; + typedef allocator_difference_type_t< + allocator_type> difference_type; typedef tuple ctor_args; diff --git a/include/boost/multi_index/random_access_index.hpp b/include/boost/multi_index/random_access_index.hpp index 9f9a43566..ecc5ea8f3 100644 --- a/include/boost/multi_index/random_access_index.hpp +++ b/include/boost/multi_index/random_access_index.hpp @@ -18,13 +18,13 @@ #include #include #include +#include #include #include #include #include #include #include -#include #include #include #include @@ -130,15 +130,12 @@ class random_access_index: #endif typedef iterator const_iterator; - -private: - typedef allocator_traits alloc_traits; - -public: - typedef typename alloc_traits::pointer pointer; - typedef typename alloc_traits::const_pointer const_pointer; - typedef typename alloc_traits::size_type size_type; - typedef typename alloc_traits::difference_type difference_type; + typedef allocator_pointer_t pointer; + typedef allocator_const_pointer_t< + allocator_type> const_pointer; + typedef allocator_size_type_t size_type; + typedef allocator_difference_type_t< + allocator_type> difference_type; typedef typename std::reverse_iterator reverse_iterator; typedef typename diff --git a/include/boost/multi_index/sequenced_index.hpp b/include/boost/multi_index/sequenced_index.hpp index 48974757d..121b232f0 100644 --- a/include/boost/multi_index/sequenced_index.hpp +++ b/include/boost/multi_index/sequenced_index.hpp @@ -17,13 +17,13 @@ #include #include #include +#include #include #include #include #include #include #include -#include #include #include #include @@ -117,15 +117,12 @@ class sequenced_index: #endif typedef iterator const_iterator; - -private: - typedef allocator_traits alloc_traits; - -public: - typedef typename alloc_traits::pointer pointer; - typedef typename alloc_traits::const_pointer const_pointer; - typedef typename alloc_traits::size_type size_type; - typedef typename alloc_traits::difference_type difference_type; + typedef allocator_pointer_t pointer; + typedef allocator_const_pointer< + allocator_type> const_pointer; + typedef allocator_size_type_t size_type; + typedef allocator_difference_type_t< + allocator_type> difference_type; typedef typename std::reverse_iterator reverse_iterator; typedef typename diff --git a/include/boost/multi_index_container.hpp b/include/boost/multi_index_container.hpp index 8171309f1..9b1fb07f9 100644 --- a/include/boost/multi_index_container.hpp +++ b/include/boost/multi_index_container.hpp @@ -18,6 +18,7 @@ #include /* keep it first to prevent nasty warns in MSVC */ #include #include +#include #include #include #include @@ -28,7 +29,6 @@ #include #include #include -#include #include #include #include @@ -96,20 +96,20 @@ struct unequal_alloc_move_ctor_tag{}; template class multi_index_container: private ::boost::base_from_member< - typename detail::rebind_alloc_for< + allocator_rebind_t< Allocator, typename detail::multi_index_node_type< Value,IndexSpecifierList,Allocator>::type - >::type + > >, BOOST_MULTI_INDEX_PRIVATE_IF_MEMBER_TEMPLATE_FRIENDS detail::header_holder< - typename detail::allocator_traits< - typename detail::rebind_alloc_for< + allocator_pointer_t< + allocator_rebind_t< Allocator, typename detail::multi_index_node_type< Value,IndexSpecifierList,Allocator>::type - >::type - >::pointer, + > + >, multi_index_container >, public detail::multi_index_base_type< Value,IndexSpecifierList,Allocator>::type @@ -135,12 +135,11 @@ class multi_index_container: typedef typename detail::multi_index_base_type< Value,IndexSpecifierList,Allocator>::type super; - typedef typename detail::rebind_alloc_for< + typedef allocator_rebind_t< Allocator, typename super::index_node_type - >::type node_allocator; - typedef detail::allocator_traits node_alloc_traits; - typedef typename node_alloc_traits::pointer node_pointer; + > node_allocator; + typedef allocator_pointer_t node_pointer; typedef ::boost::base_from_member< node_allocator> bfm_allocator; typedef detail::header_holder< @@ -284,7 +283,7 @@ class multi_index_container: multi_index_container( const multi_index_container& x): bfm_allocator( - node_alloc_traits::select_on_container_copy_construction( + allocator_select_on_container_copy_construction( x.bfm_allocator::member)), bfm_header(), super(x), @@ -361,7 +360,8 @@ class multi_index_container: { multi_index_container y( x, - node_alloc_traits::propagate_on_container_copy_assignment::value? + allocator_propagate_on_container_copy_assignment_t< + node_allocator>::value? x.get_allocator():this->get_allocator()); swap_(y,boost::true_type() /* swap_allocators */); return *this; @@ -373,7 +373,8 @@ class multi_index_container: #include BOOST_MULTI_INDEX_IF_CONSTEXPR( - node_alloc_traits::propagate_on_container_move_assignment::value){ + allocator_propagate_on_container_move_assignment_t< + node_allocator>::value){ swap_(x,boost::true_type() /* swap_allocators */); } else if(this->get_allocator()==x.get_allocator()){ @@ -641,26 +642,26 @@ class multi_index_container: final_node_type* allocate_node() { - return &*node_alloc_traits::allocate(bfm_allocator::member,1); + return &*allocator_allocate(bfm_allocator::member,1); } void deallocate_node(final_node_type* x) { - node_alloc_traits::deallocate( + allocator_deallocate( bfm_allocator::member,static_cast(x),1); } template void construct_value(final_node_type* x,Args&&... args) { - node_alloc_traits::construct( + allocator_construct( bfm_allocator::member,boost::addressof(x->value()), std::forward(args)...); } void destroy_value(final_node_type* x) { - node_alloc_traits::destroy( + allocator_destroy( bfm_allocator::member,boost::addressof(x->value())); } @@ -979,7 +980,8 @@ class multi_index_container: swap_( x, boost::integral_constant< - bool,node_alloc_traits::propagate_on_container_swap::value>()); + bool,allocator_propagate_on_container_swap_t< + node_allocator>::value>()); } void swap_( From 03931a507cb87b4c050d2a16e9469c45ac90b044 Mon Sep 17 00:00:00 2001 From: joaquintides Date: Thu, 6 Nov 2025 17:30:41 +0100 Subject: [PATCH 03/24] removed usage of Boost.Move --- include/boost/multi_index/detail/copy_map.hpp | 7 +- .../boost/multi_index/detail/index_base.hpp | 5 +- .../boost/multi_index/detail/node_handle.hpp | 42 +++---- .../multi_index/detail/ord_index_impl.hpp | 20 ++-- include/boost/multi_index/hashed_index.hpp | 20 ++-- .../boost/multi_index/random_access_index.hpp | 24 ++-- include/boost/multi_index/sequenced_index.hpp | 24 ++-- include/boost/multi_index_container.hpp | 33 +----- test/employee.hpp | 16 +-- test/test_alloc_awareness.cpp | 18 ++- test/test_copy_assignment.cpp | 8 +- test/test_modifiers.cpp | 19 ++- test/test_node_handling.cpp | 110 +++++++----------- test/test_safe_mode.cpp | 15 ++- test/test_serialization3.cpp | 8 +- 15 files changed, 148 insertions(+), 221 deletions(-) diff --git a/include/boost/multi_index/detail/copy_map.hpp b/include/boost/multi_index/detail/copy_map.hpp index daaf403d8..e00607e02 100644 --- a/include/boost/multi_index/detail/copy_map.hpp +++ b/include/boost/multi_index/detail/copy_map.hpp @@ -1,4 +1,4 @@ -/* Copyright 2003-2022 Joaquin M Lopez Munoz. +/* Copyright 2003-2025 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) @@ -19,11 +19,10 @@ #include #include #include -#include -#include #include #include #include +#include namespace boost{ @@ -66,7 +65,7 @@ struct copy_map_value_copier struct copy_map_value_mover { template - BOOST_RV_REF(Value) operator()(Value& x)const{return boost::move(x);} + Value&& operator()(Value& x)const{return std::move(x);} }; template diff --git a/include/boost/multi_index/detail/index_base.hpp b/include/boost/multi_index/detail/index_base.hpp index c2ea74591..fe5643df2 100644 --- a/include/boost/multi_index/detail/index_base.hpp +++ b/include/boost/multi_index/detail/index_base.hpp @@ -18,7 +18,6 @@ #include #include #include -#include #include #include #include @@ -116,7 +115,7 @@ class index_base { x=final().allocate_node(); BOOST_TRY{ - final().construct_value(x,boost::move(const_cast(v))); + final().construct_value(x,std::move(const_cast(v))); } BOOST_CATCH(...){ final().deallocate_node(x); @@ -179,7 +178,7 @@ class index_base bool replace_(const value_type& v,index_node_type* x,rvalue_tag) { - x->value()=boost::move(const_cast(v)); + x->value()=std::move(const_cast(v)); return true; } diff --git a/include/boost/multi_index/detail/node_handle.hpp b/include/boost/multi_index/detail/node_handle.hpp index c3935b854..1a97d5626 100644 --- a/include/boost/multi_index/detail/node_handle.hpp +++ b/include/boost/multi_index/detail/node_handle.hpp @@ -18,12 +18,11 @@ #include #include #include -#include -#include #include #include #include #include +#include #if !defined(BOOST_NO_SFINAE) #include @@ -51,10 +50,10 @@ class node_handle node_handle()BOOST_NOEXCEPT:node(0){} - node_handle(BOOST_RV_REF(node_handle) x)BOOST_NOEXCEPT:node(x.node) + node_handle(node_handle&& x)BOOST_NOEXCEPT:node(x.node) { if(!x.empty()){ - move_construct_allocator(boost::move(x)); + move_construct_allocator(std::move(x)); x.destroy_allocator(); x.node=0; } @@ -68,7 +67,7 @@ class node_handle } } - node_handle& operator=(BOOST_RV_REF(node_handle) x) + node_handle& operator=(node_handle&& x) { if(this!=&x){ if(!empty()){ @@ -77,7 +76,7 @@ class node_handle BOOST_MULTI_INDEX_IF_CONSTEXPR( allocator_propagate_on_container_move_assignment_t< allocator_type>::value){ - move_assign_allocator(boost::move(x)); + move_assign_allocator(std::move(x)); } x.destroy_allocator(); } @@ -86,7 +85,7 @@ class node_handle } } else if(!x.empty()){ - move_construct_allocator(boost::move(x)); + move_construct_allocator(std::move(x)); x.destroy_allocator(); } node=x.node; @@ -124,12 +123,12 @@ class node_handle } } else{ - x.move_construct_allocator(boost::move(*this)); + x.move_construct_allocator(std::move(*this)); destroy_allocator(); } } else if(!x.empty()){ - move_construct_allocator(boost::move(x)); + move_construct_allocator(std::move(x)); x.destroy_allocator(); } std::swap(node,x.node); @@ -142,8 +141,6 @@ class node_handle } private: - BOOST_MOVABLE_BUT_NOT_COPYABLE(node_handle) - template friend class boost::multi_index::multi_index_container; @@ -174,15 +171,15 @@ class node_handle #include - void move_construct_allocator(BOOST_RV_REF(node_handle) x) + void move_construct_allocator(node_handle&& x) { ::new (static_cast(allocator_ptr())) - allocator_type(boost::move(*x.allocator_ptr())); + allocator_type(std::move(*x.allocator_ptr())); } - void move_assign_allocator(BOOST_RV_REF(node_handle) x) + void move_assign_allocator(node_handle&& x) { - *allocator_ptr()=boost::move(*x.allocator_ptr()); + *allocator_ptr()=std::move(*x.allocator_ptr()); } void destroy_allocator(){allocator_ptr()->~allocator_type();} @@ -214,25 +211,22 @@ template struct insert_return_type { insert_return_type( - Iterator position_,bool inserted_,BOOST_RV_REF(NodeHandle) node_): - position(position_),inserted(inserted_),node(boost::move(node_)){} - insert_return_type(BOOST_RV_REF(insert_return_type) x): - position(x.position),inserted(x.inserted),node(boost::move(x.node)){} + Iterator position_,bool inserted_,NodeHandle&& node_): + position(position_),inserted(inserted_),node(std::move(node_)){} + insert_return_type(insert_return_type&& x): + position(x.position),inserted(x.inserted),node(std::move(x.node)){} - insert_return_type& operator=(BOOST_RV_REF(insert_return_type) x) + insert_return_type& operator=(insert_return_type&& x) { position=x.position; inserted=x.inserted; - node=boost::move(x.node); + node=std::move(x.node); return *this; } Iterator position; bool inserted; NodeHandle node; - -private: - BOOST_MOVABLE_BUT_NOT_COPYABLE(insert_return_type) }; /* utility for SFINAEing merge and related operations */ diff --git a/include/boost/multi_index/detail/ord_index_impl.hpp b/include/boost/multi_index/detail/ord_index_impl.hpp index bd73b5398..d46d6084d 100644 --- a/include/boost/multi_index/detail/ord_index_impl.hpp +++ b/include/boost/multi_index/detail/ord_index_impl.hpp @@ -48,8 +48,6 @@ #include #include #include -#include -#include #include #include #include @@ -321,7 +319,7 @@ class ordered_index_impl: return std::pair(make_iterator(p.first),p.second); } - std::pair insert(BOOST_RV_REF(value_type) x) + std::pair insert(value_type&& x) { BOOST_MULTI_INDEX_ORD_INDEX_CHECK_INVARIANT; std::pair p=this->final_insert_rv_(x); @@ -338,7 +336,7 @@ class ordered_index_impl: return make_iterator(p.first); } - iterator insert(iterator position,BOOST_RV_REF(value_type) x) + iterator insert(iterator position,value_type&& x) { BOOST_MULTI_INDEX_CHECK_VALID_ITERATOR(position); BOOST_MULTI_INDEX_CHECK_IS_OWNER(position,*this); @@ -362,15 +360,15 @@ class ordered_index_impl: } #endif - insert_return_type insert(BOOST_RV_REF(node_type) nh) + insert_return_type insert(node_type&& nh) { if(nh)BOOST_MULTI_INDEX_CHECK_EQUAL_ALLOCATORS(*this,nh); BOOST_MULTI_INDEX_ORD_INDEX_CHECK_INVARIANT; std::pair p=this->final_insert_nh_(nh); - return insert_return_type(make_iterator(p.first),p.second,boost::move(nh)); + return insert_return_type(make_iterator(p.first),p.second,std::move(nh)); } - iterator insert(const_iterator position,BOOST_RV_REF(node_type) nh) + iterator insert(const_iterator position,node_type&& nh) { BOOST_MULTI_INDEX_CHECK_VALID_ITERATOR(position); BOOST_MULTI_INDEX_CHECK_IS_OWNER(position,*this); @@ -444,7 +442,7 @@ class ordered_index_impl: x,static_cast(position.get_node())); } - bool replace(iterator position,BOOST_RV_REF(value_type) x) + bool replace(iterator position,value_type&& x) { BOOST_MULTI_INDEX_CHECK_VALID_ITERATOR(position); BOOST_MULTI_INDEX_CHECK_DEREFERENCEABLE_ITERATOR(position); @@ -544,7 +542,7 @@ class ordered_index_impl: template BOOST_MULTI_INDEX_ENABLE_IF_MERGEABLE(ordered_index_impl,Index,void) - merge(BOOST_RV_REF(Index) x){merge(static_cast(x));} + merge(Index&& x){merge(static_cast(x));} template BOOST_MULTI_INDEX_ENABLE_IF_MERGEABLE( @@ -570,7 +568,7 @@ class ordered_index_impl: template BOOST_MULTI_INDEX_ENABLE_IF_MERGEABLE( ordered_index_impl,Index,pair_return_type) - merge(BOOST_RV_REF(Index) x,BOOST_DEDUCED_TYPENAME Index::iterator i) + merge(Index&& x,BOOST_DEDUCED_TYPENAME Index::iterator i) { return merge(static_cast(x),i); } @@ -597,7 +595,7 @@ class ordered_index_impl: template BOOST_MULTI_INDEX_ENABLE_IF_MERGEABLE(ordered_index_impl,Index,void) merge( - BOOST_RV_REF(Index) x, + Index&& x, BOOST_DEDUCED_TYPENAME Index::iterator first, BOOST_DEDUCED_TYPENAME Index::iterator last) { diff --git a/include/boost/multi_index/hashed_index.hpp b/include/boost/multi_index/hashed_index.hpp index e767133ed..300fbece1 100644 --- a/include/boost/multi_index/hashed_index.hpp +++ b/include/boost/multi_index/hashed_index.hpp @@ -21,8 +21,6 @@ #include #include #include -#include -#include #include #include #include @@ -298,7 +296,7 @@ class hashed_index: return std::pair(make_iterator(p.first),p.second); } - std::pair insert(BOOST_RV_REF(value_type) x) + std::pair insert(value_type&& x) { BOOST_MULTI_INDEX_HASHED_INDEX_CHECK_INVARIANT; std::pair p=this->final_insert_rv_(x); @@ -315,7 +313,7 @@ class hashed_index: return make_iterator(p.first); } - iterator insert(iterator position,BOOST_RV_REF(value_type) x) + iterator insert(iterator position,value_type&& x) { BOOST_MULTI_INDEX_CHECK_VALID_ITERATOR(position); BOOST_MULTI_INDEX_CHECK_IS_OWNER(position,*this); @@ -339,15 +337,15 @@ class hashed_index: } #endif - insert_return_type insert(BOOST_RV_REF(node_type) nh) + insert_return_type insert(node_type&& nh) { if(nh)BOOST_MULTI_INDEX_CHECK_EQUAL_ALLOCATORS(*this,nh); BOOST_MULTI_INDEX_HASHED_INDEX_CHECK_INVARIANT; std::pair p=this->final_insert_nh_(nh); - return insert_return_type(make_iterator(p.first),p.second,boost::move(nh)); + return insert_return_type(make_iterator(p.first),p.second,std::move(nh)); } - iterator insert(const_iterator position,BOOST_RV_REF(node_type) nh) + iterator insert(const_iterator position,node_type&& nh) { BOOST_MULTI_INDEX_CHECK_VALID_ITERATOR(position); BOOST_MULTI_INDEX_CHECK_IS_OWNER(position,*this); @@ -432,7 +430,7 @@ class hashed_index: x,static_cast(position.get_node())); } - bool replace(iterator position,BOOST_RV_REF(value_type) x) + bool replace(iterator position,value_type&& x) { BOOST_MULTI_INDEX_CHECK_VALID_ITERATOR(position); BOOST_MULTI_INDEX_CHECK_DEREFERENCEABLE_ITERATOR(position); @@ -530,7 +528,7 @@ class hashed_index: template BOOST_MULTI_INDEX_ENABLE_IF_MERGEABLE(hashed_index,Index,void) - merge(BOOST_RV_REF(Index) x){merge(static_cast(x));} + merge(Index&& x){merge(static_cast(x));} template BOOST_MULTI_INDEX_ENABLE_IF_MERGEABLE(hashed_index,Index,pair_return_type) @@ -554,7 +552,7 @@ class hashed_index: template BOOST_MULTI_INDEX_ENABLE_IF_MERGEABLE(hashed_index,Index,pair_return_type) - merge(BOOST_RV_REF(Index) x,BOOST_DEDUCED_TYPENAME Index::iterator i) + merge(Index&& x,BOOST_DEDUCED_TYPENAME Index::iterator i) { return merge(static_cast(x),i); } @@ -581,7 +579,7 @@ class hashed_index: template BOOST_MULTI_INDEX_ENABLE_IF_MERGEABLE(hashed_index,Index,void) merge( - BOOST_RV_REF(Index) x, + Index&& x, BOOST_DEDUCED_TYPENAME Index::iterator first, BOOST_DEDUCED_TYPENAME Index::iterator last) { diff --git a/include/boost/multi_index/random_access_index.hpp b/include/boost/multi_index/random_access_index.hpp index ecc5ea8f3..5737f136d 100644 --- a/include/boost/multi_index/random_access_index.hpp +++ b/include/boost/multi_index/random_access_index.hpp @@ -21,8 +21,6 @@ #include #include #include -#include -#include #include #include #include @@ -331,8 +329,8 @@ class random_access_index: std::pair push_front(const value_type& x) {return insert(begin(),x);} - std::pair push_front(BOOST_RV_REF(value_type) x) - {return insert(begin(),boost::move(x));} + std::pair push_front(value_type&& x) + {return insert(begin(),std::move(x));} void pop_front(){erase(begin());} template @@ -343,8 +341,8 @@ class random_access_index: std::pair push_back(const value_type& x) {return insert(end(),x);} - std::pair push_back(BOOST_RV_REF(value_type) x) - {return insert(end(),boost::move(x));} + std::pair push_back(value_type&& x) + {return insert(end(),std::move(x));} void pop_back(){erase(--end());} template @@ -373,7 +371,7 @@ class random_access_index: return std::pair(make_iterator(p.first),p.second); } - std::pair insert(iterator position,BOOST_RV_REF(value_type) x) + std::pair insert(iterator position,value_type&& x) { BOOST_MULTI_INDEX_CHECK_VALID_ITERATOR(position); BOOST_MULTI_INDEX_CHECK_IS_OWNER(position,*this); @@ -417,7 +415,7 @@ class random_access_index: } #endif - insert_return_type insert(const_iterator position,BOOST_RV_REF(node_type) nh) + insert_return_type insert(const_iterator position,node_type&& nh) { BOOST_MULTI_INDEX_CHECK_VALID_ITERATOR(position); BOOST_MULTI_INDEX_CHECK_IS_OWNER(position,*this); @@ -427,7 +425,7 @@ class random_access_index: if(p.second&&position.get_node()!=header()){ relocate(position.get_node(),p.first); } - return insert_return_type(make_iterator(p.first),p.second,boost::move(nh)); + return insert_return_type(make_iterator(p.first),p.second,std::move(nh)); } node_type extract(const_iterator position) @@ -474,7 +472,7 @@ class random_access_index: x,static_cast(position.get_node())); } - bool replace(iterator position,BOOST_RV_REF(value_type) x) + bool replace(iterator position,value_type&& x) { BOOST_MULTI_INDEX_CHECK_VALID_ITERATOR(position); BOOST_MULTI_INDEX_CHECK_DEREFERENCEABLE_ITERATOR(position); @@ -561,7 +559,7 @@ class random_access_index: template BOOST_MULTI_INDEX_ENABLE_IF_MERGEABLE(random_access_index,Index,void) - splice(iterator position,BOOST_RV_REF(Index) x) + splice(iterator position,Index&& x) { splice(position,static_cast(x)); } @@ -596,7 +594,7 @@ class random_access_index: BOOST_MULTI_INDEX_ENABLE_IF_MERGEABLE( random_access_index,Index,pair_return_type) splice( - iterator position,BOOST_RV_REF(Index) x, + iterator position,Index&& x, BOOST_DEDUCED_TYPENAME Index::iterator i) { return splice(position,static_cast(x),i); @@ -630,7 +628,7 @@ class random_access_index: template BOOST_MULTI_INDEX_ENABLE_IF_MERGEABLE(random_access_index,Index,void) splice( - iterator position,BOOST_RV_REF(Index) x, + iterator position,Index&& x, BOOST_DEDUCED_TYPENAME Index::iterator first, BOOST_DEDUCED_TYPENAME Index::iterator last) { diff --git a/include/boost/multi_index/sequenced_index.hpp b/include/boost/multi_index/sequenced_index.hpp index 121b232f0..8d820eeda 100644 --- a/include/boost/multi_index/sequenced_index.hpp +++ b/include/boost/multi_index/sequenced_index.hpp @@ -20,8 +20,6 @@ #include #include #include -#include -#include #include #include #include @@ -292,8 +290,8 @@ class sequenced_index: std::pair push_front(const value_type& x) {return insert(begin(),x);} - std::pair push_front(BOOST_RV_REF(value_type) x) - {return insert(begin(),boost::move(x));} + std::pair push_front(value_type&& x) + {return insert(begin(),std::move(x));} void pop_front(){erase(begin());} template @@ -304,8 +302,8 @@ class sequenced_index: std::pair push_back(const value_type& x) {return insert(end(),x);} - std::pair push_back(BOOST_RV_REF(value_type) x) - {return insert(end(),boost::move(x));} + std::pair push_back(value_type&& x) + {return insert(end(),std::move(x));} void pop_back(){erase(--end());} template @@ -334,7 +332,7 @@ class sequenced_index: return std::pair(make_iterator(p.first),p.second); } - std::pair insert(iterator position,BOOST_RV_REF(value_type) x) + std::pair insert(iterator position,value_type&& x) { BOOST_MULTI_INDEX_CHECK_VALID_ITERATOR(position); BOOST_MULTI_INDEX_CHECK_IS_OWNER(position,*this); @@ -367,7 +365,7 @@ class sequenced_index: } #endif - insert_return_type insert(const_iterator position,BOOST_RV_REF(node_type) nh) + insert_return_type insert(const_iterator position,node_type&& nh) { BOOST_MULTI_INDEX_CHECK_VALID_ITERATOR(position); BOOST_MULTI_INDEX_CHECK_IS_OWNER(position,*this); @@ -377,7 +375,7 @@ class sequenced_index: if(p.second&&position.get_node()!=header()){ relink(position.get_node(),p.first); } - return insert_return_type(make_iterator(p.first),p.second,boost::move(nh)); + return insert_return_type(make_iterator(p.first),p.second,std::move(nh)); } node_type extract(const_iterator position) @@ -424,7 +422,7 @@ class sequenced_index: x,static_cast(position.get_node())); } - bool replace(iterator position,BOOST_RV_REF(value_type) x) + bool replace(iterator position,value_type&& x) { BOOST_MULTI_INDEX_CHECK_VALID_ITERATOR(position); BOOST_MULTI_INDEX_CHECK_DEREFERENCEABLE_ITERATOR(position); @@ -511,7 +509,7 @@ class sequenced_index: template BOOST_MULTI_INDEX_ENABLE_IF_MERGEABLE(sequenced_index,Index,void) - splice(iterator position,BOOST_RV_REF(Index) x) + splice(iterator position,Index&& x) { splice(position,static_cast(x)); } @@ -546,7 +544,7 @@ class sequenced_index: BOOST_MULTI_INDEX_ENABLE_IF_MERGEABLE( sequenced_index,Index,pair_return_type) splice( - iterator position,BOOST_RV_REF(Index) x, + iterator position,Index&& x, BOOST_DEDUCED_TYPENAME Index::iterator i) { return splice(position,static_cast(x),i); @@ -580,7 +578,7 @@ class sequenced_index: template BOOST_MULTI_INDEX_ENABLE_IF_MERGEABLE(sequenced_index,Index,void) splice( - iterator position,BOOST_RV_REF(Index) x, + iterator position,Index&& x, BOOST_DEDUCED_TYPENAME Index::iterator first, BOOST_DEDUCED_TYPENAME Index::iterator last) { diff --git a/include/boost/multi_index_container.hpp b/include/boost/multi_index_container.hpp index 9b1fb07f9..5d7f238b7 100644 --- a/include/boost/multi_index_container.hpp +++ b/include/boost/multi_index_container.hpp @@ -21,8 +21,6 @@ #include #include #include -#include -#include #include #include #include @@ -125,8 +123,6 @@ class multi_index_container: #endif private: - BOOST_COPYABLE_AND_MOVABLE(multi_index_container) - #if !defined(BOOST_NO_MEMBER_TEMPLATE_FRIENDS) template friend class detail::index_base; template friend struct detail::header_holder; @@ -292,8 +288,8 @@ class multi_index_container: copy_construct_from(x); } - multi_index_container(BOOST_RV_REF(multi_index_container) x): - bfm_allocator(boost::move(x.bfm_allocator::member)), + 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()), node_count(0) @@ -315,7 +311,7 @@ class multi_index_container: } multi_index_container( - BOOST_RV_REF(multi_index_container) x,const allocator_type& al): + multi_index_container&& x,const allocator_type& al): bfm_allocator(al), bfm_header(), super(x,detail::do_not_copy_elements_tag()), @@ -338,25 +334,8 @@ class multi_index_container: delete_all_nodes_(); } -#if defined(BOOST_NO_CXX11_RVALUE_REFERENCES) - /* As per http://www.boost.org/doc/html/move/emulation_limitations.html - * #move.emulation_limitations.assignment_operator - */ - - multi_index_container& operator=( - const multi_index_container& x) - { - multi_index_container y( - x, - node_alloc_traits::propagate_on_container_copy_assignment::value? - x.get_allocator():this->get_allocator()); - swap_(y,boost::true_type() /* swap_allocators */); - return *this; - } -#endif - multi_index_container& operator=( - BOOST_COPY_ASSIGN_REF(multi_index_container) x) + const multi_index_container& x) { multi_index_container y( x, @@ -368,7 +347,7 @@ class multi_index_container: } multi_index_container& operator=( - BOOST_RV_REF(multi_index_container) x) + multi_index_container&& x) { #include @@ -381,7 +360,7 @@ class multi_index_container: swap_(x,boost::false_type() /* swap_allocators */); } else{ - multi_index_container y(boost::move(x),this->get_allocator()); + multi_index_container y(std::move(x),this->get_allocator()); swap_(y,boost::false_type() /* swap_allocators */); } return *this; diff --git a/test/employee.hpp b/test/employee.hpp index d7f632d8d..d4eca9746 100644 --- a/test/employee.hpp +++ b/test/employee.hpp @@ -12,8 +12,6 @@ #define BOOST_MULTI_INDEX_TEST_EMPLOYEE_HPP #include /* keep it first to prevent nasty warns in MSVC */ -#include -#include #include #include #include @@ -24,6 +22,7 @@ #include #include #include +#include #include "non_std_allocator.hpp" struct employee @@ -41,11 +40,11 @@ struct employee id(x.id),name(x.name),age(x.age),ssn(x.ssn) {} - employee(BOOST_RV_REF(employee) x): - id(x.id),name(boost::move(x.name)),age(x.age),ssn(x.ssn) + employee(employee&& x): + id(x.id),name(std::move(x.name)),age(x.age),ssn(x.ssn) {} - employee& operator=(BOOST_COPY_ASSIGN_REF(employee) x) + employee& operator=(const employee& x) { id=x.id; name=x.name; @@ -54,10 +53,10 @@ struct employee return *this; }; - employee& operator=(BOOST_RV_REF(employee) x) + employee& operator=(employee&& x) { id=x.id; - name=boost::move(x.name); + name=std::move(x.name); age=x.age; ssn=x.ssn; return *this; @@ -89,9 +88,6 @@ struct employee os< /* keep it first to prevent nasty warns in MSVC */ #include -#include -#include #include "pre_multi_index.hpp" #include #include @@ -22,22 +20,20 @@ #include #include #include +#include #include "rooted_allocator.hpp" struct move_tracker { move_tracker(int n):n(n),move_cted(false){} move_tracker(const move_tracker& x):n(x.n),move_cted(false){} - move_tracker(BOOST_RV_REF(move_tracker) x):n(x.n),move_cted(true){} - move_tracker& operator=(BOOST_COPY_ASSIGN_REF(move_tracker) x) + move_tracker(move_tracker&& x):n(x.n),move_cted(true){} + move_tracker& operator=(const move_tracker& x) {n=x.n;return *this;} - move_tracker& operator=(BOOST_RV_REF(move_tracker) x){n=x.n;return *this;} + move_tracker& operator=(move_tracker&& x){n=x.n;return *this;} int n; bool move_cted; - -private: - BOOST_COPYABLE_AND_MOVABLE(move_tracker) }; inline bool operator==(const move_tracker& x,const move_tracker& y) @@ -101,7 +97,7 @@ void test_allocator_awareness_for() { container c2(c); const move_tracker* pfirst=&*c2.begin(); - container c3(boost::move(c2),root2); + container c3(std::move(c2),root2); BOOST_TEST(c3.get_allocator().comes_from(root2)); BOOST_TEST(c3==c); BOOST_TEST(c2.empty()); @@ -120,7 +116,7 @@ void test_allocator_awareness_for() container c2(c); const move_tracker* pfirst=&*c2.begin(); container c3(root2); - c3=boost::move(c2); + c3=std::move(c2); BOOST_TEST(c3.get_allocator().comes_from(Propagate?root1:root2)); BOOST_TEST(c3==c); BOOST_TEST(c2.empty()); diff --git a/test/test_copy_assignment.cpp b/test/test_copy_assignment.cpp index fca40b267..bbe357c70 100644 --- a/test/test_copy_assignment.cpp +++ b/test/test_copy_assignment.cpp @@ -1,6 +1,6 @@ /* Boost.MultiIndex test for copying and assignment. * - * Copyright 2003-2018 Joaquin M Lopez Munoz. + * Copyright 2003-2025 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) @@ -12,9 +12,9 @@ #include /* keep it first to prevent nasty warns in MSVC */ #include -#include #include #include +#include #include #include "pre_multi_index.hpp" #include "employee.hpp" @@ -202,11 +202,11 @@ void test_copy_assignment() employee_set es10(produce_employee_set()),es11(produce_employee_set()); BOOST_TEST(es10==es11); - employee_set es12(boost::move(es10)); + employee_set es12(std::move(es10)); BOOST_TEST(es10.empty()); BOOST_TEST(es11==es12); - es10=boost::move(es12); + es10=std::move(es12); BOOST_TEST(es12.empty()); BOOST_TEST(es11==es10); diff --git a/test/test_modifiers.cpp b/test/test_modifiers.cpp index ea677ae15..909aa94a2 100644 --- a/test/test_modifiers.cpp +++ b/test/test_modifiers.cpp @@ -1,6 +1,6 @@ /* Boost.MultiIndex test for modifier memfuns. * - * Copyright 2003-2018 Joaquin M Lopez Munoz. + * Copyright 2003-2025 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) @@ -14,11 +14,10 @@ #include #include #include -#include -#include #include #include #include +#include #include #include "pre_multi_index.hpp" #include "employee.hpp" @@ -28,8 +27,8 @@ using namespace boost::multi_index; struct non_copyable_int { explicit non_copyable_int(int n_):n(n_){} - non_copyable_int(BOOST_RV_REF(non_copyable_int) x):n(x.n){x.n=0;} - non_copyable_int& operator=(BOOST_RV_REF(non_copyable_int) x) + non_copyable_int(non_copyable_int&& x):n(x.n){x.n=0;} + non_copyable_int& operator=(non_copyable_int&& x) { n=x.n; x.n=0; @@ -37,8 +36,6 @@ struct non_copyable_int } int n; -private: - BOOST_MOVABLE_BUT_NOT_COPYABLE(non_copyable_int) }; class always_one @@ -419,19 +416,19 @@ void test_modifiers() get<3>(ncic).emplace_back(1); non_copyable_int nci(1); - ncic.insert(boost::move(nci)); + ncic.insert(std::move(nci)); BOOST_TEST(nci.n==0); nci.n=1; - get<1>(ncic).insert(boost::move(nci)); + get<1>(ncic).insert(std::move(nci)); BOOST_TEST(nci.n==0); nci.n=1; - get<2>(ncic).push_back(boost::move(nci)); + get<2>(ncic).push_back(std::move(nci)); BOOST_TEST(nci.n==0); nci.n=1; - get<3>(ncic).push_back(boost::move(nci)); + get<3>(ncic).push_back(std::move(nci)); BOOST_TEST(nci.n==0); std::vector vi(4,1); diff --git a/test/test_node_handling.cpp b/test/test_node_handling.cpp index 6f03d2370..9573ba4a6 100644 --- a/test/test_node_handling.cpp +++ b/test/test_node_handling.cpp @@ -1,6 +1,6 @@ /* Boost.MultiIndex test for node handling operations. * - * Copyright 2003-2021 Joaquin M Lopez Munoz. + * Copyright 2003-2025 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) @@ -13,7 +13,6 @@ #include /* keep it first to prevent nasty warns in MSVC */ #include #include -#include #include "pre_multi_index.hpp" #include #include @@ -70,17 +69,17 @@ void test_node_handle() BOOST_TEST(&n2.value()==addr0); BOOST_TEST(allocator_count==1); - node_type n3(boost::move(n2)); + node_type n3(std::move(n2)); BOOST_TEST(n2.empty()); BOOST_TEST(!n3.empty()); BOOST_TEST(&n3.value()==addr0); BOOST_TEST(allocator_count==1); - node_type n4(boost::move(n2)); + node_type n4(std::move(n2)); BOOST_TEST(n4.empty()); BOOST_TEST(allocator_count==1); - n1=boost::move(n3); + n1=std::move(n3); BOOST_TEST(!n1.empty()); BOOST_TEST(&n1.value()==addr0); BOOST_TEST(n3.empty()); @@ -115,19 +114,19 @@ void test_node_handle() BOOST_TEST(n2.empty()); BOOST_TEST(allocator_count==2); - n2=boost::move(n3); + n2=std::move(n3); BOOST_TEST(n2.empty()); BOOST_TEST(n3.empty()); BOOST_TEST(allocator_count==2); BOOST_TEST(element_count==3); - n1=boost::move(n5); + n1=std::move(n5); BOOST_TEST(&n1.value()==addr0); BOOST_TEST(n5.empty()); BOOST_TEST(element_count==2); BOOST_TEST(allocator_count==1); - n1=boost::move(n5); + n1=std::move(n5); BOOST_TEST(n1.empty()); BOOST_TEST(element_count==1); BOOST_TEST(allocator_count==0); @@ -212,7 +211,7 @@ void test_transfer_result( (!is_key_based::value||*pos==x)){ BOOST_TEST(boost::next(res.position)==pos); } - test_transfer_result(dst,Ret(boost::move(res)),n,x); + test_transfer_result(dst,Ret(std::move(res)),n,x); } template @@ -232,7 +231,7 @@ void test_transfer_result_empty( Dst& dst,typename Dst::iterator,Ret res, typename enable_if_not_iterator::type=0) { - test_transfer_result_empty(dst,Ret(boost::move(res))); + test_transfer_result_empty(dst,Ret(std::move(res))); } template @@ -249,7 +248,7 @@ typename Src::node_type checked_extract( { typename Src::node_type n=src.extract(k); if(n)BOOST_TEST(src.key_extractor()(n.value())==k); - return boost::move(n); + return std::move(n); } template @@ -258,7 +257,7 @@ typename Src::node_type checked_extract(Src& src,typename Src::iterator pos) typename Src::value_type x=*pos; typename Src::node_type n=src.extract(pos); if(n)BOOST_TEST(n.value()==x); - return boost::move(n); + return std::move(n); } template @@ -267,10 +266,10 @@ void test_transfer(Src& src,Locator loc,Dst& dst) typename Dst::node_type n=checked_extract(src,loc); if(n){ typename Dst::value_type x=n.value(); - test_transfer_result(dst,dst.insert(boost::move(n)),n,x); + test_transfer_result(dst,dst.insert(std::move(n)),n,x); } else{ - test_transfer_result_empty(dst,dst.insert(boost::move(n))); + test_transfer_result_empty(dst,dst.insert(std::move(n))); } } @@ -280,10 +279,10 @@ void test_transfer(Src& src,Locator loc,Dst& dst,Iterator pos) typename Dst::node_type n=checked_extract(src,loc); if(n){ typename Dst::value_type x=n.value(); - test_transfer_result(dst,pos,dst.insert(pos,boost::move(n)),n,x); + test_transfer_result(dst,pos,dst.insert(pos,std::move(n)),n,x); } else{ - test_transfer_result_empty(dst,pos,dst.insert(pos,boost::move(n))); + test_transfer_result_empty(dst,pos,dst.insert(pos,std::move(n))); } } @@ -420,84 +419,65 @@ struct enable_if_not_key_based:boost::enable_if_c< void* >{}; -/* Boost.Move C++03 perfect forwarding emulation converts non-const lvalue - * refs to const lvalue refs. final_forward undoes that. - */ - -#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) - -template -T&& final_forward(typename boost::remove_reference::type& x) -{ - return static_cast(x); -} - -#else - -template -T& final_forward(const T& x){return const_cast(x);} - -#endif - template void merge( - Dst& dst,BOOST_FWD_REF(Src) src, + Dst& dst,Src&& src, typename enable_if_key_based::type=0) { - dst.merge(final_forward(src)); + dst.merge(std::forward(src)); } template void merge( - Dst& dst,BOOST_FWD_REF(Src) src, + Dst& dst,Src&& src, typename enable_if_not_key_based::type=0) { - dst.splice(dst.end(),final_forward(src)); + dst.splice(dst.end(),std::forward(src)); } template std::pair merge( - Dst& dst,BOOST_FWD_REF(Src) src, + Dst& dst,Src&& src, typename boost::remove_reference::type::iterator i, typename enable_if_key_based::type=0) { - return dst.merge(final_forward(src),i); + return dst.merge(std::forward(src),i); } template std::pair merge( - Dst& dst,BOOST_FWD_REF(Src) src, + Dst& dst,Src&& src, typename boost::remove_reference::type::iterator i, typename enable_if_not_key_based::type=0) { - return dst.splice(dst.end(),final_forward(src),i); + return dst.splice(dst.end(),std::forward(src),i); } template void merge( - Dst& dst,BOOST_FWD_REF(Src) src, + Dst& dst,Src&& src, typename boost::remove_reference::type::iterator first, typename boost::remove_reference::type::iterator last, typename enable_if_key_based::type=0) { - dst.merge(final_forward(src),first,last); + dst.merge(std::forward(src),first,last); } template void merge( - Dst& dst,BOOST_FWD_REF(Src) src, + Dst& dst,Src&& src, typename boost::remove_reference::type::iterator first, typename boost::remove_reference::type::iterator last, typename enable_if_not_key_based::type=0) { - dst.splice(dst.end(),final_forward(src),first,last); + dst.splice(dst.end(),std::forward(src),first,last); } template -void test_merge_same(Dst& dst,BOOST_FWD_REF(Src) src) +void test_merge_same(Dst& dst,Src&& src) { std::size_t n=dst.size(); - merge(dst,boost::forward(src)); + merge(dst,std::forward(src)); BOOST_TEST(dst.size()==n); BOOST_TEST(src.size()==n); } @@ -511,7 +491,7 @@ bool find_address(Iterator first,Iterator last,const Value* x) template void test_merge_different( - Dst& dst,BOOST_FWD_REF(Src) src,bool transferred_iters) + Dst& dst,Src&& src,bool transferred_iters) { typedef typename boost::remove_reference:: type::iterator src_iterator; @@ -526,7 +506,7 @@ void test_merge_different( v.push_back(std::make_pair(first,&*first)); } - merge(dst,boost::forward(src)); + merge(dst,std::forward(src)); BOOST_TEST(dst.size()>=n && m>=src.size() && dst.size()-n==m-src.size()); for(std::size_t i=0;i void test_merge_same( - Dst& dst,BOOST_FWD_REF(Src) src, + Dst& dst,Src&& src, typename boost::remove_reference::type::iterator i, bool key_based=is_key_based::value) { @@ -550,7 +530,7 @@ void test_merge_same( std::size_t n=dst.size(); - std::pair p=merge(dst,boost::forward(src),i); + std::pair p=merge(dst,std::forward(src),i); BOOST_TEST(dst.size()==n); BOOST_TEST(src.size()==n); BOOST_TEST(&*(p.first)==&*i && p.second); @@ -559,7 +539,7 @@ void test_merge_same( template void test_merge_different( - Dst& dst,BOOST_FWD_REF(Src) src, + Dst& dst,Src&& src, typename boost::remove_reference::type::iterator i, bool key_based=is_key_based::value) { @@ -568,7 +548,7 @@ void test_merge_different( std::size_t n=dst.size(),m=src.size(); const typename Dst::value_type* pi=&*i; - std::pair p=merge(dst,boost::forward(src),i); + std::pair p=merge(dst,std::forward(src),i); BOOST_TEST(dst.size()+src.size()==n+m); BOOST_TEST(p.second? &*(p.first)==pi: @@ -578,7 +558,7 @@ void test_merge_different( template void test_merge_same( - Dst& dst,BOOST_FWD_REF(Src) src, + Dst& dst,Src&& src, typename boost::remove_reference::type::iterator first, typename boost::remove_reference::type::iterator last, bool key_based=is_key_based::value) @@ -593,7 +573,7 @@ void test_merge_same( std::vector v; for(src_iterator it=first;it!=last;++it)v.push_back(&*it); - merge(dst,boost::forward(src),first,last); + merge(dst,std::forward(src),first,last); BOOST_TEST(dst.size()==n); BOOST_TEST(src.size()==n); if(!key_based){ @@ -612,7 +592,7 @@ void test_merge_same( template void test_merge_different( - Dst& dst,BOOST_FWD_REF(Src) src, + Dst& dst,Src&& src, typename boost::remove_reference::type::iterator first, typename boost::remove_reference::type::iterator last, bool key_based=is_key_based::value) @@ -628,7 +608,7 @@ void test_merge_different( std::vector v; for(src_iterator it=first;it!=last;++it)v.push_back(&*it); - merge(dst,boost::forward(src),first,last); + merge(dst,std::forward(src),first,last); BOOST_TEST(dst.size()>=n && m>=src.size() && dst.size()-n==m-src.size()); if(!key_based){ for(dst_iterator it=boost::next(dst.begin(),(std::ptrdiff_t)n); @@ -652,7 +632,7 @@ void test_merge_same(Dst& dst) test_merge_same( dst2.template get(),dst2.template get()); test_merge_same( - dst2.template get(),boost::move(dst2.template get())); + dst2.template get(),std::move(dst2.template get())); } { Dst dst2=dst1; @@ -661,7 +641,7 @@ void test_merge_same(Dst& dst) boost::next( dst2.template get().begin(),(std::ptrdiff_t)(dst2.size()/2))); test_merge_same( - dst2.template get(),boost::move(dst2.template get()), + dst2.template get(),std::move(dst2.template get()), boost::next( dst2.template get().begin(),(std::ptrdiff_t)(dst2.size()/2))); } @@ -673,7 +653,7 @@ void test_merge_same(Dst& dst) boost::next( dst2.template get().begin(),(std::ptrdiff_t)(dst2.size()/2))); test_merge_same( - dst2.template get(),boost::move(dst2.template get()), + dst2.template get(),std::move(dst2.template get()), dst2.template get().begin(), boost::next( dst2.template get().begin(),(std::ptrdiff_t)(dst2.size()/2))); @@ -699,7 +679,7 @@ void test_merge_different(Dst& dst,Src& src) Dst dst2=dst1; Src src2=src1; test_merge_different( - dst2.template get(),boost::move(src2.template get()), + dst2.template get(),std::move(src2.template get()), transferred_iters); } { @@ -714,7 +694,7 @@ void test_merge_different(Dst& dst,Src& src) Dst dst2=dst1; Src src2=src1; test_merge_different( - dst2.template get(),boost::move(src2.template get()), + dst2.template get(),std::move(src2.template get()), boost::next( src2.template get().begin(),(std::ptrdiff_t)(src2.size()/2))); } @@ -731,7 +711,7 @@ void test_merge_different(Dst& dst,Src& src) Dst dst2=dst1; Src src2=src1; test_merge_different( - dst2.template get(),boost::move(src2.template get()), + dst2.template get(),std::move(src2.template get()), src2.template get().begin(), boost::next( src2.template get().begin(),(std::ptrdiff_t)(src2.size()/2))); diff --git a/test/test_safe_mode.cpp b/test/test_safe_mode.cpp index ff1801264..f8002f3d2 100644 --- a/test/test_safe_mode.cpp +++ b/test/test_safe_mode.cpp @@ -1,6 +1,6 @@ /* Boost.MultiIndex test for safe_mode. * - * Copyright 2003-2021 Joaquin M Lopez Munoz. + * Copyright 2003-2025 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) @@ -11,12 +11,11 @@ #include "test_safe_mode.hpp" #include /* keep it first to prevent nasty warns in MSVC */ -#include -#include #include "pre_multi_index.hpp" #include "employee.hpp" #include "pair_of_ints.hpp" #include +#include #include using namespace boost::multi_index; @@ -209,7 +208,7 @@ static void local_test_safe_mode( node_type nh=i.extract(it); container c3(c2,allocator_type(-1)); index_type& i3=Policy::index_from_container(c3); - Policy::insert(i3,boost::move(nh)); + Policy::insert(i3,std::move(nh)); CATCH_SAFE_MODE(safe_mode::unequal_allocators) /* testcase for bug reported at @@ -374,9 +373,9 @@ struct key_based_index_policy_base: return i.insert(it,v); } - static void insert(index_type& i,BOOST_RV_REF(node_type) nh) + static void insert(index_type& i,node_type&& nh) { - i.insert(boost::move(nh)); + i.insert(std::move(nh)); } }; @@ -402,9 +401,9 @@ struct non_key_based_index_policy_base: return i.insert(it,v).first; } - static void insert(index_type& i,BOOST_RV_REF(node_type) nh) + static void insert(index_type& i,node_type&& nh) { - i.insert(i.end(),boost::move(nh)); + i.insert(i.end(),std::move(nh)); } }; diff --git a/test/test_serialization3.cpp b/test/test_serialization3.cpp index 5a759c1d5..7a14dcf4f 100644 --- a/test/test_serialization3.cpp +++ b/test/test_serialization3.cpp @@ -1,6 +1,6 @@ /* Boost.MultiIndex test for serialization, part 3. * - * Copyright 2003-2018 Joaquin M Lopez Munoz. + * Copyright 2003-2025 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) @@ -11,7 +11,6 @@ #include "test_serialization3.hpp" #include "test_serialization_template.hpp" -#include #include #include #include @@ -74,15 +73,12 @@ template<> struct version struct non_copyable { non_copyable(int n_=0):n(n_){} - non_copyable(BOOST_RV_REF(non_copyable) x):n(x.n){} + non_copyable(non_copyable&& x):n(x.n){} bool operator==(const non_copyable& x)const{return n==x.n;} bool operator<(const non_copyable& x)const{return n Date: Thu, 6 Nov 2025 17:57:12 +0100 Subject: [PATCH 04/24] avoided pessimizing-move warnings --- test/test_node_handling.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/test_node_handling.cpp b/test/test_node_handling.cpp index 9573ba4a6..946adb734 100644 --- a/test/test_node_handling.cpp +++ b/test/test_node_handling.cpp @@ -248,7 +248,7 @@ typename Src::node_type checked_extract( { typename Src::node_type n=src.extract(k); if(n)BOOST_TEST(src.key_extractor()(n.value())==k); - return std::move(n); + return n; } template @@ -257,7 +257,7 @@ typename Src::node_type checked_extract(Src& src,typename Src::iterator pos) typename Src::value_type x=*pos; typename Src::node_type n=src.extract(pos); if(n)BOOST_TEST(n.value()==x); - return std::move(n); + return n; } template From 992dff1428ff12617da8f3ed968349619940a440 Mon Sep 17 00:00:00 2001 From: joaquintides Date: Thu, 6 Nov 2025 18:28:18 +0100 Subject: [PATCH 05/24] removed usage of BOOST_DEDUCED_TYPENAME --- .../boost/multi_index/detail/index_base.hpp | 4 ++-- .../multi_index/detail/ord_index_impl.hpp | 14 +++++------ .../multi_index/detail/ord_index_ops.hpp | 8 +++---- .../multi_index/detail/rnd_index_ops.hpp | 4 ++-- .../multi_index/detail/rnk_index_ops.hpp | 10 ++++---- .../multi_index/detail/seq_index_ops.hpp | 6 ++--- include/boost/multi_index/hashed_index.hpp | 12 +++++----- .../boost/multi_index/random_access_index.hpp | 24 +++++++++---------- include/boost/multi_index/sequenced_index.hpp | 24 +++++++++---------- include/boost/multi_index_container.hpp | 20 ++++++++-------- test/test_serialization_template.hpp | 4 ++-- 11 files changed, 65 insertions(+), 65 deletions(-) diff --git a/include/boost/multi_index/detail/index_base.hpp b/include/boost/multi_index/detail/index_base.hpp index fe5643df2..1751a6f4d 100644 --- a/include/boost/multi_index/detail/index_base.hpp +++ b/include/boost/multi_index/detail/index_base.hpp @@ -287,8 +287,8 @@ class index_base template void final_transfer_range_( Index& x, - BOOST_DEDUCED_TYPENAME Index::iterator first, - BOOST_DEDUCED_TYPENAME Index::iterator last) + typename Index::iterator first, + typename Index::iterator last) {final().transfer_range_(x,first,last);} void final_swap_(final_type& x){final().swap_(x);} diff --git a/include/boost/multi_index/detail/ord_index_impl.hpp b/include/boost/multi_index/detail/ord_index_impl.hpp index d46d6084d..7b258de81 100644 --- a/include/boost/multi_index/detail/ord_index_impl.hpp +++ b/include/boost/multi_index/detail/ord_index_impl.hpp @@ -547,7 +547,7 @@ class ordered_index_impl: template BOOST_MULTI_INDEX_ENABLE_IF_MERGEABLE( ordered_index_impl,Index,pair_return_type) - merge(Index& x,BOOST_DEDUCED_TYPENAME Index::iterator i) + merge(Index& x,typename Index::iterator i) { BOOST_MULTI_INDEX_CHECK_VALID_ITERATOR(i); BOOST_MULTI_INDEX_CHECK_DEREFERENCEABLE_ITERATOR(i); @@ -568,7 +568,7 @@ class ordered_index_impl: template BOOST_MULTI_INDEX_ENABLE_IF_MERGEABLE( ordered_index_impl,Index,pair_return_type) - merge(Index&& x,BOOST_DEDUCED_TYPENAME Index::iterator i) + merge(Index&& x,typename Index::iterator i) { return merge(static_cast(x),i); } @@ -577,8 +577,8 @@ class ordered_index_impl: BOOST_MULTI_INDEX_ENABLE_IF_MERGEABLE(ordered_index_impl,Index,void) merge( Index& x, - BOOST_DEDUCED_TYPENAME Index::iterator first, - BOOST_DEDUCED_TYPENAME Index::iterator last) + typename Index::iterator first, + typename Index::iterator last) { BOOST_MULTI_INDEX_CHECK_VALID_ITERATOR(first); BOOST_MULTI_INDEX_CHECK_VALID_ITERATOR(last); @@ -596,8 +596,8 @@ class ordered_index_impl: BOOST_MULTI_INDEX_ENABLE_IF_MERGEABLE(ordered_index_impl,Index,void) merge( Index&& x, - BOOST_DEDUCED_TYPENAME Index::iterator first, - BOOST_DEDUCED_TYPENAME Index::iterator last) + typename Index::iterator first, + typename Index::iterator last) { merge(static_cast(x),first,last); } @@ -1556,7 +1556,7 @@ class ordered_index: #if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST) ordered_index& operator=( - std::initializer_list list) + std::initializer_list list) { this->final()=list; return *this; diff --git a/include/boost/multi_index/detail/ord_index_ops.hpp b/include/boost/multi_index/detail/ord_index_ops.hpp index 3a59ee433..07f7ecf4e 100644 --- a/include/boost/multi_index/detail/ord_index_ops.hpp +++ b/include/boost/multi_index/detail/ord_index_ops.hpp @@ -82,7 +82,7 @@ template< > inline Node* ordered_index_find( Node* top,Node* y,const KeyFromValue& key, - const BOOST_DEDUCED_TYPENAME KeyFromValue::result_type& x, + const typename KeyFromValue::result_type& x, const CompatibleCompare& comp,std::true_type) { return ordered_index_find(top,y,key,x,comp,std::false_type()); @@ -130,7 +130,7 @@ template< > inline Node* ordered_index_lower_bound( Node* top,Node* y,const KeyFromValue& key, - const BOOST_DEDUCED_TYPENAME KeyFromValue::result_type& x, + const typename KeyFromValue::result_type& x, const CompatibleCompare& comp,std::true_type) { return ordered_index_lower_bound(top,y,key,x,comp,std::false_type()); @@ -176,7 +176,7 @@ template< > inline Node* ordered_index_upper_bound( Node* top,Node* y,const KeyFromValue& key, - const BOOST_DEDUCED_TYPENAME KeyFromValue::result_type& x, + const typename KeyFromValue::result_type& x, const CompatibleCompare& comp,std::true_type) { return ordered_index_upper_bound(top,y,key,x,comp,std::false_type()); @@ -224,7 +224,7 @@ template< > inline std::pair ordered_index_equal_range( Node* top,Node* y,const KeyFromValue& key, - const BOOST_DEDUCED_TYPENAME KeyFromValue::result_type& x, + const typename KeyFromValue::result_type& x, const CompatibleCompare& comp,std::true_type) { return ordered_index_equal_range(top,y,key,x,comp,std::false_type()); diff --git a/include/boost/multi_index/detail/rnd_index_ops.hpp b/include/boost/multi_index/detail/rnd_index_ops.hpp index f5e76e444..887e871f0 100644 --- a/include/boost/multi_index/detail/rnd_index_ops.hpp +++ b/include/boost/multi_index/detail/rnd_index_ops.hpp @@ -1,4 +1,4 @@ -/* Copyright 2003-2015 Joaquin M Lopez Munoz. +/* Copyright 2003-2025 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) @@ -83,7 +83,7 @@ template void random_access_index_inplace_merge( const Allocator& al, random_access_index_ptr_array& ptrs, - BOOST_DEDUCED_TYPENAME Node::impl_ptr_pointer first1,Compare comp) + typename Node::impl_ptr_pointer first1,Compare comp) { typedef typename Node::value_type value_type; typedef typename Node::impl_pointer impl_pointer; diff --git a/include/boost/multi_index/detail/rnk_index_ops.hpp b/include/boost/multi_index/detail/rnk_index_ops.hpp index 7aeac94ca..5f1ab4831 100644 --- a/include/boost/multi_index/detail/rnk_index_ops.hpp +++ b/include/boost/multi_index/detail/rnk_index_ops.hpp @@ -46,7 +46,7 @@ ranked_node_size(Pointer x) template inline Pointer ranked_index_nth( - BOOST_DEDUCED_TYPENAME ranked_node_size_type::type n,Pointer end_) + typename ranked_node_size_type::type n,Pointer end_) { typedef typename ranked_node_size_type::type size_type; @@ -108,7 +108,7 @@ template< > inline typename Node::size_type ranked_index_find_rank( Node* top,Node* y,const KeyFromValue& key, - const BOOST_DEDUCED_TYPENAME KeyFromValue::result_type& x, + const typename KeyFromValue::result_type& x, const CompatibleCompare& comp,std::true_type) { return ranked_index_find_rank(top,y,key,x,comp,std::false_type()); @@ -163,7 +163,7 @@ template< > inline typename Node::size_type ranked_index_lower_bound_rank( Node* top,Node* y,const KeyFromValue& key, - const BOOST_DEDUCED_TYPENAME KeyFromValue::result_type& x, + const typename KeyFromValue::result_type& x, const CompatibleCompare& comp,std::true_type) { return ranked_index_lower_bound_rank(top,y,key,x,comp,std::false_type()); @@ -216,7 +216,7 @@ template< > inline typename Node::size_type ranked_index_upper_bound_rank( Node* top,Node* y,const KeyFromValue& key, - const BOOST_DEDUCED_TYPENAME KeyFromValue::result_type& x, + const typename KeyFromValue::result_type& x, const CompatibleCompare& comp,std::true_type) { return ranked_index_upper_bound_rank(top,y,key,x,comp,std::false_type()); @@ -273,7 +273,7 @@ template< inline std::pair ranked_index_equal_range_rank( Node* top,Node* y,const KeyFromValue& key, - const BOOST_DEDUCED_TYPENAME KeyFromValue::result_type& x, + const typename KeyFromValue::result_type& x, const CompatibleCompare& comp,std::true_type) { return ranked_index_equal_range_rank(top,y,key,x,comp,std::false_type()); diff --git a/include/boost/multi_index/detail/seq_index_ops.hpp b/include/boost/multi_index/detail/seq_index_ops.hpp index b12cc321a..463283117 100644 --- a/include/boost/multi_index/detail/seq_index_ops.hpp +++ b/include/boost/multi_index/detail/seq_index_ops.hpp @@ -1,4 +1,4 @@ -/* Copyright 2003-2020 Joaquin M Lopez Munoz. +/* Copyright 2003-2025 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) @@ -77,8 +77,8 @@ void sequenced_index_merge(SequencedIndex& x,SequencedIndex& y,Compare comp) template void sequenced_index_collate( - BOOST_DEDUCED_TYPENAME Node::impl_type* x, - BOOST_DEDUCED_TYPENAME Node::impl_type* y, + typename Node::impl_type* x, + typename Node::impl_type* y, Compare comp) { typedef typename Node::impl_type impl_type; diff --git a/include/boost/multi_index/hashed_index.hpp b/include/boost/multi_index/hashed_index.hpp index 300fbece1..7b3e2ffad 100644 --- a/include/boost/multi_index/hashed_index.hpp +++ b/include/boost/multi_index/hashed_index.hpp @@ -532,7 +532,7 @@ class hashed_index: template BOOST_MULTI_INDEX_ENABLE_IF_MERGEABLE(hashed_index,Index,pair_return_type) - merge(Index& x,BOOST_DEDUCED_TYPENAME Index::iterator i) + merge(Index& x,typename Index::iterator i) { BOOST_MULTI_INDEX_CHECK_VALID_ITERATOR(i); BOOST_MULTI_INDEX_CHECK_DEREFERENCEABLE_ITERATOR(i); @@ -552,7 +552,7 @@ class hashed_index: template BOOST_MULTI_INDEX_ENABLE_IF_MERGEABLE(hashed_index,Index,pair_return_type) - merge(Index&& x,BOOST_DEDUCED_TYPENAME Index::iterator i) + merge(Index&& x,typename Index::iterator i) { return merge(static_cast(x),i); } @@ -561,8 +561,8 @@ class hashed_index: BOOST_MULTI_INDEX_ENABLE_IF_MERGEABLE(hashed_index,Index,void) merge( Index& x, - BOOST_DEDUCED_TYPENAME Index::iterator first, - BOOST_DEDUCED_TYPENAME Index::iterator last) + typename Index::iterator first, + typename Index::iterator last) { BOOST_MULTI_INDEX_CHECK_VALID_ITERATOR(first); BOOST_MULTI_INDEX_CHECK_VALID_ITERATOR(last); @@ -580,8 +580,8 @@ class hashed_index: BOOST_MULTI_INDEX_ENABLE_IF_MERGEABLE(hashed_index,Index,void) merge( Index&& x, - BOOST_DEDUCED_TYPENAME Index::iterator first, - BOOST_DEDUCED_TYPENAME Index::iterator last) + typename Index::iterator first, + typename Index::iterator last) { merge(static_cast(x),first,last); } diff --git a/include/boost/multi_index/random_access_index.hpp b/include/boost/multi_index/random_access_index.hpp index 5737f136d..546f187ea 100644 --- a/include/boost/multi_index/random_access_index.hpp +++ b/include/boost/multi_index/random_access_index.hpp @@ -568,7 +568,7 @@ class random_access_index: BOOST_MULTI_INDEX_ENABLE_IF_MERGEABLE( random_access_index,Index,pair_return_type) splice( - iterator position,Index& x,BOOST_DEDUCED_TYPENAME Index::iterator i) + iterator position,Index& x,typename Index::iterator i) { BOOST_MULTI_INDEX_CHECK_VALID_ITERATOR(position); BOOST_MULTI_INDEX_CHECK_IS_OWNER(position,*this); @@ -595,7 +595,7 @@ class random_access_index: random_access_index,Index,pair_return_type) splice( iterator position,Index&& x, - BOOST_DEDUCED_TYPENAME Index::iterator i) + typename Index::iterator i) { return splice(position,static_cast(x),i); } @@ -604,8 +604,8 @@ class random_access_index: BOOST_MULTI_INDEX_ENABLE_IF_MERGEABLE(random_access_index,Index,void) splice( iterator position,Index& x, - BOOST_DEDUCED_TYPENAME Index::iterator first, - BOOST_DEDUCED_TYPENAME Index::iterator last) + typename Index::iterator first, + typename Index::iterator last) { BOOST_MULTI_INDEX_CHECK_VALID_ITERATOR(position); BOOST_MULTI_INDEX_CHECK_IS_OWNER(position,*this); @@ -629,8 +629,8 @@ class random_access_index: BOOST_MULTI_INDEX_ENABLE_IF_MERGEABLE(random_access_index,Index,void) splice( iterator position,Index&& x, - BOOST_DEDUCED_TYPENAME Index::iterator first, - BOOST_DEDUCED_TYPENAME Index::iterator last) + typename Index::iterator first, + typename Index::iterator last) { splice(position,static_cast(x),first,last); } @@ -1095,7 +1095,7 @@ class random_access_index: template std::pair external_splice( - iterator position,Index& x,BOOST_DEDUCED_TYPENAME Index::iterator i, + iterator position,Index& x,typename Index::iterator i, boost::true_type /* copy-constructible value */) { if(get_allocator()==x.get_allocator()){ @@ -1113,7 +1113,7 @@ class random_access_index: template std::pair external_splice( - iterator position,Index& x,BOOST_DEDUCED_TYPENAME Index::iterator i, + iterator position,Index& x,typename Index::iterator i, boost::false_type /* copy-constructible value */) { BOOST_MULTI_INDEX_CHECK_EQUAL_ALLOCATORS(*this,x); @@ -1157,8 +1157,8 @@ class random_access_index: template void external_splice( iterator position,Index& x, - BOOST_DEDUCED_TYPENAME Index::iterator first, - BOOST_DEDUCED_TYPENAME Index::iterator last, + typename Index::iterator first, + typename Index::iterator last, boost::true_type /* copy-constructible value */) { if(get_allocator()==x.get_allocator()){ @@ -1186,8 +1186,8 @@ class random_access_index: template void external_splice( iterator position,Index& x, - BOOST_DEDUCED_TYPENAME Index::iterator first, - BOOST_DEDUCED_TYPENAME Index::iterator last, + typename Index::iterator first, + typename Index::iterator last, boost::false_type /* copy-constructible value */) { BOOST_MULTI_INDEX_CHECK_EQUAL_ALLOCATORS(*this,x); diff --git a/include/boost/multi_index/sequenced_index.hpp b/include/boost/multi_index/sequenced_index.hpp index 8d820eeda..94de1e438 100644 --- a/include/boost/multi_index/sequenced_index.hpp +++ b/include/boost/multi_index/sequenced_index.hpp @@ -518,7 +518,7 @@ class sequenced_index: BOOST_MULTI_INDEX_ENABLE_IF_MERGEABLE( sequenced_index,Index,pair_return_type) splice( - iterator position,Index& x,BOOST_DEDUCED_TYPENAME Index::iterator i) + iterator position,Index& x,typename Index::iterator i) { BOOST_MULTI_INDEX_CHECK_VALID_ITERATOR(position); BOOST_MULTI_INDEX_CHECK_IS_OWNER(position,*this); @@ -545,7 +545,7 @@ class sequenced_index: sequenced_index,Index,pair_return_type) splice( iterator position,Index&& x, - BOOST_DEDUCED_TYPENAME Index::iterator i) + typename Index::iterator i) { return splice(position,static_cast(x),i); } @@ -554,8 +554,8 @@ class sequenced_index: BOOST_MULTI_INDEX_ENABLE_IF_MERGEABLE(sequenced_index,Index,void) splice( iterator position,Index& x, - BOOST_DEDUCED_TYPENAME Index::iterator first, - BOOST_DEDUCED_TYPENAME Index::iterator last) + typename Index::iterator first, + typename Index::iterator last) { BOOST_MULTI_INDEX_CHECK_VALID_ITERATOR(position); BOOST_MULTI_INDEX_CHECK_IS_OWNER(position,*this); @@ -579,8 +579,8 @@ class sequenced_index: BOOST_MULTI_INDEX_ENABLE_IF_MERGEABLE(sequenced_index,Index,void) splice( iterator position,Index&& x, - BOOST_DEDUCED_TYPENAME Index::iterator first, - BOOST_DEDUCED_TYPENAME Index::iterator last) + typename Index::iterator first, + typename Index::iterator last) { splice(position,static_cast(x),first,last); } @@ -1006,7 +1006,7 @@ class sequenced_index: template std::pair external_splice( - iterator position,Index& x,BOOST_DEDUCED_TYPENAME Index::iterator i, + iterator position,Index& x,typename Index::iterator i, boost::true_type /* copy-constructible value */) { if(get_allocator()==x.get_allocator()){ @@ -1024,7 +1024,7 @@ class sequenced_index: template std::pair external_splice( - iterator position,Index& x,BOOST_DEDUCED_TYPENAME Index::iterator i, + iterator position,Index& x,typename Index::iterator i, boost::false_type /* copy-constructible value */) { BOOST_MULTI_INDEX_CHECK_EQUAL_ALLOCATORS(*this,x); @@ -1056,8 +1056,8 @@ class sequenced_index: template void external_splice( iterator position,Index& x, - BOOST_DEDUCED_TYPENAME Index::iterator first, - BOOST_DEDUCED_TYPENAME Index::iterator last, + typename Index::iterator first, + typename Index::iterator last, boost::true_type /* copy-constructible value */) { if(get_allocator()==x.get_allocator()){ @@ -1076,8 +1076,8 @@ class sequenced_index: template void external_splice( iterator position,Index& x, - BOOST_DEDUCED_TYPENAME Index::iterator first, - BOOST_DEDUCED_TYPENAME Index::iterator last, + typename Index::iterator first, + typename Index::iterator last, boost::false_type /* copy-constructible value */) { BOOST_MULTI_INDEX_CHECK_EQUAL_ALLOCATORS(*this,x); diff --git a/include/boost/multi_index_container.hpp b/include/boost/multi_index_container.hpp index 5d7f238b7..26970cd10 100644 --- a/include/boost/multi_index_container.hpp +++ b/include/boost/multi_index_container.hpp @@ -946,8 +946,8 @@ class multi_index_container: template void transfer_range_( Index& x, - BOOST_DEDUCED_TYPENAME Index::iterator first, - BOOST_DEDUCED_TYPENAME Index::iterator last) + typename Index::iterator first, + typename Index::iterator last) { while(first!=last){ transfer_(x,static_cast((first++).get_node())); @@ -1220,7 +1220,7 @@ get( BOOST_STATIC_ASSERT(N>=0&& N< mp11::mp_size< - BOOST_DEDUCED_TYPENAME multi_index_type::index_type_list + typename multi_index_type::index_type_list >::value); return detail::converter::index(m); @@ -1244,7 +1244,7 @@ get( BOOST_STATIC_ASSERT(N>=0&& N< mp11::mp_size< - BOOST_DEDUCED_TYPENAME multi_index_type::index_type_list + typename multi_index_type::index_type_list >::value); return detail::converter::index(m); @@ -1338,7 +1338,7 @@ project( #if !defined(__SUNPRO_CC)||!(__SUNPRO_CC<0x580) /* Sun C++ 5.7 fails */ BOOST_STATIC_ASSERT(( mp11::mp_contains< - BOOST_DEDUCED_TYPENAME multi_index_type::iterator_type_list, + typename multi_index_type::iterator_type_list, IteratorType>::value)); #endif @@ -1364,10 +1364,10 @@ project( #if !defined(__SUNPRO_CC)||!(__SUNPRO_CC<0x580) /* Sun C++ 5.7 fails */ BOOST_STATIC_ASSERT(( mp11::mp_contains< - BOOST_DEDUCED_TYPENAME multi_index_type::iterator_type_list, + typename multi_index_type::iterator_type_list, IteratorType>::value|| mp11::mp_contains< - BOOST_DEDUCED_TYPENAME multi_index_type::const_iterator_type_list, + typename multi_index_type::const_iterator_type_list, IteratorType>::value)); #endif @@ -1410,7 +1410,7 @@ project( #if !defined(__SUNPRO_CC)||!(__SUNPRO_CC<0x580) /* Sun C++ 5.7 fails */ BOOST_STATIC_ASSERT(( mp11::mp_contains< - BOOST_DEDUCED_TYPENAME multi_index_type::iterator_type_list, + typename multi_index_type::iterator_type_list, IteratorType>::value)); #endif @@ -1437,10 +1437,10 @@ project( #if !defined(__SUNPRO_CC)||!(__SUNPRO_CC<0x580) /* Sun C++ 5.7 fails */ BOOST_STATIC_ASSERT(( mp11::mp_contains< - BOOST_DEDUCED_TYPENAME multi_index_type::iterator_type_list, + typename multi_index_type::iterator_type_list, IteratorType>::value|| mp11::mp_contains< - BOOST_DEDUCED_TYPENAME multi_index_type::const_iterator_type_list, + typename multi_index_type::const_iterator_type_list, IteratorType>::value)); #endif diff --git a/test/test_serialization_template.hpp b/test/test_serialization_template.hpp index 8d73e1ab0..bcd3a299c 100644 --- a/test/test_serialization_template.hpp +++ b/test/test_serialization_template.hpp @@ -56,11 +56,11 @@ bool all_indices_equal( #if defined(BOOST_MULTI_INDEX_ENABLE_MPL_SUPPORT) BOOST_STATIC_CONSTANT(int, N=boost::mpl::size< - BOOST_DEDUCED_TYPENAME MultiIndexContainer::index_type_list>::value); + typename MultiIndexContainer::index_type_list>::value); #else BOOST_STATIC_CONSTANT(int, N=boost::mp11::mp_size< - BOOST_DEDUCED_TYPENAME MultiIndexContainer::index_type_list>::value); + typename MultiIndexContainer::index_type_list>::value); #endif return all_indices_equal_helper::compare(m1,m2); From 1fd1d01719720f00b639aa57f7e5a2bb60d2dd4b Mon Sep 17 00:00:00 2001 From: joaquintides Date: Thu, 6 Nov 2025 18:52:01 +0100 Subject: [PATCH 06/24] removed usage of BOOST_NO_CXX11_HDR_INITIALIZER_LIST --- include/boost/multi_index/detail/ord_index_impl.hpp | 9 +-------- include/boost/multi_index/hashed_index.hpp | 9 +-------- include/boost/multi_index/random_access_index.hpp | 11 +---------- include/boost/multi_index/sequenced_index.hpp | 11 +---------- include/boost/multi_index_container.hpp | 11 +---------- test/test_copy_assignment.cpp | 7 ------- test/test_modifiers.cpp | 8 -------- 7 files changed, 5 insertions(+), 61 deletions(-) diff --git a/include/boost/multi_index/detail/ord_index_impl.hpp b/include/boost/multi_index/detail/ord_index_impl.hpp index 7b258de81..eba463f4d 100644 --- a/include/boost/multi_index/detail/ord_index_impl.hpp +++ b/include/boost/multi_index/detail/ord_index_impl.hpp @@ -67,14 +67,11 @@ #include #include #include +#include #include #include #include -#if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST) -#include -#endif - #if !defined(BOOST_MULTI_INDEX_DISABLE_SERIALIZATION) #include #include @@ -353,12 +350,10 @@ class ordered_index_impl: for(;first!=last;++first)this->final_insert_ref_(*first); } -#if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST) void insert(std::initializer_list list) { insert(list.begin(),list.end()); } -#endif insert_return_type insert(node_type&& nh) { @@ -1554,14 +1549,12 @@ class ordered_index: return *this; } -#if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST) ordered_index& operator=( std::initializer_list list) { this->final()=list; return *this; } -#endif protected: ordered_index( diff --git a/include/boost/multi_index/hashed_index.hpp b/include/boost/multi_index/hashed_index.hpp index 7b3e2ffad..4d2966f4e 100644 --- a/include/boost/multi_index/hashed_index.hpp +++ b/include/boost/multi_index/hashed_index.hpp @@ -42,14 +42,11 @@ #include #include #include +#include #include #include #include -#if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST) -#include -#endif - #if !defined(BOOST_MULTI_INDEX_DISABLE_SERIALIZATION) #include #endif @@ -214,14 +211,12 @@ class hashed_index: return *this; } -#if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST) hashed_index& operator=( std::initializer_list list) { this->final()=list; return *this; } -#endif allocator_type get_allocator()const BOOST_NOEXCEPT { @@ -330,12 +325,10 @@ class hashed_index: for(;first!=last;++first)this->final_insert_ref_(*first); } -#if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST) void insert(std::initializer_list list) { insert(list.begin(),list.end()); } -#endif insert_return_type insert(node_type&& nh) { diff --git a/include/boost/multi_index/random_access_index.hpp b/include/boost/multi_index/random_access_index.hpp index 546f187ea..f13b7bb0f 100644 --- a/include/boost/multi_index/random_access_index.hpp +++ b/include/boost/multi_index/random_access_index.hpp @@ -39,15 +39,12 @@ #include #include #include +#include #include #include #include #include -#if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST) -#include -#endif - #if !defined(BOOST_MULTI_INDEX_DISABLE_SERIALIZATION) #include #endif @@ -190,14 +187,12 @@ class random_access_index: return *this; } -#if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST) random_access_index& operator=( std::initializer_list list) { this->final()=list; return *this; } -#endif template void assign(InputIterator first,InputIterator last) @@ -205,12 +200,10 @@ class random_access_index: assign_iter(first,last,mp11::mp_not >()); } -#if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST) void assign(std::initializer_list list) { assign(list.begin(),list.end()); } -#endif void assign(size_type n,value_param_type value) { @@ -408,12 +401,10 @@ class random_access_index: insert_iter(position,first,last,mp11::mp_not >()); } -#if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST) void insert(iterator position,std::initializer_list list) { insert(position,list.begin(),list.end()); } -#endif insert_return_type insert(const_iterator position,node_type&& nh) { diff --git a/include/boost/multi_index/sequenced_index.hpp b/include/boost/multi_index/sequenced_index.hpp index 94de1e438..32a30ff04 100644 --- a/include/boost/multi_index/sequenced_index.hpp +++ b/include/boost/multi_index/sequenced_index.hpp @@ -36,14 +36,11 @@ #include #include #include +#include #include #include #include -#if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST) -#include -#endif - #if defined(BOOST_MULTI_INDEX_ENABLE_INVARIANT_CHECKING) #define BOOST_MULTI_INDEX_SEQ_INDEX_CHECK_INVARIANT_OF(x) \ detail::scope_guard BOOST_JOIN(check_invariant_,__LINE__)= \ @@ -176,14 +173,12 @@ class sequenced_index: return *this; } -#if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST) sequenced_index& operator=( std::initializer_list list) { this->final()=list; return *this; } -#endif template void assign(InputIterator first,InputIterator last) @@ -191,12 +186,10 @@ class sequenced_index: assign_iter(first,last,mp11::mp_not >()); } -#if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST) void assign(std::initializer_list list) { assign(list.begin(),list.end()); } -#endif void assign(size_type n,value_param_type value) { @@ -358,12 +351,10 @@ class sequenced_index: insert_iter(position,first,last,mp11::mp_not >()); } -#if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST) void insert(iterator position,std::initializer_list list) { insert(position,list.begin(),list.end()); } -#endif insert_return_type insert(const_iterator position,node_type&& nh) { diff --git a/include/boost/multi_index_container.hpp b/include/boost/multi_index_container.hpp index 26970cd10..92dfbcdb9 100644 --- a/include/boost/multi_index_container.hpp +++ b/include/boost/multi_index_container.hpp @@ -42,11 +42,8 @@ #include #include #include -#include - -#if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST) #include -#endif +#include #if !defined(BOOST_MULTI_INDEX_DISABLE_SERIALIZATION) #include @@ -248,7 +245,6 @@ class multi_index_container: BOOST_CATCH_END } -#if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST) multi_index_container( std::initializer_list list, const ctor_args_list& args_list=ctor_args_list(), @@ -274,7 +270,6 @@ class multi_index_container: } BOOST_CATCH_END } -#endif multi_index_container( const multi_index_container& x): @@ -368,7 +363,6 @@ class multi_index_container: #include } -#if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST) multi_index_container& operator=( std::initializer_list list) { @@ -385,7 +379,6 @@ class multi_index_container: x.swap_elements_(*this); return*this; } -#endif allocator_type get_allocator()const BOOST_NOEXCEPT { @@ -583,7 +576,6 @@ class multi_index_container: BOOST_MULTI_INDEX_CHECK_INVARIANT; } -#if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST) multi_index_container( const multi_index_container& x, detail::do_not_copy_elements_tag): @@ -594,7 +586,6 @@ class multi_index_container: { BOOST_MULTI_INDEX_CHECK_INVARIANT; } -#endif void copy_construct_from( const multi_index_container& x) diff --git a/test/test_copy_assignment.cpp b/test/test_copy_assignment.cpp index bbe357c70..d606712d9 100644 --- a/test/test_copy_assignment.cpp +++ b/test/test_copy_assignment.cpp @@ -53,11 +53,7 @@ static void test_assign() s.assign((const int*)(&a[0]),(const int*)(&a[sa])); BOOST_TEST(s.size()==sa&&std::equal(s.begin(),s.end(),&a[0])); -#if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST) s.assign({0,1,2,3,4,5}); -#else - s.assign(&a[0],&a[sa]); -#endif BOOST_TEST(s.size()==sa&&std::equal(s.begin(),s.end(),&a[0])); @@ -156,8 +152,6 @@ void test_copy_assignment() BOOST_TEST(i5==get<5>(es2)); -#if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST)&&\ - !BOOST_WORKAROUND(BOOST_MSVC,==1800) /* MSVC 12.0 chokes on what follows */ employee_set es8({{0,"Rose",40,4512},{1,"Mary",38,3345},{2,"Jo",25,7102}}); employee_set es9; es9={{0,"Rose",40,4512},{1,"Mary",38,3345},{2,"Jo",25,7102}, @@ -197,7 +191,6 @@ void test_copy_assignment() get<5>(es9)={{1,"Mary",38,3345},{2,"Jo",25,7102},{0,"Rose",40,4512}, {2,"Jo",25,7102}}; BOOST_TEST(es9==es8); -#endif employee_set es10(produce_employee_set()),es11(produce_employee_set()); BOOST_TEST(es10==es11); diff --git a/test/test_modifiers.cpp b/test/test_modifiers.cpp index 909aa94a2..b9a9ca1f4 100644 --- a/test/test_modifiers.cpp +++ b/test/test_modifiers.cpp @@ -258,10 +258,8 @@ void test_modifiers() i1.insert(ve.begin(),ve.end()); BOOST_TEST(i2.size()==3); -#if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST) i1.insert({{4,"Vanessa",20,9236},{5,"Penelope",55,2358}}); BOOST_TEST(i2.size()==5); -#endif BOOST_TEST(i2.erase(i2.begin(),i2.end())==i2.end()); BOOST_TEST(es.size()==0); @@ -269,10 +267,8 @@ void test_modifiers() i2.insert(ve.begin(),ve.end()); BOOST_TEST(i3.size()==3); -#if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST) i2.insert({{4,"Vanessa",20,9236},{5,"Penelope",55,2358}}); BOOST_TEST(i3.size()==5); -#endif BOOST_TEST(*(i3.erase(i3.begin()))==employee(1,"Rachel",27,9012)); BOOST_TEST(i3.erase(i3.begin(),i3.end())==i3.end()); @@ -281,11 +277,9 @@ void test_modifiers() i3.insert(i3.end(),ve.begin(),ve.end()); BOOST_TEST(es.size()==3); -#if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST) i3.insert(i3.begin(),{{4,"Vanessa",20,9236},{5,"Penelope",55,2358}}); BOOST_TEST(i3.front().name=="Vanessa"); BOOST_TEST(i4.size()==5); -#endif BOOST_TEST(i4.erase(9012)==1); i4.erase(i4.begin()); @@ -300,11 +294,9 @@ void test_modifiers() i5.insert(i5.begin(),ve.begin(),ve.end()); BOOST_TEST(i1.size()==3); -#if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST) i5.insert(i5.end(),{{4,"Vanessa",20,9236},{5,"Penelope",55,2358}}); BOOST_TEST(i5.back().name=="Penelope"); BOOST_TEST(i1.size()==5); -#endif BOOST_TEST(es.erase(es.begin(),es.end())==es.end()); BOOST_TEST(i2.size()==0); From df2c4510f5cb00b53441b9abee2452846f130e30 Mon Sep 17 00:00:00 2001 From: joaquintides Date: Thu, 6 Nov 2025 19:56:22 +0100 Subject: [PATCH 07/24] removed usage of BOOST_NO_MEMBER_TEMPLATES --- example/bimap.cpp | 20 +------------------ include/boost/multi_index_container.hpp | 8 -------- test/employee.hpp | 10 ---------- test/test_basic.cpp | 6 +----- test/test_projection.cpp | 26 +------------------------ 5 files changed, 3 insertions(+), 67 deletions(-) diff --git a/example/bimap.cpp b/example/bimap.cpp index aac99d06c..1dd9297ab 100644 --- a/example/bimap.cpp +++ b/example/bimap.cpp @@ -1,6 +1,6 @@ /* Boost.MultiIndex example of a bidirectional map. * - * Copyright 2003-2009 Joaquin M Lopez Munoz. + * Copyright 2003-2025 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) @@ -108,22 +108,6 @@ int main() std::string word; std::getline(std::cin,word); -#if defined(BOOST_NO_MEMBER_TEMPLATES) /* use global get<> and family instead */ - - dictionary::iterator it=get(d).find(word); - if(it!=d.end()){ - std::cout<second<<" in English"<::type::iterator it2=get<1>(d).find(word); - if(it2!=get<1>(d).end()){ - std::cout<first<<" in Spanish"<().find(word); @@ -143,7 +127,5 @@ int main() else std::cout<<"No such word in the dictionary"< struct nth_index { @@ -408,11 +407,9 @@ class multi_index_container: BOOST_STATIC_ASSERT(N>=0&&N::value); return *this; } -#endif /* retrieval of indices by tag */ -#if !defined(BOOST_NO_MEMBER_TEMPLATES) template struct index { @@ -439,11 +436,9 @@ class multi_index_container: { return *this; } -#endif /* projection of iterators by number */ -#if !defined(BOOST_NO_MEMBER_TEMPLATES) template struct nth_index_iterator { @@ -488,11 +483,9 @@ class multi_index_container: return index_type::make_iterator( static_cast(it.get_node())); } -#endif /* projection of iterators by tag */ -#if !defined(BOOST_NO_MEMBER_TEMPLATES) template struct index_iterator { @@ -537,7 +530,6 @@ class multi_index_container: return index_type::make_iterator( static_cast(it.get_node())); } -#endif BOOST_MULTI_INDEX_PROTECTED_IF_MEMBER_TEMPLATE_FRIENDS: typedef typename super::final_node_handle_type final_node_handle_type; diff --git a/test/employee.hpp b/test/employee.hpp index d4eca9746..623644bcb 100644 --- a/test/employee.hpp +++ b/test/employee.hpp @@ -121,12 +121,7 @@ typedef employee_set_indices, non_std_allocator > employee_set; -#if defined(BOOST_NO_MEMBER_TEMPLATES) -typedef boost::multi_index::nth_index< - employee_set,1>::type employee_set_by_name; -#else typedef employee_set::nth_index<1>::type employee_set_by_name; -#endif typedef boost::multi_index::index< employee_set,age>::type employee_set_by_age; @@ -135,12 +130,7 @@ typedef boost::multi_index::index< typedef boost::multi_index::index< employee_set,ssn>::type employee_set_by_ssn; -#if defined(BOOST_NO_MEMBER_TEMPLATES) -typedef boost::multi_index::index< - employee_set,randomly>::type employee_set_randomly; -#else typedef employee_set::index< randomly>::type employee_set_randomly; -#endif #endif diff --git a/test/test_basic.cpp b/test/test_basic.cpp index dbfa9dada..aa18ad20b 100644 --- a/test/test_basic.cpp +++ b/test/test_basic.cpp @@ -1,6 +1,6 @@ /* Boost.MultiIndex basic test. * - * Copyright 2003-2017 Joaquin M Lopez Munoz. + * Copyright 2003-2025 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) @@ -65,11 +65,7 @@ void test_basic() employee_set es; std::vector v; -#if defined(BOOST_NO_MEMBER_TEMPLATES) - employee_set_by_name& i1=get(es); -#else employee_set_by_name& i1=es.get(); -#endif const employee_set_by_age& i2=get<2>(es); employee_set_as_inserted& i3=get<3>(es); diff --git a/test/test_projection.cpp b/test/test_projection.cpp index 324a04583..ec49c81b6 100644 --- a/test/test_projection.cpp +++ b/test/test_projection.cpp @@ -1,6 +1,6 @@ /* Boost.MultiIndex test for projection capabilities. * - * Copyright 2003-2013 Joaquin M Lopez Munoz. + * Copyright 2003-2025 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) @@ -39,15 +39,9 @@ void test_projection() BOOST_STATIC_ASSERT((boost::is_same< employee_set_by_name::iterator, nth_index_iterator::type >::value)); -#if defined(BOOST_NO_MEMBER_TEMPLATES) - BOOST_STATIC_ASSERT((boost::is_same< - employee_set_by_age::iterator, - index_iterator::type >::value)); -#else BOOST_STATIC_ASSERT((boost::is_same< employee_set_by_age::iterator, employee_set::index_iterator::type >::value)); -#endif BOOST_STATIC_ASSERT((boost::is_same< employee_set_as_inserted::iterator, nth_index_iterator::type >::value)); @@ -64,11 +58,7 @@ void test_projection() it3= project(es,it2); it4= project(es,it3); it5= project(es,it4); -#if defined(BOOST_NO_MEMBER_TEMPLATES) - itbis=project<0>(es,it5); -#else itbis=es.project<0>(it5); -#endif BOOST_TEST( *it==*it1&&*it1==*it2&&*it2==*it3&&*it3==*it4&&*it4==*it5&&itbis==it); @@ -94,15 +84,9 @@ void test_projection() BOOST_STATIC_ASSERT((boost::is_same< employee_set_by_name::const_iterator, nth_index_const_iterator::type >::value)); -#if defined(BOOST_NO_MEMBER_TEMPLATES) - BOOST_STATIC_ASSERT((boost::is_same< - employee_set_by_age::const_iterator, - index_const_iterator::type >::value)); -#else BOOST_STATIC_ASSERT((boost::is_same< employee_set_by_age::const_iterator, employee_set::index_const_iterator::type >::value)); -#endif BOOST_STATIC_ASSERT((boost::is_same< employee_set_as_inserted::const_iterator, nth_index_const_iterator::type >::value)); @@ -114,17 +98,9 @@ void test_projection() nth_index_const_iterator::type >::value)); cit= ces.find(employee(4,"John",57,1002)); -#if defined(BOOST_NO_MEMBER_TEMPLATES) - cit1= project(ces,cit); -#else cit1= ces.project(cit); -#endif cit2= project(ces,cit1); -#if defined(BOOST_NO_MEMBER_TEMPLATES) - cit3= project(ces,cit2); -#else cit3= ces.project(cit2); -#endif cit4= project(ces,cit3); cit5= project(ces,cit4); citbis=project<0>(ces,cit5); From c6db783d08a332c9b6e6e0e5662d3d97f7aa516e Mon Sep 17 00:00:00 2001 From: joaquintides Date: Thu, 6 Nov 2025 20:14:21 +0100 Subject: [PATCH 08/24] removed usage of BOOST_NO_SFINAE --- .../multi_index/detail/is_transparent.hpp | 2 +- .../boost/multi_index/detail/node_handle.hpp | 17 ++------ include/boost/multi_index/global_fun.hpp | 20 +--------- include/boost/multi_index/identity.hpp | 15 +------ include/boost/multi_index/mem_fun.hpp | 25 +----------- include/boost/multi_index/member.hpp | 25 +----------- test/test_key_extractors.cpp | 39 +------------------ 7 files changed, 9 insertions(+), 134 deletions(-) diff --git a/include/boost/multi_index/detail/is_transparent.hpp b/include/boost/multi_index/detail/is_transparent.hpp index b3e8a0c16..86b363457 100644 --- a/include/boost/multi_index/detail/is_transparent.hpp +++ b/include/boost/multi_index/detail/is_transparent.hpp @@ -37,7 +37,7 @@ struct is_transparent:std::true_type{}; } /* namespace boost */ -#if !defined(BOOST_NO_SFINAE)&&!defined(BOOST_NO_SFINAE_EXPR)&& \ +#if !defined(BOOST_NO_SFINAE_EXPR)&& \ !defined(BOOST_NO_CXX11_DECLTYPE)&& \ (defined(BOOST_NO_CXX11_FINAL)||defined(BOOST_IS_FINAL)) diff --git a/include/boost/multi_index/detail/node_handle.hpp b/include/boost/multi_index/detail/node_handle.hpp index 1a97d5626..e8ef5ff8d 100644 --- a/include/boost/multi_index/detail/node_handle.hpp +++ b/include/boost/multi_index/detail/node_handle.hpp @@ -17,18 +17,15 @@ #include #include #include +#include #include #include #include #include -#include -#include - -#if !defined(BOOST_NO_SFINAE) -#include #include #include -#endif +#include +#include namespace boost{ @@ -231,8 +228,6 @@ struct insert_return_type /* utility for SFINAEing merge and related operations */ -#if !defined(BOOST_NO_SFINAE) - #define BOOST_MULTI_INDEX_ENABLE_IF_MERGEABLE(Dst,Src,T) \ typename enable_if_c< \ !is_const< Dst >::value&&!is_const< Src >::value&& \ @@ -240,12 +235,6 @@ typename enable_if_c< \ T \ >::type -#else - -#define BOOST_MULTI_INDEX_ENABLE_IF_MERGEABLE(Dst,Src,T) T - -#endif - } /* namespace multi_index::detail */ } /* namespace multi_index */ diff --git a/include/boost/multi_index/global_fun.hpp b/include/boost/multi_index/global_fun.hpp index b42a7e7f6..fc024c0ef 100644 --- a/include/boost/multi_index/global_fun.hpp +++ b/include/boost/multi_index/global_fun.hpp @@ -18,14 +18,11 @@ #include #include #include +#include #include #include #include -#if !defined(BOOST_NO_SFINAE) -#include -#endif - namespace boost{ template class reference_wrapper; /* fwd decl. */ @@ -54,13 +51,8 @@ struct const_ref_global_fun_base template -#if !defined(BOOST_NO_SFINAE) typename disable_if< is_convertible,Type>::type -#else - Type -#endif - operator()(const ChainedPtr& x)const { return operator()(*x); @@ -101,13 +93,8 @@ struct non_const_ref_global_fun_base template -#if !defined(BOOST_NO_SFINAE) typename disable_if< is_convertible,Type>::type -#else - Type -#endif - operator()(const ChainedPtr& x)const { return operator()(*x); @@ -133,13 +120,8 @@ struct non_ref_global_fun_base template -#if !defined(BOOST_NO_SFINAE) typename disable_if< is_convertible,Type>::type -#else - Type -#endif - operator()(const ChainedPtr& x)const { return operator()(*x); diff --git a/include/boost/multi_index/identity.hpp b/include/boost/multi_index/identity.hpp index dd1b01d10..bf99a86f2 100644 --- a/include/boost/multi_index/identity.hpp +++ b/include/boost/multi_index/identity.hpp @@ -19,11 +19,8 @@ #include #include #include -#include - -#if !defined(BOOST_NO_SFINAE) #include -#endif +#include namespace boost{ @@ -50,12 +47,7 @@ struct const_identity_base template -#if !defined(BOOST_NO_SFINAE) typename disable_if,Type&>::type -#else - Type& -#endif - operator()(const ChainedPtr& x)const { return operator()(*x); @@ -94,13 +86,8 @@ struct non_const_identity_base template -#if !defined(BOOST_NO_SFINAE) typename disable_if< is_convertible,Type&>::type -#else - Type& -#endif - operator()(const ChainedPtr& x)const { return operator()(*x); diff --git a/include/boost/multi_index/mem_fun.hpp b/include/boost/multi_index/mem_fun.hpp index 5433d3989..2ab17a016 100644 --- a/include/boost/multi_index/mem_fun.hpp +++ b/include/boost/multi_index/mem_fun.hpp @@ -15,11 +15,8 @@ #include /* keep it first to prevent nasty warns in MSVC */ #include -#include - -#if !defined(BOOST_NO_SFINAE) #include -#endif +#include namespace boost{ @@ -58,13 +55,8 @@ struct const_mem_fun_impl template -#if !defined(BOOST_NO_SFINAE) typename disable_if< is_convertible,Type>::type -#else - Type -#endif - operator()(const ChainedPtr& x)const { return operator()(*x); @@ -96,13 +88,8 @@ struct mem_fun_impl template -#if !defined(BOOST_NO_SFINAE) typename disable_if< is_convertible,Type>::type -#else - Type -#endif - operator()(const ChainedPtr& x)const { return operator()(*x); @@ -198,13 +185,8 @@ struct const_mem_fun_explicit template -#if !defined(BOOST_NO_SFINAE) typename disable_if< is_convertible,Type>::type -#else - Type -#endif - operator()(const ChainedPtr& x)const { return operator()(*x); @@ -236,13 +218,8 @@ struct mem_fun_explicit template -#if !defined(BOOST_NO_SFINAE) typename disable_if< is_convertible,Type>::type -#else - Type -#endif - operator()(const ChainedPtr& x)const { return operator()(*x); diff --git a/include/boost/multi_index/member.hpp b/include/boost/multi_index/member.hpp index be95cb367..d5bedf141 100644 --- a/include/boost/multi_index/member.hpp +++ b/include/boost/multi_index/member.hpp @@ -17,11 +17,8 @@ #include #include #include -#include - -#if !defined(BOOST_NO_SFINAE) #include -#endif +#include namespace boost{ @@ -48,13 +45,8 @@ struct const_member_base template -#if !defined(BOOST_NO_SFINAE) typename disable_if< is_convertible,Type&>::type -#else - Type& -#endif - operator()(const ChainedPtr& x)const { return operator()(*x); @@ -83,13 +75,8 @@ struct non_const_member_base template -#if !defined(BOOST_NO_SFINAE) typename disable_if< is_convertible,Type&>::type -#else - Type& -#endif - operator()(const ChainedPtr& x)const { return operator()(*x); @@ -154,13 +141,8 @@ struct const_member_offset_base template -#if !defined(BOOST_NO_SFINAE) typename disable_if< is_convertible,Type&>::type -#else - Type& -#endif - operator()(const ChainedPtr& x)const { return operator()(*x); @@ -192,13 +174,8 @@ struct non_const_member_offset_base template -#if !defined(BOOST_NO_SFINAE) typename disable_if< is_convertible,Type&>::type -#else - Type& -#endif - operator()(const ChainedPtr& x)const { return operator()(*x); diff --git a/test/test_key_extractors.cpp b/test/test_key_extractors.cpp index 75cb5aae8..54aefb1fd 100644 --- a/test/test_key_extractors.cpp +++ b/test/test_key_extractors.cpp @@ -1,6 +1,6 @@ /* Boost.MultiIndex test for key extractors. * - * Copyright 2003-2022 Joaquin M Lopez Munoz. + * Copyright 2003-2025 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) @@ -124,7 +124,6 @@ typedef composite_key< key_mf > ccompw_key; -#if !defined(BOOST_NO_SFINAE) /* testcases for problems with non-copyable classes reported at * http://lists.boost.org/Archives/boost/2006/04/103065.php */ @@ -183,7 +182,6 @@ typedef composite_key< nc_ckey_m, nc_key_cmf > nc_compkey; -#endif void test_key_extractors() { @@ -244,7 +242,6 @@ void test_key_extractors() BOOST_TEST(cmpk(ctr)==make_tuple(test_class(0,0),0,0,true)); BOOST_TEST(ccmpk(ctr)==make_tuple(test_class(0,0),0)); -#if !defined(BOOST_NO_SFINAE) BOOST_TEST(id(td).int_member==0); BOOST_TEST(cid(td).int_member==0); BOOST_TEST(k_m(td)==0); @@ -257,7 +254,6 @@ void test_key_extractors() BOOST_TEST(ck_m(ctdr)==0); BOOST_TEST(cmpk(ctdr)==make_tuple(test_class(0,0),0,0,true)); BOOST_TEST(ccmpk(ctdr)==make_tuple(test_class(0,0),0)); -#endif k_m(tr)=1; BOOST_TEST(id(tp).int_member==1); @@ -271,7 +267,6 @@ void test_key_extractors() BOOST_TEST(cmpk(ctp)==make_tuple(test_class(1,0),1,0,true)); BOOST_TEST(ccmpk(ctp)==make_tuple(test_class(1,0),1)); -#if !defined(BOOST_NO_SFINAE) BOOST_TEST(id(tdp).int_member==1); BOOST_TEST(cid(tdp).int_member==1); BOOST_TEST(k_m(tdp)==1); @@ -282,7 +277,6 @@ void test_key_extractors() BOOST_TEST(ck_m(ctdp)==1); BOOST_TEST(cmpk(ctdp)==make_tuple(test_class(1,0),1,0,true)); BOOST_TEST(ccmpk(ctdp)==make_tuple(test_class(1,0),1)); -#endif k_m(tp)=2; BOOST_TEST(id(tpp).int_member==2); @@ -327,18 +321,14 @@ void test_key_extractors() BOOST_TEST(k_cm(tr)==0); BOOST_TEST(k_cm(ctr)==0); -#if !defined(BOOST_NO_SFINAE) BOOST_TEST(k_cm(td)==0); BOOST_TEST(k_cm(ctdr)==0); -#endif BOOST_TEST(k_cm(tp)==0); BOOST_TEST(k_cm(ctp)==0); -#if !defined(BOOST_NO_SFINAE) BOOST_TEST(k_cm(tdp)==0); BOOST_TEST(k_cm(ctdp)==0); -#endif BOOST_TEST(k_cm(tpp)==0); BOOST_TEST(k_cm(ctpp)==0); @@ -360,7 +350,6 @@ void test_key_extractors() BOOST_TEST(k_cvrmf(ctr)); #endif -#if !defined(BOOST_NO_SFINAE) BOOST_TEST(k_cmf(td)); BOOST_TEST(k_cmf(ctdr)); BOOST_TEST(k_cvmf(td)); @@ -371,7 +360,6 @@ void test_key_extractors() BOOST_TEST(k_crmf(ctdr)); BOOST_TEST(k_cvrmf(td)); BOOST_TEST(k_cvrmf(ctdr)); -#endif #endif BOOST_TEST(k_cmf(tp)); @@ -386,7 +374,6 @@ void test_key_extractors() BOOST_TEST(k_cvrmf(ctp)); #endif -#if !defined(BOOST_NO_SFINAE) BOOST_TEST(k_cmf(tdp)); BOOST_TEST(k_cmf(ctdp)); BOOST_TEST(k_cvmf(tdp)); @@ -397,7 +384,6 @@ void test_key_extractors() BOOST_TEST(k_crmf(ctdp)); BOOST_TEST(k_cvrmf(tdp)); BOOST_TEST(k_cvrmf(ctdp)); -#endif #endif BOOST_TEST(k_cmf(tpp)); @@ -440,14 +426,12 @@ void test_key_extractors() BOOST_TEST(!k_vrmf(tr)); #endif -#if !defined(BOOST_NO_SFINAE) BOOST_TEST(!k_mf(td)); BOOST_TEST(!k_vmf(td)); #if !defined(BOOST_NO_CXX11_REF_QUALIFIERS) BOOST_TEST(!k_rmf(td)); BOOST_TEST(!k_vrmf(td)); -#endif #endif BOOST_TEST(!k_mf(tp)); @@ -458,14 +442,12 @@ void test_key_extractors() BOOST_TEST(!k_vrmf(tp)); #endif -#if !defined(BOOST_NO_SFINAE) BOOST_TEST(!k_mf(tdp)); BOOST_TEST(!k_vmf(tdp)); #if !defined(BOOST_NO_CXX11_REF_QUALIFIERS) BOOST_TEST(!k_rmf(tdp)); BOOST_TEST(!k_vrmf(tdp)); -#endif #endif BOOST_TEST(!k_mf(tpp)); @@ -487,18 +469,14 @@ void test_key_extractors() BOOST_TEST(k_gf(tr)); BOOST_TEST(k_gf(ctr)); -#if !defined(BOOST_NO_SFINAE) BOOST_TEST(k_gf(td)); BOOST_TEST(k_gf(ctdr)); -#endif BOOST_TEST(k_gf(tp)); BOOST_TEST(k_gf(ctp)); -#if !defined(BOOST_NO_SFINAE) BOOST_TEST(k_gf(tdp)); BOOST_TEST(k_gf(ctdp)); -#endif BOOST_TEST(k_gf(tpp)); BOOST_TEST(k_gf(ctpp)); @@ -511,46 +489,31 @@ void test_key_extractors() BOOST_TEST(!k_gcrf(tr)); BOOST_TEST(!k_gcrf(ctr)); -#if !defined(BOOST_NO_SFINAE) BOOST_TEST(!k_gcrf(td)); BOOST_TEST(!k_gcrf(ctdr)); -#endif BOOST_TEST(!k_gcrf(tp)); BOOST_TEST(!k_gcrf(ctp)); -#if !defined(BOOST_NO_SFINAE) BOOST_TEST(!k_gcrf(tdp)); BOOST_TEST(!k_gcrf(ctdp)); -#endif - BOOST_TEST(!k_gcrf(tpp)); BOOST_TEST(!k_gcrf(ctpp)); BOOST_TEST(!k_gcrf(tap)); BOOST_TEST(!k_gcrf(ctap)); - BOOST_TEST(!k_gcrf(tw)); BOOST_TEST(!k_gcrf(ctw)); BOOST_TEST(k_grf(tr)); - -#if !defined(BOOST_NO_SFINAE) BOOST_TEST(k_grf(td)); -#endif - BOOST_TEST(k_grf(tp)); - -#if !defined(BOOST_NO_SFINAE) BOOST_TEST(k_grf(tdp)); -#endif - BOOST_TEST(k_grf(tpp)); BOOST_TEST(k_grf(tap)); BOOST_TEST(k_grf(tw)); BOOST_TEST(ccmpk_w(tw)==make_tuple(false)); -#if !defined(BOOST_NO_SFINAE) /* testcases for problems with non-copyable classes reported at * http://lists.boost.org/Archives/boost/2006/04/103065.php */ From 6b6b9463344880b5d199576f75697369f9c62b55 Mon Sep 17 00:00:00 2001 From: joaquintides Date: Thu, 6 Nov 2025 21:46:41 +0100 Subject: [PATCH 09/24] removed leftover pp line --- test/test_key_extractors.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/test/test_key_extractors.cpp b/test/test_key_extractors.cpp index 54aefb1fd..2c18b4e78 100644 --- a/test/test_key_extractors.cpp +++ b/test/test_key_extractors.cpp @@ -546,7 +546,6 @@ void test_key_extractors() test_nc_class nc_t(1,0); BOOST_TEST(nc_cmpk(nc_td)==make_tuple(boost::cref(nc_t),1,1,true)); -#endif std::list tl; for(int i=0;i<20;++i)tl.push_back(test_class(i)); From e0e51bf893dfd1b564ed3d0817883ea1c9e4b5cb Mon Sep 17 00:00:00 2001 From: joaquintides Date: Fri, 7 Nov 2025 09:38:52 +0100 Subject: [PATCH 10/24] removed usage of BOOST_NO_MEMBER_TEMPLATE_FRIENDS --- include/boost/multi_index/composite_key.hpp | 1 - .../multi_index/detail/access_specifier.hpp | 54 ------------------- .../multi_index/detail/ord_index_impl.hpp | 9 +--- .../boost/multi_index/detail/safe_mode.hpp | 13 ++--- include/boost/multi_index/hashed_index.hpp | 13 +---- .../boost/multi_index/random_access_index.hpp | 9 +--- include/boost/multi_index/sequenced_index.hpp | 9 +--- include/boost/multi_index_container.hpp | 7 +-- 8 files changed, 13 insertions(+), 102 deletions(-) delete mode 100644 include/boost/multi_index/detail/access_specifier.hpp diff --git a/include/boost/multi_index/composite_key.hpp b/include/boost/multi_index/composite_key.hpp index d0e049320..101933f59 100644 --- a/include/boost/multi_index/composite_key.hpp +++ b/include/boost/multi_index/composite_key.hpp @@ -17,7 +17,6 @@ #include #include #include -#include #include #include #include diff --git a/include/boost/multi_index/detail/access_specifier.hpp b/include/boost/multi_index/detail/access_specifier.hpp deleted file mode 100644 index f3346e836..000000000 --- a/include/boost/multi_index/detail/access_specifier.hpp +++ /dev/null @@ -1,54 +0,0 @@ -/* Copyright 2003-2013 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) - * - * See http://www.boost.org/libs/multi_index for library home page. - */ - -#ifndef BOOST_MULTI_INDEX_DETAIL_ACCESS_SPECIFIER_HPP -#define BOOST_MULTI_INDEX_DETAIL_ACCESS_SPECIFIER_HPP - -#if defined(_MSC_VER) -#pragma once -#endif - -#include -#include - -/* In those compilers that do not accept the member template friend syntax, - * some protected and private sections might need to be specified as - * public. - */ - -#if defined(BOOST_NO_MEMBER_TEMPLATE_FRIENDS) -#define BOOST_MULTI_INDEX_PROTECTED_IF_MEMBER_TEMPLATE_FRIENDS public -#define BOOST_MULTI_INDEX_PRIVATE_IF_MEMBER_TEMPLATE_FRIENDS public -#else -#define BOOST_MULTI_INDEX_PROTECTED_IF_MEMBER_TEMPLATE_FRIENDS protected -#define BOOST_MULTI_INDEX_PRIVATE_IF_MEMBER_TEMPLATE_FRIENDS private -#endif - -/* GCC does not correctly support in-class using declarations for template - * functions. See http://gcc.gnu.org/bugzilla/show_bug.cgi?id=9810 - * MSVC 7.1/8.0 seem to have a similar problem, though the conditions in - * which the error happens are not that simple. I have yet to isolate this - * into a snippet suitable for bug reporting. - * Sun Studio also has this problem, which might be related, from the - * information gathered at Sun forums, with a known issue notified at the - * internal bug report 6421933. The bug is present up to Studio Express 2, - * the latest preview version of the future Sun Studio 12. As of this writing - * (October 2006) it is not known whether a fix will finally make it into the - * official Sun Studio 12. - */ - -#if BOOST_WORKAROUND(__GNUC__,==3)&&(__GNUC_MINOR__<4)||\ - BOOST_WORKAROUND(BOOST_MSVC,==1310)||\ - BOOST_WORKAROUND(BOOST_MSVC,==1400)||\ - BOOST_WORKAROUND(__SUNPRO_CC,BOOST_TESTED_AT(0x590)) -#define BOOST_MULTI_INDEX_PRIVATE_IF_USING_DECL_FOR_TEMPL_FUNCTIONS public -#else -#define BOOST_MULTI_INDEX_PRIVATE_IF_USING_DECL_FOR_TEMPL_FUNCTIONS private -#endif - -#endif diff --git a/include/boost/multi_index/detail/ord_index_impl.hpp b/include/boost/multi_index/detail/ord_index_impl.hpp index eba463f4d..aea505d13 100644 --- a/include/boost/multi_index/detail/ord_index_impl.hpp +++ b/include/boost/multi_index/detail/ord_index_impl.hpp @@ -49,7 +49,6 @@ #include #include #include -#include #include #include #include @@ -124,8 +123,7 @@ template< typename KeyFromValue,typename Compare, typename SuperMeta,typename TagList,typename Category,typename AugmentPolicy > -class ordered_index_impl: - BOOST_MULTI_INDEX_PROTECTED_IF_MEMBER_TEMPLATE_FRIENDS SuperMeta::type +class ordered_index_impl:protected SuperMeta::type { #if defined(BOOST_MULTI_INDEX_ENABLE_INVARIANT_CHECKING)&&\ BOOST_WORKAROUND(__MWERKS__,<=0x3003) @@ -137,11 +135,8 @@ class ordered_index_impl: #pragma parse_mfunc_templ off #endif -#if !defined(BOOST_NO_MEMBER_TEMPLATE_FRIENDS) /* cross-index access */ - template friend class index_base; -#endif typedef typename SuperMeta::type super; @@ -722,7 +717,7 @@ class ordered_index_impl: return range(lower,upper,dispatch()); } -BOOST_MULTI_INDEX_PROTECTED_IF_MEMBER_TEMPLATE_FRIENDS: +protected: ordered_index_impl(const ctor_args_list& args_list,const allocator_type& al): super(args_list.get_tail(),al), key(tuples::get<0>(args_list.get_head())), diff --git a/include/boost/multi_index/detail/safe_mode.hpp b/include/boost/multi_index/detail/safe_mode.hpp index 08de2f4ff..b11260585 100644 --- a/include/boost/multi_index/detail/safe_mode.hpp +++ b/include/boost/multi_index/detail/safe_mode.hpp @@ -1,4 +1,4 @@ -/* Copyright 2003-2023 Joaquin M Lopez Munoz. +/* Copyright 2003-2025 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) @@ -120,7 +120,6 @@ #include #include #include -#include #include #include #include @@ -349,9 +348,7 @@ class safe_iterator_base const safe_container_base* owner()const{return cont;} -BOOST_MULTI_INDEX_PRIVATE_IF_MEMBER_TEMPLATE_FRIENDS: - -#if !defined(BOOST_NO_MEMBER_TEMPLATE_FRIENDS) +private: friend class safe_container_base; template friend class safe_mode::safe_container; @@ -360,7 +357,6 @@ class safe_iterator_base template friend void safe_mode_detail::transfer_equivalent_iterators( Dst&,Iterator,boost::true_type); -#endif inline void attach(safe_container_base* cont_); @@ -374,16 +370,13 @@ class safe_container_base:private noncopyable public: safe_container_base(){} -BOOST_MULTI_INDEX_PROTECTED_IF_MEMBER_TEMPLATE_FRIENDS: - -#if !defined(BOOST_NO_MEMBER_TEMPLATE_FRIENDS) +protected: friend class safe_iterator_base; template friend void safe_mode::detach_equivalent_iterators(Iterator&); template friend void safe_mode_detail::transfer_equivalent_iterators( Dst&,Iterator,boost::true_type); -#endif ~safe_container_base() { diff --git a/include/boost/multi_index/hashed_index.hpp b/include/boost/multi_index/hashed_index.hpp index 4d2966f4e..1fb00a8ac 100644 --- a/include/boost/multi_index/hashed_index.hpp +++ b/include/boost/multi_index/hashed_index.hpp @@ -22,7 +22,6 @@ #include #include #include -#include #include #include #include @@ -85,8 +84,7 @@ template< typename KeyFromValue,typename Hash,typename Pred, typename SuperMeta,typename TagList,typename Category > -class hashed_index: - BOOST_MULTI_INDEX_PROTECTED_IF_MEMBER_TEMPLATE_FRIENDS SuperMeta::type +class hashed_index:protected SuperMeta::type { #if defined(BOOST_MULTI_INDEX_ENABLE_INVARIANT_CHECKING)&&\ BOOST_WORKAROUND(__MWERKS__,<=0x3003) @@ -98,11 +96,8 @@ class hashed_index: #pragma parse_mfunc_templ off #endif -#if !defined(BOOST_NO_MEMBER_TEMPLATE_FRIENDS) /* cross-index access */ - template friend class index_base; -#endif typedef typename SuperMeta::type super; @@ -750,7 +745,7 @@ class hashed_index: rehash(static_cast(std::ceil(static_cast(n)/mlf))); } -BOOST_MULTI_INDEX_PROTECTED_IF_MEMBER_TEMPLATE_FRIENDS: +protected: hashed_index(const ctor_args_list& args_list,const allocator_type& al): super(args_list.get_tail(),al), key(tuples::get<1>(args_list.get_head())), @@ -1181,13 +1176,9 @@ class hashed_index: /* comparison */ -#if !defined(BOOST_NO_MEMBER_TEMPLATE_FRIENDS) - /* defect macro refers to class, not function, templates, but anyway */ - template friend bool operator==( const hashed_index&,const hashed_index& y); -#endif bool equals(const hashed_index& x)const{return equals(x,Category());} diff --git a/include/boost/multi_index/random_access_index.hpp b/include/boost/multi_index/random_access_index.hpp index f13b7bb0f..1a501813a 100644 --- a/include/boost/multi_index/random_access_index.hpp +++ b/include/boost/multi_index/random_access_index.hpp @@ -22,7 +22,6 @@ #include #include #include -#include #include #include #include @@ -77,8 +76,7 @@ namespace detail{ #endif template -class random_access_index: - BOOST_MULTI_INDEX_PROTECTED_IF_MEMBER_TEMPLATE_FRIENDS SuperMeta::type +class random_access_index:protected SuperMeta::type { #if defined(BOOST_MULTI_INDEX_ENABLE_INVARIANT_CHECKING)&&\ BOOST_WORKAROUND(__MWERKS__,<=0x3003) @@ -90,11 +88,8 @@ class random_access_index: #pragma parse_mfunc_templ off #endif -#if !defined(BOOST_NO_MEMBER_TEMPLATE_FRIENDS) /* cross-index access */ - template friend class index_base; -#endif typedef typename SuperMeta::type super; @@ -755,7 +750,7 @@ class random_access_index: } } -BOOST_MULTI_INDEX_PROTECTED_IF_MEMBER_TEMPLATE_FRIENDS: +protected: random_access_index( const ctor_args_list& args_list,const allocator_type& al): super(args_list.get_tail(),al), diff --git a/include/boost/multi_index/sequenced_index.hpp b/include/boost/multi_index/sequenced_index.hpp index 32a30ff04..30d066f98 100644 --- a/include/boost/multi_index/sequenced_index.hpp +++ b/include/boost/multi_index/sequenced_index.hpp @@ -21,7 +21,6 @@ #include #include #include -#include #include #include #include @@ -67,8 +66,7 @@ namespace detail{ #endif template -class sequenced_index: - BOOST_MULTI_INDEX_PROTECTED_IF_MEMBER_TEMPLATE_FRIENDS SuperMeta::type +class sequenced_index:protected SuperMeta::type { #if defined(BOOST_MULTI_INDEX_ENABLE_INVARIANT_CHECKING)&&\ BOOST_WORKAROUND(__MWERKS__,<=0x3003) @@ -80,11 +78,8 @@ class sequenced_index: #pragma parse_mfunc_templ off #endif -#if !defined(BOOST_NO_MEMBER_TEMPLATE_FRIENDS) /* cross-index access */ - template friend class index_base; -#endif typedef typename SuperMeta::type super; @@ -670,7 +665,7 @@ class sequenced_index: } } -BOOST_MULTI_INDEX_PROTECTED_IF_MEMBER_TEMPLATE_FRIENDS: +protected: sequenced_index(const ctor_args_list& args_list,const allocator_type& al): super(args_list.get_tail(),al) diff --git a/include/boost/multi_index_container.hpp b/include/boost/multi_index_container.hpp index c715017f3..c63d7356a 100644 --- a/include/boost/multi_index_container.hpp +++ b/include/boost/multi_index_container.hpp @@ -25,7 +25,6 @@ #include #include #include -#include #include #include #include @@ -97,7 +96,7 @@ class multi_index_container: Value,IndexSpecifierList,Allocator>::type > >, - BOOST_MULTI_INDEX_PRIVATE_IF_MEMBER_TEMPLATE_FRIENDS detail::header_holder< + private detail::header_holder< allocator_pointer_t< allocator_rebind_t< Allocator, @@ -120,11 +119,9 @@ class multi_index_container: #endif private: -#if !defined(BOOST_NO_MEMBER_TEMPLATE_FRIENDS) template friend class detail::index_base; template friend struct detail::header_holder; template friend struct detail::converter; -#endif typedef typename detail::multi_index_base_type< Value,IndexSpecifierList,Allocator>::type super; @@ -531,7 +528,7 @@ class multi_index_container: static_cast(it.get_node())); } -BOOST_MULTI_INDEX_PROTECTED_IF_MEMBER_TEMPLATE_FRIENDS: +protected: typedef typename super::final_node_handle_type final_node_handle_type; typedef typename super::copy_map_type copy_map_type; From 68e121212af3c3d01c460c0f3880239b8927ee4b Mon Sep 17 00:00:00 2001 From: joaquintides Date: Fri, 7 Nov 2025 10:05:46 +0100 Subject: [PATCH 11/24] removed usage of BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP --- .../boost/multi_index/detail/bucket_array.hpp | 8 -------- .../multi_index/detail/index_node_base.hpp | 10 +--------- test/pair_of_ints.hpp | 12 +---------- test/test_alloc_awareness.cpp | 8 -------- test/test_basic.cpp | 8 -------- test/test_modifiers.cpp | 8 -------- test/test_serialization3.cpp | 20 ------------------- 7 files changed, 2 insertions(+), 72 deletions(-) diff --git a/include/boost/multi_index/detail/bucket_array.hpp b/include/boost/multi_index/detail/bucket_array.hpp index 0d4f9ef57..47356bb14 100644 --- a/include/boost/multi_index/detail/bucket_array.hpp +++ b/include/boost/multi_index/detail/bucket_array.hpp @@ -224,12 +224,8 @@ void swap(bucket_array& x,bucket_array& y) * somehow invalid archive. */ -#if defined(BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP) -namespace serialization{ -#else namespace multi_index{ namespace detail{ -#endif template inline void load_construct_data( @@ -239,12 +235,8 @@ inline void load_construct_data( throw_exception(boost::multi_index::detail::bad_archive_exception()); } -#if defined(BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP) -} /* namespace serialization */ -#else } /* namespace multi_index::detail */ } /* namespace multi_index */ -#endif #endif diff --git a/include/boost/multi_index/detail/index_node_base.hpp b/include/boost/multi_index/detail/index_node_base.hpp index 0d37b02b1..c98975ef5 100644 --- a/include/boost/multi_index/detail/index_node_base.hpp +++ b/include/boost/multi_index/detail/index_node_base.hpp @@ -1,4 +1,4 @@ -/* Copyright 2003-2023 Joaquin M Lopez Munoz. +/* Copyright 2003-2025 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) @@ -105,12 +105,8 @@ Node* node_from_value(const Value* p) * somehow invalid archive. */ -#if defined(BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP) -namespace serialization{ -#else namespace multi_index{ namespace detail{ -#endif template inline void load_construct_data( @@ -120,12 +116,8 @@ inline void load_construct_data( throw_exception(boost::multi_index::detail::bad_archive_exception()); } -#if defined(BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP) -} /* namespace serialization */ -#else } /* namespace multi_index::detail */ } /* namespace multi_index */ -#endif #endif diff --git a/test/pair_of_ints.hpp b/test/pair_of_ints.hpp index f4c31f8e3..2cf1a4cfb 100644 --- a/test/pair_of_ints.hpp +++ b/test/pair_of_ints.hpp @@ -1,6 +1,6 @@ /* Used in Boost.MultiIndex tests. * - * Copyright 2003-2023 Joaquin M Lopez Munoz. + * Copyright 2003-2025 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) @@ -58,11 +58,6 @@ inline int decrement_int(int& x) return --x; } -#if defined(BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP) -namespace boost{ -namespace serialization{ -#endif - template void serialize(Archive& ar,pair_of_ints& p,const unsigned int) { @@ -70,9 +65,4 @@ void serialize(Archive& ar,pair_of_ints& p,const unsigned int) ar&boost::core::make_nvp("second",p.second); } -#if defined(BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP) -} /* namespace serialization */ -} /* namespace boost*/ -#endif - #endif diff --git a/test/test_alloc_awareness.cpp b/test/test_alloc_awareness.cpp index 238598390..b982cfd0b 100644 --- a/test/test_alloc_awareness.cpp +++ b/test/test_alloc_awareness.cpp @@ -46,20 +46,12 @@ inline bool operator<(const move_tracker& x,const move_tracker& y) return x.n h; return h(x.n); } -#if defined(BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP) -} /* namespace boost */ -#endif - #if defined(BOOST_NO_CXX17_IF_CONSTEXPR)&&defined(BOOST_MSVC) #pragma warning(push) #pragma warning(disable:4127) /* conditional expression is constant */ diff --git a/test/test_basic.cpp b/test/test_basic.cpp index aa18ad20b..8f2d61fe4 100644 --- a/test/test_basic.cpp +++ b/test/test_basic.cpp @@ -46,20 +46,12 @@ bool operator<(const no_addressof_type& x,const no_addressof_type& y) return x.n h; return h(x.n); } -#if defined(BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP) -} /* namespace boost */ -#endif - void test_basic() { employee_set es; diff --git a/test/test_modifiers.cpp b/test/test_modifiers.cpp index b9a9ca1f4..6f6494d58 100644 --- a/test/test_modifiers.cpp +++ b/test/test_modifiers.cpp @@ -55,19 +55,11 @@ inline bool operator==(const always_one& x,const always_one& y) return x.get()==y.get(); } -#if defined(BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP) -namespace boost{ -#endif - inline std::size_t hash_value(const always_one& x) { return static_cast(x.get()); } -#if defined(BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP) -} /* namespace boost */ -#endif - class linked_object { struct impl:boost::enable_shared_from_this diff --git a/test/test_serialization3.cpp b/test/test_serialization3.cpp index 7a14dcf4f..a5fae2530 100644 --- a/test/test_serialization3.cpp +++ b/test/test_serialization3.cpp @@ -26,11 +26,6 @@ struct non_default_ctble int n; }; -#if defined(BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP) -namespace boost{ -namespace serialization{ -#endif - template void save_construct_data( Archive& ar,const non_default_ctble* p,const unsigned int version) @@ -56,11 +51,6 @@ void serialize(Archive&,non_default_ctble&,const unsigned int) { } -#if defined(BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP) -} /* namespace serialization */ -} /* namespace boost*/ -#endif - namespace boost{ namespace serialization{ template<> struct version @@ -81,22 +71,12 @@ struct non_copyable int n; }; -#if defined(BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP) -namespace boost{ -namespace serialization{ -#endif - template void serialize(Archive& ar,non_copyable& x,const unsigned int) { ar&boost::serialization::make_nvp("n",x.n); } -#if defined(BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP) -} /* namespace serialization */ -} /* namespace boost*/ -#endif - using namespace boost::multi_index; void test_serialization3() From c8ad854f17cffa7e18bec4ea7cf8cea04b782b2a Mon Sep 17 00:00:00 2001 From: joaquintides Date: Fri, 7 Nov 2025 10:29:16 +0100 Subject: [PATCH 12/24] removed usage of BOOST_FUNCTION_SCOPE_USING_DECLARATION_BREAKS_ADL --- include/boost/multi_index/detail/adl_swap.hpp | 8 +---- test/test_modifiers.cpp | 29 ------------------- 2 files changed, 1 insertion(+), 36 deletions(-) diff --git a/include/boost/multi_index/detail/adl_swap.hpp b/include/boost/multi_index/detail/adl_swap.hpp index 02b064422..77e30c55c 100644 --- a/include/boost/multi_index/detail/adl_swap.hpp +++ b/include/boost/multi_index/detail/adl_swap.hpp @@ -1,4 +1,4 @@ -/* Copyright 2003-2013 Joaquin M Lopez Munoz. +/* Copyright 2003-2025 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) @@ -25,14 +25,8 @@ namespace detail{ template void adl_swap(T& x,T& y) { - -#if !defined(BOOST_FUNCTION_SCOPE_USING_DECLARATION_BREAKS_ADL) using std::swap; swap(x,y); -#else - std::swap(x,y); -#endif - } } /* namespace multi_index::detail */ diff --git a/test/test_modifiers.cpp b/test/test_modifiers.cpp index 6f6494d58..2b9f8e678 100644 --- a/test/test_modifiers.cpp +++ b/test/test_modifiers.cpp @@ -323,49 +323,20 @@ void test_modifiers() i5.swap(get<5>(es2)); BOOST_TEST(es==es2_backup&&es2==es_backup); -#if defined(BOOST_FUNCTION_SCOPE_USING_DECLARATION_BREAKS_ADL) - ::boost::multi_index::detail::swap(i1,get<1>(es2)); -#else using std::swap; swap(i1,get<1>(es2)); -#endif - BOOST_TEST(es==es_backup&&es2==es2_backup); -#if defined(BOOST_FUNCTION_SCOPE_USING_DECLARATION_BREAKS_ADL) - ::boost::multi_index::detail::swap(i2,get<2>(es2)); -#else - using std::swap; swap(i2,get<2>(es2)); -#endif - BOOST_TEST(es==es2_backup&&es2==es_backup); -#if defined(BOOST_FUNCTION_SCOPE_USING_DECLARATION_BREAKS_ADL) - ::boost::multi_index::detail::swap(i3,get<3>(es2)); -#else - using std::swap; swap(i3,get<3>(es2)); -#endif - BOOST_TEST(es==es_backup&&es2==es2_backup); -#if defined(BOOST_FUNCTION_SCOPE_USING_DECLARATION_BREAKS_ADL) - ::boost::multi_index::detail::swap(i4,get<4>(es2)); -#else - using std::swap; swap(i4,get<4>(es2)); -#endif - BOOST_TEST(es==es2_backup&&es2==es_backup); -#if defined(BOOST_FUNCTION_SCOPE_USING_DECLARATION_BREAKS_ADL) - ::boost::multi_index::detail::swap(i5,get<5>(es2)); -#else - using std::swap; swap(i5,get<5>(es2)); -#endif - BOOST_TEST(es==es_backup&&es2==es2_backup); i3.clear(); From 5ff851beef04b42dfc54f81ebf75154ca24b7bb1 Mon Sep 17 00:00:00 2001 From: joaquintides Date: Fri, 7 Nov 2025 10:41:36 +0100 Subject: [PATCH 13/24] removed usage of BOOST_NO_CXX11_HDR_TYPE_TRAITS --- include/boost/multi_index/detail/is_function.hpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/include/boost/multi_index/detail/is_function.hpp b/include/boost/multi_index/detail/is_function.hpp index 765f963ee..f378dd773 100644 --- a/include/boost/multi_index/detail/is_function.hpp +++ b/include/boost/multi_index/detail/is_function.hpp @@ -1,4 +1,4 @@ -/* Copyright 2003-2019 Joaquin M Lopez Munoz. +/* Copyright 2003-2025 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) @@ -16,8 +16,7 @@ #include /* keep it first to prevent nasty warns in MSVC */ #include -#if !defined(BOOST_NO_CXX11_HDR_TYPE_TRAITS)||\ - BOOST_WORKAROUND(_LIBCPP_VERSION,<30700)||\ +#if BOOST_WORKAROUND(_LIBCPP_VERSION,<30700)||\ BOOST_WORKAROUND(BOOST_LIBSTDCXX_VERSION,<40802) /* libc++: std::is_function fails, * https://bugs.llvm.org/show_bug.cgi?id=20084 From d3a614d372033385fb0f79b7bebc891de3456bf5 Mon Sep 17 00:00:00 2001 From: joaquintides Date: Fri, 7 Nov 2025 10:57:04 +0100 Subject: [PATCH 14/24] removed usage of BOOST_NO_CXX11_HDR_RANDOM --- example/rearrange.cpp | 17 ++--------------- 1 file changed, 2 insertions(+), 15 deletions(-) diff --git a/example/rearrange.cpp b/example/rearrange.cpp index 97edd4ea8..37a2d3dc1 100644 --- a/example/rearrange.cpp +++ b/example/rearrange.cpp @@ -1,6 +1,6 @@ /* Boost.MultiIndex example of use of rearrange facilities. * - * Copyright 2003-2020 Joaquin M Lopez Munoz. + * Copyright 2003-2025 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) @@ -22,11 +22,8 @@ #include #include #include -#include - -#if !defined(BOOST_NO_CXX11_HDR_RANDOM) #include -#endif +#include using boost::multi_index_container; using namespace boost::multi_index; @@ -197,22 +194,12 @@ struct random_shuffler private: deck_view dv; - -#if !defined(BOOST_NO_CXX11_HDR_RANDOM) std::mt19937 e; void shuffle_view() { std::shuffle(dv.begin(),dv.end(),e); } -#else - /* for pre-C++11 compilers we use std::random_shuffle */ - - void shuffle_view() - { - std::random_shuffle(dv.begin(),dv.end()); - } -#endif }; /* Repeat a given shuffling algorithm repeats_num times From c410457fc0774cc9e108d7aa44c46deeb584ebda Mon Sep 17 00:00:00 2001 From: joaquintides Date: Fri, 7 Nov 2025 11:08:12 +0100 Subject: [PATCH 15/24] removed usage of BOOST_NO_POINTER_TO_MEMBER_TEMPLATE_PARAMETERS --- example/bimap.cpp | 26 -------------------------- include/boost/multi_index/member.hpp | 11 +++-------- 2 files changed, 3 insertions(+), 34 deletions(-) diff --git a/example/bimap.cpp b/example/bimap.cpp index 1dd9297ab..14891f308 100644 --- a/example/bimap.cpp +++ b/example/bimap.cpp @@ -44,30 +44,6 @@ struct bidirectional_map ToType second; }; -#if defined(BOOST_NO_POINTER_TO_MEMBER_TEMPLATE_PARAMETERS) ||\ - defined(BOOST_MSVC)&&(BOOST_MSVC<1300) ||\ - defined(BOOST_INTEL_CXX_VERSION)&&defined(_MSC_VER)&&\ - (BOOST_INTEL_CXX_VERSION<=700) - -/* see Compiler specifics: Use of member_offset for info on member<> and - * member_offset<> - */ - - BOOST_STATIC_CONSTANT(unsigned,from_offset=offsetof(value_type,first)); - BOOST_STATIC_CONSTANT(unsigned,to_offset =offsetof(value_type,second)); - - typedef multi_index_container< - value_type, - indexed_by< - ordered_unique< - tag,member_offset >, - ordered_unique< - tag, member_offset > - > - > type; - -#else - /* A bidirectional map can be simulated as a multi_index_container * of pairs of (FromType,ToType) with two unique indices, one * for each member of the pair. @@ -82,8 +58,6 @@ struct bidirectional_map tag, member > > > type; - -#endif }; /* a dictionary is a bidirectional map from strings to strings */ diff --git a/include/boost/multi_index/member.hpp b/include/boost/multi_index/member.hpp index d5bedf141..61c9b2467 100644 --- a/include/boost/multi_index/member.hpp +++ b/include/boost/multi_index/member.hpp @@ -219,18 +219,13 @@ struct member_offset: { }; -/* BOOST_MULTI_INDEX_MEMBER resolves to member in the normal cases, - * and to member_offset as a workaround in those defective compilers for - * which BOOST_NO_POINTER_TO_MEMBER_TEMPLATE_PARAMETERS is defined. +/* BOOST_MULTI_INDEX_MEMBER used to resolve to member_offset in those defective + * compilers for which BOOST_NO_POINTER_TO_MEMBER_TEMPLATE_PARAMETERS is + * defined, none of which supported is supported any longer. */ -#if defined(BOOST_NO_POINTER_TO_MEMBER_TEMPLATE_PARAMETERS) -#define BOOST_MULTI_INDEX_MEMBER(Class,Type,MemberName) \ -::boost::multi_index::member_offset< Class,Type,offsetof(Class,MemberName) > -#else #define BOOST_MULTI_INDEX_MEMBER(Class,Type,MemberName) \ ::boost::multi_index::member< Class,Type,&Class::MemberName > -#endif } /* namespace multi_index */ From a48cb7859fd4b1699cc34c415a011112965652ec Mon Sep 17 00:00:00 2001 From: joaquintides Date: Fri, 7 Nov 2025 11:15:53 +0100 Subject: [PATCH 16/24] removed usage of BOOST_NO_CXX11_DECLTYPE --- include/boost/multi_index/detail/is_transparent.hpp | 1 - 1 file changed, 1 deletion(-) diff --git a/include/boost/multi_index/detail/is_transparent.hpp b/include/boost/multi_index/detail/is_transparent.hpp index 86b363457..45bffe122 100644 --- a/include/boost/multi_index/detail/is_transparent.hpp +++ b/include/boost/multi_index/detail/is_transparent.hpp @@ -38,7 +38,6 @@ struct is_transparent:std::true_type{}; } /* namespace boost */ #if !defined(BOOST_NO_SFINAE_EXPR)&& \ - !defined(BOOST_NO_CXX11_DECLTYPE)&& \ (defined(BOOST_NO_CXX11_FINAL)||defined(BOOST_IS_FINAL)) #include From 25a9d10b9bebcaa5af61fcc0b40dce9cb68623ad Mon Sep 17 00:00:00 2001 From: joaquintides Date: Fri, 7 Nov 2025 11:51:46 +0100 Subject: [PATCH 17/24] removed workarounds for pre-C++11 compilers --- .../multi_index/detail/ord_index_impl.hpp | 15 ----- include/boost/multi_index/hashed_index.hpp | 15 ----- .../boost/multi_index/random_access_index.hpp | 15 ----- include/boost/multi_index/sequenced_index.hpp | 15 ----- include/boost/multi_index_container.hpp | 58 ------------------- test/pre_multi_index.hpp | 6 +- test/test_copy_assignment.cpp | 13 ----- test/test_list_ops.cpp | 15 +---- test/test_modifiers.cpp | 7 --- test/test_rearrange.cpp | 15 +---- 10 files changed, 3 insertions(+), 171 deletions(-) diff --git a/include/boost/multi_index/detail/ord_index_impl.hpp b/include/boost/multi_index/detail/ord_index_impl.hpp index aea505d13..3d4552316 100644 --- a/include/boost/multi_index/detail/ord_index_impl.hpp +++ b/include/boost/multi_index/detail/ord_index_impl.hpp @@ -125,16 +125,6 @@ template< > class ordered_index_impl:protected SuperMeta::type { -#if defined(BOOST_MULTI_INDEX_ENABLE_INVARIANT_CHECKING)&&\ - BOOST_WORKAROUND(__MWERKS__,<=0x3003) -/* The "ISO C++ Template Parser" option in CW8.3 has a problem with the - * lifetime of const references bound to temporaries --precisely what - * scopeguards are. - */ - -#pragma parse_mfunc_templ off -#endif - /* cross-index access */ template friend class index_base; @@ -1503,11 +1493,6 @@ class ordered_index_impl:protected SuperMeta::type #if defined(BOOST_MULTI_INDEX_ENABLE_SAFE_MODE) safe_container safe; #endif - -#if defined(BOOST_MULTI_INDEX_ENABLE_INVARIANT_CHECKING)&&\ - BOOST_WORKAROUND(__MWERKS__,<=0x3003) -#pragma parse_mfunc_templ reset -#endif }; template< diff --git a/include/boost/multi_index/hashed_index.hpp b/include/boost/multi_index/hashed_index.hpp index 1fb00a8ac..e6440257e 100644 --- a/include/boost/multi_index/hashed_index.hpp +++ b/include/boost/multi_index/hashed_index.hpp @@ -86,16 +86,6 @@ template< > class hashed_index:protected SuperMeta::type { -#if defined(BOOST_MULTI_INDEX_ENABLE_INVARIANT_CHECKING)&&\ - BOOST_WORKAROUND(__MWERKS__,<=0x3003) -/* The "ISO C++ Template Parser" option in CW8.3 has a problem with the - * lifetime of const references bound to temporaries --precisely what - * scopeguards are. - */ - -#pragma parse_mfunc_templ off -#endif - /* cross-index access */ template friend class index_base; @@ -1752,11 +1742,6 @@ class hashed_index:protected SuperMeta::type #if defined(BOOST_MULTI_INDEX_ENABLE_SAFE_MODE) safe_container safe; #endif - -#if defined(BOOST_MULTI_INDEX_ENABLE_INVARIANT_CHECKING)&&\ - BOOST_WORKAROUND(__MWERKS__,<=0x3003) -#pragma parse_mfunc_templ reset -#endif }; #if defined(BOOST_MSVC) diff --git a/include/boost/multi_index/random_access_index.hpp b/include/boost/multi_index/random_access_index.hpp index 1a501813a..a3cf4bc5a 100644 --- a/include/boost/multi_index/random_access_index.hpp +++ b/include/boost/multi_index/random_access_index.hpp @@ -78,16 +78,6 @@ namespace detail{ template class random_access_index:protected SuperMeta::type { -#if defined(BOOST_MULTI_INDEX_ENABLE_INVARIANT_CHECKING)&&\ - BOOST_WORKAROUND(__MWERKS__,<=0x3003) -/* The "ISO C++ Template Parser" option in CW8.3 has a problem with the - * lifetime of const references bound to temporaries --precisely what - * scopeguards are. - */ - -#pragma parse_mfunc_templ off -#endif - /* cross-index access */ template friend class index_base; @@ -1194,11 +1184,6 @@ class random_access_index:protected SuperMeta::type #if defined(BOOST_MULTI_INDEX_ENABLE_SAFE_MODE) safe_container safe; #endif - -#if defined(BOOST_MULTI_INDEX_ENABLE_INVARIANT_CHECKING)&&\ - BOOST_WORKAROUND(__MWERKS__,<=0x3003) -#pragma parse_mfunc_templ reset -#endif }; #if defined(BOOST_MSVC) diff --git a/include/boost/multi_index/sequenced_index.hpp b/include/boost/multi_index/sequenced_index.hpp index 30d066f98..0b4be811b 100644 --- a/include/boost/multi_index/sequenced_index.hpp +++ b/include/boost/multi_index/sequenced_index.hpp @@ -68,16 +68,6 @@ namespace detail{ template class sequenced_index:protected SuperMeta::type { -#if defined(BOOST_MULTI_INDEX_ENABLE_INVARIANT_CHECKING)&&\ - BOOST_WORKAROUND(__MWERKS__,<=0x3003) -/* The "ISO C++ Template Parser" option in CW8.3 has a problem with the - * lifetime of const references bound to temporaries --precisely what - * scopeguards are. - */ - -#pragma parse_mfunc_templ off -#endif - /* cross-index access */ template friend class index_base; @@ -1089,11 +1079,6 @@ class sequenced_index:protected SuperMeta::type #if defined(BOOST_MULTI_INDEX_ENABLE_SAFE_MODE) safe_container safe; #endif - -#if defined(BOOST_MULTI_INDEX_ENABLE_INVARIANT_CHECKING)&&\ - BOOST_WORKAROUND(__MWERKS__,<=0x3003) -#pragma parse_mfunc_templ reset -#endif }; #if defined(BOOST_MSVC) diff --git a/include/boost/multi_index_container.hpp b/include/boost/multi_index_container.hpp index c63d7356a..5b5de389a 100644 --- a/include/boost/multi_index_container.hpp +++ b/include/boost/multi_index_container.hpp @@ -108,16 +108,6 @@ class multi_index_container: public detail::multi_index_base_type< Value,IndexSpecifierList,Allocator>::type { -#if defined(BOOST_MULTI_INDEX_ENABLE_INVARIANT_CHECKING)&&\ - BOOST_WORKAROUND(__MWERKS__,<=0x3003) -/* The "ISO C++ Template Parser" option in CW8.3 has a problem with the - * lifetime of const references bound to temporaries --precisely what - * scopeguards are. - */ - -#pragma parse_mfunc_templ off -#endif - private: template friend class detail::index_base; template friend struct detail::header_holder; @@ -174,19 +164,7 @@ class multi_index_container: explicit multi_index_container( const ctor_args_list& args_list, - -#if BOOST_WORKAROUND(__IBMCPP__,<=600) - /* VisualAge seems to have an ETI issue with the default value for - * argument al. - */ - - const allocator_type& al= - typename mp11::mp_identity::type:: - allocator_type()): -#else const allocator_type& al=allocator_type()): -#endif - bfm_allocator(al), super(args_list,bfm_allocator::member), node_count(0) @@ -205,23 +183,8 @@ class multi_index_container: template multi_index_container( InputIterator first,InputIterator last, - -#if BOOST_WORKAROUND(__IBMCPP__,<=600) - /* VisualAge seems to have an ETI issue with the default values - * for arguments args_list and al. - */ - - const ctor_args_list& args_list= - typename mp11::mp_identity::type:: - ctor_args_list(), - const allocator_type& al= - typename mp11::mp_identity::type:: - allocator_type()): -#else const ctor_args_list& args_list=ctor_args_list(), const allocator_type& al=allocator_type()): -#endif - bfm_allocator(al), super(args_list,bfm_allocator::member), node_count(0) @@ -453,10 +416,8 @@ class multi_index_container: { typedef typename nth_index::type index_type; -#if !defined(__SUNPRO_CC)||!(__SUNPRO_CC<0x580) /* fails in Sun C++ 5.7 */ BOOST_STATIC_ASSERT( (mp11::mp_contains::value)); -#endif BOOST_MULTI_INDEX_CHECK_VALID_ITERATOR(it); BOOST_MULTI_INDEX_CHECK_BELONGS_IN_SOME_INDEX(it,*this); @@ -469,11 +430,9 @@ class multi_index_container: { typedef typename nth_index::type index_type; -#if !defined(__SUNPRO_CC)||!(__SUNPRO_CC<0x580) /* fails in Sun C++ 5.7 */ BOOST_STATIC_ASSERT(( mp11::mp_contains::value|| mp11::mp_contains::value)); -#endif BOOST_MULTI_INDEX_CHECK_VALID_ITERATOR(it); BOOST_MULTI_INDEX_CHECK_BELONGS_IN_SOME_INDEX(it,*this); @@ -500,10 +459,8 @@ class multi_index_container: { typedef typename index::type index_type; -#if !defined(__SUNPRO_CC)||!(__SUNPRO_CC<0x580) /* fails in Sun C++ 5.7 */ BOOST_STATIC_ASSERT( (mp11::mp_contains::value)); -#endif BOOST_MULTI_INDEX_CHECK_VALID_ITERATOR(it); BOOST_MULTI_INDEX_CHECK_BELONGS_IN_SOME_INDEX(it,*this); @@ -516,11 +473,9 @@ class multi_index_container: { typedef typename index::type index_type; -#if !defined(__SUNPRO_CC)||!(__SUNPRO_CC<0x580) /* fails in Sun C++ 5.7 */ BOOST_STATIC_ASSERT(( mp11::mp_contains::value|| mp11::mp_contains::value)); -#endif BOOST_MULTI_INDEX_CHECK_VALID_ITERATOR(it); BOOST_MULTI_INDEX_CHECK_BELONGS_IN_SOME_INDEX(it,*this); @@ -1159,11 +1114,6 @@ class multi_index_container: private: size_type node_count; - -#if defined(BOOST_MULTI_INDEX_ENABLE_INVARIANT_CHECKING)&&\ - BOOST_WORKAROUND(__MWERKS__,<=0x3003) -#pragma parse_mfunc_templ reset -#endif }; #if BOOST_WORKAROUND(BOOST_MSVC,BOOST_TESTED_AT(1500)) @@ -1315,12 +1265,10 @@ project( Value,IndexSpecifierList,Allocator> multi_index_type; typedef typename nth_index::type index_type; -#if !defined(__SUNPRO_CC)||!(__SUNPRO_CC<0x580) /* Sun C++ 5.7 fails */ BOOST_STATIC_ASSERT(( mp11::mp_contains< typename multi_index_type::iterator_type_list, IteratorType>::value)); -#endif BOOST_MULTI_INDEX_CHECK_VALID_ITERATOR(it); BOOST_MULTI_INDEX_CHECK_BELONGS_IN_SOME_INDEX(it,m); @@ -1341,7 +1289,6 @@ project( Value,IndexSpecifierList,Allocator> multi_index_type; typedef typename nth_index::type index_type; -#if !defined(__SUNPRO_CC)||!(__SUNPRO_CC<0x580) /* Sun C++ 5.7 fails */ BOOST_STATIC_ASSERT(( mp11::mp_contains< typename multi_index_type::iterator_type_list, @@ -1349,7 +1296,6 @@ project( mp11::mp_contains< typename multi_index_type::const_iterator_type_list, IteratorType>::value)); -#endif BOOST_MULTI_INDEX_CHECK_VALID_ITERATOR(it); BOOST_MULTI_INDEX_CHECK_BELONGS_IN_SOME_INDEX(it,m); @@ -1387,12 +1333,10 @@ project( typedef typename ::boost::multi_index::index< multi_index_type,Tag>::type index_type; -#if !defined(__SUNPRO_CC)||!(__SUNPRO_CC<0x580) /* Sun C++ 5.7 fails */ BOOST_STATIC_ASSERT(( mp11::mp_contains< typename multi_index_type::iterator_type_list, IteratorType>::value)); -#endif BOOST_MULTI_INDEX_CHECK_VALID_ITERATOR(it); BOOST_MULTI_INDEX_CHECK_BELONGS_IN_SOME_INDEX(it,m); @@ -1414,7 +1358,6 @@ project( typedef typename ::boost::multi_index::index< multi_index_type,Tag>::type index_type; -#if !defined(__SUNPRO_CC)||!(__SUNPRO_CC<0x580) /* Sun C++ 5.7 fails */ BOOST_STATIC_ASSERT(( mp11::mp_contains< typename multi_index_type::iterator_type_list, @@ -1422,7 +1365,6 @@ project( mp11::mp_contains< typename multi_index_type::const_iterator_type_list, IteratorType>::value)); -#endif BOOST_MULTI_INDEX_CHECK_VALID_ITERATOR(it); BOOST_MULTI_INDEX_CHECK_BELONGS_IN_SOME_INDEX(it,m); diff --git a/test/pre_multi_index.hpp b/test/pre_multi_index.hpp index 7fc5b9e92..12f333171 100644 --- a/test/pre_multi_index.hpp +++ b/test/pre_multi_index.hpp @@ -1,6 +1,6 @@ /* Used in Boost.MultiIndex tests. * - * Copyright 2003-2008 Joaquin M Lopez Munoz. + * Copyright 2003-2025 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) @@ -30,10 +30,6 @@ #define BOOST_MULTI_INDEX_ENABLE_SAFE_MODE -#if BOOST_WORKAROUND(__IBMCPP__,<=600) -#pragma info(nolan) /* suppress warnings about offsetof with non-POD types */ -#endif - struct safe_mode_exception { safe_mode_exception(boost::multi_index::safe_mode::error_code error_code_): diff --git a/test/test_copy_assignment.cpp b/test/test_copy_assignment.cpp index d606712d9..d7c4f717b 100644 --- a/test/test_copy_assignment.cpp +++ b/test/test_copy_assignment.cpp @@ -23,15 +23,6 @@ using namespace boost::multi_index; -#if BOOST_WORKAROUND(__MWERKS__,<=0x3003) -/* The "ISO C++ Template Parser" option makes CW8.3 incorrectly fail at - * expressions of the form sizeof(x) where x is an array local to a - * template function. - */ - -#pragma parse_func_templ off -#endif - typedef multi_index_container copyable_and_movable; struct holder @@ -64,10 +55,6 @@ static void test_assign() BOOST_TEST(s.size()==12&&std::accumulate(s.begin(),s.end(),0)==2004); } -#if BOOST_WORKAROUND(__MWERKS__,<=0x3003) -#pragma parse_func_templ reset -#endif - template static void test_integral_assign() { diff --git a/test/test_list_ops.cpp b/test/test_list_ops.cpp index c736e9736..9c6ade550 100644 --- a/test/test_list_ops.cpp +++ b/test/test_list_ops.cpp @@ -1,6 +1,6 @@ /* Boost.MultiIndex test for standard list operations. * - * Copyright 2003-2021 Joaquin M Lopez Munoz. + * Copyright 2003-2025 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) @@ -63,15 +63,6 @@ bool is_sorted( } } -#if BOOST_WORKAROUND(__MWERKS__,<=0x3003) -/* The "ISO C++ Template Parser" option makes CW8.3 incorrectly fail at - * expressions of the form sizeof(x) where x is an array local to a - * template function. - */ - -#pragma parse_func_templ off -#endif - template static void test_list_ops_unique_seq() { @@ -245,10 +236,6 @@ static void test_list_ops_non_unique_seq() } } -#if BOOST_WORKAROUND(__MWERKS__,<=0x3003) -#pragma parse_func_templ reset -#endif - void test_list_ops() { typedef multi_index_container< diff --git a/test/test_modifiers.cpp b/test/test_modifiers.cpp index 2b9f8e678..3e26e29fc 100644 --- a/test/test_modifiers.cpp +++ b/test/test_modifiers.cpp @@ -75,15 +75,8 @@ class linked_object typedef multi_index_container< impl, indexed_by< - -#if BOOST_WORKAROUND(__IBMCPP__,BOOST_TESTED_AT(1010)) - ordered_unique >, - hashed_non_unique >, -#else ordered_unique >, hashed_non_unique >, -#endif - sequenced<>, random_access<> > diff --git a/test/test_rearrange.cpp b/test/test_rearrange.cpp index 170eabd92..cccdebceb 100644 --- a/test/test_rearrange.cpp +++ b/test/test_rearrange.cpp @@ -1,6 +1,6 @@ /* Boost.MultiIndex test for rearrange operations. * - * Copyright 2003-2022 Joaquin M Lopez Munoz. + * Copyright 2003-2025 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) @@ -37,15 +37,6 @@ using namespace boost::multi_index; #undef CHECK_VOID_RANGE #define CHECK_VOID_RANGE(p) BOOST_TEST((p).first==(p).second) -#if BOOST_WORKAROUND(__MWERKS__,<=0x3003) -/* The "ISO C++ Template Parser" option makes CW8.3 incorrectly fail at - * expressions of the form sizeof(x) where x is an array local to a - * template function. - */ - -#pragma parse_func_templ off -#endif - template static void local_test_rearrange() { @@ -110,10 +101,6 @@ static void local_test_rearrange() BOOST_TEST(std::equal(sc.begin(),sc.end(),v.begin())); } -#if BOOST_WORKAROUND(__MWERKS__,<=0x3003) -#pragma parse_func_templ reset -#endif - void test_rearrange() { typedef multi_index_container< From 230f28c644e9eb9e328f4fd27a027f4c901ec617 Mon Sep 17 00:00:00 2001 From: joaquintides Date: Fri, 7 Nov 2025 12:07:50 +0100 Subject: [PATCH 18/24] updated dependencies --- CMakeLists.txt | 1 - build.jam | 1 - 2 files changed, 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 5ad0347bc..8535d5c5b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -20,7 +20,6 @@ target_link_libraries(boost_multi_index Boost::container_hash Boost::core Boost::integer - Boost::move Boost::mp11 Boost::preprocessor Boost::smart_ptr diff --git a/build.jam b/build.jam index 9e1844ef5..d827a6c6a 100644 --- a/build.jam +++ b/build.jam @@ -12,7 +12,6 @@ constant boost_dependencies : /boost/container_hash//boost_container_hash /boost/core//boost_core /boost/integer//boost_integer - /boost/move//boost_move /boost/mp11//boost_mp11 /boost/preprocessor//boost_preprocessor /boost/smart_ptr//boost_smart_ptr From aa70ecdc509e7416e487c6c7f33bd557ef58b17f Mon Sep 17 00:00:00 2001 From: joaquintides Date: Fri, 7 Nov 2025 12:49:36 +0100 Subject: [PATCH 19/24] removed usage of BOOST_MULTI_INDEX_MEMBER and similar in examples --- example/basic.cpp | 12 ++++-------- example/complex_structs.cpp | 28 ++++++++++++---------------- example/composite_keys.cpp | 18 +++++++----------- example/fun_key.cpp | 6 ++---- example/hashed.cpp | 10 +++------- example/ip_allocator.cpp | 12 ++++-------- 6 files changed, 32 insertions(+), 54 deletions(-) diff --git a/example/basic.cpp b/example/basic.cpp index 9304cf9b1..4445f862e 100644 --- a/example/basic.cpp +++ b/example/basic.cpp @@ -1,6 +1,6 @@ /* Boost.MultiIndex basic example. * - * Copyright 2003-2022 Joaquin M Lopez Munoz. + * Copyright 2003-2025 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) @@ -47,10 +47,6 @@ struct id{}; struct name{}; struct age{}; -/* see Compiler specifics: Use of member_offset for info on - * BOOST_MULTI_INDEX_MEMBER - */ - /* Define a multi_index_container of employees with following indices: * - a unique index sorted by employee::id, * - a non-unique index sorted by employee::name, @@ -61,11 +57,11 @@ typedef multi_index_container< employee, indexed_by< ordered_unique< - tag, BOOST_MULTI_INDEX_MEMBER(employee,int,id)>, + tag, member >, ordered_non_unique< - tag,BOOST_MULTI_INDEX_MEMBER(employee,std::string,name)>, + tag,member >, ordered_non_unique< - tag, BOOST_MULTI_INDEX_MEMBER(employee,int,age)> > + tag, member > > > employee_set; template diff --git a/example/complex_structs.cpp b/example/complex_structs.cpp index 70eb78bcd..a4cffb7f0 100644 --- a/example/complex_structs.cpp +++ b/example/complex_structs.cpp @@ -1,6 +1,6 @@ /* Boost.MultiIndex example: complex searches and foreign keys. * - * Copyright 2003-2008 Joaquin M Lopez Munoz. + * Copyright 2003-2025 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) @@ -88,10 +88,6 @@ struct car_model } }; -/* see Compiler specifics: Use of member_offset for info on - * BOOST_MULTI_INDEX_MEMBER - */ - /* Car manufacturers are stored in a multi_index_container with one single * index on the name member. This is functionally equivalent to an std::set, * though in this latter case we woud have to define a non-default comparison @@ -102,7 +98,7 @@ typedef multi_index_container< car_manufacturer, indexed_by< ordered_unique< - BOOST_MULTI_INDEX_MEMBER(car_manufacturer,std::string,name) + member > > > car_manufacturer_table; @@ -118,18 +114,18 @@ typedef multi_index_container< car_model, indexed_by< ordered_unique< - tag,BOOST_MULTI_INDEX_MEMBER(car_model,std::string,model) + tag,member >, ordered_non_unique< tag, key_from_key< - BOOST_MULTI_INDEX_MEMBER(car_manufacturer,const std::string,name), - BOOST_MULTI_INDEX_MEMBER( - car_model,const car_manufacturer *,manufacturer) + member, + member< + car_model,const car_manufacturer *,&car_model::manufacturer> > >, ordered_non_unique< - tag,BOOST_MULTI_INDEX_MEMBER(car_model,int,price) + tag,member > > > car_table; @@ -138,7 +134,7 @@ typedef multi_index_container< * actual objects. These views are used in the complex search performed * in the program. Resorting to multi_index of pointers eliminates * unnecessary copying of objects, and provides us with an opportunity - * to show how BOOST_MULTI_INDEX_MEMBER can be used with pointer + * to show how boost::multi_index::member can be used with pointer * type elements. * car_table_price_view indexes (pointers to) car_models by price. */ @@ -146,7 +142,7 @@ typedef multi_index_container< typedef multi_index_container< const car_model*, indexed_by< - ordered_non_unique + ordered_non_unique > > > car_table_price_view; @@ -159,9 +155,9 @@ typedef multi_index_container< indexed_by< ordered_non_unique< key_from_key< - BOOST_MULTI_INDEX_MEMBER(car_manufacturer,const std::string,name), - BOOST_MULTI_INDEX_MEMBER( - car_model,const car_manufacturer * const,manufacturer) + member, + member< + car_model,const car_manufacturer * const,&car_model::manufacturer> > > > diff --git a/example/composite_keys.cpp b/example/composite_keys.cpp index e9da2affa..4d2693ad2 100644 --- a/example/composite_keys.cpp +++ b/example/composite_keys.cpp @@ -1,6 +1,6 @@ /* Boost.MultiIndex example of composite keys. * - * Copyright 2003-2008 Joaquin M Lopez Munoz. + * Copyright 2003-2025 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) @@ -57,26 +57,22 @@ struct file_entry * file and size. These indices are firstly ordered by directory, as commands * work on a current directory basis. Composite keys are just fine to model * this. - * NB: The use of derivation here instead of simple typedef is explained in - * Compiler specifics: type hiding. + * NB: The use of derivation here instead of simple typedef helps produce + * shorter symbol names in compilation */ struct name_key:composite_key< file_entry, - BOOST_MULTI_INDEX_MEMBER(file_entry,const file_entry*,dir), - BOOST_MULTI_INDEX_MEMBER(file_entry,std::string,name) + member, + member >{}; struct size_key:composite_key< file_entry, - BOOST_MULTI_INDEX_MEMBER(file_entry,const file_entry* const,dir), - BOOST_MULTI_INDEX_MEMBER(file_entry,unsigned,size) + member, + member >{}; -/* see Compiler specifics: composite_key in compilers without partial - * template specialization, for info on composite_key_result_less - */ - typedef multi_index_container< file_entry, indexed_by< diff --git a/example/fun_key.cpp b/example/fun_key.cpp index 769d7bf6c..a66d62121 100644 --- a/example/fun_key.cpp +++ b/example/fun_key.cpp @@ -1,6 +1,6 @@ /* Boost.MultiIndex example of functions used as key extractors. * - * Copyright 2003-2008 Joaquin M Lopez Munoz. + * Copyright 2003-2025 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) @@ -54,15 +54,13 @@ std::string::size_type name_record_length(const name_record& r) /* multi_index_container with indices based on name_record::name() * and name_record_length(). - * See Compiler specifics: Use of const_mem_fun_explicit and - * mem_fun_explicit for info on BOOST_MULTI_INDEX_CONST_MEM_FUN. */ typedef multi_index_container< name_record, indexed_by< ordered_unique< - BOOST_MULTI_INDEX_CONST_MEM_FUN(name_record,std::string,name) + const_mem_fun >, ordered_non_unique< global_fun diff --git a/example/hashed.cpp b/example/hashed.cpp index 98228ea25..0bfac217b 100644 --- a/example/hashed.cpp +++ b/example/hashed.cpp @@ -1,6 +1,6 @@ /* Boost.MultiIndex example of use of hashed indices. * - * Copyright 2003-2008 Joaquin M Lopez Munoz. + * Copyright 2003-2025 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) @@ -37,19 +37,15 @@ struct word_counter_entry word_counter_entry(std::string word_):word(word_),occurrences(0){} }; -/* see Compiler specifics: Use of member_offset for info on - * BOOST_MULTI_INDEX_MEMBER - */ - typedef multi_index_container< word_counter_entry, indexed_by< ordered_non_unique< - BOOST_MULTI_INDEX_MEMBER(word_counter_entry,unsigned int,occurrences), + member, std::greater /* sorted beginning with most frequent */ >, hashed_unique< - BOOST_MULTI_INDEX_MEMBER(word_counter_entry,std::string,word) + member > > > word_counter; diff --git a/example/ip_allocator.cpp b/example/ip_allocator.cpp index f2c6d677d..85821bce0 100644 --- a/example/ip_allocator.cpp +++ b/example/ip_allocator.cpp @@ -1,6 +1,6 @@ /* Boost.MultiIndex example of use of Boost.Interprocess allocators. * - * Copyright 2003-2008 Joaquin M Lopez Munoz. + * Copyright 2003-2025 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) @@ -104,22 +104,18 @@ struct partial_str_less * * We are using a Boost.Interprocess specific allocator. */ -/* see Compiler specifics: Use of member_offset for info on - * BOOST_MULTI_INDEX_MEMBER - */ - typedef multi_index_container< book, indexed_by< ordered_non_unique< - BOOST_MULTI_INDEX_MEMBER(book,shared_string,author) + member >, ordered_non_unique< - BOOST_MULTI_INDEX_MEMBER(book,shared_string,name), + member, partial_str_less >, ordered_non_unique< - BOOST_MULTI_INDEX_MEMBER(book,unsigned,prize) + member > >, bip::allocator From 365e530f1c25914e8891d2a7167de31d369aaa20 Mon Sep 17 00:00:00 2001 From: joaquintides Date: Fri, 7 Nov 2025 13:10:06 +0100 Subject: [PATCH 20/24] updated docs --- doc/compiler_specifics.html | 234 ------------------------------ doc/index.html | 5 +- doc/performance.html | 14 +- doc/reference/key_extraction.html | 12 +- doc/release_notes.html | 9 +- 5 files changed, 20 insertions(+), 254 deletions(-) delete mode 100644 doc/compiler_specifics.html diff --git a/doc/compiler_specifics.html b/doc/compiler_specifics.html deleted file mode 100644 index a887dcb98..000000000 --- a/doc/compiler_specifics.html +++ /dev/null @@ -1,234 +0,0 @@ - - - - - -Boost.MultiIndex Documentation - Compiler specifics - - - - - - - - -

boost.png (6897 bytes)Boost.MultiIndex Compiler specifics

- - - -
- -
- -

-Boost.MultiIndex utilizes some C++11 capabilities but is also equipped -to work reasonably well in decent C++03-compliant environments. -We list some of the possible limitations along with suitable workarounds when available. -

- -

Contents

- - - -

Move semantics

- -

-Boost.MultiIndex uses Boost.Move -to support compilers without rvalue references. In such scenarios, taking -advantage of multi_index_container<Value> capabilities for -increased efficiency in insertion and handling of moveable-only elements will -require that Value be suitably instrumented. -

- -

Allocator awareness

- -

-In pre-C++11 compilers or defective environments without proper -allocator -awareness machinery (basically, std::allocator_traits), -Boost.MultiIndex behaves as if -std::allocator_traits<allocator_type>::propagate_on_container_*::value -were false for all allocators. -

- -

Emplace functions

- -

-In compilers without variadic template support, Boost.MultiIndex emplace -functions emulate this missing functionality by accepting up to -BOOST_MULTI_INDEX_LIMIT_VARTEMPL_ARGS -construction arguments that are internally forwarded with -Boost.Move: -only constant lvalue references and rvalues are permitted as construction arguments -in such case. -

- -

-BOOST_MULTI_INDEX_LIMIT_VARTEMPL_ARGS, which by default is 5, can -be globally defined by the user to a different value. -

- -

Initializer lists

- -

-No transparent emulation of this functionality can be provided in the absence of -std::initializer_list: consider -Boost.Assign as a -possible replacement. -

- -

Tuples

- -

-Everywhere where std::tuples are used in the library interface, -boost::tuples can be resorted to in their place. The converse, however, -is not true. -

- -

Legacy compilers

- -

-Boost.MultiIndex support for legacy compilers is not actively kept, so if you happen -to work with an old environment you might need to use a former version of the library. -A table is provided of some legacy compilers along with the latest version of -Boost.MultiIndex known to work for them (frequently with limitations as explained -in the corresponding compiler specifics section). If you successfully try one of those -with newer versions of Boost.MultiIndex than stated here, please report back so that -the information can be updated. -

- -

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Support for legacy compilers.
CompilerLatest known
compatible version
Date
Borland C++ Builder 6.4 through 2006, CodeGear C++Builder 2010Never worked with Boost.MultiIndex
Comeau C/C++ 4.3.10.1 for Windows (VC++ 9.0 backend)Boost 1.38February 2009
Compaq C++ 6.5-042 through 7.1-006 for Tru64 UNIXBoost 1.38February 2009
GCC 3.2 through 3.4Boost 1.41November 2009
HP aC++ A.06.12 through A.06.17 for HP-UX IA64Boost 1.38February 2009
HP aC++ A.03.80 through A.03.85 for HP-UX PA-RISCBoost 1.38February 2009
IBM VisualAge C++ V6.0 for AIXBoost 1.33.1December 2006
IBM XL C/C++ V9.0 through V10.1 for AIXBoost 1.41November 2009
Intel C++ Compiler for Linux 8.1 through 11.1Boost 1.41November 2009
Intel C++ Compiler for Mac OS 9.1 through 11.0Boost 1.41November 2009
Intel C++ Compiler for Windows 32-bit 8.0 through 11.1Boost 1.41November 2009
Intel C++ Compiler for Windows 64-bit 10.0 through 11.11Boost 1.41November 2009
Metrowerks CodeWarrior 8.3Boost 1.36August 2008
Metrowerks CodeWarrior 9 through 9.5Boost 1.34.1July 2007
Microsoft Visual C++ 6.0 Service Pack 5Boost 1.36August 2008
Microsoft Visual C++ 7.0Boost 1.35March 2008
Sun Studio 10 through 12 Update 1 for SolarisBoost 1.41November 2009
-

- -
- - - -
- -
- -

Revised November 1st 2025

- -

© Copyright 2003-2025 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) -

- - - diff --git a/doc/index.html b/doc/index.html index b86dca594..34a52f239 100644 --- a/doc/index.html +++ b/doc/index.html @@ -67,7 +67,6 @@

Contents

@@ -504,7 +506,7 @@

Boost 1.55 release

  • Random access indices provide shrink_to_fit().
  • - Refer to the compiler specifics section for limitations + Refer to the compiler specifics section for limitations on pre-C++11 compilers.
  • The following classes are deprecated: @@ -823,8 +825,7 @@

    Boost 1.33 release

    Boost 1.32 release. This results in much shorter and more readable error messages and has also a beneficial impact on compilers with strict limits on symbol name lengths. Additionally, a section on further - reduction of symbol name - lengths has been added. + reduction of symbol name lengths has been added.
  • Restructured some parts of the documentation, new examples.
  • Maintenance fixes.
  • @@ -845,7 +846,7 @@

    Boost 1.33 release


    -

    Revised November 3rd 2025

    +

    Revised November 7th 2025

    © Copyright 2003-2025 Joaquín M López Muñoz. Distributed under the Boost Software From 053b3f78d2ecd7a24e21c1735b9c96f5c5f9947d Mon Sep 17 00:00:00 2001 From: joaquintides Date: Fri, 7 Nov 2025 13:13:48 +0100 Subject: [PATCH 21/24] added C++11 badge --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index ffa8e53aa..5d7df6848 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ [![Branch](https://img.shields.io/badge/branch-master-brightgreen.svg)](https://github.com/boostorg/multi_index/tree/master) [![CI](https://github.com/boostorg/multi_index/actions/workflows/ci.yml/badge.svg?branch=master)](https://github.com/boostorg/multi_index/actions/workflows/ci.yml) [![Drone status](https://img.shields.io/drone/build/boostorg/multi_index/master?server=https%3A%2F%2Fdrone.cpp.al&logo=drone&logoColor=%23CCCCCC&label=CI)](https://drone.cpp.al/boostorg/multi_index) [![Deps](https://img.shields.io/badge/deps-master-brightgreen.svg)](https://pdimov.github.io/boostdep-report/master/multi_index.html) [![Documentation](https://img.shields.io/badge/docs-master-brightgreen.svg)](https://www.boost.org/doc/libs/master/libs/multi_index) [![Enter the Matrix](https://img.shields.io/badge/matrix-master-brightgreen.svg)](https://regression.boost.org/master/developer/multi_index.html)
    [![Branch](https://img.shields.io/badge/branch-develop-brightgreen.svg)](https://github.com/boostorg/multi_index/tree/develop) [![CI](https://github.com/boostorg/multi_index/actions/workflows/ci.yml/badge.svg?branch=develop)](https://github.com/boostorg/multi_index/actions/workflows/ci.yml) [![Drone status](https://img.shields.io/drone/build/boostorg/multi_index/develop?server=https%3A%2F%2Fdrone.cpp.al&logo=drone&logoColor=%23CCCCCC&label=CI)](https://drone.cpp.al/boostorg/multi_index) [![Deps](https://img.shields.io/badge/deps-develop-brightgreen.svg)](https://pdimov.github.io/boostdep-report/develop/multi_index.html) [![Documentation](https://img.shields.io/badge/docs-develop-brightgreen.svg)](https://www.boost.org/doc/libs/develop/libs/multi_index) [![Enter the Matrix](https://img.shields.io/badge/matrix-develop-brightgreen.svg)](https://regression.boost.org/develop/developer/multi_index.html)
    -[![BSL 1.0](https://img.shields.io/badge/license-BSL_1.0-blue.svg)](https://www.boost.org/users/license.html) Header-only library +[![BSL 1.0](https://img.shields.io/badge/license-BSL_1.0-blue.svg)](https://www.boost.org/users/license.html) C++11 required Header-only library [Boost.MultiIndex](http://boost.org/libs/multi_index) provides a class template named `multi_index_container` which enables the construction of containers From 345920677e28c006c1828f7b3d5c7bfe0738909a Mon Sep 17 00:00:00 2001 From: joaquintides Date: Fri, 7 Nov 2025 16:33:32 +0100 Subject: [PATCH 22/24] updated as per Alexander Grund's review --- CMakeLists.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 8535d5c5b..8d3319a8e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -3,12 +3,13 @@ # Distributed under the Boost Software License, Version 1.0. # https://www.boost.org/LICENSE_1_0.txt -cmake_minimum_required(VERSION 3.5...3.16) +cmake_minimum_required(VERSION 3.8...3.16) project(boost_multi_index VERSION "${BOOST_SUPERPROJECT_VERSION}" LANGUAGES CXX) add_library(boost_multi_index INTERFACE) add_library(Boost::multi_index ALIAS boost_multi_index) +target_compile_features(boost_multi_index INTERFACE cxx_std_11) target_include_directories(boost_multi_index INTERFACE include) From 05aaf2812e54d1ec582dd14451b9ade9b5e8e819 Mon Sep 17 00:00:00 2001 From: joaquintides Date: Fri, 7 Nov 2025 16:39:51 +0100 Subject: [PATCH 23/24] editorial --- include/boost/multi_index/member.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/boost/multi_index/member.hpp b/include/boost/multi_index/member.hpp index 61c9b2467..56e4aa477 100644 --- a/include/boost/multi_index/member.hpp +++ b/include/boost/multi_index/member.hpp @@ -221,7 +221,7 @@ struct member_offset: /* BOOST_MULTI_INDEX_MEMBER used to resolve to member_offset in those defective * compilers for which BOOST_NO_POINTER_TO_MEMBER_TEMPLATE_PARAMETERS is - * defined, none of which supported is supported any longer. + * defined, none of which is supported any longer. */ #define BOOST_MULTI_INDEX_MEMBER(Class,Type,MemberName) \ From cc1c062e07f3029cdb62eba0d876e98c3278d6bb Mon Sep 17 00:00:00 2001 From: joaquintides Date: Fri, 7 Nov 2025 17:52:15 +0100 Subject: [PATCH 24/24] removed unneeded #includes --- include/boost/multi_index/detail/index_base.hpp | 1 - include/boost/multi_index/detail/node_type.hpp | 1 - include/boost/multi_index/detail/ord_index_impl.hpp | 1 - include/boost/multi_index/detail/unbounded.hpp | 3 +-- include/boost/multi_index/hashed_index.hpp | 1 - include/boost/multi_index/random_access_index.hpp | 1 - include/boost/multi_index/sequenced_index.hpp | 1 - test/pre_multi_index.hpp | 1 - 8 files changed, 1 insertion(+), 9 deletions(-) diff --git a/include/boost/multi_index/detail/index_base.hpp b/include/boost/multi_index/detail/index_base.hpp index 1751a6f4d..591445d09 100644 --- a/include/boost/multi_index/detail/index_base.hpp +++ b/include/boost/multi_index/detail/index_base.hpp @@ -17,7 +17,6 @@ #include #include #include -#include #include #include #include diff --git a/include/boost/multi_index/detail/node_type.hpp b/include/boost/multi_index/detail/node_type.hpp index 8f1e4681b..3f87a12e3 100644 --- a/include/boost/multi_index/detail/node_type.hpp +++ b/include/boost/multi_index/detail/node_type.hpp @@ -14,7 +14,6 @@ #endif #include /* keep it first to prevent nasty warns in MSVC */ -#include #include #include #include diff --git a/include/boost/multi_index/detail/ord_index_impl.hpp b/include/boost/multi_index/detail/ord_index_impl.hpp index 3d4552316..300052b87 100644 --- a/include/boost/multi_index/detail/ord_index_impl.hpp +++ b/include/boost/multi_index/detail/ord_index_impl.hpp @@ -47,7 +47,6 @@ #include #include #include -#include #include #include #include diff --git a/include/boost/multi_index/detail/unbounded.hpp b/include/boost/multi_index/detail/unbounded.hpp index dc09be177..defb009ce 100644 --- a/include/boost/multi_index/detail/unbounded.hpp +++ b/include/boost/multi_index/detail/unbounded.hpp @@ -1,4 +1,4 @@ -/* Copyright 2003-2013 Joaquin M Lopez Munoz. +/* Copyright 2003-2025 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) @@ -14,7 +14,6 @@ #endif #include /* keep it first to prevent nasty warns in MSVC */ -#include namespace boost{ diff --git a/include/boost/multi_index/hashed_index.hpp b/include/boost/multi_index/hashed_index.hpp index e6440257e..f12c9244a 100644 --- a/include/boost/multi_index/hashed_index.hpp +++ b/include/boost/multi_index/hashed_index.hpp @@ -19,7 +19,6 @@ #include #include #include -#include #include #include #include diff --git a/include/boost/multi_index/random_access_index.hpp b/include/boost/multi_index/random_access_index.hpp index a3cf4bc5a..965f507fe 100644 --- a/include/boost/multi_index/random_access_index.hpp +++ b/include/boost/multi_index/random_access_index.hpp @@ -20,7 +20,6 @@ #include #include #include -#include #include #include #include diff --git a/include/boost/multi_index/sequenced_index.hpp b/include/boost/multi_index/sequenced_index.hpp index 0b4be811b..3d0f5a133 100644 --- a/include/boost/multi_index/sequenced_index.hpp +++ b/include/boost/multi_index/sequenced_index.hpp @@ -19,7 +19,6 @@ #include #include #include -#include #include #include #include diff --git a/test/pre_multi_index.hpp b/test/pre_multi_index.hpp index 12f333171..e0e512584 100644 --- a/test/pre_multi_index.hpp +++ b/test/pre_multi_index.hpp @@ -12,7 +12,6 @@ #define BOOST_MULTI_INDEX_TEST_PRE_MULTI_INDEX_HPP #include /* keep it first to prevent nasty warns in MSVC */ -#include #include #if defined(__GNUC__)&&defined(__APPLE__)&&\