290 Commits

Author SHA1 Message Date
joaquintides fbeaf88056 extended fancy pointer support for iterators (#100)
* added memory relocatability test
* added missing #includes
* avoided C++14 std::make_unique
* added hashed index local iterators to the test
* made all iterators store allocator-provided pointers to the nodes
* updated docs
2026-06-27 19:41:10 +02:00
joaquintides 1f61ddc1ec avoided bogus unitialized warnings in GCC 16.1, plus additional warning silencing (#97)
* added gcc-15, gcc-16
* explicitly constructed bfm_header everywhere
* reverted, silenced uninitialized warning
* moved silencing pragma inside header body
* made silencing pragma enclose entire multi_index_container definition
* abandoned pragma, deinlined header()
* tried an even more convoluted workaround
* type-erased member in header_holder
* s/static_cast/reinterpret_cast
* reverted, passed allocator and header explicitly in construction
* used passed header in construction rather than header()
* investigated if hit by https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119321
* documented GCC 16.1 flag
* avoided VS warning
2026-06-01 19:15:24 +02:00
kraldan ac4971abc2 [bug] Fix severe performance bug caused by usage of float (#94)
* Replace `float` with `double` in hashed_index.hpp

* Fix formatting indents

* Reset changes

* Add fix from PR comment

comment: https://github.com/boostorg/multi_index/pull/94#issuecomment-4283474290

* forced both args of std::max to the same type

---------

Co-authored-by: Daniel Kral <daniel.kral@recombee.com>
Co-authored-by: joaquintides <joaquin.lopezmunoz@gmail.com>
2026-04-24 10:35:24 +02:00
joaquintides 179b5def1e removed C++03 polyfills (#90)
* removed simulated variadic function args

* removed detail/allocator_traits.hpp in favor of Boost.Core functionality

* removed usage of Boost.Move

* avoided pessimizing-move warnings

* removed usage of BOOST_DEDUCED_TYPENAME

* removed usage of BOOST_NO_CXX11_HDR_INITIALIZER_LIST

* removed usage of BOOST_NO_MEMBER_TEMPLATES

* removed usage of BOOST_NO_SFINAE

* removed leftover pp line

* removed usage of BOOST_NO_MEMBER_TEMPLATE_FRIENDS

* removed usage of BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP

* removed usage of BOOST_FUNCTION_SCOPE_USING_DECLARATION_BREAKS_ADL

* removed usage of BOOST_NO_CXX11_HDR_TYPE_TRAITS

* removed usage of BOOST_NO_CXX11_HDR_RANDOM

* removed usage of BOOST_NO_POINTER_TO_MEMBER_TEMPLATE_PARAMETERS

* removed usage of BOOST_NO_CXX11_DECLTYPE

* removed workarounds for pre-C++11 compilers

* updated dependencies

* removed usage of BOOST_MULTI_INDEX_MEMBER and similar in examples

* updated docs

* added C++11 badge

* updated as per  Alexander Grund's review

* editorial

* removed unneeded #includes
2025-11-07 18:37:41 +01:00
joaquintides eb993b1e23 made composite_key and associated class templates variadic (#88)
* made composite_key and associated types truly variadic

* added redundant ctor seemingly needed by MSVC 14.0

* moved redundant default ctor one derived class down

* temporarily disabled SFINAE for augmented_stdtuple(const boost_tuple_arg&)

* made previous permanent (more informative API)

* stylistic

* addes tests for std::tuple construction

* tested composite_key with long tuples

* stylistic

* tested composite_key assignability

* updated docs

* modernized test_composite_key
2025-11-05 20:16:25 +01:00
joaquintides 890f032939 removed Boost.MPL usage in favor of Boost.Mp11 (#87)
* omitted test_mpl_ops for now

* made IndexSpecifierList a Mp11 sequence

* made nested *_type_list's and tag Mp11 sequences

* leftover MPL->Mp11 change

* removed Clang 5.0 -std=c++1z as not supported by Mp11

* replaced boost::mpl::na with void as default index specifier arg

* removed Clang 5.0 -std=c++1z as not supported by Mp11 (Drone)

* replaced elementary MPL TMP with Mp11/std

* replaced elementary MPL TMP with Mp11/std (tests)

* leftover MPL #include

* suppressed potential narrowing conversion warnings

* enabled macro to support old interface, plus restored and augmented test_mpl_ops

* removed secondary dependency to MPL thru Iterator

* optimized Jamfile.v2

* added conditional support for old definition of tag

* updated MPL support macro in tests

* updated docs

* stylistic

* updated "cxxstd" in libraries.json

* disabled test_serialization for Clang 3.5-3.6 due to lack of support from Boost.SmartPtr

* fixed previous

* removed no longer necessary workaround

* removed redundant dependencies

* updated test description
2025-10-27 09:17:48 +01:00
Peter Dimov 47d36ce8e2 Avoid inclusion of deprecated header (#74) 2024-09-30 18:39:47 +02:00
joaquintides 2b2c52a27f fixed #70 2023-09-09 17:06:06 +02:00
joaquintides 343cb4c6f3 fixed container size serialization in LLP64 2023-05-22 13:26:17 +02:00
joaquintides f8143b9ff9 fixed #68 2023-05-21 11:39:44 +02:00
joaquintides 6163f59747 editorial, extended test_iterators 2023-03-01 09:52:07 +01:00
Christian Mazakas 92de0326b5 Remove usage of boost/foreach_fwd.hpp in lieu of manual forward declaration + specialization 2023-02-28 08:20:18 -08:00
joaquintides 00abbbdb27 fixed header guard name 2023-02-27 09:56:45 +01:00
joaquintides c42c2509bc removed header-level dependency from Boost.Serialization 2023-02-26 19:16:45 +01:00
joaquintides 40bead0430 updated (C) 2022-12-28 12:43:35 +01:00
Michael Ford 4312c88ead Minor include refactors (#65)
* refactor: use type_traits/declval over utility/declval

The later is just an include for the former.

* refactor: use container_hash/hash* over functional/hash*

The later just include the former.
2022-12-28 12:34:58 +01:00
joaquintides a7716c7f16 updated copyright dates 2022-08-23 19:12:10 +02:00
Michael Ford ae95816ae8 refactor: use core/enable_if over utility/enable_if (#64)
The later is deprecated:
```cpp
// The header file at this path is deprecated;
// use boost/core/enable_if.hpp instead.

include <boost/core/enable_if.hpp>
```
2022-08-23 19:04:48 +02:00
joaquintides 99f33def00 fixed #61 2022-07-01 09:59:56 +02:00
joaquintides fba66b0538 updated dates and release notes 2022-04-08 17:13:04 +02:00
Michael Ford a7e5cf843a refactor use core/ref.hpp over ref.hpp (#58)
The later has been deprecated:
```cpp

// The header file at this path is deprecated;
// use boost/core/ref.hpp instead.

```
2022-04-08 17:05:47 +02:00
joaquintides 647a60da24 updated revision dates 2022-04-03 16:29:38 +02:00
Michael Ford 2b78a77d6b refactor: use boost/core/noncopyable.hpp over boost/noncopyable.hpp (#57)
boost/noncopyable.hpp is deprecated
2022-04-03 15:27:18 +02:00
joaquintides 7c591a13aa improved performance of count in ranked indices (#56)
* count for ranked_index uses rank

Normally, count is calculated as the distance between iterators,
which takes linear time when count(x,comp) is comparable with n,
but for ranked indices we can subtract the values or rank,
reducing the complexity from log(n)+count(x,comp) to log(n).

* Added test for new count(x) and count(x,comp) in ranked_index

Both, the existing implementation of count from ordered_index and
the new implementation for ranked_index are compared with the
common sense. Positive results of this test show in particular that
the numbers produced by the new implementation are consistent with
those from the existing implementation and hence correct.

* Benchmark of count(): ordered_index vs ranked_index

A benchmark is added as count_benchmark.cpp in the 'example'
directory.

When the values of an index are unique, both implementations are
comparable (ranked_index is 10-15% faster).

However, for highly non-unique indices (like the age of people),
the new implementation in ranked_index outperforms ordered_index.
For 1 000 people of age in 0..99 ranked_index is ~2x faster,
for 10 000 people it is 12-13x faster, and
for 100 000 people it is 95-100x times faster.

For even more non-unique indices (like sex or the age of pupils)
or coarse comparison predicates (grouping people in age groups
like 0..9, 10..19 etc.) the gap in performance grows further.
For a comparison predicate comparing 'age/10' for age in 0..99,
similar gaps in performance occur already for 10x smaller
containers:
for 100 people count in ranked_index is 2x faster,
for 1 000 people it is ~9x faster,
for 10 000 people it is 95-100x faster,
for 100 000 people it is almost 1000x faster.

* Documentation updated with new complexity of count in ranked_index

* simplified Damian's contribution

* reorganized code

* covered ranked_index::count

* updated docs

Co-authored-by: DamianSawicki <86234282+DamianSawicki@users.noreply.github.com>
2022-02-05 12:59:43 +01:00
joaquintides 2026b94c12 fixed 1b38fdcc77 2021-08-30 09:20:29 +02:00
joaquintides d86df5a52f kept max line length below 80 chars 2021-08-26 19:05:16 +02:00
joaquintides 5c8b26cd9b added missing #include's 2021-08-26 18:53:41 +02:00
joaquintides 1b38fdcc77 suppressed VS warnings 2021-08-26 18:41:45 +02:00
joaquintides a52810fc3d implemented merge operations (#49)
* initial draft

* modified appveyor.yml for this branch

* dropped BOOST_RV_REF
as it doesn't handle lvalue refs

* befriended index_base from all indices
so as to be grant access to final_extract_for_merge_ from an external container

* added rvalue ref merge
(test expected to fail in C++03)

* added explicit boost::move on rvalue ref
for the benefit of C++03 compilers

* fixed previous workaround

* refactored merge algorithm into multi_index_container

* added hashed_index::merge

* reimplemented sequenced_index::splice(position,x)

* added missing this->'s

* refactored SFINAEing code

* made sequenced_index::splice(position,x) exception robust

* reimplemented random_access_index::splice(position,x)

* micro-optimized legacy code in random_access_index::splice(position,x)

* added missing #include

* reimplemented sequenced_index::splice(position,x,i)

* reimplemented random_access_index::splice(position,x,i)

* reimplemented sequenced_index::splice(position,x,first,last)

* reimplemented random_access_index::splice(position,x,first,last)

* re-engineered sequenced_index::splice(position,x,i)
so that it works when source and destination belong to the same container

* stylistic

* re-engineered random_access_index::splice(position,x,i)
so that it works when source and destination belong to the same container

* re-engineered sequenced_index::splice(position,x,first,last)
so that it works when source and destination belong to the same container

* stylistic

* fixed bug in rvalue ref overload of sequenced_index::splice(position,x,first,last)

* fixed internal sequenced_index::splice(position,x,first,last) across different indices

* re-engineered random_access_index::splice(position,x,first,last)
the same way as done with sequenced_index

* replaced multi_index_container::merge_ with transfer_range_
so as to refactor some code in non-key-based indices

* fixed safe mode check for different-type containers

* hardened merge/splice tests

* s/BOOST_RV_REF/BOOST_FWD_REF

* called the right merge_different overload

* fixed problem with Boost.Move C++03 perfect fwd emulation

* updated (C) year

* allowed intra-container full splice

* required position==end() in intra-container full splice

* made pointwise splice return a pair<iterator,bool>

* added partial merge functionality to key-based indices
plus fixed a compile-time error with legacy splice code when applied to different-type indices

* suppressed unused variable

* fixed wrong signature in splice memfun

* made safe-mode iterators SCARY

* refactored any_container_view

* implemented safe iterator transfer in merge/splice

* reorganized internal deps

* stylistic

* automatically checked iterator invalidation upon merge/splice

* removed commented-out code

* checked allocator equality

* reimplemented random_access_index internal, cross-index splice in linear time

* updated docs

* reverted appveyor.yml
2021-08-19 10:41:03 +02:00
joaquintides 5623d2b9e2 added contains (#35) 2021-07-29 12:04:15 +02:00
joaquintides b685e11dfc stopped relying on stdlib function objects' ::result_type 2020-06-29 11:51:24 +02:00
joaquintides 1b1e29d6e3 added workaround for https://github.com/boostorg/config/issues/336 2020-05-10 15:27:11 +02:00
joaquintides 53c11e1ea7 added missing #include 2020-05-10 13:58:16 +02:00
joaquintides e3fec3af57 fixed allocator_is_always_equal usage 2020-05-10 13:47:09 +02:00
joaquintides ed5a975059 provided pre-C++17 allocator_traits::is_always_equal 2020-05-10 13:33:36 +02:00
joaquintides 4a109e99e5 avoided deprecated #includes, fixed Boost.Move headers 2020-05-10 12:17:55 +02:00
joaquintides ff3f612abb added missing template keywords 2020-05-10 10:11:51 +02:00
joaquintides 99430f9edd avoided deprecated #includes 2020-05-09 22:01:20 +02:00
joaquintides e69466039d implemented node extraction/insertion (#27) 2020-05-09 20:25:41 +02:00
joaquintides a766a08573 replaced erase_ backbone function with extract:_ 2020-05-01 20:36:38 +02:00
joaquintides 3a47a82947 simplified delete_node_ 2020-05-01 13:22:03 +02:00
joaquintides a34c774a05 made node structure independent of unique/non_unique flavor 2020-05-01 12:29:03 +02:00
joaquintides 382e41fa99 renamed internal typedefs to make room for public node_type 2020-05-01 11:46:51 +02:00
joaquintides 1c3ef66798 stopped #including deprecated <boost/bind.hpp> 2020-02-17 09:39:08 +01:00
joaquintides d7ad9185e8 spared one equal allocator swap 2020-01-27 12:14:03 +01:00
joaquintides 81dbe86f25 suppressed VS warnings 2020-01-26 13:24:55 +01:00
joaquintides a8d34a56f7 made multi_index_container AllocatorAware (#30) 2020-01-26 11:52:23 +01:00
joaquintides 89b4ff7bbf abode by [depr.impldec] 2020-01-21 15:04:21 +01:00
joaquintides 3caea31bfc enabled ADL for internal swapping of user-provided objects (#29) 2019-11-09 12:59:55 +01:00
joaquintides a7ef250b9f avoided VS's spurious preprocessor warning 2019-06-11 17:10:01 +02:00