mirror of
https://github.com/boostorg/multi_index.git
synced 2026-07-21 13:23:43 +00:00
Compare commits
12 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| b6a0722f11 | |||
| fbeaf88056 | |||
| 19237f650a | |||
| 0356be0f6f | |||
| 1f61ddc1ec | |||
| 0d48b7d14b | |||
| ac4971abc2 | |||
| a47c9f57b4 | |||
| d260b4e524 | |||
| 179b5def1e | |||
| eb993b1e23 | |||
| 890f032939 |
+1
-1
@@ -319,7 +319,7 @@ local windows_pipeline(name, image, environment, arch = "amd64") =
|
||||
linux_pipeline(
|
||||
"Linux 18.04 Clang 5.0",
|
||||
"cppalliance/droneubuntu1804:1",
|
||||
{ TOOLSET: 'clang', COMPILER: 'clang++-5.0', CXXSTD: '11,14,1z' },
|
||||
{ TOOLSET: 'clang', COMPILER: 'clang++-5.0', CXXSTD: '11,14' },
|
||||
"clang-5.0",
|
||||
),
|
||||
|
||||
|
||||
@@ -11,6 +11,7 @@ on:
|
||||
|
||||
env:
|
||||
UBSAN_OPTIONS: print_stacktrace=1
|
||||
ACTIONS_ALLOW_USE_UNSECURE_NODE_VERSION: true
|
||||
|
||||
jobs:
|
||||
posix:
|
||||
@@ -79,6 +80,18 @@ jobs:
|
||||
os: ubuntu-24.04
|
||||
install: g++-14-multilib
|
||||
address-model: 32,64
|
||||
- toolset: gcc-15
|
||||
cxxstd: "11,14,17,20,23,2c"
|
||||
container: ubuntu:26.04
|
||||
os: ubuntu-latest
|
||||
install: g++-15-multilib
|
||||
address-model: 32,64
|
||||
- toolset: gcc-16
|
||||
cxxstd: "11,14,17,20,23,2c"
|
||||
container: ubuntu:26.04
|
||||
os: ubuntu-latest
|
||||
install: g++-16-multilib
|
||||
address-model: 32,64
|
||||
- toolset: clang
|
||||
compiler: clang++-3.9
|
||||
cxxstd: "11,14"
|
||||
@@ -93,7 +106,7 @@ jobs:
|
||||
install: clang-4.0
|
||||
- toolset: clang
|
||||
compiler: clang++-5.0
|
||||
cxxstd: "11,14,1z"
|
||||
cxxstd: "11,14"
|
||||
os: ubuntu-latest
|
||||
container: ubuntu:18.04
|
||||
install: clang-5.0
|
||||
@@ -176,11 +189,26 @@ jobs:
|
||||
os: ubuntu-latest
|
||||
install: clang-18
|
||||
- toolset: clang
|
||||
compiler: clang++-19
|
||||
cxxstd: "11,14,17,20,2b"
|
||||
os: macos-13
|
||||
container: ubuntu:24.04
|
||||
os: ubuntu-latest
|
||||
install: clang-19
|
||||
- toolset: clang
|
||||
compiler: clang++-20
|
||||
cxxstd: "11,14,17,20,23,2c"
|
||||
container: ubuntu:24.04
|
||||
os: ubuntu-latest
|
||||
install: clang-20
|
||||
- toolset: clang
|
||||
cxxstd: "11,14,17,20,2b"
|
||||
os: macos-14
|
||||
- toolset: clang
|
||||
cxxstd: "11,14,17,20,23,2c"
|
||||
os: macos-15
|
||||
- toolset: clang
|
||||
cxxstd: "11,14,17,20,23,2c"
|
||||
os: macos-26
|
||||
|
||||
runs-on: ${{matrix.os}}
|
||||
container:
|
||||
|
||||
+3
-5
@@ -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)
|
||||
|
||||
@@ -20,12 +21,9 @@ target_link_libraries(boost_multi_index
|
||||
Boost::container_hash
|
||||
Boost::core
|
||||
Boost::integer
|
||||
Boost::iterator
|
||||
Boost::move
|
||||
Boost::mpl
|
||||
Boost::mp11
|
||||
Boost::preprocessor
|
||||
Boost::smart_ptr
|
||||
Boost::static_assert
|
||||
Boost::throw_exception
|
||||
Boost::tuple
|
||||
Boost::type_traits
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
[](https://github.com/boostorg/multi_index/tree/master) [](https://github.com/boostorg/multi_index/actions/workflows/ci.yml) [](https://drone.cpp.al/boostorg/multi_index) [](https://pdimov.github.io/boostdep-report/master/multi_index.html) [](https://www.boost.org/doc/libs/master/libs/multi_index) [](https://regression.boost.org/master/developer/multi_index.html)<br/>
|
||||
[](https://github.com/boostorg/multi_index/tree/develop) [](https://github.com/boostorg/multi_index/actions/workflows/ci.yml) [](https://drone.cpp.al/boostorg/multi_index) [](https://pdimov.github.io/boostdep-report/develop/multi_index.html) [](https://www.boost.org/doc/libs/develop/libs/multi_index) [](https://regression.boost.org/develop/developer/multi_index.html)<br/>
|
||||
[](https://www.boost.org/users/license.html) <img alt="Header-only library" src="https://img.shields.io/badge/build-header--only-blue.svg">
|
||||
[](https://www.boost.org/users/license.html) <img alt="C++11 required" src="https://img.shields.io/badge/standard-C%2b%2b11-blue.svg"> <img alt="Header-only library" src="https://img.shields.io/badge/build-header--only-blue.svg">
|
||||
|
||||
[Boost.MultiIndex](http://boost.org/libs/multi_index) provides a class template
|
||||
named `multi_index_container` which enables the construction of containers
|
||||
|
||||
@@ -12,12 +12,9 @@ constant boost_dependencies :
|
||||
/boost/container_hash//boost_container_hash
|
||||
/boost/core//boost_core
|
||||
/boost/integer//boost_integer
|
||||
/boost/iterator//boost_iterator
|
||||
/boost/move//boost_move
|
||||
/boost/mpl//boost_mpl
|
||||
/boost/mp11//boost_mp11
|
||||
/boost/preprocessor//boost_preprocessor
|
||||
/boost/smart_ptr//boost_smart_ptr
|
||||
/boost/static_assert//boost_static_assert
|
||||
/boost/throw_exception//boost_throw_exception
|
||||
/boost/tuple//boost_tuple
|
||||
/boost/type_traits//boost_type_traits
|
||||
|
||||
@@ -1,402 +0,0 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0.1 Transitional//EN">
|
||||
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
||||
<title>Boost.MultiIndex Documentation - Compiler specifics</title>
|
||||
<link rel="stylesheet" href="style.css" type="text/css">
|
||||
<link rel="start" href="index.html">
|
||||
<link rel="prev" href="reference/key_extraction.html">
|
||||
<link rel="up" href="index.html">
|
||||
<link rel="next" href="performance.html">
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<h1><img src="../../../boost.png" alt="boost.png (6897 bytes)" align=
|
||||
"middle" width="277" height="86">Boost.MultiIndex Compiler specifics</h1>
|
||||
|
||||
<div class="prev_link"><a href="reference/key_extraction.html"><img src="prev.gif" alt="key extraction" border="0"><br>
|
||||
Key extraction
|
||||
</a></div>
|
||||
<div class="up_link"><a href="index.html"><img src="up.gif" alt="index" border="0"><br>
|
||||
Index
|
||||
</a></div>
|
||||
<div class="next_link"><a href="performance.html"><img src="next.gif" alt="performance" border="0"><br>
|
||||
Performance
|
||||
</a></div><br clear="all" style="clear: all;">
|
||||
|
||||
<hr>
|
||||
|
||||
<p>
|
||||
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.
|
||||
</p>
|
||||
|
||||
<h2>Contents</h2>
|
||||
|
||||
<ul>
|
||||
<li><a href="#move">Move semantics</a></li>
|
||||
<li><a href="#allocator_awareness">Allocator awareness</a></li>
|
||||
<li><a href="#emplace">Emplace functions</a></li>
|
||||
<li><a href="#initializer_list">Initializer lists</a></li>
|
||||
<li><a href="#tuple">Tuples</a></li>
|
||||
<li><a href="#symbol_reduction">Reduction of symbol name lengths</a>
|
||||
<ul>
|
||||
<li><a href="#argument_limitation">Limitation of maximum number of arguments</a></li>
|
||||
<li><a href="#type_hiding">Type hiding</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><a href="#legacy">Legacy compilers</a></li>
|
||||
</ul>
|
||||
|
||||
<h2><a name="move">Move semantics</a></h2>
|
||||
|
||||
<p>
|
||||
Boost.MultiIndex uses <a href="../../../doc/html/move.html">Boost.Move</a>
|
||||
to support compilers without rvalue references. In such scenarios, taking
|
||||
advantage of <code>multi_index_container<Value></code> capabilities for
|
||||
increased efficiency in insertion and handling of moveable-only elements will
|
||||
require that <code>Value</code> be suitably instrumented.
|
||||
</p>
|
||||
|
||||
<h2><a name="allocator_awareness">Allocator awareness</a></h2>
|
||||
|
||||
<p>
|
||||
In pre-C++11 compilers or defective environments without proper
|
||||
<a href="https://en.cppreference.com/w/cpp/named_req/AllocatorAwareContainer">allocator
|
||||
awareness</a> machinery (basically, <code>std::allocator_traits</code>),
|
||||
Boost.MultiIndex behaves as if
|
||||
<code>std::allocator_traits<allocator_type>::propagate_on_container_*::value</code>
|
||||
were <code>false</code> for all allocators.
|
||||
</p>
|
||||
|
||||
<h2><a name="emplace">Emplace functions</a></h2>
|
||||
|
||||
<p>
|
||||
In compilers without variadic template support, Boost.MultiIndex emplace
|
||||
functions emulate this missing functionality by accepting up to
|
||||
<code>BOOST_MULTI_INDEX_LIMIT_VARTEMPL_ARGS</code>
|
||||
construction arguments that are internally forwarded with
|
||||
<a href="../../../doc/html/move.html">Boost.Move</a>:
|
||||
only constant lvalue references and rvalues are permitted as construction arguments
|
||||
in such case.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<code>BOOST_MULTI_INDEX_LIMIT_VARTEMPL_ARGS</code>, which by default is 5, can
|
||||
be globally defined by the user to a different value.
|
||||
</p>
|
||||
|
||||
<h2><a name="initializer_list">Initializer lists</a></h2>
|
||||
|
||||
<p>
|
||||
No transparent emulation of this functionality can be provided in the absence of
|
||||
<code>std::initializer_list</code>: consider
|
||||
<a href="../../../libs/assign/index.html">Boost.Assign</a> as a
|
||||
possible replacement.
|
||||
</p>
|
||||
|
||||
<h2><a name="tuple">Tuples</a></h2>
|
||||
|
||||
<p>
|
||||
Everywhere where <code>std::tuple</code>s are used in the library interface,
|
||||
<code>boost::tuple</code>s can be resorted to in their place. The converse, however,
|
||||
is not true.
|
||||
</p>
|
||||
|
||||
<h2><a name="symbol_reduction">Reduction of symbol name lengths</a></h2>
|
||||
|
||||
<p>
|
||||
The types generated on the instantiations of <code>multi_index_container</code>s
|
||||
typically produce very long symbol names, sometimes beyond the internal limits
|
||||
of some compilers. There are several techniques to shorten generated symbol
|
||||
names: these techniques have also the beneficial side effect that resulting error
|
||||
messages are more readable.
|
||||
</p>
|
||||
|
||||
<h3><a name="argument_limitation">Limitation of maximum number of arguments</a></h3>
|
||||
|
||||
<p>
|
||||
The class templates <a href="reference/indices.html#indexed_by"><code>indexed_by</code></a>,
|
||||
<a href="reference/indices.html#tag"><code>tag</code></a> and
|
||||
<a href="reference/key_extraction.html#composite_key"><code>composite_key</code></a>
|
||||
accept a variable number of arguments whose maximum number is limited by
|
||||
internal macros. Even non-used arguments contribute to the final types,
|
||||
so manually adjusting the corresponding macros can result in a modest reduction
|
||||
of symbol names.
|
||||
</p>
|
||||
|
||||
<p align="center">
|
||||
<table cellspacing="0">
|
||||
<caption><b>Limiting maximum number of arguments of some class templates
|
||||
of Boost.MultiIndex.</b></caption>
|
||||
<tr>
|
||||
<th>class template</th>
|
||||
<th>limiting macro</th>
|
||||
<th>default value</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="center"> <code>indexed_by</code> </td>
|
||||
<td align="center"> <code>BOOST_MULTI_INDEX_LIMIT_INDEXED_BY_SIZE</code> </td>
|
||||
<td align="center">20</td>
|
||||
</tr>
|
||||
<tr class="odd_tr">
|
||||
<td align="center"> <code>tag</code> </td>
|
||||
<td align="center"> <code>BOOST_MULTI_INDEX_LIMIT_TAG_SIZE</code> </td>
|
||||
<td align="center">20</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="center"> <code>composite_key</code> </td>
|
||||
<td align="center"> <code>BOOST_MULTI_INDEX_LIMIT_COMPOSITE_KEY_SIZE</code> </td>
|
||||
<td align="center">10</td>
|
||||
</tr>
|
||||
</table>
|
||||
</p>
|
||||
|
||||
<h3><a name="type_hiding">Type hiding</a></h3>
|
||||
|
||||
<p>
|
||||
Consider a typical instantiation of <code>multi_index_container</code>:
|
||||
</p>
|
||||
|
||||
<blockquote><pre>
|
||||
<span class=keyword>typedef</span> <span class=identifier>multi_index_container</span><span class=special><</span>
|
||||
<span class=identifier>employee</span><span class=special>,</span>
|
||||
<span class=identifier>indexed_by</span><span class=special><</span>
|
||||
<span class=identifier>ordered_unique</span><span class=special><</span><span class=identifier>identity</span><span class=special><</span><span class=identifier>employee</span><span class=special>></span> <span class=special>>,</span>
|
||||
<span class=identifier>ordered_non_unique</span><span class=special><</span><span class=identifier>member</span><span class=special><</span><span class=identifier>employee</span><span class=special>,</span><span class=identifier>std</span><span class=special>::</span><span class=identifier>string</span><span class=special>,&</span><span class=identifier>employee</span><span class=special>::</span><span class=identifier>name</span><span class=special>></span> <span class=special>>,</span>
|
||||
<span class=identifier>ordered_unique</span><span class=special><</span><span class=identifier>member</span><span class=special><</span><span class=identifier>employee</span><span class=special>,</span><span class=keyword>int</span><span class=special>,&</span><span class=identifier>employee</span><span class=special>::</span><span class=identifier>ssnumber</span><span class=special>></span> <span class=special>></span>
|
||||
<span class=special>></span>
|
||||
<span class=special>></span> <span class=identifier>employee_set</span><span class=special>;</span>
|
||||
</pre></blockquote>
|
||||
|
||||
<p>
|
||||
Then, for instance, the type <code>employee_set::nth_index<0>::type</code>
|
||||
resolves to the following in GCC:
|
||||
</p>
|
||||
|
||||
<blockquote><pre>
|
||||
<span class=identifier>boost</span><span class=special>::</span><span class=identifier>multi_index</span><span class=special>::</span><span class=identifier>detail</span><span class=special>::</span><span class=identifier>ordered_index</span><span class=special><</span>
|
||||
<span class=identifier>boost</span><span class=special>::</span><span class=identifier>multi_index</span><span class=special>::</span><span class=identifier>identity</span><span class=special><</span><span class=identifier>employee</span><span class=special>>,</span>
|
||||
<span class=identifier>std</span><span class=special>::</span><span class=identifier>less</span><span class=special><</span><span class=identifier>employee</span><span class=special>>,</span>
|
||||
<span class=identifier>boost</span><span class=special>::</span><span class=identifier>multi_index</span><span class=special>::</span><span class=identifier>detail</span><span class=special>::</span><span class=identifier>nth_layer</span><span class=special><</span>
|
||||
<span class=number>1</span><span class=special>,</span> <span class=identifier>employee</span><span class=special>,</span>
|
||||
<span class=identifier>boost</span><span class=special>::</span><span class=identifier>multi_index</span><span class=special>::</span><span class=identifier>indexed_by</span><span class=special><</span>
|
||||
<span class=identifier>boost</span><span class=special>::</span><span class=identifier>multi_index</span><span class=special>::</span><span class=identifier>ordered_unique</span><span class=special><</span>
|
||||
<span class=identifier>boost</span><span class=special>::</span><span class=identifier>multi_index</span><span class=special>::</span><span class=identifier>identity</span><span class=special><</span><span class=identifier>employee</span><span class=special>>,</span> <span class=identifier>mpl_</span><span class=special>::</span><span class=identifier>na</span><span class=special>,</span> <span class=identifier>mpl_</span><span class=special>::</span><span class=identifier>na</span>
|
||||
<span class=special>>,</span>
|
||||
<span class=identifier>boost</span><span class=special>::</span><span class=identifier>multi_index</span><span class=special>::</span><span class=identifier>ordered_non_unique</span><span class=special><</span>
|
||||
<span class=identifier>boost</span><span class=special>::</span><span class=identifier>multi_index</span><span class=special>::</span><span class=identifier>member</span><span class=special><</span><span class=identifier>employee</span><span class=special>,</span> <span class=identifier>std</span><span class=special>::</span><span class=identifier>string</span><span class=special>,</span> <span class=special>&</span><span class=identifier>employee</span><span class=special>::</span><span class=identifier>name</span><span class=special>>,</span>
|
||||
<span class=identifier>mpl_</span><span class=special>::</span><span class=identifier>na</span><span class=special>,</span> <span class=identifier>mpl_</span><span class=special>::</span><span class=identifier>na</span>
|
||||
<span class=special>>,</span>
|
||||
<span class=identifier>boost</span><span class=special>::</span><span class=identifier>multi_index</span><span class=special>::</span><span class=identifier>ordered_unique</span><span class=special><</span>
|
||||
<span class=identifier>boost</span><span class=special>::</span><span class=identifier>multi_index</span><span class=special>::</span><span class=identifier>member</span><span class=special><</span><span class=identifier>employee</span><span class=special>,</span> <span class=keyword>int</span><span class=special>,</span> <span class=special>&</span><span class=identifier>employee</span><span class=special>::</span><span class=identifier>ssnumber</span><span class=special>>,</span>
|
||||
<span class=identifier>mpl_</span><span class=special>::</span><span class=identifier>na</span><span class=special>,</span> <span class=identifier>mpl_</span><span class=special>::</span><span class=identifier>na</span>
|
||||
<span class=special>>,</span>
|
||||
<span class=identifier>mpl_</span><span class=special>::</span><span class=identifier>na</span><span class=special>,</span> <span class=identifier>mpl_</span><span class=special>::</span><span class=identifier>na</span><span class=special>,</span> <span class=identifier>mpl_</span><span class=special>::</span><span class=identifier>na</span><span class=special>,</span> <span class=identifier>mpl_</span><span class=special>::</span><span class=identifier>na</span><span class=special>,</span> <span class=identifier>mpl_</span><span class=special>::</span><span class=identifier>na</span><span class=special>,</span> <span class=identifier>mpl_</span><span class=special>::</span><span class=identifier>na</span><span class=special>,</span>
|
||||
<span class=identifier>mpl_</span><span class=special>::</span><span class=identifier>na</span><span class=special>,</span> <span class=identifier>mpl_</span><span class=special>::</span><span class=identifier>na</span><span class=special>,</span> <span class=identifier>mpl_</span><span class=special>::</span><span class=identifier>na</span><span class=special>,</span> <span class=identifier>mpl_</span><span class=special>::</span><span class=identifier>na</span><span class=special>,</span> <span class=identifier>mpl_</span><span class=special>::</span><span class=identifier>na</span><span class=special>,</span> <span class=identifier>mpl_</span><span class=special>::</span><span class=identifier>na</span><span class=special>,</span>
|
||||
<span class=identifier>mpl_</span><span class=special>::</span><span class=identifier>na</span><span class=special>,</span> <span class=identifier>mpl_</span><span class=special>::</span><span class=identifier>na</span><span class=special>,</span> <span class=identifier>mpl_</span><span class=special>::</span><span class=identifier>na</span><span class=special>,</span> <span class=identifier>mpl_</span><span class=special>::</span><span class=identifier>na</span><span class=special>,</span> <span class=identifier>mpl_</span><span class=special>::</span><span class=identifier>na</span>
|
||||
<span class=special>>,</span>
|
||||
<span class=identifier>std</span><span class=special>::</span><span class=identifier>allocator</span><span class=special><</span><span class=identifier>employee</span><span class=special>></span>
|
||||
<span class=special>>,</span>
|
||||
<span class=identifier>boost</span><span class=special>::</span><span class=identifier>mpl</span><span class=special>::</span><span class=identifier>vector0</span><span class=special><</span><span class=identifier>mpl_</span><span class=special>::</span><span class=identifier>na</span><span class=special>>,</span>
|
||||
<span class=identifier>boost</span><span class=special>::</span><span class=identifier>multi_index</span><span class=special>::</span><span class=identifier>detail</span><span class=special>::</span><span class=identifier>ordered_unique_tag</span>
|
||||
<span class=special>></span>
|
||||
</pre></blockquote>
|
||||
|
||||
<p>
|
||||
It can be seen that a significant portion of the type name is contributed by
|
||||
the <code>indexed_by<...></code> part, which is nothing but an expanded
|
||||
version of the index specifier list provided in the definition of
|
||||
<code>employee_set</code>. We can prevent this very long name from appearing
|
||||
in the final type by encapsulating it into another, shorter-named construct:
|
||||
</p>
|
||||
|
||||
<blockquote><pre>
|
||||
<span class=comment>// reducing symbol names through type hiding
|
||||
// type hide the index specifier list within employee_set_indices</span>
|
||||
|
||||
<span class=keyword>struct</span> <span class=identifier>employee_set_indices</span><span class=special>:</span>
|
||||
<span class=identifier>indexed_by</span><span class=special><</span>
|
||||
<span class=identifier>ordered_unique</span><span class=special><</span><span class=identifier>identity</span><span class=special><</span><span class=identifier>employee</span><span class=special>></span> <span class=special>>,</span>
|
||||
<span class=identifier>ordered_non_unique</span><span class=special><</span><span class=identifier>member</span><span class=special><</span><span class=identifier>employee</span><span class=special>,</span><span class=identifier>std</span><span class=special>::</span><span class=identifier>string</span><span class=special>,&</span><span class=identifier>employee</span><span class=special>::</span><span class=identifier>name</span><span class=special>></span> <span class=special>>,</span>
|
||||
<span class=identifier>ordered_unique</span><span class=special><</span><span class=identifier>member</span><span class=special><</span><span class=identifier>employee</span><span class=special>,</span><span class=keyword>int</span><span class=special>,&</span><span class=identifier>employee</span><span class=special>::</span><span class=identifier>ssnumber</span><span class=special>></span> <span class=special>></span>
|
||||
<span class=special>></span>
|
||||
<span class=special>{};</span>
|
||||
|
||||
<span class=keyword>typedef</span> <span class=identifier>multi_index_container</span><span class=special><</span>
|
||||
<span class=identifier>employee</span><span class=special>,</span>
|
||||
<span class=identifier>employee_set_indices</span>
|
||||
<span class=special>></span> <span class=identifier>employee_set</span><span class=special>;</span>
|
||||
</pre></blockquote>
|
||||
|
||||
<p>
|
||||
<code>employee_set_indices</code> works as a conventional <code>typedef</code>
|
||||
in all respects, save for a detail: its name does not explicitly
|
||||
include the information contained in the <code>indexed_by</code> instantiation.
|
||||
Applying this technique, <code>employee_set::nth_index<0>::type</code>
|
||||
now becomes:
|
||||
</p>
|
||||
|
||||
<blockquote><pre>
|
||||
<span class=identifier>boost</span><span class=special>::</span><span class=identifier>multi_index</span><span class=special>::</span><span class=identifier>detail</span><span class=special>::</span><span class=identifier>ordered_index</span><span class=special><</span>
|
||||
<span class=identifier>boost</span><span class=special>::</span><span class=identifier>multi_index</span><span class=special>::</span><span class=identifier>identity</span><span class=special><</span><span class=identifier>employee</span><span class=special>>,</span>
|
||||
<span class=identifier>std</span><span class=special>::</span><span class=identifier>less</span><span class=special><</span><span class=identifier>employee</span><span class=special>>,</span>
|
||||
<span class=identifier>boost</span><span class=special>::</span><span class=identifier>multi_index</span><span class=special>::</span><span class=identifier>detail</span><span class=special>::</span><span class=identifier>nth_layer</span><span class=special><</span>
|
||||
<span class=number>1</span><span class=special>,</span> <span class=identifier>employee</span><span class=special>,</span>
|
||||
<span class=identifier>employee_set_indices</span><span class=special>,</span>
|
||||
<span class=identifier>std</span><span class=special>::</span><span class=identifier>allocator</span><span class=special><</span><span class=identifier>employee</span><span class=special>></span>
|
||||
<span class=special>>,</span>
|
||||
<span class=identifier>boost</span><span class=special>::</span><span class=identifier>mpl</span><span class=special>::</span><span class=identifier>vector0</span><span class=special><</span><span class=identifier>mpl_</span><span class=special>::</span><span class=identifier>na</span><span class=special>>,</span>
|
||||
<span class=identifier>boost</span><span class=special>::</span><span class=identifier>multi_index</span><span class=special>::</span><span class=identifier>detail</span><span class=special>::</span><span class=identifier>ordered_unique_tag</span>
|
||||
<span class=special>></span>
|
||||
</pre></blockquote>
|
||||
|
||||
<p>
|
||||
which is considerably shorter than the original, and also more
|
||||
easily parsed by a human reader. Type hiding would not work if, instead of
|
||||
making <code>employee_set_indices</code> a derived <code>struct</code> of
|
||||
<code>indexed_by<...></code>, we had defined it as a <code>typedef</code>:
|
||||
<code>typedef</code>s are syntactic aliases and usually get expanded
|
||||
by the compiler before doing any further type handling.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
Type hiding techniques can also be applied to <code>composite_key</code> instantiations,
|
||||
which often contribute a great deal to symbol name lengths.
|
||||
</p>
|
||||
|
||||
<h2><a name="legacy">Legacy compilers</a></h2>
|
||||
|
||||
<p>
|
||||
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.
|
||||
</p>
|
||||
|
||||
<p align="center">
|
||||
<table cellspacing="0" cellpadding="5">
|
||||
<caption><b>Support for legacy compilers.</b></caption>
|
||||
<tr>
|
||||
<th>Compiler</th>
|
||||
<th>Latest known<br>compatible version</th>
|
||||
<th>Date</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Borland C++ Builder 6.4 through 2006, CodeGear C++Builder 2010</td>
|
||||
<td>Never worked with Boost.MultiIndex</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr class="odd_tr">
|
||||
<td>Comeau C/C++ 4.3.10.1 for Windows (VC++ 9.0 backend)</td>
|
||||
<td><a href="http://www.boost.org/doc/libs/1_38_0/libs/multi_index/doc/compiler_specifics.html#comeau_43101_win_vc7_71">Boost 1.38</a></td>
|
||||
<td>February 2009</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Compaq C++ 6.5-042 through 7.1-006 for Tru64 UNIX</td>
|
||||
<td><a href="http://www.boost.org/doc/libs/1_38_0/libs/multi_index/doc/compiler_specifics.html#compaq_65">Boost 1.38</a></td>
|
||||
<td>February 2009</td>
|
||||
</tr>
|
||||
<tr class="odd_tr">
|
||||
<td>GCC 3.2 through 3.4</td>
|
||||
<td><a href="http://www.boost.org/doc/libs/1_41_0/libs/multi_index/doc/compiler_specifics.html#gcc_32">Boost 1.41</a></td>
|
||||
<td>November 2009</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>HP aC++ A.06.12 through A.06.17 for HP-UX IA64</td>
|
||||
<td><a href="http://www.boost.org/doc/libs/1_38_0/libs/multi_index/doc/compiler_specifics.html#acc_612_ia64">Boost 1.38</a></td>
|
||||
<td>February 2009</td>
|
||||
</tr>
|
||||
<tr class="odd_tr">
|
||||
<td>HP aC++ A.03.80 through A.03.85 for HP-UX PA-RISC</td>
|
||||
<td><a href="http://www.boost.org/doc/libs/1_38_0/libs/multi_index/doc/compiler_specifics.html#acc_380_pa_risc">Boost 1.38</a></td>
|
||||
<td>February 2009</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>IBM VisualAge C++ V6.0 for AIX</td>
|
||||
<td><a href="http://www.boost.org/doc/libs/1_33_1/libs/multi_index/doc/compiler_specifics.html#va_60">Boost 1.33.1</a></td>
|
||||
<td>December 2006</td>
|
||||
</tr>
|
||||
<tr class="odd_tr">
|
||||
<td>IBM XL C/C++ V9.0 through V10.1 for AIX</td>
|
||||
<td><a href="http://www.boost.org/doc/libs/1_41_0/libs/multi_index/doc/compiler_specifics.html#xl_90">Boost 1.41</a></td>
|
||||
<td>November 2009</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Intel C++ Compiler for Linux 8.1 through 11.1</td>
|
||||
<td><a href="http://www.boost.org/doc/libs/1_41_0/libs/multi_index/doc/compiler_specifics.html#intel_81_lin">Boost 1.41</a></td>
|
||||
<td>November 2009</td>
|
||||
</tr>
|
||||
<tr class="odd_tr">
|
||||
<td>Intel C++ Compiler for Mac OS 9.1 through 11.0</td>
|
||||
<td><a href="http://www.boost.org/doc/libs/1_41_0/libs/multi_index/doc/compiler_specifics.html#intel_91_mac">Boost 1.41</a></td>
|
||||
<td>November 2009</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Intel C++ Compiler for Windows 32-bit 8.0 through 11.1</td>
|
||||
<td><a href="http://www.boost.org/doc/libs/1_41_0/libs/multi_index/doc/compiler_specifics.html#intel_80_win">Boost 1.41</a></td>
|
||||
<td>November 2009</td>
|
||||
</tr>
|
||||
<tr class="odd_tr">
|
||||
<td>Intel C++ Compiler for Windows 64-bit 10.0 through 11.11</td>
|
||||
<td><a href="http://www.boost.org/doc/libs/1_41_0/libs/multi_index/doc/compiler_specifics.html#intel_100_win64">Boost 1.41</a></td>
|
||||
<td>November 2009</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Metrowerks CodeWarrior 8.3</td>
|
||||
<td><a href="http://www.boost.org/doc/libs/1_36_0/libs/multi_index/doc/compiler_specifics.html#cw_83">Boost 1.36</a></td>
|
||||
<td>August 2008</td>
|
||||
</tr>
|
||||
<tr class="odd_tr">
|
||||
<td>Metrowerks CodeWarrior 9 through 9.5</td>
|
||||
<td><a href="http://www.boost.org/doc/libs/1_34_1/libs/multi_index/doc/compiler_specifics.html#cw_9x">Boost 1.34.1</a></td>
|
||||
<td>July 2007</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Microsoft Visual C++ 6.0 Service Pack 5</td>
|
||||
<td><a href="http://www.boost.org/doc/libs/1_36_0/libs/multi_index/doc/compiler_specifics.html#msvc_60">Boost 1.36</a></td>
|
||||
<td>August 2008</td>
|
||||
</tr>
|
||||
<tr class="odd_tr">
|
||||
<td>Microsoft Visual C++ 7.0</td>
|
||||
<td><a href="http://www.boost.org/doc/libs/1_35_0/libs/multi_index/doc/compiler_specifics.html#msvc_70">Boost 1.35</a></td>
|
||||
<td>March 2008</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Sun Studio 10 through 12 Update 1 for Solaris</td>
|
||||
<td><a href="http://www.boost.org/doc/libs/1_41_0/libs/multi_index/doc/compiler_specifics.html#sun_10">Boost 1.41</a></td>
|
||||
<td>November 2009</td>
|
||||
</tr>
|
||||
</table>
|
||||
</p>
|
||||
|
||||
<hr>
|
||||
|
||||
<div class="prev_link"><a href="reference/key_extraction.html"><img src="prev.gif" alt="key extraction" border="0"><br>
|
||||
Key extraction
|
||||
</a></div>
|
||||
<div class="up_link"><a href="index.html"><img src="up.gif" alt="index" border="0"><br>
|
||||
Index
|
||||
</a></div>
|
||||
<div class="next_link"><a href="performance.html"><img src="next.gif" alt="performance" border="0"><br>
|
||||
Performance
|
||||
</a></div><br clear="all" style="clear: all;">
|
||||
|
||||
<br>
|
||||
|
||||
<p>Revised January 25th 2020</p>
|
||||
|
||||
<p>© Copyright 2003-2020 Joaquín M López Muñoz.
|
||||
Distributed under the Boost Software
|
||||
License, Version 1.0. (See accompanying file <a href="../../../LICENSE_1_0.txt">
|
||||
LICENSE_1_0.txt</a> or copy at <a href="http://www.boost.org/LICENSE_1_0.txt">
|
||||
http://www.boost.org/LICENSE_1_0.txt</a>)
|
||||
</p>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
+2
-3
@@ -67,7 +67,6 @@ examples of use developed in the documentation:
|
||||
<ul>
|
||||
<li><a href="tutorial/index.html">Tutorial</a></li>
|
||||
<li><a href="reference/index.html">Reference</a></li>
|
||||
<li><a href="compiler_specifics.html">Compiler specifics</a></li>
|
||||
<li><a href="performance.html">Performance</a></li>
|
||||
<li><a href="examples.html">Examples</a></li>
|
||||
<li><a href="tests.html">Tests</a></li>
|
||||
@@ -86,9 +85,9 @@ Tutorial
|
||||
|
||||
<br>
|
||||
|
||||
<p>Revised April 19th 2015</p>
|
||||
<p>Revised November 7th 2025</p>
|
||||
|
||||
<p>© Copyright 2003-2015 Joaquín M López Muñoz.
|
||||
<p>© Copyright 2003-2025 Joaquín M López Muñoz.
|
||||
Distributed under the Boost Software
|
||||
License, Version 1.0. (See accompanying file <a href="../../../LICENSE_1_0.txt">
|
||||
LICENSE_1_0.txt</a> or copy at <a href="http://www.boost.org/LICENSE_1_0.txt">
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<title>Boost.MultiIndex Documentation - Performance</title>
|
||||
<link rel="stylesheet" href="style.css" type="text/css">
|
||||
<link rel="start" href="index.html">
|
||||
<link rel="prev" href="compiler_specifics.html">
|
||||
<link rel="prev" href="reference/key_extraction.html">
|
||||
<link rel="up" href="index.html">
|
||||
<link rel="next" href="examples.html">
|
||||
</head>
|
||||
@@ -15,8 +15,8 @@
|
||||
<h1><img src="../../../boost.png" alt="boost.png (6897 bytes)" align=
|
||||
"middle" width="277" height="86">Boost.MultiIndex Performance</h1>
|
||||
|
||||
<div class="prev_link"><a href="compiler_specifics.html"><img src="prev.gif" alt="compiler specifics" border="0"><br>
|
||||
Compiler specifics
|
||||
<div class="prev_link"><a href="reference/key_extraction.html"><img src="prev.gif" alt="key extraction" border="0"><br>
|
||||
Key extraction
|
||||
</a></div>
|
||||
<div class="up_link"><a href="index.html"><img src="up.gif" alt="index" border="0"><br>
|
||||
Index
|
||||
@@ -737,8 +737,8 @@ some improvements both in space consumption and execution time.
|
||||
|
||||
<hr>
|
||||
|
||||
<div class="prev_link"><a href="compiler_specifics.html"><img src="prev.gif" alt="compiler specifics" border="0"><br>
|
||||
Compiler specifics
|
||||
<div class="prev_link"><a href="reference/key_extraction.html"><img src="prev.gif" alt="key extraction" border="0"><br>
|
||||
Key extraction
|
||||
</a></div>
|
||||
<div class="up_link"><a href="index.html"><img src="up.gif" alt="index" border="0"><br>
|
||||
Index
|
||||
@@ -749,9 +749,9 @@ Examples
|
||||
|
||||
<br>
|
||||
|
||||
<p>Revised April 18th 2020</p>
|
||||
<p>Revised November 7th 2025</p>
|
||||
|
||||
<p>© Copyright 2003-2020 Joaquín M López Muñoz.
|
||||
<p>© Copyright 2003-2025 Joaquín M López Muñoz.
|
||||
Distributed under the Boost Software
|
||||
License, Version 1.0. (See accompanying file <a href="../../../LICENSE_1_0.txt">
|
||||
LICENSE_1_0.txt</a> or copy at <a href="http://www.boost.org/LICENSE_1_0.txt">
|
||||
|
||||
@@ -212,7 +212,7 @@ index specifiers
|
||||
|
||||
<span class=keyword>namespace</span> <span class=identifier>multi_index</span><span class=special>{</span>
|
||||
|
||||
<span class=keyword>template</span><span class=special><</span><span class=keyword>typename</span> <span class=identifier>T0</span><span class=special>,...,</span><span class=keyword>typename</span> <span class=identifier>Tn</span><span class=special>></span>
|
||||
<span class=keyword>template</span><span class=special><</span><span class=keyword>typename</span> <span class=identifier>T</span><span class=special>,</span><span class=keyword>typename</span><span class=special>...</span> <span class=identifier>Ts</span><span class=special>></span>
|
||||
<span class=keyword>struct</span> <span class=identifier>indexed_by</span><span class=special>;</span>
|
||||
|
||||
<span class=special>}</span> <span class=comment>// namespace boost::multi_index</span>
|
||||
@@ -223,24 +223,19 @@ index specifiers
|
||||
<h3><a name="indexed_by">Class template <code>indexed_by</code></a></h3>
|
||||
|
||||
<p>
|
||||
<code>indexed_by</code> is a model of
|
||||
<a href="../../../../libs/mpl/doc/refmanual/random-access-sequence.html">
|
||||
<code>MPL Random Access Sequence</code></a> and
|
||||
<a href="../../../../libs/mpl/doc/refmanual/extensible-sequence.html">
|
||||
<code>MPL Extensible Sequence</code></a> meant to be used to specify a
|
||||
<code>indexed_by</code> is meant to be used to specify a
|
||||
compile-time list of indices as the <code>IndexSpecifierList</code> of
|
||||
<code>multi_index_container</code>.
|
||||
</p>
|
||||
|
||||
<blockquote><pre>
|
||||
<span class=keyword>template</span><span class=special><</span><span class=keyword>typename</span> <span class=identifier>T0</span><span class=special>,...,</span><span class=keyword>typename</span> <span class=identifier>Tn</span><span class=special>></span>
|
||||
<span class=keyword>template</span><span class=special><</span><span class=keyword>typename</span> <span class=identifier>T</span><span class=special>,</span><span class=keyword>typename</span><span class=special>...</span> <span class=identifier>Ts</span><span class=special>></span>
|
||||
<span class=keyword>struct</span> <span class=identifier>indexed_by</span><span class=special>;</span>
|
||||
</pre></blockquote>
|
||||
|
||||
<p>
|
||||
Each user-provided element of <code>indexed_list</code> must be an index
|
||||
specifier. At least an element must be provided. The maximum number of elements
|
||||
of an <code>indexed_by</code> sequence is implementation defined.
|
||||
specifier. At least an element must be provided.
|
||||
</p>
|
||||
|
||||
<h2><a name="tags">Tags</a></h2>
|
||||
@@ -264,7 +259,7 @@ class template <a href="#tag"><code>tag</code></a>.
|
||||
|
||||
<span class=keyword>namespace</span> <span class=identifier>multi_index</span><span class=special>{</span>
|
||||
|
||||
<span class=keyword>template</span><span class=special><</span><span class=keyword>typename</span> <span class=identifier>T0</span><span class=special>,...,</span><span class=keyword>typename</span> <span class=identifier>Tn</span><span class=special>></span>
|
||||
<span class=keyword>template</span><span class=special><</span><span class=keyword>typename</span><span class=special>...</span> <span class=identifier>Ts</span><span class=special>></span>
|
||||
<span class=keyword>struct</span> <span class=identifier>tag</span><span class=special>;</span>
|
||||
|
||||
<span class=special>}</span> <span class=comment>// namespace boost::multi_index</span>
|
||||
@@ -280,25 +275,13 @@ sequence of tags to be assigned to an index in instantiation time.
|
||||
</p>
|
||||
|
||||
<blockquote><pre>
|
||||
<span class=keyword>template</span><span class=special><</span><span class=keyword>typename</span> <span class=identifier>T0</span><span class=special>,...,</span><span class=keyword>typename</span> <span class=identifier>Tn</span><span class=special>></span>
|
||||
<span class=keyword>struct</span> <span class=identifier>tag</span>
|
||||
<span class=special>{</span>
|
||||
<span class=keyword>typedef</span> <b>implementation defined</b> <span class=identifier>type</span><span class=special>;</span>
|
||||
<span class=special>};</span>
|
||||
<span class=keyword>template</span><span class=special><</span><span class=keyword>typename</span><span class=special>...</span> <span class=identifier>Ts</span><span class=special>></span>
|
||||
<span class=keyword>struct</span> <span class=identifier>tag</span><span class=special>;</span>
|
||||
</pre></blockquote>
|
||||
|
||||
<p>
|
||||
Elements of <code>tag</code> can be any type, though the user is expected
|
||||
to provide classes with mnemonic names. Duplicate elements are not allowed.
|
||||
The maximum number of elements of a <code>tag</code> instantiation is
|
||||
implementation defined.
|
||||
The nested
|
||||
<code>type</code> is a model of
|
||||
<a href="../../../../libs/mpl/doc/refmanual/random-access-sequence.html">
|
||||
<code>MPL Random Access Sequence</code></a> and
|
||||
<a href="../../../../libs/mpl/doc/refmanual/extensible-sequence.html">
|
||||
<code>MPL Extensible Sequence</code></a> containing the types <code>T0</code>, ... ,
|
||||
<code>Tn</code> in the same order as specified.
|
||||
</p>
|
||||
|
||||
<h2><a name="index_catalog">Indices provided by Boost.MultiIndex</a></h2>
|
||||
@@ -386,9 +369,9 @@ Ordered indices
|
||||
|
||||
<br>
|
||||
|
||||
<p>Revised January 9th 2020</p>
|
||||
<p>Revised October 25th 2025</p>
|
||||
|
||||
<p>© Copyright 2003-2020 Joaquín M López Muñoz.
|
||||
<p>© Copyright 2003-2025 Joaquín M López Muñoz.
|
||||
Distributed under the Boost Software
|
||||
License, Version 1.0. (See accompanying file <a href="../../../../LICENSE_1_0.txt">
|
||||
LICENSE_1_0.txt</a> or copy at <a href="http://www.boost.org/LICENSE_1_0.txt">
|
||||
|
||||
+195
-186
@@ -8,7 +8,7 @@
|
||||
<link rel="start" href="../index.html">
|
||||
<link rel="prev" href="rnd_indices.html">
|
||||
<link rel="up" href="index.html">
|
||||
<link rel="next" href="../compiler_specifics.html">
|
||||
<link rel="next" href="../performance.html">
|
||||
</head>
|
||||
|
||||
<body>
|
||||
@@ -21,8 +21,8 @@ Random access indices
|
||||
<div class="up_link"><a href="index.html"><img src="../up.gif" alt="Boost.MultiIndex reference" border="0"><br>
|
||||
Boost.MultiIndex reference
|
||||
</a></div>
|
||||
<div class="next_link"><a href="../compiler_specifics.html"><img src="../next.gif" alt="compiler specifics" border="0"><br>
|
||||
Compiler specifics
|
||||
<div class="next_link"><a href="../performance.html"><img src="../next.gif" alt="performance" border="0"><br>
|
||||
Performance
|
||||
</a></div><br clear="all" style="clear: all;">
|
||||
|
||||
<hr>
|
||||
@@ -825,73 +825,73 @@ Type operator()(<br>
|
||||
|
||||
<span class=keyword>namespace</span> <span class=identifier>multi_index</span><span class=special>{</span>
|
||||
|
||||
<span class=keyword>template</span><span class=special><</span><span class=keyword>typename</span> <span class=identifier>Value</span><span class=special>,</span><span class=keyword>typename</span> <span class=identifier>KeyFromValue0</span><span class=special>,...,</span><span class=keyword>typename</span> <span class=identifier>KeyFromValuen</span><span class=special>></span>
|
||||
<span class=keyword>template</span><span class=special><</span><span class=keyword>typename</span> <span class=identifier>Value</span><span class=special>,</span><span class=keyword>typename</span> <span class=identifier>KeyFromValue</span><span class=special>,</span><span class=keyword>typename</span><span class=special>...</span> <span class=identifier>KeyFromValues</span><span class=special>></span>
|
||||
<span class=keyword>struct</span> <span class=identifier>composite_key</span><span class=special>;</span>
|
||||
|
||||
<span class=keyword>template</span><span class=special><</span><span class=keyword>typename</span> <span class=identifier>CompositeKey</span><span class=special>></span>
|
||||
<span class=keyword>struct</span> <span class=identifier>composite_key_result</span><span class=special>;</span>
|
||||
|
||||
<span class=comment>// comparison operators for composite_key_result:</span>
|
||||
<span class=comment>// comparison operators for composite_key_result:
|
||||
|
||||
<span class=comment>// <b>OP</b> is any of ==,<,!=,>,>=,<=</span>
|
||||
// <b>OP</b> is any of ==,<,!=,>,>=,<=</span>
|
||||
|
||||
<span class=keyword>template</span><span class=special><</span><span class=keyword>typename</span> <span class=identifier>CompositeKey1</span><span class=special>,</span><span class=keyword>typename</span> <span class=identifier>CompositeKey2</span><span class=special>></span>
|
||||
<span class=keyword>bool</span> <span class=keyword>operator</span> <b><i>OP</i></b><span class=special>(</span>
|
||||
<span class=keyword>bool</span> <span class=keyword>operator</span> <span class=identifier><b><i>OP</i></b></span><span class=special>(</span>
|
||||
<span class=keyword>const</span> <span class=identifier>composite_key_result</span><span class=special><</span><span class=identifier>CompositeKey1</span><span class=special>>&</span> <span class=identifier>x</span><span class=special>,</span>
|
||||
<span class=keyword>const</span> <span class=identifier>composite_key_result</span><span class=special><</span><span class=identifier>CompositeKey2</span><span class=special>>&</span> <span class=identifier>y</span><span class=special>);</span>
|
||||
|
||||
<span class=keyword>template</span><span class=special><</span><span class=keyword>typename</span> <span class=identifier>CompositeKey</span><span class=special>,</span><span class=keyword>typename</span><span class=special>...</span> <span class=identifier>Values</span><span class=special>></span>
|
||||
<span class=keyword>bool</span> <span class=keyword>operator</span> <b><i>OP</i></b><span class=special>(</span>
|
||||
<span class=keyword>bool</span> <span class=keyword>operator</span> <span class=identifier><b><i>OP</i></b></span><span class=special>(</span>
|
||||
<span class=keyword>const</span> <span class=identifier>composite_key_result</span><span class=special><</span><span class=identifier>CompositeKey</span><span class=special>>&</span> <span class=identifier>x</span><span class=special>,</span>
|
||||
<span class=keyword>const</span> <span class=identifier>std</span><span class=special>::</span><span class=identifier>tuple</span><span class=special><</span><span class=identifier>Values</span><span class=special>...>&</span> <span class=identifier>y</span><span class=special>);</span>
|
||||
|
||||
<span class=keyword>template</span><span class=special><</span><span class=keyword>typename</span> <span class=identifier>CompositeKey</span><span class=special>,</span><span class=keyword>typename</span><span class=special>...</span> <span class=identifier>Values</span><span class=special>></span>
|
||||
<span class=keyword>bool</span> <span class=keyword>operator</span> <b><i>OP</i></b><span class=special>(</span>
|
||||
<span class=keyword>template</span><span class=special><</span><span class=keyword>typename</span><span class=special>...</span> <span class=identifier>Values</span><span class=special>,</span><span class=keyword>typename</span> <span class=identifier>CompositeKey</span><span class=special>></span>
|
||||
<span class=keyword>bool</span> <span class=keyword>operator</span> <span class=identifier><b><i>OP</i></b></span><span class=special>(</span>
|
||||
<span class=keyword>const</span> <span class=identifier>std</span><span class=special>::</span><span class=identifier>tuple</span><span class=special><</span><span class=identifier>Values</span><span class=special>...>&</span> <span class=identifier>x</span><span class=special>,</span>
|
||||
<span class=keyword>const</span> <span class=identifier>composite_key_result</span><span class=special><</span><span class=identifier>CompositeKey</span><span class=special>>&</span> <span class=identifier>y</span><span class=special>);</span>
|
||||
|
||||
<span class=keyword>template</span><span class=special><</span><span class=keyword>typename</span> <span class=identifier>CompositeKey</span><span class=special>,</span><span class=keyword>typename</span> <span class=identifier>Value0</span><span class=special>,...,</span><span class=keyword>typename</span> <span class=identifier>Valuen</span><span class=special>></span>
|
||||
<span class=keyword>bool</span> <span class=keyword>operator</span> <b><i>OP</i></b><span class=special>(</span>
|
||||
<span class=keyword>template</span><span class=special><</span><span class=keyword>typename</span> <span class=identifier>CompositeKey</span><span class=special>,</span><span class=keyword>typename</span><span class=special>...</span> <span class=identifier>Values</span><span class=special>></span>
|
||||
<span class=keyword>bool</span> <span class=keyword>operator</span> <span class=identifier><b><i>OP</i></b></span><span class=special>(</span>
|
||||
<span class=keyword>const</span> <span class=identifier>composite_key_result</span><span class=special><</span><span class=identifier>CompositeKey</span><span class=special>>&</span> <span class=identifier>x</span><span class=special>,</span>
|
||||
<span class=keyword>const</span> <span class=identifier>boost</span><span class=special>::</span><span class=identifier>tuple</span><span class=special><</span><span class=identifier>Value0</span><span class=special>,...,</span><span class=identifier>Valuen</span><span class=special>>&</span> <span class=identifier>y</span><span class=special>);</span>
|
||||
<span class=keyword>const</span> <span class=identifier>boost</span><span class=special>::</span><span class=identifier>tuple</span><span class=special><</span><span class=identifier>Values</span><span class=special>...>&</span> <span class=identifier>y</span><span class=special>);</span>
|
||||
|
||||
<span class=keyword>template</span><span class=special><</span><span class=keyword>typename</span> <span class=identifier>Value0</span><span class=special>,...,</span><span class=keyword>typename</span> <span class=identifier>Valuen</span><span class=special>,</span><span class=keyword>typename</span> <span class=identifier>CompositeKey</span><span class=special>></span>
|
||||
<span class=keyword>bool</span> <span class=keyword>operator</span> <b><i>OP</i></b><span class=special>(</span>
|
||||
<span class=keyword>const</span> <span class=identifier>boost</span><span class=special>::</span><span class=identifier>tuple</span><span class=special><</span><span class=identifier>Value0</span><span class=special>,...,</span><span class=identifier>Valuen</span><span class=special>>&</span> <span class=identifier>x</span><span class=special>,</span>
|
||||
<span class=keyword>template</span><span class=special><</span><span class=keyword>typename</span><span class=special>...</span> <span class=identifier>Values</span><span class=special>,</span><span class=keyword>typename</span> <span class=identifier>CompositeKey</span><span class=special>></span>
|
||||
<span class=keyword>bool</span> <span class=keyword>operator</span> <span class=identifier><b><i>OP</i></b></span><span class=special>(</span>
|
||||
<span class=keyword>const</span> <span class=identifier>boost</span><span class=special>::</span><span class=identifier>tuple</span><span class=special><</span><span class=identifier>Values</span><span class=special>...>&</span> <span class=identifier>x</span><span class=special>,</span>
|
||||
<span class=keyword>const</span> <span class=identifier>composite_key_result</span><span class=special><</span><span class=identifier>CompositeKey</span><span class=special>>&</span> <span class=identifier>y</span><span class=special>);</span>
|
||||
|
||||
<span class=comment>// equality functors:</span>
|
||||
|
||||
<span class=keyword>template</span><span class=special><</span><span class=keyword>typename</span> <span class=identifier>Pred0</span><span class=special>,...,</span><span class=keyword>typename</span> <span class=identifier>Predn</span><span class=special>></span>
|
||||
<span class=keyword>template</span><span class=special><</span><span class=keyword>typename</span> <span class=identifier>Pred</span><span class=special>,</span><span class=keyword>typename</span><span class=special>...</span> <span class=identifier>Preds</span><span class=special>></span>
|
||||
<span class=keyword>struct</span> <span class=identifier>composite_key_equal_to</span><span class=special>;</span>
|
||||
|
||||
<span class=keyword>template</span><span class=special><</span><span class=keyword>typename</span> <span class=identifier>CompositeKeyResult</span><span class=special>></span>
|
||||
<span class=keyword>struct</span> <span class=identifier>composite_key_result_equal_to</span><span class=special>;</span> <span class=comment><b>// deprecated</b></span>
|
||||
<span class=keyword>struct</span> <span class=identifier>composite_key_result_equal_to</span><span class=special>;</span> <span class=comment>// deprecated
|
||||
|
||||
<span class=comment>// comparison functors:</span>
|
||||
// comparison functors:</span>
|
||||
|
||||
<span class=keyword>template</span><span class=special><</span><span class=keyword>typename</span> <span class=identifier>Compare0</span><span class=special>,...,</span><span class=keyword>typename</span> <span class=identifier>Comparen</span><span class=special>></span>
|
||||
<span class=keyword>template</span><span class=special><</span><span class=keyword>typename</span> <span class=identifier>Compare</span><span class=special>,</span><span class=keyword>typename</span><span class=special>...</span> <span class=identifier>Compares</span><span class=special>></span>
|
||||
<span class=keyword>struct</span> <span class=identifier>composite_key_compare</span><span class=special>;</span>
|
||||
|
||||
<span class=keyword>template</span><span class=special><</span><span class=keyword>typename</span> <span class=identifier>CompositeKeyResult</span><span class=special>></span>
|
||||
<span class=keyword>struct</span> <span class=identifier>composite_key_result_less</span><span class=special>;</span> <span class=comment><b>// deprecated</b></span>
|
||||
<span class=keyword>struct</span> <span class=identifier>composite_key_result_less</span><span class=special>;</span> <span class=comment>// deprecated</span>
|
||||
|
||||
<span class=keyword>template</span><span class=special><</span><span class=keyword>typename</span> <span class=identifier>CompositeKeyResult</span><span class=special>></span>
|
||||
<span class=keyword>struct</span> <span class=identifier>composite_key_result_greater</span><span class=special>;</span> <span class=comment><b>// deprecated</b></span>
|
||||
<span class=keyword>struct</span> <span class=identifier>composite_key_result_greater</span><span class=special>;</span> <span class=comment>// deprecated
|
||||
|
||||
<span class=comment>// hash functors:</span>
|
||||
// hash functors:</span>
|
||||
|
||||
<span class=keyword>template</span><span class=special><</span><span class=keyword>typename</span> <span class=identifier>Hash0</span><span class=special>,...,</span><span class=keyword>typename</span> <span class=identifier>Hashn</span><span class=special>></span>
|
||||
<span class=keyword>template</span><span class=special><</span><span class=keyword>typename</span> <span class=identifier>Hash</span><span class=special>,...,</span><span class=keyword>typename</span> <span class=identifier>Hashes</span><span class=special>></span>
|
||||
<span class=keyword>struct</span> <span class=identifier>composite_key_hash</span><span class=special>;</span>
|
||||
|
||||
<span class=keyword>template</span><span class=special><</span><span class=keyword>typename</span> <span class=identifier>CompositeKeyResult</span><span class=special>></span>
|
||||
<span class=keyword>struct</span> <span class=identifier>composite_key_result_hash</span><span class=special>;</span> <span class=comment><b>// deprecated</b></span>
|
||||
<span class=keyword>struct</span> <span class=identifier>composite_key_result_hash</span><span class=special>;</span> <span class=comment>// deprecated</span>
|
||||
|
||||
<span class=special>}</span> <span class=comment>// namespace boost::multi_index</span>
|
||||
|
||||
<span class=special>}</span> <span class=comment>// namespace boost</span>
|
||||
<span class=special>}</span> <span class=comment>// namespace boost
|
||||
|
||||
<span class=comment>// specializations of external functors for composite_key_result:</span>
|
||||
// specializations of external functors for composite_key_result:</span>
|
||||
|
||||
<span class=keyword>namespace</span> <span class=identifier>std</span><span class=special>{</span>
|
||||
|
||||
@@ -925,19 +925,23 @@ at compile time. The returned object is of type
|
||||
</p>
|
||||
|
||||
<blockquote><pre>
|
||||
<span class=keyword>template</span><span class=special><</span><span class=keyword>typename</span> <span class=identifier>Value</span><span class=special>,</span><span class=keyword>typename</span> <span class=identifier>KeyFromValue0</span><span class=special>,...,</span><span class=keyword>typename</span> <span class=identifier>KeyFromValuen</span><span class=special>></span>
|
||||
<span class=keyword>template</span><span class=special><</span><span class=keyword>typename</span> <span class=identifier>Value</span><span class=special>,</span><span class=keyword>typename</span> <span class=identifier>KeyFromValue</span><span class=special>,</span><span class=keyword>typename</span><span class=special>...</span> <span class=identifier>KeyFromValues</span><span class=special>></span>
|
||||
<span class=keyword>struct</span> <span class=identifier>composite_key</span>
|
||||
<span class=special>{</span>
|
||||
<span class=keyword>typedef</span> <span class=identifier>boost</span><span class=special>::</span><span class=identifier>tuple</span><span class=special><</span><span class=identifier>KeyFromValue0</span><span class=special>,...,</span><span class=identifier>KeyFromValuen</span><span class=special>></span> <span class=identifier>key_extractor_tuple</span><span class=special>;</span>
|
||||
<span class=keyword>typedef</span> <span class=identifier>Value</span> <span class=identifier>value_type</span><span class=special>;</span>
|
||||
<span class=keyword>typedef</span> <span class=identifier>composite_key_result</span><span class=special><</span><span class=identifier>composite_key</span><span class=special>></span> <span class=identifier>result_type</span><span class=special>;</span>
|
||||
<span class=keyword>typedef</span> <span class=identifier>std</span><span class=special>::</span><span class=identifier>tuple</span><span class=special><</span><span class=identifier>KeyFromValue</span><span class=special>,</span><span class=identifier>KeyFromValues</span><span class=special>...></span> <span class=identifier>key_extractor_tuple</span><span class=special>;</span>
|
||||
<span class=keyword>typedef</span> <span class=identifier>Value</span> <span class=identifier>value_type</span><span class=special>;</span>
|
||||
<span class=keyword>typedef</span> <span class=identifier>composite_key_result</span><span class=special><</span><span class=identifier>composite_key</span><span class=special>></span> <span class=identifier>result_type</span><span class=special>;</span>
|
||||
|
||||
<span class=identifier>composite_key</span><span class=special>(</span>
|
||||
<span class=keyword>const</span> <span class=identifier>KeyFromValue0</span><span class=special>&</span> <span class=identifier>k0</span><span class=special>=</span><span class=identifier>KeyFromValue0</span><span class=special>(),</span>
|
||||
<span class=special>...</span>
|
||||
<span class=keyword>const</span> <span class=identifier>KeyFromValuen</span><span class=special>&</span> <span class=identifier>kn</span><span class=special>=</span><span class=identifier>KeyFromValuen</span><span class=special>());</span>
|
||||
<span class=comment>// only provided if number of arguments is not greater than the number
|
||||
// of elements and each args<sub>i</sub>&& is convertible to const KeyFromValues<sub>i</sub>&</span>
|
||||
<span class=keyword>template</span><span class=special><</span><span class=keyword>typename</span><span class=special>...</span> <span class=identifier>Args</span><span class=special>></span>
|
||||
<span class=identifier>composite_key</span><span class=special>(</span><span class=identifier>Args</span><span class=special>&&...</span> <span class=identifier>args</span><span class=special>);</span>
|
||||
|
||||
<span class=identifier>composite_key</span><span class=special>(</span><span class=keyword>const</span> <span class=identifier>key_extractor_tuple</span><span class=special>&</span> <span class=identifier>x</span><span class=special>);</span>
|
||||
|
||||
<span class=comment>// only provided if number of elements is not greater than
|
||||
// the maximum length of a boost::tuple</span>
|
||||
<span class=identifier>composite_key</span><span class=special>(</span><span class=keyword>const</span> <span class=identifier>boost</span><span class=special>::</span><span class=identifier>tuple</span><span class=special><</span><span class=identifier>KeyFromValue</span><span class=special>,</span><span class=identifier>KeyFromValues</span><span class=special>...>&</span> <span class=identifier>x</span><span class=special>);</span>
|
||||
|
||||
<span class=keyword>const</span> <span class=identifier>key_extractor_tuple</span><span class=special>&</span> <span class=identifier>key_extractors</span><span class=special>()</span><span class=keyword>const</span><span class=special>;</span>
|
||||
<span class=identifier>key_extractor_tuple</span><span class=special>&</span> <span class=identifier>key_extractors</span><span class=special>()</span>
|
||||
@@ -953,14 +957,12 @@ at compile time. The returned object is of type
|
||||
</pre></blockquote>
|
||||
|
||||
<p>
|
||||
<code>KeyFromValue0</code>, ... , <code>KeyFromValuen</code> are the types of
|
||||
<code>KeyFromValue</code> and <code>KeyFromValues...</code> are the types of
|
||||
the key extractors combined into the composite key. Each of these types
|
||||
must be a <a href="#key_extractors"><code>Key Extractor</code></a> from
|
||||
<code>Value</code>. At least a key extractor must be provided. The maximum
|
||||
number of key extractors of a <code>composite_key</code> instantiation is
|
||||
implementation defined. <code>composite_key</code> internally stores an
|
||||
<code>Value</code>. <code>composite_key</code> internally stores an
|
||||
object of every constituent key extractor type.
|
||||
<code>composite_key<Value,KeyFromValue0,...,KeyFromValuen></code> is a model
|
||||
<code>composite_key<Value,KeyFromValue,KeyFromValues...></code> is a model
|
||||
of:
|
||||
<ul>
|
||||
<li><a href="#key_extractors"><code>Key Extractor</code></a>
|
||||
@@ -980,18 +982,19 @@ of:
|
||||
|
||||
<h4><code>composite_key</code> members</h4>
|
||||
|
||||
<code>composite_key(<br>
|
||||
const KeyFromValue0& k0=KeyFromValue0(),<br>
|
||||
...<br>
|
||||
const KeyFromValuen& kn=KeyFromValuen());
|
||||
<code>template<typename... Args><br>
|
||||
composite_key(Args&&... args)
|
||||
</code>
|
||||
|
||||
<blockquote>
|
||||
<b>Effects:</b> Constructs a <code>composite_key</code> that stores
|
||||
copies of the key extractor objects supplied.
|
||||
copies of <code>const KeyFromValue&</code>, <code>const KeyFromValues&...</code>
|
||||
values each obtained from the respective value of <code>std::forward<Args>(args)...</code>.
|
||||
</blockquote>
|
||||
|
||||
<code>composite_key(const key_extractor_tuple& x);</code>
|
||||
<code>composite_key(const key_extractor_tuple& x);<br>
|
||||
composite_key(const boost::tuple<KeyFromValue,KeyFromValues...>& x);
|
||||
</code>
|
||||
|
||||
<blockquote>
|
||||
<b>Effects:</b> Constructs a <code>composite_key</code> that stores
|
||||
@@ -1073,19 +1076,19 @@ instantiations as their extracted key.
|
||||
<span class=keyword>const</span> <span class=identifier>composite_key_result</span><span class=special><</span><span class=identifier>CompositeKey</span><span class=special>>&</span> <span class=identifier>x</span><span class=special>,</span>
|
||||
<span class=keyword>const</span> <span class=identifier>std</span><span class=special>::</span><span class=identifier>tuple</span><span class=special><</span><span class=identifier>Values</span><span class=special>...>&</span> <span class=identifier>y</span><span class=special>);</span>
|
||||
|
||||
<span class=keyword>template</span><span class=special><</span><span class=keyword>typename</span> <span class=identifier>CompositeKey</span><span class=special>,</span><span class=keyword>typename</span><span class=special>...</span> <span class=identifier>Values</span><span class=special>></span>
|
||||
<span class=keyword>template</span><span class=special><</span><span class=keyword>typename</span><span class=special>...</span> <span class=identifier>Values</span><span class=special>,</span><span class=keyword>typename</span> <span class=identifier>CompositeKey</span><span class=special>></span>
|
||||
<span class=keyword>bool</span> <span class=keyword>operator</span> <b><i>OP</i></b><span class=special>(</span>
|
||||
<span class=keyword>const</span> <span class=identifier>std</span><span class=special>::</span><span class=identifier>tuple</span><span class=special><</span><span class=identifier>Values</span><span class=special>...>&</span> <span class=identifier>x</span><span class=special>,</span>
|
||||
<span class=keyword>const</span> <span class=identifier>composite_key_result</span><span class=special><</span><span class=identifier>CompositeKey</span><span class=special>>&</span> <span class=identifier>y</span><span class=special>);</span>
|
||||
|
||||
<span class=keyword>template</span><span class=special><</span><span class=keyword>typename</span> <span class=identifier>CompositeKey</span><span class=special>,</span><span class=keyword>typename</span> <span class=identifier>Value0</span><span class=special>,...,</span><span class=keyword>typename</span> <span class=identifier>Valuen</span><span class=special>></span>
|
||||
<span class=keyword>template</span><span class=special><</span><span class=keyword>typename</span> <span class=identifier>CompositeKey</span><span class=special>,</span><span class=keyword>typename</span><span class=special>...</span> <span class=identifier>Values</span><span class=special>></span>
|
||||
<span class=keyword>bool</span> <span class=keyword>operator</span> <b><i>OP</i></b><span class=special>(</span>
|
||||
<span class=keyword>const</span> <span class=identifier>composite_key_result</span><span class=special><</span><span class=identifier>CompositeKey</span><span class=special>>&</span> <span class=identifier>x</span><span class=special>,</span>
|
||||
<span class=keyword>const</span> <span class=identifier>boost</span><span class=special>::</span><span class=identifier>tuple</span><span class=special><</span><span class=identifier>Value0</span><span class=special>,...,</span><span class=identifier>Valuen</span><span class=special>>&</span> <span class=identifier>y</span><span class=special>);</span>
|
||||
<span class=keyword>const</span> <span class=identifier>boost</span><span class=special>::</span><span class=identifier>tuple</span><span class=special><</span><span class=identifier>Values</span><span class=special>...>&</span> <span class=identifier>y</span><span class=special>);</span>
|
||||
|
||||
<span class=keyword>template</span><span class=special><</span><span class=keyword>typename</span> <span class=identifier>Value0</span><span class=special>,...,</span><span class=keyword>typename</span> <span class=identifier>Valuen</span><span class=special>,</span><span class=keyword>typename</span> <span class=identifier>CompositeKey</span><span class=special>></span>
|
||||
<span class=keyword>template</span><span class=special><</span><span class=keyword>typename</span><span class=special>...</span> <span class=identifier>Values</span><span class=special>,</span><span class=keyword>typename</span> <span class=identifier>CompositeKey</span><span class=special>></span>
|
||||
<span class=keyword>bool</span> <span class=keyword>operator</span> <b><i>OP</i></b><span class=special>(</span>
|
||||
<span class=keyword>const</span> <span class=identifier>boost</span><span class=special>::</span><span class=identifier>tuple</span><span class=special><</span><span class=identifier>Value0</span><span class=special>,...,</span><span class=identifier>Valuen</span><span class=special>>&</span> <span class=identifier>x</span><span class=special>,</span>
|
||||
<span class=keyword>const</span> <span class=identifier>boost</span><span class=special>::</span><span class=identifier>tuple</span><span class=special><</span><span class=identifier>Values</span><span class=special>...>&</span> <span class=identifier>x</span><span class=special>,</span>
|
||||
<span class=keyword>const</span> <span class=identifier>composite_key_result</span><span class=special><</span><span class=identifier>CompositeKey</span><span class=special>>&</span> <span class=identifier>y</span><span class=special>);</span>
|
||||
</pre></blockquote>
|
||||
|
||||
@@ -1111,7 +1114,7 @@ we use the following notation:
|
||||
<code>x</code>,</li>
|
||||
<li><code>v(x)</code> is the object of type <code>CompositeKey::value_type</code>
|
||||
associated to <code>x</code>,</li>
|
||||
<li><code>k<sub>i</sub>(x) = ck(x).key_extractors().get<i>()</code>,
|
||||
<li><code>k<sub>i</sub>(x) = get<i>(ck(x).key_extractors())</code>,
|
||||
that is, is the <code>i</code>-th key extractor of <code>ck(x)</code>,</li>
|
||||
<li><code>x<sub>i</sub> = k<sub>i</sub>(x)(v(x))</code>, that is, the
|
||||
key extracted from <code>v(x)</code> by the <code>i</code>-th key extractor,</li>
|
||||
@@ -1134,17 +1137,17 @@ template<typename CompositeKey,typename... Values><br>
|
||||
bool operator==(<br>
|
||||
const composite_key_result<CompositeKey>& x,<br>
|
||||
const std::tuple<Values...>& y);<br>
|
||||
template<typename CompositeKey,typename... Values><br>
|
||||
template<typename... Values,typename CompositeKey><br>
|
||||
bool operator==(<br>
|
||||
const std::tuple<Values...>& x,<br>
|
||||
const composite_key_result<CompositeKey>& y);<br>
|
||||
template<typename CompositeKey,typename Value0,...,typename Valuen><br>
|
||||
template<typename CompositeKey,typename... Values><br>
|
||||
bool operator==(<br>
|
||||
const composite_key_result<CompositeKey>& x,<br>
|
||||
const boost::tuple<Value0,...,Valuen>& y);<br>
|
||||
template<typename Value0,...,typename Valuen,typename CompositeKey><br>
|
||||
const boost::tuple<Values...>& y);<br>
|
||||
template<typename... Values,typename CompositeKey><br>
|
||||
bool operator==(<br>
|
||||
const boost::tuple<Value0,...,Valuen>& x,<br>
|
||||
const boost::tuple<Values...>& x,<br>
|
||||
const composite_key_result<CompositeKey>& y);
|
||||
</code>
|
||||
|
||||
@@ -1160,7 +1163,7 @@ in <code>[0,length(x))</code>.
|
||||
<b>Complexity:</b> No more key extraction operations and comparisons
|
||||
are performed than those necessary for the evaluation of the expression above,
|
||||
starting at <code>i==0</code>. The evaluation is short-circuited as soon as
|
||||
the result is determined to be <code>false</code>.
|
||||
the result is determined.
|
||||
</blockquote>
|
||||
|
||||
<code>template<typename CompositeKey1,typename CompositeKey2><br>
|
||||
@@ -1171,17 +1174,17 @@ template<typename CompositeKey,typename... Values><br>
|
||||
bool operator<(<br>
|
||||
const composite_key_result<CompositeKey>& x,<br>
|
||||
const std::tuple<Values...>& y);<br>
|
||||
template<typename CompositeKey,typename... Values><br>
|
||||
template<typename... Values,typename CompositeKey><br>
|
||||
bool operator<(<br>
|
||||
const std::tuple<Values...>& x,<br>
|
||||
const composite_key_result<CompositeKey>& y);<br>
|
||||
template<typename CompositeKey,typename Value0,...,typename Valuen><br>
|
||||
template<typename CompositeKey,typename... Values><br>
|
||||
bool operator<(<br>
|
||||
const composite_key_result<CompositeKey>& x,<br>
|
||||
const boost::tuple<Value0,...,Valuen>& y);<br>
|
||||
template<typename Value0,...,typename Valuen,typename CompositeKey><br>
|
||||
const boost::tuple<Values...>& y);<br>
|
||||
template<typename... Values,typename CompositeKey><br>
|
||||
bool operator<(<br>
|
||||
const boost::tuple<Value0,...,Valuen>& x,<br>
|
||||
const boost::tuple<Values...>& x,<br>
|
||||
const composite_key_result<CompositeKey>& y);
|
||||
</code>
|
||||
|
||||
@@ -1212,17 +1215,17 @@ template<typename CompositeKey,typename... Values><br>
|
||||
bool operator <b><i>OP</i></b>(<br>
|
||||
const composite_key_result<CompositeKey>& x,<br>
|
||||
const std::tuple<Values...>& y);<br>
|
||||
template<typename CompositeKey,typename... Values><br>
|
||||
template<typename... Values,typename CompositeKey><br>
|
||||
bool operator <b><i>OP</i></b>(<br>
|
||||
const std::tuple<Values...>& x,<br>
|
||||
const composite_key_result<CompositeKey>& y);<br>
|
||||
template<typename CompositeKey,typename Value0,...,typename Valuen><br>
|
||||
template<typename CompositeKey,typename... Values><br>
|
||||
bool operator <b><i>OP</i></b>(<br>
|
||||
const composite_key_result<CompositeKey>& x,<br>
|
||||
const boost::tuple<Value0,...,Valuen>& y);<br>
|
||||
template<typename Value0,...,typename Valuen,typename CompositeKey><br>
|
||||
const boost::tuple<Values...>& y);<br>
|
||||
template<typename... Values,typename CompositeKey><br>
|
||||
bool operator <b><i>OP</i></b>(<br>
|
||||
const boost::tuple<Value0,...,Valuen>& x,<br>
|
||||
const boost::tuple<Values...>& x,<br>
|
||||
const composite_key_result<CompositeKey>& y);
|
||||
</code>
|
||||
|
||||
@@ -1256,20 +1259,24 @@ collection of elementary equality predicates.
|
||||
</p>
|
||||
|
||||
<blockquote><pre>
|
||||
<span class=keyword>template</span><span class=special><</span><span class=keyword>typename</span> <span class=identifier>Pred0</span><span class=special>,...,</span><span class=keyword>typename</span> <span class=identifier>Predn</span><span class=special>></span>
|
||||
<span class=keyword>template</span><span class=special><</span><span class=keyword>typename</span> <span class=identifier>Pred</span><span class=special>,</span><span class=keyword>typename</span><span class=special>...</span> <span class=identifier>Preds</span><span class=special>></span>
|
||||
<span class=keyword>struct</span> <span class=identifier>composite_key_equal_to</span>
|
||||
<span class=special>{</span>
|
||||
<span class=keyword>typedef</span> <span class=identifier>boost</span><span class=special>::</span><span class=identifier>tuple</span><span class=special><</span><span class=identifier>Pred0</span><span class=special>,...,</span><span class=identifier>Predn</span><span class=special>></span> <span class=identifier>key_eq_tuple</span><span class=special>;</span>
|
||||
<span class=keyword>typedef</span> <span class=identifier>std</span><span class=special>::</span><span class=identifier>tuple</span><span class=special><</span><span class=identifier>Pred</span><span class=special>,</span><span class=identifier>Preds</span><span class=special>...></span> <span class=identifier>key_eq_tuple</span><span class=special>;</span>
|
||||
|
||||
<span class=identifier>composite_key_equal_to</span><span class=special>(</span>
|
||||
<span class=keyword>const</span> <span class=identifier>Pred0</span><span class=special>&</span> <span class=identifier>p0</span><span class=special>=</span><span class=identifier>Pred0</span><span class=special>(),</span>
|
||||
<span class=special>...</span>
|
||||
<span class=keyword>const</span> <span class=identifier>Predn</span><span class=special>&</span> <span class=identifier>pn</span><span class=special>=</span><span class=identifier>Predn</span><span class=special>());</span>
|
||||
<span class=comment>// only provided if number of arguments is not greater than the number
|
||||
// of elements and each args<sub>i</sub>&& is convertible to const Preds<sub>i</sub>&</span>
|
||||
<span class=keyword>template</span><span class=special><</span><span class=keyword>typename</span><span class=special>...</span> <span class=identifier>Args</span><span class=special>></span>
|
||||
<span class=identifier>composite_key_equal_to</span><span class=special>(</span><span class=identifier>Args</span><span class=special>&&...</span> <span class=identifier>args</span><span class=special>);</span>
|
||||
|
||||
<span class=identifier>composite_key_equal_to</span><span class=special>(</span><span class=keyword>const</span> <span class=identifier>key_eq_tuple</span><span class=special>&</span> <span class=identifier>x</span><span class=special>);</span>
|
||||
|
||||
<span class=comment>// only provided if number of elements is not greater than
|
||||
// the maximum length of a boost::tuple</span>
|
||||
<span class=identifier>composite_key_equal_to</span><span class=special>(</span><span class=keyword>const</span> <span class=identifier>boost</span><span class=special>::</span><span class=identifier>tuple</span><span class=special><</span><span class=identifier>Pred</span><span class=special>,</span><span class=identifier>Preds</span><span class=special>...>&</span> <span class=identifier>x</span><span class=special>);</span>
|
||||
|
||||
<span class=keyword>const</span> <span class=identifier>key_eq_tuple</span><span class=special>&</span> <span class=identifier>key_eqs</span><span class=special>()</span><span class=keyword>const</span><span class=special>;</span>
|
||||
<span class=identifier>key_eq_tuple</span><span class=special>&</span> <span class=identifier>key_eqs</span><span class=special>()</span><span class=special>;</span>
|
||||
<span class=identifier>key_eq_tuple</span><span class=special>&</span> <span class=identifier>key_eqs</span><span class=special>();</span>
|
||||
|
||||
<span class=keyword>template</span><span class=special><</span><span class=keyword>typename</span> <span class=identifier>CompositeKey1</span><span class=special>,</span><span class=keyword>typename</span> <span class=identifier>CompositeKey2</span><span class=special>></span>
|
||||
<span class=keyword>bool</span> <span class=keyword>operator</span><span class=special>()(</span>
|
||||
@@ -1281,37 +1288,35 @@ collection of elementary equality predicates.
|
||||
<span class=keyword>const</span> <span class=identifier>composite_key_result</span><span class=special><</span><span class=identifier>CompositeKey</span><span class=special>>&</span> <span class=identifier>x</span><span class=special>,</span>
|
||||
<span class=keyword>const</span> <span class=identifier>std</span><span class=special>::</span><span class=identifier>tuple</span><span class=special><</span><span class=identifier>Values</span><span class=special>...>&</span> <span class=identifier>y</span><span class=special>)</span><span class=keyword>const</span><span class=special>;</span>
|
||||
|
||||
<span class=keyword>template</span><span class=special><</span><span class=keyword>typename</span> <span class=identifier>CompositeKey</span><span class=special>,</span><span class=keyword>typename</span><span class=special>...</span> <span class=identifier>Values</span><span class=special>></span>
|
||||
<span class=keyword>template</span><span class=special><</span><span class=keyword>typename</span><span class=special>...</span><span class=identifier>Values</span><span class=special>,</span><span class=keyword>typename</span> <span class=identifier>CompositeKey</span><span class=special>></span>
|
||||
<span class=keyword>bool</span> <span class=keyword>operator</span><span class=special>()(</span>
|
||||
<span class=keyword>const</span> <span class=identifier>std</span><span class=special>::</span><span class=identifier>tuple</span><span class=special><</span><span class=identifier>Values</span><span class=special>...>&</span> <span class=identifier>x</span><span class=special>,</span>
|
||||
<span class=keyword>const</span> <span class=identifier>composite_key_result</span><span class=special><</span><span class=identifier>CompositeKey</span><span class=special>>&</span> <span class=identifier>y</span><span class=special>)</span><span class=keyword>const</span><span class=special>;</span>
|
||||
|
||||
<span class=keyword>template</span><span class=special><</span><span class=keyword>typename</span> <span class=identifier>CompositeKey</span><span class=special>,</span><span class=keyword>typename</span> <span class=identifier>Value0</span><span class=special>,...,</span><span class=keyword>typename</span> <span class=identifier>Valuen</span><span class=special>></span>
|
||||
<span class=keyword>template</span><span class=special><</span><span class=keyword>typename</span> <span class=identifier>CompositeKey</span><span class=special>,</span><span class=keyword>typename</span><span class=special>...</span> <span class=identifier>Values</span><span class=special>></span>
|
||||
<span class=keyword>bool</span> <span class=keyword>operator</span><span class=special>()(</span>
|
||||
<span class=keyword>const</span> <span class=identifier>composite_key_result</span><span class=special><</span><span class=identifier>CompositeKey</span><span class=special>>&</span> <span class=identifier>x</span><span class=special>,</span>
|
||||
<span class=keyword>const</span> <span class=identifier>boost</span><span class=special>::</span><span class=identifier>tuple</span><span class=special><</span><span class=identifier>Value0</span><span class=special>,...,</span><span class=identifier>Valuen</span><span class=special>>&</span> <span class=identifier>y</span><span class=special>)</span><span class=keyword>const</span><span class=special>;</span>
|
||||
<span class=keyword>const</span> <span class=identifier>boost</span><span class=special>::</span><span class=identifier>tuple</span><span class=special><</span><span class=identifier>Values</span><span class=special>...>&</span> <span class=identifier>y</span><span class=special>)</span><span class=keyword>const</span><span class=special>;</span>
|
||||
|
||||
<span class=keyword>template</span><span class=special><</span><span class=keyword>typename</span> <span class=identifier>Value0</span><span class=special>,...,</span><span class=keyword>typename</span> <span class=identifier>Valuen</span><span class=special>,</span><span class=keyword>typename</span> <span class=identifier>CompositeKey</span><span class=special>></span>
|
||||
<span class=keyword>template</span><span class=special><</span><span class=keyword>typename</span><span class=special>...</span> <span class=identifier>Values</span><span class=special>,</span><span class=keyword>typename</span> <span class=identifier>CompositeKey</span><span class=special>></span>
|
||||
<span class=keyword>bool</span> <span class=keyword>operator</span><span class=special>()(</span>
|
||||
<span class=keyword>const</span> <span class=identifier>boost</span><span class=special>::</span><span class=identifier>tuple</span><span class=special><</span><span class=identifier>Value0</span><span class=special>,...,</span><span class=identifier>Valuen</span><span class=special>>&</span> <span class=identifier>x</span><span class=special>,</span>
|
||||
<span class=keyword>const</span> <span class=identifier>boost</span><span class=special>::</span><span class=identifier>tuple</span><span class=special><</span><span class=identifier>Values</span><span class=special>...>&</span> <span class=identifier>x</span><span class=special>,</span>
|
||||
<span class=keyword>const</span> <span class=identifier>composite_key_result</span><span class=special><</span><span class=identifier>CompositeKey</span><span class=special>>&</span> <span class=identifier>y</span><span class=special>)</span><span class=keyword>const</span><span class=special>;</span>
|
||||
<span class=special>};</span>
|
||||
</pre></blockquote>
|
||||
|
||||
<p>
|
||||
<code>Pred0</code>, ... , <code>Predn</code> are the types of the equality
|
||||
<code>Pred</code>, <code>Preds...</code> are the types of the equality
|
||||
binary predicates stored by <code>composite_key_equal_to</code>. Each of these predicates
|
||||
must be <code>CopyConstructible</code> and <code>CopyAssignable</code>. At least an
|
||||
equality predicate must be provided. The maximum number of equality predicates of
|
||||
a <code>composite_key_equal_to</code> instantiation is implementation defined.
|
||||
must be <code>CopyConstructible</code> and <code>CopyAssignable</code>.
|
||||
<code>composite_key_equal_to</code> is
|
||||
<code>CopyConstructible</code> and <code>CopyAssignable</code>.
|
||||
It is also <code>DefaultConstructible</code>
|
||||
if each <code>Predi</code> is <code>DefaultConstructible</code> in its turn.
|
||||
if each <code>Preds<sub>i</sub></code> is <code>DefaultConstructible</code> in its turn.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
Note that formally it is not required that the <code>Predi</code> types
|
||||
Note that formally it is not required that the <code>Pred</code>, <code>Preds...</code> types
|
||||
behave as equality predicates in any definite way. However, the
|
||||
semantics of <code>composite_key_equal_to</code> is well defined if this
|
||||
is the case, as explained in the section on the
|
||||
@@ -1326,18 +1331,19 @@ introduced for <code>composite_key_result</code>.
|
||||
|
||||
<h4><code>composite_key_equal_to</code> members</h4>
|
||||
|
||||
<code>composite_key_equal_to(<br>
|
||||
const Pred0& p0=Pred0(),<br>
|
||||
...<br>
|
||||
const Predn& pn=Predn());
|
||||
<code>template<typename... Args><br>
|
||||
composite_key_equal_to(Args&&... args);
|
||||
</code>
|
||||
|
||||
<blockquote>
|
||||
<b>Effects:</b> Constructs a <code>composite_key_equal_to</code> that stores
|
||||
copies of the equality predicates supplied.
|
||||
copies of <code>const Pred&</code>, <code>const Preds&...</code> values each
|
||||
obtained from the respective values of <code>std::forward<Arg>(args)...</code>.
|
||||
</blockquote>
|
||||
|
||||
<code>composite_key_equal_to(const key_eq_tuple& x);</code>
|
||||
<code>composite_key_equal_to(const key_eq_tuple& x);<br>
|
||||
composite_key_equal_to(const boost::tuple<Pred,Preds...>& x);
|
||||
</code>
|
||||
|
||||
<blockquote>
|
||||
<b>Effects:</b> Constructs a <code>composite_key_equal_to</code> that stores
|
||||
@@ -1369,34 +1375,34 @@ template<typename CompositeKey,typename Values...><br>
|
||||
bool operator()(<br>
|
||||
const composite_key_result<CompositeKey>& x,<br>
|
||||
const std::tuple<Values...>& y)const;<br>
|
||||
template<typename CompositeKey,typename Values...><br>
|
||||
template<typename... Values,typename CompositeKey><br>
|
||||
bool operator()(<br>
|
||||
const std::tuple<Values...>& x,<br>
|
||||
const composite_key_result<CompositeKey>& y)const;<br>
|
||||
template<typename CompositeKey,typename Value0,...,typename Valuen><br>
|
||||
template<typename CompositeKey,typename... Values><br>
|
||||
bool operator()(<br>
|
||||
const composite_key_result<CompositeKey>& x,<br>
|
||||
const boost::tuple<Value0,...,Valuen>& y)const;<br>
|
||||
template<typename Value0,...,typename Valuen,typename CompositeKey><br>
|
||||
const boost::tuple<Values...>& y)const;<br>
|
||||
template<typename... Values,typename CompositeKey><br>
|
||||
bool operator()(<br>
|
||||
const boost::tuple<Value0,...,Valuen>& x,<br>
|
||||
const boost::tuple<Values...>& x,<br>
|
||||
const composite_key_result<CompositeKey>& y)const;<br>
|
||||
</code>
|
||||
|
||||
<blockquote>
|
||||
<b>Requires:</b> <code>length(x)==length(y)</code>. The expressions
|
||||
<code>key_eqs().get<i>()(x<sub>i</sub>,y<sub>i</sub>)</code> and
|
||||
<code>key_eqs().get<i>()(y<sub>i</sub>,x<sub>i</sub>)</code>
|
||||
<code>get<i>(key_eqs())(x<sub>i</sub>,y<sub>i</sub>)</code> and
|
||||
<code>get<i>(key_eqs())(y<sub>i</sub>,x<sub>i</sub>)</code>
|
||||
are valid for all <code>i</code> in <code>[0,length(x))</code>.<br>
|
||||
<b>Returns:</b> <code>true</code> if and only
|
||||
<blockquote>
|
||||
<code>key_eqs().get<i>()(x<sub>i</sub>,y<sub>i</sub>)</code>
|
||||
<code>get<i>(key_eqs())(x<sub>i</sub>,y<sub>i</sub>)</code>
|
||||
for all <code>i</code> in <code>[0,length(x))</code>.<br>
|
||||
</blockquote>
|
||||
<b>Complexity:</b> No more key extraction operations and comparisons
|
||||
are performed than those necessary for the evaluation of the expression above,
|
||||
starting at <code>i==0</code>. The evaluation is short-circuited as soon as
|
||||
the result is determined to be <code>false</code>.
|
||||
the result is determined.
|
||||
</blockquote>
|
||||
|
||||
<h4><a name="composite_key_result_equal_to">Class template
|
||||
@@ -1439,19 +1445,19 @@ are instantiations of <code>std::equal_to</code>.
|
||||
<span class=keyword>const</span> <span class=identifier>boost</span><span class=special>::</span><span class=identifier>multi_index</span><span class=special>::</span><span class=identifier>composite_key_result</span><span class=special><</span><span class=identifier>CompositeKey</span><span class=special>>&</span> <span class=identifier>x</span><span class=special>,</span>
|
||||
<span class=keyword>const</span> <span class=identifier>std</span><span class=special>::</span><span class=identifier>tuple</span><span class=special><</span><span class=identifier>Values</span><span class=special>...>&</span> <span class=identifier>y</span><span class=special>)</span><span class=keyword>const</span><span class=special>;</span>
|
||||
|
||||
<span class=keyword>template</span><span class=special><</span><span class=keyword>typename</span> <span class=identifier>CompositeKey</span><span class=special>,</span><span class=keyword>typename</span><span class=special>...</span> <span class=identifier>Values</span><span class=special>></span>
|
||||
<span class=keyword>template</span><span class=special><</span><span class=keyword>typename</span> <span class=identifier>Values</span><span class=special>...,</span><span class=keyword>typename</span> <span class=identifier>CompositeKey</span><span class=special>></span>
|
||||
<span class=keyword>bool</span> <span class=keyword>operator</span><span class=special>()(</span>
|
||||
<span class=keyword>const</span> <span class=identifier>std</span><span class=special>::</span><span class=identifier>tuple</span><span class=special><</span><span class=identifier>Values</span><span class=special>...>&</span> <span class=identifier>x</span><span class=special>,</span>
|
||||
<span class=keyword>const</span> <span class=identifier>boost</span><span class=special>::</span><span class=identifier>multi_index</span><span class=special>::</span><span class=identifier>composite_key_result</span><span class=special><</span><span class=identifier>CompositeKey</span><span class=special>>&</span> <span class=identifier>y</span><span class=special>)</span><span class=keyword>const</span><span class=special>;</span>
|
||||
|
||||
<span class=keyword>template</span><span class=special><</span><span class=keyword>typename</span> <span class=identifier>CompositeKey</span><span class=special>,</span><span class=keyword>typename</span> <span class=identifier>Value0</span><span class=special>,...,</span><span class=keyword>typename</span> <span class=identifier>Valuen</span><span class=special>></span>
|
||||
<span class=keyword>template</span><span class=special><</span><span class=keyword>typename</span> <span class=identifier>CompositeKey</span><span class=special>,</span><span class=keyword>typename</span><span class=special>...</span> <span class=identifier>Values</span><span class=special>></span>
|
||||
<span class=keyword>bool</span> <span class=keyword>operator</span><span class=special>()(</span>
|
||||
<span class=keyword>const</span> <span class=identifier>boost</span><span class=special>::</span><span class=identifier>multi_index</span><span class=special>::</span><span class=identifier>composite_key_result</span><span class=special><</span><span class=identifier>CompositeKey</span><span class=special>>&</span> <span class=identifier>x</span><span class=special>,</span>
|
||||
<span class=keyword>const</span> <span class=identifier>boost</span><span class=special>::</span><span class=identifier>tuple</span><span class=special><</span><span class=identifier>Value0</span><span class=special>,...,</span><span class=identifier>Valuen</span><span class=special>>&</span> <span class=identifier>y</span><span class=special>)</span><span class=keyword>const</span><span class=special>;</span>
|
||||
<span class=keyword>const</span> <span class=identifier>boost</span><span class=special>::</span><span class=identifier>tuple</span><span class=special><</span><span class=identifier>Values</span><span class=special>...>&</span> <span class=identifier>y</span><span class=special>)</span><span class=keyword>const</span><span class=special>;</span>
|
||||
|
||||
<span class=keyword>template</span><span class=special><</span><span class=keyword>typename</span> <span class=identifier>Value0</span><span class=special>,...,</span><span class=keyword>typename</span> <span class=identifier>Valuen</span><span class=special>,</span><span class=keyword>typename</span> <span class=identifier>CompositeKey</span><span class=special>></span>
|
||||
<span class=keyword>template</span><span class=special><</span><span class=keyword>typename</span> <span class=identifier>Values</span><span class=special>...,</span><span class=keyword>typename</span> <span class=identifier>CompositeKey</span><span class=special>></span>
|
||||
<span class=keyword>bool</span> <span class=keyword>operator</span><span class=special>()(</span>
|
||||
<span class=keyword>const</span> <span class=identifier>boost</span><span class=special>::</span><span class=identifier>tuple</span><span class=special><</span><span class=identifier>Value0</span><span class=special>,...,</span><span class=identifier>Valuen</span><span class=special>>&</span> <span class=identifier>x</span><span class=special>,</span>
|
||||
<span class=keyword>const</span> <span class=identifier>boost</span><span class=special>::</span><span class=identifier>tuple</span><span class=special><</span><span class=identifier>Values</span><span class=special>...>&</span> <span class=identifier>x</span><span class=special>,</span>
|
||||
<span class=keyword>const</span> <span class=identifier>boost</span><span class=special>::</span><span class=identifier>multi_index</span><span class=special>::</span><span class=identifier>composite_key_result</span><span class=special><</span><span class=identifier>CompositeKey</span><span class=special>>&</span> <span class=identifier>y</span><span class=special>)</span><span class=keyword>const</span><span class=special>;</span>
|
||||
<span class=special>};</span>
|
||||
|
||||
@@ -1491,20 +1497,24 @@ collection of elementary comparison predicates.
|
||||
</p>
|
||||
|
||||
<blockquote><pre>
|
||||
<span class=keyword>template</span><span class=special><</span><span class=keyword>typename</span> <span class=identifier>Compare0</span><span class=special>,...,</span><span class=keyword>typename</span> <span class=identifier>Comparen</span><span class=special>></span>
|
||||
<span class=keyword>template</span><span class=special><</span><span class=keyword>typename</span> <span class=identifier>Compare</span><span class=special>,</span><span class=keyword>typename</span><span class=special>...</span> <span class=identifier>Compares</span><span class=special>></span>
|
||||
<span class=keyword>struct</span> <span class=identifier>composite_key_compare</span>
|
||||
<span class=special>{</span>
|
||||
<span class=keyword>typedef</span> <span class=identifier>boost</span><span class=special>::</span><span class=identifier>tuple</span><span class=special><</span><span class=identifier>Compare0</span><span class=special>,...,</span><span class=identifier>Comparen</span><span class=special>></span> <span class=identifier>key_comp_tuple</span><span class=special>;</span>
|
||||
|
||||
<span class=identifier>composite_key_compare</span><span class=special>(</span>
|
||||
<span class=keyword>const</span> <span class=identifier>Compare0</span><span class=special>&</span> <span class=identifier>c0</span><span class=special>=</span><span class=identifier>Compare0</span><span class=special>(),</span>
|
||||
<span class=special>...</span>
|
||||
<span class=keyword>const</span> <span class=identifier>Comparen</span><span class=special>&</span> <span class=identifier>cn</span><span class=special>=</span><span class=identifier>Comparen</span><span class=special>());</span>
|
||||
<span class=keyword>typedef</span> <span class=identifier>std</span><span class=special>::</span><span class=identifier>tuple</span><span class=special><</span><span class=identifier>Compare</span><span class=special>,</span><span class=identifier>Compares</span><span class=special>...></span> <span class=identifier>key_comp_tuple</span><span class=special>;</span>
|
||||
|
||||
<span class=comment>// only provided if number of arguments is not greater than the number
|
||||
// of elements and each args<sub>i</sub>&& is convertible to const Compares<sub>i</sub>&</span>
|
||||
<span class=keyword>template</span><span class=special><</span><span class=keyword>typename</span><span class=special>...</span> <span class=identifier>Args</span><span class=special>></span>
|
||||
<span class=identifier>composite_key_compare</span><span class=special>(</span><span class=identifier>Args</span><span class=special>&&...</span> <span class=identifier>args</span><span class=special>);</span>
|
||||
|
||||
<span class=identifier>composite_key_compare</span><span class=special>(</span><span class=keyword>const</span> <span class=identifier>key_comp_tuple</span><span class=special>&</span> <span class=identifier>x</span><span class=special>);</span>
|
||||
|
||||
<span class=comment>// only provided if number of elements is not greater than
|
||||
// the maximum length of a boost::tuple</span>
|
||||
<span class=identifier>composite_key_compare</span><span class=special>(</span><span class=keyword>const</span> <span class=identifier>boost</span><span class=special>::</span><span class=identifier>tuple</span><span class=special><</span><span class=identifier>Compare</span><span class=special>,</span><span class=identifier>Compares</span><span class=special>...>&</span> <span class=identifier>x</span><span class=special>);</span>
|
||||
|
||||
<span class=keyword>const</span> <span class=identifier>key_comp_tuple</span><span class=special>&</span> <span class=identifier>key_comps</span><span class=special>()</span><span class=keyword>const</span><span class=special>;</span>
|
||||
<span class=identifier>key_comp_tuple</span><span class=special>&</span> <span class=identifier>key_comps</span><span class=special>()</span><span class=special>;</span>
|
||||
<span class=identifier>key_comp_tuple</span><span class=special>&</span> <span class=identifier>key_comps</span><span class=special>();</span>
|
||||
|
||||
<span class=keyword>template</span><span class=special><</span><span class=keyword>typename</span> <span class=identifier>CompositeKey1</span><span class=special>,</span><span class=keyword>typename</span> <span class=identifier>CompositeKey2</span><span class=special>></span>
|
||||
<span class=keyword>bool</span> <span class=keyword>operator</span><span class=special>()(</span>
|
||||
@@ -1516,19 +1526,19 @@ collection of elementary comparison predicates.
|
||||
<span class=keyword>const</span> <span class=identifier>composite_key_result</span><span class=special><</span><span class=identifier>CompositeKey</span><span class=special>>&</span> <span class=identifier>x</span><span class=special>,</span>
|
||||
<span class=keyword>const</span> <span class=identifier>std</span><span class=special>::</span><span class=identifier>tuple</span><span class=special><</span><span class=identifier>Values</span><span class=special>...>&</span> <span class=identifier>y</span><span class=special>)</span><span class=keyword>const</span><span class=special>;</span>
|
||||
|
||||
<span class=keyword>template</span><span class=special><</span><span class=keyword>typename</span> <span class=identifier>CompositeKey</span><span class=special>,</span><span class=keyword>typename</span><span class=special>...</span> <span class=identifier>Values</span><span class=special>></span>
|
||||
<span class=keyword>template</span><span class=special><</span><span class=keyword>typename</span><span class=special>...</span> <span class=identifier>Values</span><span class=special>,</span><span class=keyword>typename</span> <span class=identifier>CompositeKey</span><span class=special>></span>
|
||||
<span class=keyword>bool</span> <span class=keyword>operator</span><span class=special>()(</span>
|
||||
<span class=keyword>const</span> <span class=identifier>std</span><span class=special>::</span><span class=identifier>tuple</span><span class=special><</span><span class=identifier>Values</span><span class=special>...>&</span> <span class=identifier>x</span><span class=special>,</span>
|
||||
<span class=keyword>const</span> <span class=identifier>composite_key_result</span><span class=special><</span><span class=identifier>CompositeKey</span><span class=special>>&</span> <span class=identifier>y</span><span class=special>)</span><span class=keyword>const</span><span class=special>;</span>
|
||||
|
||||
<span class=keyword>template</span><span class=special><</span><span class=keyword>typename</span> <span class=identifier>CompositeKey</span><span class=special>,</span><span class=keyword>typename</span> <span class=identifier>Value0</span><span class=special>,...,</span><span class=keyword>typename</span> <span class=identifier>Valuen</span><span class=special>></span>
|
||||
<span class=keyword>template</span><span class=special><</span><span class=keyword>typename</span> <span class=identifier>CompositeKey</span><span class=special>,</span><span class=keyword>typename</span><span class=special>...</span> <span class=identifier>Values</span><span class=special>></span>
|
||||
<span class=keyword>bool</span> <span class=keyword>operator</span><span class=special>()(</span>
|
||||
<span class=keyword>const</span> <span class=identifier>composite_key_result</span><span class=special><</span><span class=identifier>CompositeKey</span><span class=special>>&</span> <span class=identifier>x</span><span class=special>,</span>
|
||||
<span class=keyword>const</span> <span class=identifier>boost</span><span class=special>::</span><span class=identifier>tuple</span><span class=special><</span><span class=identifier>Value0</span><span class=special>,...,</span><span class=identifier>Valuen</span><span class=special>>&</span> <span class=identifier>y</span><span class=special>)</span><span class=keyword>const</span><span class=special>;</span>
|
||||
<span class=keyword>const</span> <span class=identifier>boost</span><span class=special>::</span><span class=identifier>tuple</span><span class=special><</span><span class=identifier>Values</span><span class=special>...>&</span> <span class=identifier>y</span><span class=special>)</span><span class=keyword>const</span><span class=special>;</span>
|
||||
|
||||
<span class=keyword>template</span><span class=special><</span><span class=keyword>typename</span> <span class=identifier>Value0</span><span class=special>,...,</span><span class=keyword>typename</span> <span class=identifier>Valuen</span><span class=special>,</span><span class=keyword>typename</span> <span class=identifier>CompositeKey</span><span class=special>></span>
|
||||
<span class=keyword>template</span><span class=special><</span><span class=keyword>typename</span><span class=special>...</span> <span class=identifier>Values</span><span class=special>,</span><span class=keyword>typename</span> <span class=identifier>CompositeKey</span><span class=special>></span>
|
||||
<span class=keyword>bool</span> <span class=keyword>operator</span><span class=special>()(</span>
|
||||
<span class=keyword>const</span> <span class=identifier>boost</span><span class=special>::</span><span class=identifier>tuple</span><span class=special><</span><span class=identifier>Value0</span><span class=special>,...,</span><span class=identifier>Valuen</span><span class=special>>&</span> <span class=identifier>x</span><span class=special>,</span>
|
||||
<span class=keyword>const</span> <span class=identifier>boost</span><span class=special>::</span><span class=identifier>tuple</span><span class=special><</span><span class=identifier>Values</span><span class=special>...>&</span> <span class=identifier>x</span><span class=special>,</span>
|
||||
<span class=keyword>const</span> <span class=identifier>composite_key_result</span><span class=special><</span><span class=identifier>CompositeKey</span><span class=special>>&</span> <span class=identifier>y</span><span class=special>)</span><span class=keyword>const</span><span class=special>;</span>
|
||||
|
||||
<span class=keyword>template</span><span class=special><</span><span class=keyword>typename</span> <span class=identifier>CompositeKey</span><span class=special>,</span><span class=keyword>typename</span> <span class=identifier>Value</span><span class=special>></span>
|
||||
@@ -1542,20 +1552,18 @@ collection of elementary comparison predicates.
|
||||
</pre></blockquote>
|
||||
|
||||
<p>
|
||||
<code>Compare0</code>, ... , <code>Comparen</code> are the types of the comparison
|
||||
<code>Compare</code>, <code>Compares...</code> are the types of the comparison
|
||||
binary predicates stored by <code>composite_key_compare</code>. Each of these predicates must be
|
||||
<code>CopyConstructible</code> and <code>CopyAssignable</code>. At least a
|
||||
comparison predicate must be provided. The maximum number of comparison predicates of
|
||||
a <code>composite_key_compare</code> instantiation is implementation defined.
|
||||
<code>CopyConstructible</code> and <code>CopyAssignable</code>
|
||||
<code>composite_key_compare</code> is
|
||||
<code>CopyConstructible</code> and <code>CopyAssignable</code>.
|
||||
It is also
|
||||
<code>DefaultConstructible</code>
|
||||
if each <code>Comparei</code> is <code>DefaultConstructible</code> in its turn.
|
||||
if each <code>Compares<sub>i</sub></code> is <code>DefaultConstructible</code> in its turn.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
Note that formally it is not required that the <code>Comparei</code> types
|
||||
Note that formally it is not required that the <code>Compare</code>, <code>Compares...</code> types
|
||||
behave as comparison predicates in any definite way. However, the
|
||||
semantics of <code>composite_key_compare</code> is well defined if this
|
||||
is the case, as explained in the section on the
|
||||
@@ -1570,18 +1578,19 @@ introduced for <code>composite_key_result</code>.
|
||||
|
||||
<h4><code>composite_key_compare</code> members</h4>
|
||||
|
||||
<code>composite_key_compare(<br>
|
||||
const Compare0& c0=Compare0(),<br>
|
||||
...<br>
|
||||
const Comparen& cn=Comparen());
|
||||
<code>template<typename... Args><br>
|
||||
composite_key_compare(Args&&... args);
|
||||
</code>
|
||||
|
||||
<blockquote>
|
||||
<b>Effects:</b> Constructs a <code>composite_key_compare</code> that stores
|
||||
copies of the comparison predicates supplied.
|
||||
copies of <code>const Compare&</code>, <code>const Compares&...</code>
|
||||
values each obtained from the respective values of <code>std::forward<Arg>(args)...</code>.
|
||||
</blockquote>
|
||||
|
||||
<code>composite_key_compare(const key_comp_tuple& x);</code>
|
||||
<code>composite_key_compare(const key_comp_tuple& x);<br>
|
||||
composite_key_compare(const boost::tuple<Compare,Compares...>& x)
|
||||
</code>
|
||||
|
||||
<blockquote>
|
||||
<b>Effects:</b> Constructs a <code>composite_key_compare</code> that stores
|
||||
@@ -1613,38 +1622,38 @@ template<typename CompositeKey,typename... Values><br>
|
||||
bool operator()(<br>
|
||||
const composite_key_result<CompositeKey>& x,<br>
|
||||
const std::tuple<Values...>& y)const;<br>
|
||||
template<typename CompositeKey,typename... Values><br>
|
||||
template<typename... Values,typename CompositeKey><br>
|
||||
bool operator()(<br>
|
||||
const std::tuple<Values...>& x,<br>
|
||||
const composite_key_result<CompositeKey>& y)const;<br>
|
||||
template<typename CompositeKey,typename Value0,...,typename Valuen><br>
|
||||
template<typename CompositeKey,typename... Values><br>
|
||||
bool operator()(<br>
|
||||
const composite_key_result<CompositeKey>& x,<br>
|
||||
const boost::tuple<Value0,...,Valuen>& y)const;<br>
|
||||
template<typename Value0,...,typename Valuen,typename CompositeKey><br>
|
||||
const boost::tuple<Values...>& y)const;<br>
|
||||
template<typename... Values,typename CompositeKey><br>
|
||||
bool operator()(<br>
|
||||
const boost::tuple<Value0,...,Valuen>& x,<br>
|
||||
const boost::tuple<Values...>& x,<br>
|
||||
const composite_key_result<CompositeKey>& y)const;<br>
|
||||
</code>
|
||||
|
||||
<blockquote>
|
||||
<b>Requires:</b> The expressions
|
||||
<code>key_comps().get<i>()(x<sub>i</sub>,y<sub>i</sub>)</code> and
|
||||
<code>key_comps().get<i>()(y<sub>i</sub>,x<sub>i</sub>)</code>
|
||||
<code>get<i>(key_comps())(x<sub>i</sub>,y<sub>i</sub>)</code> and
|
||||
<code>get<i>(key_comps())(y<sub>i</sub>,x<sub>i</sub>)</code>
|
||||
are valid for all <code>i</code>
|
||||
in <code>[0,min(length(x),length(y)))</code>.<br>
|
||||
<b>Returns:</b> <code>true</code> if and only if there exists some
|
||||
<code>j</code> in the range <code>[0,min(length(x),length(y)))</code>
|
||||
such that
|
||||
<blockquote>
|
||||
<code>!key_comps().get<i>()(x<sub>i</sub>,y<sub>i</sub>) && !key_comps().get<i>()(y<sub>i</sub>,x<sub>i</sub>)</code>
|
||||
<code>!get<i>(key_comps())(x<sub>i</sub>,y<sub>i</sub>) && !get<i>(key_comps())(y<sub>i</sub>,x<sub>i</sub>)</code>
|
||||
for all <code>i</code> in <code>[0,j)</code>,<br>
|
||||
<code> key_comps().get<j>()(x<sub>j</sub>,y<sub>j</sub>)</code>.
|
||||
<code> get<j>(key_comps())(x<sub>j</sub>,y<sub>j</sub>)</code>.
|
||||
</blockquote>
|
||||
<b>Complexity:</b> No more key extraction operations and comparisons
|
||||
are performed than those necessary for the evaluation of the expression above,
|
||||
starting at <code>i==0</code>. The evaluation is short-circuited as soon as
|
||||
the result is determined to be <code>false</code>.
|
||||
the result is determined.
|
||||
</blockquote>
|
||||
|
||||
<code>
|
||||
@@ -1719,19 +1728,19 @@ instantiations of <code>std::less</code>.
|
||||
<span class=keyword>const</span> <span class=identifier>boost</span><span class=special>::</span><span class=identifier>multi_index</span><span class=special>::</span><span class=identifier>composite_key_result</span><span class=special><</span><span class=identifier>CompositeKey</span><span class=special>>&</span> <span class=identifier>x</span><span class=special>,</span>
|
||||
<span class=keyword>const</span> <span class=identifier>std</span><span class=special>::</span><span class=identifier>tuple</span><span class=special><</span><span class=identifier>Values</span><span class=special>...>&</span> <span class=identifier>y</span><span class=special>)</span><span class=keyword>const</span><span class=special>;</span>
|
||||
|
||||
<span class=keyword>template</span><span class=special><</span><span class=keyword>typename</span> <span class=identifier>CompositeKey</span><span class=special>,</span><span class=keyword>typename</span><span class=special>...</span> <span class=identifier>Values</span><span class=special>></span>
|
||||
<span class=keyword>template</span><span class=special><</span><span class=keyword>typename</span><span class=special>...</span> <span class=identifier>Values</span><span class=special>,</span><span class=keyword>typename</span> <span class=identifier>CompositeKey</span><span class=special>></span>
|
||||
<span class=keyword>bool</span> <span class=keyword>operator</span><span class=special>()(</span>
|
||||
<span class=keyword>const</span> <span class=identifier>std</span><span class=special>::</span><span class=identifier>tuple</span><span class=special><</span><span class=identifier>Values</span><span class=special>...>&</span> <span class=identifier>x</span><span class=special>,</span>
|
||||
<span class=keyword>const</span> <span class=identifier>boost</span><span class=special>::</span><span class=identifier>multi_index</span><span class=special>::</span><span class=identifier>composite_key_result</span><span class=special><</span><span class=identifier>CompositeKey</span><span class=special>>&</span> <span class=identifier>y</span><span class=special>)</span><span class=keyword>const</span><span class=special>;</span>
|
||||
|
||||
<span class=keyword>template</span><span class=special><</span><span class=keyword>typename</span> <span class=identifier>CompositeKey</span><span class=special>,</span><span class=keyword>typename</span> <span class=identifier>Value0</span><span class=special>,...,</span><span class=keyword>typename</span> <span class=identifier>Valuen</span><span class=special>></span>
|
||||
<span class=keyword>template</span><span class=special><</span><span class=keyword>typename</span> <span class=identifier>CompositeKey</span><span class=special>,</span><span class=keyword>typename</span><span class=special>...</span> <span class=identifier>Values</span><span class=special>></span>
|
||||
<span class=keyword>bool</span> <span class=keyword>operator</span><span class=special>()(</span>
|
||||
<span class=keyword>const</span> <span class=identifier>boost</span><span class=special>::</span><span class=identifier>multi_index</span><span class=special>::</span><span class=identifier>composite_key_result</span><span class=special><</span><span class=identifier>CompositeKey</span><span class=special>>&</span> <span class=identifier>x</span><span class=special>,</span>
|
||||
<span class=keyword>const</span> <span class=identifier>boost</span><span class=special>::</span><span class=identifier>tuple</span><span class=special><</span><span class=identifier>Value0</span><span class=special>,...,</span><span class=identifier>Valuen</span><span class=special>>&</span> <span class=identifier>y</span><span class=special>)</span><span class=keyword>const</span><span class=special>;</span>
|
||||
<span class=keyword>const</span> <span class=identifier>boost</span><span class=special>::</span><span class=identifier>tuple</span><span class=special><</span><span class=identifier>Values</span><span class=special>...>&</span> <span class=identifier>y</span><span class=special>)</span><span class=keyword>const</span><span class=special>;</span>
|
||||
|
||||
<span class=keyword>template</span><span class=special><</span><span class=keyword>typename</span> <span class=identifier>Value0</span><span class=special>,...,</span><span class=keyword>typename</span> <span class=identifier>Valuen</span><span class=special>,</span><span class=keyword>typename</span> <span class=identifier>CompositeKey</span><span class=special>></span>
|
||||
<span class=keyword>template</span><span class=special><</span><span class=keyword>typename</span><span class=special>...</span> <span class=identifier>Values</span><span class=special>,</span><span class=keyword>typename</span> <span class=identifier>CompositeKey</span><span class=special>></span>
|
||||
<span class=keyword>bool</span> <span class=keyword>operator</span><span class=special>()(</span>
|
||||
<span class=keyword>const</span> <span class=identifier>boost</span><span class=special>::</span><span class=identifier>tuple</span><span class=special><</span><span class=identifier>Value0</span><span class=special>,...,</span><span class=identifier>Valuen</span><span class=special>>&</span> <span class=identifier>x</span><span class=special>,</span>
|
||||
<span class=keyword>const</span> <span class=identifier>boost</span><span class=special>::</span><span class=identifier>tuple</span><span class=special><</span><span class=identifier>Values</span><span class=special>...>&</span> <span class=identifier>x</span><span class=special>,</span>
|
||||
<span class=keyword>const</span> <span class=identifier>boost</span><span class=special>::</span><span class=identifier>multi_index</span><span class=special>::</span><span class=identifier>composite_key_result</span><span class=special><</span><span class=identifier>CompositeKey</span><span class=special>>&</span> <span class=identifier>y</span><span class=special>)</span><span class=keyword>const</span><span class=special>;</span>
|
||||
|
||||
<span class=keyword>template</span><span class=special><</span><span class=keyword>typename</span> <span class=identifier>CompositeKey</span><span class=special>,</span><span class=keyword>typename</span> <span class=identifier>Value</span><span class=special>></span>
|
||||
@@ -1779,7 +1788,6 @@ an instantiation of <code>composite_key_result</code>, behaves as a particulariz
|
||||
are instantiations of <code>std::greater</code>.
|
||||
</p>
|
||||
|
||||
|
||||
<blockquote><pre>
|
||||
<span class=keyword>namespace</span> <span class=identifier>std</span><span class=special>{</span>
|
||||
|
||||
@@ -1802,19 +1810,19 @@ are instantiations of <code>std::greater</code>.
|
||||
<span class=keyword>const</span> <span class=identifier>boost</span><span class=special>::</span><span class=identifier>multi_index</span><span class=special>::</span><span class=identifier>composite_key_result</span><span class=special><</span><span class=identifier>CompositeKey</span><span class=special>>&</span> <span class=identifier>x</span><span class=special>,</span>
|
||||
<span class=keyword>const</span> <span class=identifier>std</span><span class=special>::</span><span class=identifier>tuple</span><span class=special><</span><span class=identifier>Values</span><span class=special>...>&</span> <span class=identifier>y</span><span class=special>)</span><span class=keyword>const</span><span class=special>;</span>
|
||||
|
||||
<span class=keyword>template</span><span class=special><</span><span class=keyword>typename</span> <span class=identifier>CompositeKey</span><span class=special>,</span><span class=keyword>typename</span><span class=special>...</span> <span class=identifier>Values</span><span class=special>></span>
|
||||
<span class=keyword>template</span><span class=special><</span><span class=keyword>typename</span><span class=special>...</span> <span class=identifier>Values</span><span class=special>,</span><span class=keyword>typename</span> <span class=identifier>CompositeKey</span><span class=special>></span>
|
||||
<span class=keyword>bool</span> <span class=keyword>operator</span><span class=special>()(</span>
|
||||
<span class=keyword>const</span> <span class=identifier>std</span><span class=special>::</span><span class=identifier>tuple</span><span class=special><</span><span class=identifier>Values</span><span class=special>...>&</span> <span class=identifier>x</span><span class=special>,</span>
|
||||
<span class=keyword>const</span> <span class=identifier>boost</span><span class=special>::</span><span class=identifier>multi_index</span><span class=special>::</span><span class=identifier>composite_key_result</span><span class=special><</span><span class=identifier>CompositeKey</span><span class=special>>&</span> <span class=identifier>y</span><span class=special>)</span><span class=keyword>const</span><span class=special>;</span>
|
||||
|
||||
<span class=keyword>template</span><span class=special><</span><span class=keyword>typename</span> <span class=identifier>CompositeKey</span><span class=special>,</span><span class=keyword>typename</span> <span class=identifier>Value0</span><span class=special>,...,</span><span class=keyword>typename</span> <span class=identifier>Valuen</span><span class=special>></span>
|
||||
<span class=keyword>template</span><span class=special><</span><span class=keyword>typename</span> <span class=identifier>CompositeKey</span><span class=special>,</span><span class=keyword>typename</span><span class=special>...</span> <span class=identifier>Values</span><span class=special>></span>
|
||||
<span class=keyword>bool</span> <span class=keyword>operator</span><span class=special>()(</span>
|
||||
<span class=keyword>const</span> <span class=identifier>boost</span><span class=special>::</span><span class=identifier>multi_index</span><span class=special>::</span><span class=identifier>composite_key_result</span><span class=special><</span><span class=identifier>CompositeKey</span><span class=special>>&</span> <span class=identifier>x</span><span class=special>,</span>
|
||||
<span class=keyword>const</span> <span class=identifier>boost</span><span class=special>::</span><span class=identifier>tuple</span><span class=special><</span><span class=identifier>Value0</span><span class=special>,...,</span><span class=identifier>Valuen</span><span class=special>>&</span> <span class=identifier>y</span><span class=special>)</span><span class=keyword>const</span><span class=special>;</span>
|
||||
<span class=keyword>const</span> <span class=identifier>boost</span><span class=special>::</span><span class=identifier>tuple</span><span class=special><</span><span class=identifier>Values</span><span class=special>...>&</span> <span class=identifier>y</span><span class=special>)</span><span class=keyword>const</span><span class=special>;</span>
|
||||
|
||||
<span class=keyword>template</span><span class=special><</span><span class=keyword>typename</span> <span class=identifier>Value0</span><span class=special>,...,</span><span class=keyword>typename</span> <span class=identifier>Valuen</span><span class=special>,</span><span class=keyword>typename</span> <span class=identifier>CompositeKey</span><span class=special>></span>
|
||||
<span class=keyword>template</span><span class=special><</span><span class=keyword>typename</span><span class=special>...</span> <span class=identifier>Values</span><span class=special>,</span><span class=keyword>typename</span> <span class=identifier>CompositeKey</span><span class=special>></span>
|
||||
<span class=keyword>bool</span> <span class=keyword>operator</span><span class=special>()(</span>
|
||||
<span class=keyword>const</span> <span class=identifier>boost</span><span class=special>::</span><span class=identifier>tuple</span><span class=special><</span><span class=identifier>Value0</span><span class=special>,...,</span><span class=identifier>Valuen</span><span class=special>>&</span> <span class=identifier>x</span><span class=special>,</span>
|
||||
<span class=keyword>const</span> <span class=identifier>boost</span><span class=special>::</span><span class=identifier>tuple</span><span class=special><</span><span class=identifier>Values</span><span class=special>...>&</span> <span class=identifier>x</span><span class=special>,</span>
|
||||
<span class=keyword>const</span> <span class=identifier>boost</span><span class=special>::</span><span class=identifier>multi_index</span><span class=special>::</span><span class=identifier>composite_key_result</span><span class=special><</span><span class=identifier>CompositeKey</span><span class=special>>&</span> <span class=identifier>y</span><span class=special>)</span><span class=keyword>const</span><span class=special>;</span>
|
||||
|
||||
<span class=keyword>template</span><span class=special><</span><span class=keyword>typename</span> <span class=identifier>CompositeKey</span><span class=special>,</span><span class=keyword>typename</span> <span class=identifier>Value</span><span class=special>></span>
|
||||
@@ -1863,20 +1871,24 @@ instantiations based on a collection of elementary hash functors.
|
||||
</p>
|
||||
|
||||
<blockquote><pre>
|
||||
<span class=keyword>template</span><span class=special><</span><span class=keyword>typename</span> <span class=identifier>Hash0</span><span class=special>,...,</span><span class=keyword>typename</span> <span class=identifier>Hashn</span><span class=special>></span>
|
||||
<span class=keyword>template</span><span class=special><</span><span class=keyword>typename</span> <span class=identifier>Hash</span><span class=special>,</span><span class=keyword>typename</span><span class=special>...</span> <span class=identifier>Hashes</span><span class=special>></span>
|
||||
<span class=keyword>struct</span> <span class=identifier>composite_key_hash</span>
|
||||
<span class=special>{</span>
|
||||
<span class=keyword>typedef</span> <span class=identifier>boost</span><span class=special>::</span><span class=identifier>tuple</span><span class=special><</span><span class=identifier>Hash0</span><span class=special>,...,</span><span class=identifier>Hashn</span><span class=special>></span> <span class=identifier>key_hasher_tuple</span><span class=special>;</span>
|
||||
|
||||
<span class=identifier>composite_key_hash</span><span class=special>(</span>
|
||||
<span class=keyword>const</span> <span class=identifier>Hash0</span><span class=special>&</span> <span class=identifier>h0</span><span class=special>=</span><span class=identifier>Hash0</span><span class=special>(),</span>
|
||||
<span class=special>...</span>
|
||||
<span class=keyword>const</span> <span class=identifier>Hashn</span><span class=special>&</span> <span class=identifier>hn</span><span class=special>=</span><span class=identifier>Hashn</span><span class=special>());</span>
|
||||
<span class=keyword>typedef</span> <span class=identifier>std</span><span class=special>::</span><span class=identifier>tuple</span><span class=special><</span><span class=identifier>Hash</span><span class=special>,</span><span class=identifier>Hashes</span><span class=special>...></span> <span class=identifier>key_hasher_tuple</span><span class=special>;</span>
|
||||
|
||||
<span class=comment>// only provided if number of arguments is not greater than the number
|
||||
// of elements and each args<sub>i</sub>&& is convertible to const Hashes<sub>i</sub>&</span>
|
||||
<span class=keyword>template</span><span class=special><</span><span class=keyword>typename</span><span class=special>...</span> <span class=identifier>Args</span><span class=special>></span>
|
||||
<span class=identifier>composite_key_hash</span><span class=special>(</span><span class=identifier>Args</span><span class=special>&&...</span> <span class=identifier>args</span><span class=special>);</span>
|
||||
|
||||
<span class=identifier>composite_key_hash</span><span class=special>(</span><span class=keyword>const</span> <span class=identifier>key_hasher_tuple</span><span class=special>&</span> <span class=identifier>x</span><span class=special>);</span>
|
||||
|
||||
<span class=comment>// only provided if number of elements is not greater than
|
||||
// the maximum length of a boost::tuple</span>
|
||||
<span class=identifier>composite_key_hash</span><span class=special>(</span><span class=keyword>const</span> <span class=identifier>boost</span><span class=special>::</span><span class=identifier>tuple</span><span class=special><</span><span class=identifier>Hash</span><span class=special>,</span><span class=identifier>Hashes</span><span class=special>...>&</span> <span class=identifier>x</span><span class=special>);</span>
|
||||
|
||||
<span class=keyword>const</span> <span class=identifier>key_hasher_tuple</span><span class=special>&</span> <span class=identifier>key_hash_functions</span><span class=special>()</span><span class=keyword>const</span><span class=special>;</span>
|
||||
<span class=identifier>key_hasher_tuple</span><span class=special>&</span> <span class=identifier>key_hash_functions</span><span class=special>()</span><span class=special>;</span>
|
||||
<span class=identifier>key_hasher_tuple</span><span class=special>&</span> <span class=identifier>key_hash_functions</span><span class=special>();</span>
|
||||
|
||||
<span class=keyword>template</span><span class=special><</span><span class=keyword>typename</span> <span class=identifier>CompositeKey</span><span class=special>></span>
|
||||
<span class=identifier>std</span><span class=special>::</span><span class=identifier>size_t</span> <span class=keyword>operator</span><span class=special>()(</span>
|
||||
@@ -1886,24 +1898,22 @@ instantiations based on a collection of elementary hash functors.
|
||||
<span class=identifier>std</span><span class=special>::</span><span class=identifier>size_t</span> <span class=keyword>operator</span><span class=special>()(</span>
|
||||
<span class=keyword>const</span> <span class=identifier>std</span><span class=special>::</span><span class=identifier>tuple</span><span class=special><</span><span class=identifier>Values</span><span class=special>...>&</span> <span class=identifier>x</span><span class=special>)</span><span class=keyword>const</span><span class=special>;</span>
|
||||
|
||||
<span class=keyword>template</span><span class=special><</span><span class=keyword>typename</span> <span class=identifier>Value0</span><span class=special>,...,</span><span class=keyword>typename</span> <span class=identifier>Valuen</span><span class=special>></span>
|
||||
<span class=keyword>template</span><span class=special><</span><span class=keyword>typename</span><span class=special>...</span> <span class=identifier>Values</span><span class=special>></span>
|
||||
<span class=identifier>std</span><span class=special>::</span><span class=identifier>size_t</span> <span class=keyword>operator</span><span class=special>()(</span>
|
||||
<span class=keyword>const</span> <span class=identifier>boost</span><span class=special>::</span><span class=identifier>tuple</span><span class=special><</span><span class=identifier>Value0</span><span class=special>,...,</span><span class=identifier>Valuen</span><span class=special>>&</span> <span class=identifier>x</span><span class=special>)</span><span class=keyword>const</span><span class=special>;</span>
|
||||
<span class=keyword>const</span> <span class=identifier>boost</span><span class=special>::</span><span class=identifier>tuple</span><span class=special><</span><span class=identifier>Values</span><span class=special>...>&</span> <span class=identifier>x</span><span class=special>)</span><span class=keyword>const</span><span class=special>;</span>
|
||||
<span class=special>};</span>
|
||||
</pre></blockquote>
|
||||
|
||||
<p>
|
||||
<code>Hash0</code>, ... , <code>Hashn</code> are the types of the hash unary function objects
|
||||
<code>Hash</code>, <code>Hashes...</code> are the types of the hash unary function objects
|
||||
stored by <code>composite_key_hash</code>. Each of these objects
|
||||
must be <code>CopyConstructible</code> and <code>CopyAssignable</code>
|
||||
and return a value of type <code>std::size_t</code> in the range
|
||||
[0, <code>std::numeric_limits<std::size_t>::max())</code>).
|
||||
At least a hash functor must be provided. The maximum number of hash functors of
|
||||
a <code>composite_key_hash</code> instantiation is implementation defined.
|
||||
<code>composite_key_hash</code> is
|
||||
<code>CopyConstructible</code> and <code>CopyAssignable</code>.
|
||||
It is also <code>DefaultConstructible</code>
|
||||
if each <code>Hashi</code> is <code>DefaultConstructible</code> in its turn.
|
||||
if each <code>Hash</code>, <code>Hashes...</code> is <code>DefaultConstructible</code> in its turn.
|
||||
</p>
|
||||
|
||||
<h4>Notation</h4>
|
||||
@@ -1914,18 +1924,19 @@ introduced for <code>composite_key_result</code>.
|
||||
|
||||
<h4><code>composite_key_hash</code> members</h4>
|
||||
|
||||
<code>composite_key_hash(<br>
|
||||
const Hash0& h0=Hash0(),<br>
|
||||
...<br>
|
||||
const Hashn& hn=Hashn());
|
||||
<code>template<typename... Args><br>
|
||||
composite_key_hash(Args&&... args);
|
||||
</code>
|
||||
|
||||
<blockquote>
|
||||
<b>Effects:</b> Constructs a <code>composite_key_hash</code> that stores
|
||||
copies of the hash functors supplied.
|
||||
copies of <code>const Hash&</code>, <code>const Hashes&...</code>
|
||||
values each obtained from the respective values of <code>std::forward<Args>(args)...</code>.
|
||||
</blockquote>
|
||||
|
||||
<code>composite_key_hash(const key_hasher_tuple& x);</code>
|
||||
<code>composite_key_hash(const key_hasher_tuple& x);<br>
|
||||
composite_key_hash(const boost::tuple<Hash,Hashes...>& x);
|
||||
</code>
|
||||
|
||||
<blockquote>
|
||||
<b>Effects:</b> Constructs a <code>composite_key_hash</code> that stores
|
||||
@@ -1955,23 +1966,23 @@ bool operator()(<br>
|
||||
template<typename... Values><br>
|
||||
bool operator()(<br>
|
||||
const std::tuple<Values...>& x)const;<br>
|
||||
template<typename Value0,...,typename Valuen><br>
|
||||
template<typename... Values><br>
|
||||
bool operator()(<br>
|
||||
const boost::tuple<Value0,...,Valuen>& x)const;
|
||||
const boost::tuple<Values...>& x)const;
|
||||
</code>
|
||||
|
||||
<blockquote>
|
||||
<b>Requires:</b> <code>length(x)==length(key_hash_functions())</code>.
|
||||
The expression
|
||||
<code>key_hash_functions().get<i>()(x<sub>i</sub>)</code>
|
||||
<code>get<i>(key_hash_functions())(x<sub>i</sub>)</code>
|
||||
is valid for all <code>i</code> in <code>[0,length(x))</code>.
|
||||
<br>
|
||||
<b>Returns:</b> A value in the range
|
||||
<code>[0, std::numeric_limits<std::size_t>::max())</code> that
|
||||
solely depends on the numerical tuple
|
||||
<blockquote>
|
||||
(<code>key_hash_functions().get<0>()(x<sub>0</sub>)</code>, ... ,
|
||||
<code>key_hash_functions().get<N>()(x<sub>N</sub>)</code>),
|
||||
(<code>get<0>(key_hash_functions())(x<sub>0</sub>)</code>, ... ,
|
||||
<code>get<N>(key_hash_functions())(x<sub>N</sub>)</code>),
|
||||
with <code>N=length(x)-1</code>.
|
||||
</blockquote>
|
||||
</blockquote>
|
||||
@@ -2012,9 +2023,9 @@ are instantiations of
|
||||
<span class=identifier>std</span><span class=special>::</span><span class=identifier>size_t</span> <span class=keyword>operator</span><span class=special>()(</span>
|
||||
<span class=keyword>const</span> <span class=identifier>std</span><span class=special>::</span><span class=identifier>tuple</span><span class=special><</span><span class=identifier>Values</span><span class=special>...>&</span> <span class=identifier>x</span><span class=special>)</span><span class=keyword>const</span><span class=special>;</span>
|
||||
|
||||
<span class=keyword>template</span><span class=special><</span><span class=keyword>typename</span> <span class=identifier>Value0</span><span class=special>,...,</span><span class=keyword>typename</span> <span class=identifier>Valuen</span><span class=special>></span>
|
||||
<span class=keyword>template</span><span class=special><</span><span class=keyword>typename</span><span class=special>...</span> <span class=identifier>Values</span><span class=special>></span>
|
||||
<span class=identifier>std</span><span class=special>::</span><span class=identifier>size_t</span> <span class=keyword>operator</span><span class=special>()(</span>
|
||||
<span class=keyword>const</span> <span class=identifier>boost</span><span class=special>::</span><span class=identifier>tuple</span><span class=special><</span><span class=identifier>Value0</span><span class=special>,...,</span><span class=identifier>Valuen</span><span class=special>>&</span> <span class=identifier>x</span><span class=special>)</span><span class=keyword>const</span><span class=special>;</span>
|
||||
<span class=keyword>const</span> <span class=identifier>boost</span><span class=special>::</span><span class=identifier>tuple</span><span class=special><</span><span class=identifier>Values</span><span class=special>...>&</span> <span class=identifier>x</span><span class=special>)</span><span class=keyword>const</span><span class=special>;</span>
|
||||
<span class=special>};</span>
|
||||
|
||||
<span class=special>}</span> <span class=comment>// namespace boost</span>
|
||||
@@ -2163,9 +2174,7 @@ subsets of those associated to <code>!(x<y)&&!(y<x)</code>.
|
||||
<p>
|
||||
In C++17 compliant environments, <code>key</code> provides a very terse syntax for
|
||||
the specification of Boost.MultiIndex predefined key extractors. The number of template
|
||||
arguments passed to <code>key</code> must be greater than zero and not exceed the
|
||||
maximum number of key extractors accepted by
|
||||
<a href="#composite_key"><code>composite_key</code></a>. <code>key<Key></code>
|
||||
arguments passed to <code>key</code> must be greater than zero. <code>key<Key></code>
|
||||
resolves to:
|
||||
<ul>
|
||||
<li><a href="#member"><code>member<Class,Type,Key></code></a>
|
||||
@@ -2237,15 +2246,15 @@ Random access indices
|
||||
<div class="up_link"><a href="index.html"><img src="../up.gif" alt="Boost.MultiIndex reference" border="0"><br>
|
||||
Boost.MultiIndex reference
|
||||
</a></div>
|
||||
<div class="next_link"><a href="../compiler_specifics.html"><img src="../next.gif" alt="compiler specifics" border="0"><br>
|
||||
Compiler specifics
|
||||
<div class="next_link"><a href="../performance.html"><img src="../next.gif" alt="performance" border="0"><br>
|
||||
Performance
|
||||
</a></div><br clear="all" style="clear: all;">
|
||||
|
||||
<br>
|
||||
|
||||
<p>Revised April 19th 2020</p>
|
||||
<p>Revised November 7th 2025</p>
|
||||
|
||||
<p>© Copyright 2003-2020 Joaquín M López Muñoz.
|
||||
<p>© Copyright 2003-2025 Joaquín M López Muñoz.
|
||||
Distributed under the Boost Software
|
||||
License, Version 1.0. (See accompanying file <a href="../../../../LICENSE_1_0.txt">
|
||||
LICENSE_1_0.txt</a> or copy at <a href="http://www.boost.org/LICENSE_1_0.txt">
|
||||
|
||||
@@ -235,9 +235,8 @@ and for access to the indices held.
|
||||
<p>
|
||||
A <code>multi_index_container</code> type is instantiated with the type of the
|
||||
elements contained and a non-empty
|
||||
<a href="../../../../libs/mpl/doc/refmanual/forward-sequence.html">
|
||||
<code>MPL Forward Sequence</code></a> specifying which indices conform the
|
||||
class.
|
||||
<a href="../../../../libs/mp11/doc/html/mp11.html#definitions">Mp11 list</a>
|
||||
specifying which indices conform the class.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
@@ -531,13 +530,10 @@ scheme outlined in the
|
||||
</li>
|
||||
<li><code>IndexSpecifierList</code> specifies the indices that the
|
||||
<code>multi_index_container</code> is composed of. It must be a non-empty
|
||||
<a href="../../../../libs/mpl/doc/refmanual/forward-sequence.html">
|
||||
<code>MPL Forward Sequence</code></a> (and, preferably,
|
||||
an <a href="../../../../libs/mpl/doc/refmanual/random-access-sequence.html">
|
||||
<code>MPL Random Access Sequence</code></a>) of index specifiers. For
|
||||
syntactic convenience, the
|
||||
<a href="../../../../libs/mp11/doc/html/mp11.html#definitions">Mp11 list</a>
|
||||
of index specifiers. For syntactic convenience, the
|
||||
<a href="indices.html#indexed_by"><code>indexed_by</code></a>
|
||||
MPL sequence can be used.
|
||||
construct can be used.
|
||||
</li>
|
||||
<li><code>Allocator</code> must be an allocator of <code>Value</code> objects
|
||||
satisfying the associated C++ requirements at <b>[allocator.requirements]</b>.
|
||||
@@ -556,8 +552,11 @@ scheme outlined in the
|
||||
<code>p</code> shall dereference to <code>*p</code>.
|
||||
</li>
|
||||
</ul>
|
||||
<code>multi_index_container</code>s and all their iterators do not store references
|
||||
to allocated elements other than through the allocator's pointer type.
|
||||
</li>
|
||||
</ol>
|
||||
|
||||
Indices of a given <code>multi_index_container</code> instantiation cannot have
|
||||
duplicate <a href="indices.html#tags">tags</a>, either within a single
|
||||
index or in two different indices.
|
||||
@@ -598,22 +597,16 @@ Same type as <code>IndexSpecifierList</code>.
|
||||
<code>index_type_list</code>
|
||||
|
||||
<blockquote>
|
||||
Model of
|
||||
<a href="../../../../libs/mpl/doc/refmanual/random-access-sequence.html">
|
||||
<code>MPL Random Access Sequence</code></a> and
|
||||
<a href="../../../../libs/mpl/doc/refmanual/extensible-sequence.html">
|
||||
<code>MPL Extensible Sequence</code></a> containing the types of the indices held by
|
||||
<a href="../../../../libs/mp11/doc/html/mp11.html#definitions">Mp11 list</a>
|
||||
containing the types of the indices held by
|
||||
the <code>multi_index_container</code>, in the same order as they were specified.
|
||||
</blockquote>
|
||||
|
||||
<code>iterator_type_list</code>
|
||||
|
||||
<blockquote>
|
||||
Model of
|
||||
<a href="../../../../libs/mpl/doc/refmanual/random-access-sequence.html">
|
||||
<code>MPL Random Access Sequence</code></a> and
|
||||
<a href="../../../../libs/mpl/doc/refmanual/extensible-sequence.html">
|
||||
<code>MPL Extensible Sequence</code></a> containing the types of the iterators of
|
||||
<a href="../../../../libs/mp11/doc/html/mp11.html#definitions">Mp11 list</a>
|
||||
containing the types of the iterators of
|
||||
the indices held by the <code>multi_index_container</code>, in the same order as they were
|
||||
specified.
|
||||
</blockquote>
|
||||
@@ -621,11 +614,8 @@ specified.
|
||||
<code>const_iterator_type_list</code>
|
||||
|
||||
<blockquote>
|
||||
Model of
|
||||
<a href="../../../../libs/mpl/doc/refmanual/random-access-sequence.html">
|
||||
<code>MPL Random Access Sequence</code></a> and
|
||||
<a href="../../../../libs/mpl/doc/refmanual/extensible-sequence.html">
|
||||
<code>MPL Extensible Sequence</code></a> containing the types of the constant
|
||||
<a href="../../../../libs/mp11/doc/html/mp11.html#definitions">Mp11 list</a>
|
||||
containing the types of the constant
|
||||
iterators of the indices held by the <code>multi_index_container</code>, in the same order
|
||||
as they were specified.
|
||||
</blockquote>
|
||||
@@ -1082,9 +1072,9 @@ Index reference
|
||||
|
||||
<br>
|
||||
|
||||
<p>Revised August 15th 2022</p>
|
||||
<p>Revised June 27th 2026</p>
|
||||
|
||||
<p>© Copyright 2003-2022 Joaquín M López Muñoz.
|
||||
<p>© Copyright 2003-2026 Joaquín M López Muñoz.
|
||||
Distributed under the Boost Software
|
||||
License, Version 1.0. (See accompanying file <a href="../../../../LICENSE_1_0.txt">
|
||||
LICENSE_1_0.txt</a> or copy at <a href="http://www.boost.org/LICENSE_1_0.txt">
|
||||
|
||||
+53
-5
@@ -30,6 +30,8 @@ Acknowledgements
|
||||
<h2>Contents</h2>
|
||||
|
||||
<ul>
|
||||
<li><a href="#boost_1_92">Boost 1.92 release</a></li>
|
||||
<li><a href="#boost_1_91">Boost 1.91 release</a></li>
|
||||
<li><a href="#boost_1_85">Boost 1.85 release</a></li>
|
||||
<li><a href="#boost_1_84">Boost 1.84 release</a></li>
|
||||
<li><a href="#boost_1_83">Boost 1.83 release</a></li>
|
||||
@@ -72,6 +74,53 @@ Acknowledgements
|
||||
<li><a href="#boost_1_33">Boost 1.33 release</a></li>
|
||||
</ul>
|
||||
|
||||
<h2><a name="boost_1_92">Boost 1.92 release</a></h2>
|
||||
|
||||
<p>
|
||||
<ul>
|
||||
<li>Fancy pointer support has been extended so that <code>multi_index_container</code>
|
||||
iterators now store references to the elements through the allocator's pointer type.
|
||||
In particular, this means that iterators can now be placed in shared memory using
|
||||
<a href="../../interprocess/index.html">Boost.Interprocess</a> allocators.
|
||||
</li>
|
||||
<li>Fixed a performance issue with hashed indices when rehashing at very large
|
||||
container sizes (<a href="https://github.com/boostorg/multi_index/pull/94">PR#94</a>).
|
||||
Contributed by Daniel Král.
|
||||
</li>
|
||||
</ul>
|
||||
</p>
|
||||
|
||||
<h2><a name="boost_1_91">Boost 1.91 release</a></h2>
|
||||
|
||||
<p>
|
||||
<ul>
|
||||
<li><b>Breaking change:</b> All type lists accepted or provided by the library (<code>indexed_by</code>,
|
||||
<code>tag</code>, nested typedefs <code>index_specifier_type_list</code>,
|
||||
<code>index_type_list</code>, <code>iterator_type_list</code> and
|
||||
<code>const_iterator_type_list</code>) are no longer based on
|
||||
<a href="../../mpl">Boost.MPL</a> but instead they are now
|
||||
<a href="../../mp11/doc/html/mp11.html#definitions">Boost.Mp11 lists</a>.
|
||||
As a result, Boost.MultiIndex doesn't depend anymore on Boost.MPL.
|
||||
It is expected that most user code won't be impacted by this
|
||||
change, but the previous behavior may be restored, however, by
|
||||
globally defining the macro
|
||||
<code>BOOST_MULTI_INDEX_ENABLE_MPL_SUPPORT</code>.
|
||||
Legacy support for Boost.MPL may be eventually deprecated and removed in the future.
|
||||
</li>
|
||||
<li><b>Breaking change:</b> <code>composite_key</code> and associated
|
||||
class templates (<code>composite_key_equal_to</code>, <code>composite_key_compare</code>,
|
||||
<code>composite_key_hash</code>) have been made variadic (previously the maximum
|
||||
number of template arguments was limited by <code>BOOST_MULTI_INDEX_LIMIT_COMPOSITE_KEY_SIZE</code>).
|
||||
This change should be transparent to users, with the exception that
|
||||
<code>composite_key::key_extractors</code> returns a <code>std::tuple</code>
|
||||
instead of a <code>boost::tuple</code> (and similarly for the rest of affected
|
||||
class templates).
|
||||
</li>
|
||||
<li>Removed internal workarounds and fallbacks to support pre-C++11 compilers.
|
||||
</li>
|
||||
</ul>
|
||||
</p>
|
||||
|
||||
<h2><a name="boost_1_85">Boost 1.85 release</a></h2>
|
||||
|
||||
<p>
|
||||
@@ -474,7 +523,7 @@ Acknowledgements
|
||||
</li>
|
||||
<li>Random access indices provide <code>shrink_to_fit()</code>.</li>
|
||||
</ul>
|
||||
Refer to the <a href="compiler_specifics.html">compiler specifics</a> section for limitations
|
||||
Refer to the compiler specifics section for limitations
|
||||
on pre-C++11 compilers.
|
||||
</li>
|
||||
<li>The following classes are deprecated:
|
||||
@@ -793,8 +842,7 @@ Acknowledgements
|
||||
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
|
||||
<a href="compiler_specifics.html#symbol_reduction">reduction of symbol name
|
||||
lengths</a> has been added.
|
||||
reduction of symbol name lengths has been added.
|
||||
</li>
|
||||
<li>Restructured some parts of the documentation, new examples.</li>
|
||||
<li>Maintenance fixes.</li>
|
||||
@@ -815,9 +863,9 @@ Acknowledgements
|
||||
|
||||
<br>
|
||||
|
||||
<p>Revised March 15th 2024</p>
|
||||
<p>Revised June 27th 2026</p>
|
||||
|
||||
<p>© Copyright 2003-2024 Joaquín M López Muñoz.
|
||||
<p>© Copyright 2003-2026 Joaquín M López Muñoz.
|
||||
Distributed under the Boost Software
|
||||
License, Version 1.0. (See accompanying file <a href="../../../LICENSE_1_0.txt">
|
||||
LICENSE_1_0.txt</a> or copy at <a href="http://www.boost.org/LICENSE_1_0.txt">
|
||||
|
||||
+3
-3
@@ -101,7 +101,7 @@ with some of the least common features offered by Boost.MultiIndex.
|
||||
</tr>
|
||||
<tr class="odd_tr">
|
||||
<td><a href="../test/test_mpl_ops.cpp"><code>test_mpl_ops.cpp</code></a></td>
|
||||
<td>Metaprogramming manipulations of <code>multi_index_container</code> types.</td>
|
||||
<td>Boost.MPL interoperability (when <code> BOOST_MULTI_INDEX_ENABLE_MPL_SUPPORT</code> is enabled).</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a href="../test/test_node_handling.cpp"><code>test_node_handling.cpp</code></a></td>
|
||||
@@ -166,9 +166,9 @@ Future work
|
||||
|
||||
<br>
|
||||
|
||||
<p>Revised May 9th 2020</p>
|
||||
<p>Revised October 26th 2025</p>
|
||||
|
||||
<p>© Copyright 2003-2020 Joaquín M López Muñoz.
|
||||
<p>© Copyright 2003-2025 Joaquín M López Muñoz.
|
||||
Distributed under the Boost Software
|
||||
License, Version 1.0. (See accompanying file <a href="../../../LICENSE_1_0.txt">
|
||||
LICENSE_1_0.txt</a> or copy at <a href="http://www.boost.org/LICENSE_1_0.txt">
|
||||
|
||||
@@ -201,7 +201,7 @@ than strictly required by the C++ standard, as explained in detail in the
|
||||
An important type of non-standard allocators supported are those provided by the
|
||||
<a href="../../../interprocess/index.html">Boost Interprocess Library</a>;
|
||||
this opens up the possibility of placing <code>multi_index_container</code>s
|
||||
in shared memory.
|
||||
and their iterators in shared memory.
|
||||
</p>
|
||||
|
||||
<blockquote><pre>
|
||||
@@ -340,9 +340,9 @@ Debugging support
|
||||
|
||||
<br>
|
||||
|
||||
<p>Revised July 17th 2007</p>
|
||||
<p>Revised June 27th 2026</p>
|
||||
|
||||
<p>© Copyright 2003-2007 Joaquín M López Muñoz.
|
||||
<p>© Copyright 2003-2026 Joaquín M López Muñoz.
|
||||
Distributed under the Boost Software
|
||||
License, Version 1.0. (See accompanying file <a href="../../../../LICENSE_1_0.txt">
|
||||
LICENSE_1_0.txt</a> or copy at <a href="http://www.boost.org/LICENSE_1_0.txt">
|
||||
|
||||
+23
-2
@@ -34,6 +34,7 @@ Techniques
|
||||
<li><a href="#safe_mode">Safe mode</a>
|
||||
<ul>
|
||||
<li><a href="#serialization_and_safe_mode">Serialization and safe mode</a></li>
|
||||
<li><a href="#shared_memory_and_safe_mode">Containers placed in shared memory</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><a href="#invariant_check">Invariant-checking mode</a></li>
|
||||
@@ -199,6 +200,26 @@ checked value by using the following workaround:
|
||||
<span class=identifier>it</span><span class=special>=</span><span class=identifier>es</span><span class=special>.</span><span class=identifier>project</span><span class=special><</span><span class=number>1</span><span class=special>>(</span><span class=identifier>it</span><span class=special>);</span>
|
||||
</pre></blockquote>
|
||||
|
||||
<h3><a name="shared_memory_and_safe_mode">Containers placed in shared memory</a></h3>
|
||||
|
||||
<p>
|
||||
In general, safe mode <b>can't be used</b> when placing <code>multi_index_container</code>s
|
||||
in shared memory for interprocess communication
|
||||
(as in <a href="../examples.html#example12">this example</a>).
|
||||
There are some fundamental reasons for this limitation:
|
||||
<ul>
|
||||
<li>
|
||||
Operations from one process may invalidate or change ownership for iterators
|
||||
living in non-shared memory within another process: safe-mode machinery can't
|
||||
access those for bookkeeping.
|
||||
</li>
|
||||
<li>
|
||||
Safe mode uses internal mutexes not suitable for interprocess
|
||||
synchronization or persistence to a memory-mapped file.
|
||||
</li>
|
||||
</ul>
|
||||
</p>
|
||||
|
||||
<h2><a name="invariant_check">Invariant-checking mode</a></h2>
|
||||
|
||||
<p>
|
||||
@@ -240,9 +261,9 @@ Techniques
|
||||
|
||||
<br>
|
||||
|
||||
<p>Revised May 9th 2020</p>
|
||||
<p>Revised June 27th 2026</p>
|
||||
|
||||
<p>© Copyright 2003-2020 Joaquín M López Muñoz.
|
||||
<p>© Copyright 2003-2026 Joaquín M López Muñoz.
|
||||
Distributed under the Boost Software
|
||||
License, Version 1.0. (See accompanying file <a href="../../../../LICENSE_1_0.txt">
|
||||
LICENSE_1_0.txt</a> or copy at <a href="http://www.boost.org/LICENSE_1_0.txt">
|
||||
|
||||
@@ -494,7 +494,7 @@ The analogous concept in Boost.MultiIndex is modeled by means of
|
||||
</pre></blockquote>
|
||||
|
||||
<p>
|
||||
<code>composite_key</code> accepts two or more key extractors on the same
|
||||
<code>composite_key</code> accepts several key extractors on the same
|
||||
value (here, <code>phonebook_entry</code>). Lookup operations on a composite
|
||||
key are accomplished by passing tuples with the values searched:
|
||||
</p>
|
||||
@@ -1126,9 +1126,9 @@ Container creation
|
||||
|
||||
<br>
|
||||
|
||||
<p>Revised April 19th 2020</p>
|
||||
<p>Revised November 1st 2025</p>
|
||||
|
||||
<p>© Copyright 2003-2020 Joaquín M López Muñoz.
|
||||
<p>© Copyright 2003-2025 Joaquín M López Muñoz.
|
||||
Distributed under the Boost Software
|
||||
License, Version 1.0. (See accompanying file <a href="../../../../LICENSE_1_0.txt">
|
||||
LICENSE_1_0.txt</a> or copy at <a href="http://www.boost.org/LICENSE_1_0.txt">
|
||||
|
||||
@@ -40,8 +40,8 @@ Boost.MultiIndex reference
|
||||
</li>
|
||||
<li><a href="#metaprogrammming">Metaprogramming and <code>multi_index_container</code></a>
|
||||
<ul>
|
||||
<li><a href="#mpl_analysis">MPL analysis</a></li>
|
||||
<li><a href="#mpl_synthesis">MPL synthesis</a></li>
|
||||
<li><a href="#analysis">Analysis</a></li>
|
||||
<li><a href="#synthesis">Synthesis</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
@@ -266,11 +266,10 @@ or, if the default value <code>Allocator=std::allocator<T></code> is used:
|
||||
|
||||
<p>
|
||||
Boost.MultiIndex provides a number of facilities intended to allow the analysis and
|
||||
synthesis of <code>multi_index_container</code> instantiations by
|
||||
<a href="../../../../libs/mpl/doc/index.html">MPL</a> metaprograms.
|
||||
synthesis of <code>multi_index_container</code> instantiations with metaprogramming.
|
||||
</p>
|
||||
|
||||
<h3><a name="mpl_analysis">MPL analysis</a></h3>
|
||||
<h3><a name="analysis">Analysis</a></h3>
|
||||
|
||||
<p>
|
||||
Given a <code>multi_index_container</code> instantiation, the following nested types are
|
||||
@@ -282,39 +281,47 @@ definition of the <code>multi_index_container</code>:
|
||||
<li><code>iterator_type_list</code>,</li>
|
||||
<li><code>const_iterator_type_list</code>.</li>
|
||||
</ul>
|
||||
Each of these types is an MPL sequence with as many elements as indices
|
||||
Each of these types is an
|
||||
<a href="../../../../libs/mp11/doc/html/mp11.html#definitions">Mp11 list</a>
|
||||
with as many elements as indices
|
||||
comprise the <code>multi_index_container</code>: for instance, the <code>n</code>-th
|
||||
element of <code>iterator_type_list</code> is the same as
|
||||
<code>nth_index<n>::type::iterator</code>.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
A subtle but important distinction exists between
|
||||
<code>index_specifier_type_list</code> and <code>index_type_list</code>:
|
||||
the former typelist holds the index <i>specifiers</i>
|
||||
with which the <code>multi_index_container</code> instantiation was defined,
|
||||
while the latter gives access to the actual implementation classes
|
||||
corresponding to each specifier. An example will help to clarify
|
||||
this distinction. Given the instantiation:
|
||||
<code>nth_index<n>::type::iterator</code>. Boost.Mp11 makes it very easy
|
||||
to inspect and manipulate these lists:
|
||||
</p>
|
||||
|
||||
<blockquote><pre>
|
||||
<span class=keyword>typedef</span> <span class=identifier>multi_index_container</span><span class=special><</span>
|
||||
<span class=keyword>using</span> <span class=identifier>indexed_t</span><span class=special>=</span><span class=identifier>multi_index_container</span><span class=special><</span>
|
||||
<span class=keyword>int</span><span class=special>,</span>
|
||||
<span class=identifier>indexed_by</span><span class=special><</span>
|
||||
<span class=identifier>ordered_unique</span><span class=special><</span><span class=identifier>identity</span><span class=special><</span><span class=keyword>int</span><span class=special>></span> <span class=special>>,</span>
|
||||
<span class=identifier>sequenced</span><span class=special><></span>
|
||||
<span class=special>></span>
|
||||
<span class=special>></span> <span class=identifier>indexed_t</span><span class=special>;</span>
|
||||
<span class=special>>;</span>
|
||||
|
||||
<span class=identifier>boost</span><span class=special>::</span><span class=identifier>mp11</span><span class=special>::</span><span class=identifier>mp_for_each</span><span class=special><</span><span class=identifier>indexed_t</span><span class=special>::</span><span class=identifier>index_specifier_type_list</span><span class=special>>([](</span><span class=keyword>auto</span> <span class=identifier>I</span><span class=special>){</span>
|
||||
<span class=identifier>std</span><span class=special>::</span><span class=identifier>cout</span> <span class=special><<</span> <span class=identifier>boost</span><span class=special>::</span><span class=identifier>typeindex</span><span class=special>::</span><span class=identifier>type_id</span><span class=special><</span><span class=identifier>decltype</span><span class=special>(</span><span class=identifier>I</span><span class=special>)>().</span><span class=identifier>pretty_name</span><span class=special>()</span> <span class=special><<</span> <span class=string>"\n"</span><span class=special>;</span>
|
||||
<span class=special>});</span>
|
||||
|
||||
<span class=comment>// Output:
|
||||
//
|
||||
// struct boost::multi_index::ordered_unique<struct boost::multi_index::identity<int>,void,void>
|
||||
// struct boost::multi_index::sequenced<struct boost::multi_index::tag<> ></span>
|
||||
</pre></blockquote>
|
||||
|
||||
<p>
|
||||
A subtle but important distinction exists between
|
||||
<code>index_specifier_type_list</code> and <code>index_type_list</code>:
|
||||
the former list holds the index <i>specifiers</i>
|
||||
with which the <code>multi_index_container</code> instantiation was defined,
|
||||
while the latter gives access to the actual implementation classes
|
||||
corresponding to each specifier. In the example above,
|
||||
<code>indexed_t::index_specifier_type_list</code> is a type list with
|
||||
elements
|
||||
</p>
|
||||
|
||||
<blockquote><pre>
|
||||
<span class=identifier>ordered_unique</span><span class=special><</span><span class=identifier>identity</span><span class=special><</span><span class=keyword>int</span><span class=special>></span> <span class=special>></span>
|
||||
<span class=identifier>ordered_unique</span><span class=special><</span><span class=identifier>identity</span><span class=special><</span><span class=keyword>int</span><span class=special>></span><span class=special>></span>
|
||||
<span class=identifier>sequenced</span><span class=special><></span>
|
||||
</pre></blockquote>
|
||||
|
||||
@@ -328,21 +335,18 @@ while <code>indexed_t::index_type_list</code> holds the types
|
||||
</pre></blockquote>
|
||||
|
||||
<p>
|
||||
so the typelists are radically different. Check the
|
||||
<a href="../reference/multi_index_container.html#types">reference</a>
|
||||
for the exact MPL sequence concepts modeled by these type lists.
|
||||
so the lists are radically different.
|
||||
</p>
|
||||
|
||||
<h3><a name="mpl_synthesis">MPL synthesis</a></h3>
|
||||
<h3><a name="synthesis">Synthesis</a></h3>
|
||||
|
||||
<p>
|
||||
Although typically indices are specified by means of the
|
||||
<code>indexed_by</code> construct, actually any MPL sequence of
|
||||
index specifiers can be provided instead:
|
||||
<code>indexed_by</code> construct, actually any Mp11 list can be provided instead:
|
||||
</p>
|
||||
|
||||
<blockquote><pre>
|
||||
<span class=keyword>typedef</span> <span class=identifier>mpl</span><span class=special>::</span><span class=identifier>vector</span><span class=special><</span><span class=identifier>ordered_unique</span><span class=special><</span><span class=identifier>identity</span><span class=special><</span><span class=keyword>int</span><span class=special>></span> <span class=special>>,</span><span class=identifier>sequenced</span><span class=special><></span> <span class=special>></span> <span class=identifier>index_list_t</span><span class=special>;</span>
|
||||
<span class=keyword>using</span> <span class=identifier>index_list_t</span><span class=special>=</span><span class=identifier>std</span><span class=special>::</span><span class=identifier>tuple</span><span class=special><</span><span class=identifier>ordered_unique</span><span class=special><</span><span class=identifier>identity</span><span class=special><</span><span class=keyword>int</span><span class=special>></span> <span class=special>>,</span><span class=identifier>sequenced</span><span class=special><>></span> <span class=special>;</span>
|
||||
|
||||
<span class=keyword>typedef</span> <span class=identifier>multi_index_container</span><span class=special><</span>
|
||||
<span class=keyword>int</span><span class=special>,</span>
|
||||
@@ -352,30 +356,30 @@ index specifiers can be provided instead:
|
||||
|
||||
<p>
|
||||
This possibility enables the synthesis of instantiations of
|
||||
<code>multi_index_container</code> through MPL metaprograms, as the following
|
||||
<code>multi_index_container</code> through metaprogramming, as the following
|
||||
example shows:
|
||||
</p>
|
||||
|
||||
<blockquote><pre>
|
||||
<span class=comment>// original multi_index_container instantiation</span>
|
||||
<span class=keyword>typedef</span> <span class=identifier>multi_index_container</span><span class=special><</span>
|
||||
<span class=keyword>using</span> <span class=identifier>indexed_t1</span><span class=special>=</span><span class=identifier>multi_index_container</span><span class=special><</span>
|
||||
<span class=keyword>int</span><span class=special>,</span>
|
||||
<span class=identifier>indexed_by</span><span class=special><</span>
|
||||
<span class=identifier>ordered_unique</span><span class=special><</span><span class=identifier>identity</span><span class=special><</span><span class=keyword>int</span><span class=special>></span> <span class=special>></span>
|
||||
<span class=special>></span>
|
||||
<span class=special>></span> <span class=identifier>indexed_t1</span><span class=special>;</span>
|
||||
<span class=special>>;</span>
|
||||
|
||||
<span class=comment>// we take its index list and add an index</span>
|
||||
<span class=keyword>typedef</span> <span class=identifier>boost</span><span class=special>::</span><span class=identifier>mpl</span><span class=special>::</span><span class=identifier>push_front</span><span class=special><</span>
|
||||
<span class=keyword>using</span> <span class=identifier>index_list_t2</span><span class=special>=</span><span class=identifier>boost</span><span class=special>::</span><span class=identifier>mp11</span><span class=special>::</span><span class=identifier>mp_push_front</span><span class=special><</span>
|
||||
<span class=identifier>indexed_t1</span><span class=special>::</span><span class=identifier>index_specifier_type_list</span><span class=special>,</span>
|
||||
<span class=identifier>sequenced</span><span class=special><></span>
|
||||
<span class=special>>::</span><span class=identifier>type</span> <span class=identifier>index_list_t</span><span class=special>;</span>
|
||||
<span class=special>>;</span>
|
||||
|
||||
<span class=comment>// augmented multi_index_container</span>
|
||||
<span class=keyword>typedef</span> <span class=identifier>multi_index_container</span><span class=special><</span>
|
||||
<span class=keyword>using</span> <span class=identifier>indexed_t2</span><span class=special>=</span><span class=identifier>multi_index_container</span><span class=special><</span>
|
||||
<span class=keyword>int</span><span class=special>,</span>
|
||||
<span class=identifier>index_list_t</span>
|
||||
<span class=special>></span> <span class=identifier>indexed_t2</span><span class=special>;</span>
|
||||
<span class=identifier>index_list_t2</span>
|
||||
<span class=special>>;</span>
|
||||
</pre></blockquote>
|
||||
|
||||
<hr>
|
||||
@@ -392,9 +396,9 @@ Boost.MultiIndex reference
|
||||
|
||||
<br>
|
||||
|
||||
<p>Revised November 7th 2008</p>
|
||||
<p>Revised October 25th 2025</p>
|
||||
|
||||
<p>© Copyright 2003-2008 Joaquín M López Muñoz.
|
||||
<p>© Copyright 2003-2025 Joaquín M López Muñoz.
|
||||
Distributed under the Boost Software
|
||||
License, Version 1.0. (See accompanying file <a href="../../../../LICENSE_1_0.txt">
|
||||
LICENSE_1_0.txt</a> or copy at <a href="http://www.boost.org/LICENSE_1_0.txt">
|
||||
|
||||
+4
-8
@@ -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<id>, BOOST_MULTI_INDEX_MEMBER(employee,int,id)>,
|
||||
tag<id>, member<employee,int,&employee::id> >,
|
||||
ordered_non_unique<
|
||||
tag<name>,BOOST_MULTI_INDEX_MEMBER(employee,std::string,name)>,
|
||||
tag<name>,member<employee,std::string,&employee::name> >,
|
||||
ordered_non_unique<
|
||||
tag<age>, BOOST_MULTI_INDEX_MEMBER(employee,int,age)> >
|
||||
tag<age>, member<employee,int,&employee::age> > >
|
||||
> employee_set;
|
||||
|
||||
template<typename Tag,typename MultiIndexContainer>
|
||||
|
||||
+1
-45
@@ -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)
|
||||
@@ -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<from>,member_offset<value_type,FromType,from_offset> >,
|
||||
ordered_unique<
|
||||
tag<to>, member_offset<value_type,ToType,to_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<to>, member<value_type,ToType,&value_type::second> >
|
||||
>
|
||||
> type;
|
||||
|
||||
#endif
|
||||
};
|
||||
|
||||
/* a dictionary is a bidirectional map from strings to strings */
|
||||
@@ -108,22 +82,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<from>(d).find(word);
|
||||
if(it!=d.end()){
|
||||
std::cout<<word<<" is said "<<it->second<<" in English"<<std::endl;
|
||||
}
|
||||
else{
|
||||
nth_index<dictionary,1>::type::iterator it2=get<1>(d).find(word);
|
||||
if(it2!=get<1>(d).end()){
|
||||
std::cout<<word<<" is said "<<it2->first<<" in Spanish"<<std::endl;
|
||||
}
|
||||
else std::cout<<"No such word in the dictionary"<<std::endl;
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
/* search the queried word on the from index (Spanish) */
|
||||
|
||||
dictionary::iterator it=d.get<from>().find(word);
|
||||
@@ -143,7 +101,5 @@ int main()
|
||||
else std::cout<<"No such word in the dictionary"<<std::endl;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
+12
-16
@@ -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,std::string,&car_manufacturer::name>
|
||||
>
|
||||
>
|
||||
> car_manufacturer_table;
|
||||
@@ -118,18 +114,18 @@ typedef multi_index_container<
|
||||
car_model,
|
||||
indexed_by<
|
||||
ordered_unique<
|
||||
tag<model>,BOOST_MULTI_INDEX_MEMBER(car_model,std::string,model)
|
||||
tag<model>,member<car_model,std::string,&car_model::model>
|
||||
>,
|
||||
ordered_non_unique<
|
||||
tag<manufacturer>,
|
||||
key_from_key<
|
||||
BOOST_MULTI_INDEX_MEMBER(car_manufacturer,const std::string,name),
|
||||
BOOST_MULTI_INDEX_MEMBER(
|
||||
car_model,const car_manufacturer *,manufacturer)
|
||||
member<car_manufacturer,const std::string,&car_manufacturer::name>,
|
||||
member<
|
||||
car_model,const car_manufacturer *,&car_model::manufacturer>
|
||||
>
|
||||
>,
|
||||
ordered_non_unique<
|
||||
tag<price>,BOOST_MULTI_INDEX_MEMBER(car_model,int,price)
|
||||
tag<price>,member<car_model,int,&car_model::price>
|
||||
>
|
||||
>
|
||||
> 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<BOOST_MULTI_INDEX_MEMBER(car_model,const int,price)>
|
||||
ordered_non_unique<member<car_model,const int,&car_model::price> >
|
||||
>
|
||||
> 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<car_manufacturer,const std::string,&car_manufacturer::name>,
|
||||
member<
|
||||
car_model,const car_manufacturer * const,&car_model::manufacturer>
|
||||
>
|
||||
>
|
||||
>
|
||||
|
||||
@@ -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<file_entry,const file_entry*,&file_entry::dir>,
|
||||
member<file_entry,std::string,&file_entry::name>
|
||||
>{};
|
||||
|
||||
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<file_entry,const file_entry* const,&file_entry::dir>,
|
||||
member<file_entry,unsigned,&file_entry::size>
|
||||
>{};
|
||||
|
||||
/* 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<
|
||||
|
||||
+2
-4
@@ -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<name_record,std::string,&name_record::name>
|
||||
>,
|
||||
ordered_non_unique<
|
||||
global_fun<const name_record&,std::string::size_type,name_record_length>
|
||||
|
||||
+15
-19
@@ -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<word_counter_entry,unsigned int,&word_counter_entry::occurrences>,
|
||||
std::greater<unsigned int> /* sorted beginning with most frequent */
|
||||
>,
|
||||
hashed_unique<
|
||||
BOOST_MULTI_INDEX_MEMBER(word_counter_entry,std::string,word)
|
||||
member<word_counter_entry,std::string,&word_counter_entry::word>
|
||||
>
|
||||
>
|
||||
> word_counter;
|
||||
@@ -70,23 +66,23 @@ int main()
|
||||
|
||||
std::string text=
|
||||
"En un lugar de la Mancha, de cuyo nombre no quiero acordarme, no ha "
|
||||
"mucho tiempo que vivía un hidalgo de los de lanza en astillero, adarga "
|
||||
"antigua, rocín flaco y galgo corredor. Una olla de algo más vaca que "
|
||||
"carnero, salpicón las más noches, duelos y quebrantos los sábados, "
|
||||
"lantejas los viernes, algún palomino de añadidura los domingos, "
|
||||
"consumían las tres partes de su hacienda. El resto della concluían sayo "
|
||||
"mucho tiempo que vivía un hidalgo de los de lanza en astillero, adarga "
|
||||
"antigua, rocín flaco y galgo corredor. Una olla de algo más vaca que "
|
||||
"carnero, salpicón las más noches, duelos y quebrantos los sábados, "
|
||||
"lantejas los viernes, algún palomino de añadidura los domingos, "
|
||||
"consumían las tres partes de su hacienda. El resto della concluían sayo "
|
||||
"de velarte, calzas de velludo para las fiestas, con sus pantuflos de lo "
|
||||
"mesmo, y los días de entresemana se honraba con su vellorí de lo más "
|
||||
"fino. Tenía en su casa una ama que pasaba de los cuarenta, y una "
|
||||
"mesmo, y los días de entresemana se honraba con su vellorí de lo más "
|
||||
"fino. Tenía en su casa una ama que pasaba de los cuarenta, y una "
|
||||
"sobrina que no llegaba a los veinte, y un mozo de campo y plaza, que "
|
||||
"así ensillaba el rocín como tomaba la podadera. Frisaba la edad de "
|
||||
"nuestro hidalgo con los cincuenta años; era de complexión recia, seco "
|
||||
"así ensillaba el rocín como tomaba la podadera. Frisaba la edad de "
|
||||
"nuestro hidalgo con los cincuenta años; era de complexión recia, seco "
|
||||
"de carnes, enjuto de rostro, gran madrugador y amigo de la caza. "
|
||||
"Quieren decir que tenía el sobrenombre de Quijada, o Quesada, que en "
|
||||
"Quieren decir que tenía el sobrenombre de Quijada, o Quesada, que en "
|
||||
"esto hay alguna diferencia en los autores que deste caso escriben; "
|
||||
"aunque, por conjeturas verosímiles, se deja entender que se llamaba "
|
||||
"aunque, por conjeturas verosímiles, se deja entender que se llamaba "
|
||||
"Quejana. Pero esto importa poco a nuestro cuento; basta que en la "
|
||||
"narración dél no se salga un punto de la verdad.";
|
||||
"narración dél no se salga un punto de la verdad.";
|
||||
|
||||
/* feed the text into the container */
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* Boost.MultiIndex example of use of Boost.Interprocess allocators.
|
||||
*
|
||||
* Copyright 2003-2008 Joaquin M Lopez Munoz.
|
||||
* Copyright 2003-2026 Joaquin M Lopez Munoz.
|
||||
* Distributed under the Boost Software License, Version 1.0.
|
||||
* (See accompanying file LICENSE_1_0.txt or copy at
|
||||
* http://www.boost.org/LICENSE_1_0.txt)
|
||||
@@ -10,7 +10,6 @@
|
||||
|
||||
#if !defined(NDEBUG)
|
||||
#define BOOST_MULTI_INDEX_ENABLE_INVARIANT_CHECKING
|
||||
#define BOOST_MULTI_INDEX_ENABLE_SAFE_MODE
|
||||
#endif
|
||||
|
||||
#include <boost/config.hpp> /* keep it first to prevent nasty warns in MSVC */
|
||||
@@ -104,22 +103,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<book,shared_string,&book::author>
|
||||
>,
|
||||
ordered_non_unique<
|
||||
BOOST_MULTI_INDEX_MEMBER(book,shared_string,name),
|
||||
member<book,shared_string,&book::name>,
|
||||
partial_str_less
|
||||
>,
|
||||
ordered_non_unique<
|
||||
BOOST_MULTI_INDEX_MEMBER(book,unsigned,prize)
|
||||
member<book,unsigned,&book::prize>
|
||||
>
|
||||
>,
|
||||
bip::allocator<book,bip::managed_mapped_file::segment_manager>
|
||||
|
||||
+2
-15
@@ -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 <algorithm>
|
||||
#include <iostream>
|
||||
#include <iterator>
|
||||
#include <vector>
|
||||
|
||||
#if !defined(BOOST_NO_CXX11_HDR_RANDOM)
|
||||
#include <random>
|
||||
#endif
|
||||
#include <vector>
|
||||
|
||||
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
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -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 <boost/config.hpp>
|
||||
#include <boost/detail/workaround.hpp>
|
||||
|
||||
/* 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
|
||||
@@ -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<typename T>
|
||||
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 */
|
||||
|
||||
@@ -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 <boost/config.hpp> /* keep it first to prevent nasty warns in MSVC */
|
||||
|
||||
#if !defined(BOOST_NO_CXX11_ALLOCATOR)
|
||||
#include <boost/type_traits/is_empty.hpp>
|
||||
#include <memory>
|
||||
#else
|
||||
#include <boost/detail/workaround.hpp>
|
||||
#include <boost/move/core.hpp>
|
||||
#include <boost/move/utility_core.hpp>
|
||||
#include <boost/multi_index/detail/vartempl_support.hpp>
|
||||
#include <boost/type_traits/integral_constant.hpp>
|
||||
#include <boost/type_traits/is_empty.hpp>
|
||||
#include <new>
|
||||
#endif
|
||||
|
||||
namespace boost{
|
||||
|
||||
namespace multi_index{
|
||||
|
||||
namespace detail{
|
||||
|
||||
/* poor man's replacement of std::allocator_traits */
|
||||
|
||||
#if !defined(BOOST_NO_CXX11_ALLOCATOR)
|
||||
|
||||
template<typename T> struct void_helper{typedef void type;};
|
||||
|
||||
template<typename Allocator,typename=void>
|
||||
struct allocator_is_always_equal:boost::is_empty<Allocator>{};
|
||||
|
||||
template<typename Allocator>
|
||||
struct allocator_is_always_equal<
|
||||
Allocator,
|
||||
typename void_helper<
|
||||
typename std::allocator_traits<Allocator>::is_always_equal
|
||||
>::type
|
||||
>:std::allocator_traits<Allocator>::is_always_equal{};
|
||||
|
||||
template<typename Allocator>
|
||||
struct allocator_traits:std::allocator_traits<Allocator>
|
||||
{
|
||||
/* wrap std::allocator_traits alias templates for use in C++03 codebase */
|
||||
|
||||
typedef std::allocator_traits<Allocator> super;
|
||||
|
||||
/* pre-C++17 compatibilty */
|
||||
|
||||
typedef allocator_is_always_equal<Allocator> is_always_equal;
|
||||
|
||||
template<typename T>
|
||||
struct rebind_alloc
|
||||
{
|
||||
typedef typename super::template rebind_alloc<T> type;
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
struct rebind_traits
|
||||
{
|
||||
typedef typename super::template rebind_traits<T> type;
|
||||
};
|
||||
};
|
||||
|
||||
#else
|
||||
|
||||
/* not a full std::allocator_traits rewrite (not needed) */
|
||||
|
||||
template<typename Allocator>
|
||||
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<Allocator> is_always_equal;
|
||||
|
||||
template<typename T>
|
||||
struct rebind_alloc
|
||||
{
|
||||
typedef typename Allocator::template rebind<T>::other type;
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
struct rebind_traits
|
||||
{
|
||||
typedef allocator_traits<typename rebind_alloc<T>::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<typename T>
|
||||
static void construct(Allocator&,T* p,const T& x)
|
||||
{::new (static_cast<void*>(p)) T(x);}
|
||||
template<typename T>
|
||||
static void construct(Allocator&,T* p,BOOST_RV_REF(T) x)
|
||||
{::new (static_cast<void*>(p)) T(boost::move(x));}
|
||||
|
||||
template<typename T,BOOST_MULTI_INDEX_TEMPLATE_PARAM_PACK>
|
||||
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<T> when T is a class with trivial dtor.
|
||||
*/
|
||||
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable:4100)
|
||||
#endif
|
||||
|
||||
template<typename T>
|
||||
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<typename Allocator,typename T>
|
||||
struct rebind_alloc_for
|
||||
{
|
||||
typedef typename allocator_traits<Allocator>::
|
||||
template rebind_alloc<T>::type type;
|
||||
};
|
||||
|
||||
} /* namespace multi_index::detail */
|
||||
|
||||
} /* namespace multi_index */
|
||||
|
||||
} /* namespace boost */
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,129 @@
|
||||
/* 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)
|
||||
*
|
||||
* See http://www.boost.org/libs/multi_index for library home page.
|
||||
*/
|
||||
|
||||
#ifndef BOOST_MULTI_INDEX_DETAIL_AUGMENTED_STDTUPLE_HPP
|
||||
#define BOOST_MULTI_INDEX_DETAIL_AUGMENTED_STDTUPLE_HPP
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
#include <boost/config.hpp> /* keep it first to prevent nasty warns in MSVC */
|
||||
#include <boost/mp11/algorithm.hpp>
|
||||
#include <boost/mp11/function.hpp>
|
||||
#include <boost/mp11/list.hpp>
|
||||
#include <boost/mp11/integer_sequence.hpp>
|
||||
#include <boost/mp11/integral.hpp>
|
||||
#include <boost/tuple/tuple.hpp>
|
||||
#include <tuple>
|
||||
#include <type_traits>
|
||||
|
||||
namespace boost{
|
||||
|
||||
namespace multi_index{
|
||||
|
||||
namespace detail{
|
||||
|
||||
/* augmented_stdtuple<Ts...> derives from std::tuple<Ts...> and provides the
|
||||
* following non-standard constructors:
|
||||
*
|
||||
* - augmented_stdtuple(const Ts& = Ts()...) (this signature is not legal C++,
|
||||
* shown for explanatory purposes).
|
||||
* - augmented_stdtuple(boost::tuple<Ts...>) if sizeof...(Ts) does not exceed
|
||||
* the maximum length of a boost::tuple (10 as of this writing).
|
||||
*/
|
||||
|
||||
template<typename T,typename U>
|
||||
using is_convertible_to_cref=std::is_convertible<T,const U&>;
|
||||
|
||||
template<typename FromList,typename ToList,typename=void>
|
||||
struct are_convertible_to_crefs:mp11::mp_false{};
|
||||
|
||||
template<typename FromList,typename ToList>
|
||||
struct are_convertible_to_crefs<
|
||||
FromList,ToList,
|
||||
typename std::enable_if<
|
||||
(mp11::mp_size<FromList>::value<=mp11::mp_size<ToList>::value)
|
||||
>::type
|
||||
>:
|
||||
mp11::mp_apply<
|
||||
mp11::mp_and,
|
||||
mp11::mp_transform<
|
||||
is_convertible_to_cref,
|
||||
FromList,
|
||||
mp11::mp_take_c<ToList,mp11::mp_size<FromList>::value>
|
||||
>
|
||||
>
|
||||
{};
|
||||
|
||||
template<typename... Ts>
|
||||
struct augmented_stdtuple:std::tuple<Ts...>
|
||||
{
|
||||
private:
|
||||
using super=std::tuple<Ts...>;
|
||||
static constexpr std::size_t N=sizeof...(Ts);
|
||||
|
||||
template<typename... Args>
|
||||
using are_convertible_to_crefs=
|
||||
typename detail::are_convertible_to_crefs<mp11::mp_list<Args...>,super>;
|
||||
|
||||
struct boost_tuple_too_short{};
|
||||
using boost_tuple_arg=mp11::mp_eval_if_c<
|
||||
(mp11::mp_size<boost::tuple<>>::value < N),
|
||||
boost_tuple_too_short,
|
||||
boost::tuple,Ts...
|
||||
>;
|
||||
|
||||
struct full_args_ctor{};
|
||||
augmented_stdtuple(full_args_ctor,const Ts&... args):super(args...){}
|
||||
|
||||
struct partial_args_ctor{};
|
||||
template<std::size_t... Is,typename... Args>
|
||||
augmented_stdtuple(
|
||||
partial_args_ctor,mp11::index_sequence<Is...>,Args&&... args):
|
||||
augmented_stdtuple(
|
||||
full_args_ctor{},
|
||||
std::forward<Args>(args)...,
|
||||
typename std::tuple_element<sizeof...(Args)+Is,super>::type()...)
|
||||
{}
|
||||
|
||||
struct boost_tuple_ctor{};
|
||||
template<std::size_t... Is>
|
||||
augmented_stdtuple(
|
||||
boost_tuple_ctor,mp11::index_sequence<Is...>,const boost_tuple_arg& x):
|
||||
super(tuples::get<Is>(x)...)
|
||||
{}
|
||||
|
||||
public:
|
||||
template<
|
||||
typename... Args,
|
||||
typename std::enable_if<
|
||||
are_convertible_to_crefs<Args&&...>::value
|
||||
>::type* =nullptr
|
||||
>
|
||||
augmented_stdtuple(Args&&... args):
|
||||
augmented_stdtuple(
|
||||
partial_args_ctor(),mp11::make_index_sequence<N-sizeof...(Args)>(),
|
||||
std::forward<Args>(args)...)
|
||||
{}
|
||||
|
||||
augmented_stdtuple(const super& x):super(x){}
|
||||
|
||||
augmented_stdtuple(const boost_tuple_arg& x):
|
||||
augmented_stdtuple(
|
||||
boost_tuple_ctor(),mp11::make_index_sequence<N>(),x)
|
||||
{}
|
||||
};
|
||||
|
||||
} /* namespace multi_index::detail */
|
||||
|
||||
} /* namespace multi_index */
|
||||
|
||||
} /* namespace boost */
|
||||
|
||||
#endif
|
||||
@@ -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 <boost/config.hpp> /* keep it first to prevent nasty warns in MSVC */
|
||||
#include <algorithm>
|
||||
#include <boost/core/noncopyable.hpp>
|
||||
#include <boost/core/allocator_access.hpp>
|
||||
#include <boost/multi_index/detail/adl_swap.hpp>
|
||||
#include <boost/multi_index/detail/allocator_traits.hpp>
|
||||
#include <boost/type_traits/integral_constant.hpp>
|
||||
#include <memory>
|
||||
|
||||
@@ -46,18 +46,15 @@ namespace detail{
|
||||
template<typename T,typename Allocator=std::allocator<T> >
|
||||
struct auto_space:private noncopyable
|
||||
{
|
||||
typedef typename rebind_alloc_for<
|
||||
Allocator,T>
|
||||
::type allocator;
|
||||
typedef allocator_traits<allocator> alloc_traits;
|
||||
typedef typename alloc_traits::pointer pointer;
|
||||
typedef typename alloc_traits::size_type size_type;
|
||||
typedef allocator_rebind_t<Allocator,T> allocator;
|
||||
typedef allocator_pointer_t<allocator> pointer;
|
||||
typedef allocator_size_type_t<allocator> 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<allocator>::value>());
|
||||
}
|
||||
|
||||
void swap(auto_space& x,boost::true_type /* swap_allocators */)
|
||||
|
||||
@@ -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,10 +14,9 @@
|
||||
#endif
|
||||
|
||||
#include <boost/config.hpp> /* keep it first to prevent nasty warns in MSVC */
|
||||
#include <boost/detail/workaround.hpp>
|
||||
#include <boost/mpl/at.hpp>
|
||||
#include <boost/mpl/apply.hpp>
|
||||
#include <boost/mpl/size.hpp>
|
||||
#include <boost/mp11/integral.hpp>
|
||||
#include <boost/mp11/list.hpp>
|
||||
#include <boost/mp11/utility.hpp>
|
||||
#include <boost/multi_index/detail/index_base.hpp>
|
||||
#include <boost/multi_index/detail/is_index_list.hpp>
|
||||
#include <boost/static_assert.hpp>
|
||||
@@ -28,39 +27,31 @@ namespace multi_index{
|
||||
|
||||
namespace detail{
|
||||
|
||||
/* MPL machinery to construct a linear hierarchy of indices out of
|
||||
* a index list.
|
||||
/* Mp11 machinery to construct a linear hierarchy of indices out of
|
||||
* an index list.
|
||||
*/
|
||||
|
||||
struct index_applier
|
||||
{
|
||||
template<typename IndexSpecifierMeta,typename SuperMeta>
|
||||
struct apply
|
||||
{
|
||||
typedef typename IndexSpecifierMeta::type index_specifier;
|
||||
typedef typename index_specifier::
|
||||
BOOST_NESTED_TEMPLATE index_class<SuperMeta>::type type;
|
||||
};
|
||||
};
|
||||
template<typename N,typename Mp11IndexSpecifierList,typename SuperMeta>
|
||||
using nth_layer_index=typename mp11::mp_at<Mp11IndexSpecifierList,N>::
|
||||
template index_class<SuperMeta>::type;
|
||||
|
||||
template<int N,typename Value,typename IndexSpecifierList,typename Allocator>
|
||||
struct nth_layer
|
||||
{
|
||||
BOOST_STATIC_CONSTANT(int,length=mpl::size<IndexSpecifierList>::value);
|
||||
|
||||
typedef typename mpl::eval_if_c<
|
||||
N==length,
|
||||
mpl::identity<index_base<Value,IndexSpecifierList,Allocator> >,
|
||||
mpl::apply2<
|
||||
index_applier,
|
||||
mpl::at_c<IndexSpecifierList,N>,
|
||||
nth_layer<N+1,Value,IndexSpecifierList,Allocator>
|
||||
>
|
||||
>::type type;
|
||||
using Mp11IndexSpecifierList=detail::mp11_index_list<IndexSpecifierList>;
|
||||
using type=mp11::mp_eval_if_c<
|
||||
N==mp11::mp_size<Mp11IndexSpecifierList>::value,
|
||||
index_base<Value,IndexSpecifierList,Allocator>,
|
||||
nth_layer_index,
|
||||
mp11::mp_int<N>,
|
||||
Mp11IndexSpecifierList,
|
||||
nth_layer<N+1,Value,IndexSpecifierList,Allocator>
|
||||
>;
|
||||
};
|
||||
|
||||
template<typename Value,typename IndexSpecifierList,typename Allocator>
|
||||
struct multi_index_base_type:nth_layer<0,Value,IndexSpecifierList,Allocator>
|
||||
struct multi_index_base_type:
|
||||
nth_layer<0,Value,IndexSpecifierList,Allocator>
|
||||
{
|
||||
BOOST_STATIC_ASSERT(detail::is_index_list<IndexSpecifierList>::value);
|
||||
};
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright 2003-2023 Joaquin M Lopez Munoz.
|
||||
/* Copyright 2003-2026 Joaquin M Lopez Munoz.
|
||||
* Distributed under the Boost Software License, Version 1.0.
|
||||
* (See accompanying file LICENSE_1_0.txt or copy at
|
||||
* http://www.boost.org/LICENSE_1_0.txt)
|
||||
@@ -14,6 +14,7 @@
|
||||
#endif
|
||||
|
||||
#include <boost/config.hpp> /* keep it first to prevent nasty warns in MSVC */
|
||||
#include <boost/multi_index/detail/raw_ptr.hpp>
|
||||
#include <boost/operators.hpp>
|
||||
|
||||
#if !defined(BOOST_MULTI_INDEX_DISABLE_SERIALIZATION)
|
||||
@@ -77,7 +78,7 @@ public:
|
||||
template<class Archive>
|
||||
void save(Archive& ar,const unsigned int)const
|
||||
{
|
||||
node_base_type* bnode=node;
|
||||
node_base_type* bnode=get_node();
|
||||
ar<<core::make_nvp("pointer",bnode);
|
||||
}
|
||||
|
||||
@@ -86,7 +87,7 @@ public:
|
||||
{
|
||||
node_base_type* bnode;
|
||||
ar>>core::make_nvp("pointer",bnode);
|
||||
node=static_cast<Node*>(bnode);
|
||||
node=typename Node::pointer(static_cast<Node*>(bnode));
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -94,10 +95,10 @@ public:
|
||||
|
||||
typedef Node node_type;
|
||||
|
||||
Node* get_node()const{return node;}
|
||||
Node* get_node()const{return raw_ptr<Node*>(node);}
|
||||
|
||||
private:
|
||||
Node* node;
|
||||
typename Node::pointer node;
|
||||
};
|
||||
|
||||
template<typename Node>
|
||||
|
||||
@@ -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 <boost/config.hpp> /* keep it first to prevent nasty warns in MSVC */
|
||||
#include <algorithm>
|
||||
#include <boost/core/allocator_access.hpp>
|
||||
#include <boost/core/noncopyable.hpp>
|
||||
#include <boost/multi_index/detail/allocator_traits.hpp>
|
||||
#include <boost/multi_index/detail/auto_space.hpp>
|
||||
#include <boost/multi_index/detail/hash_index_node.hpp>
|
||||
#include <boost/preprocessor/repetition/repeat.hpp>
|
||||
@@ -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:
|
||||
@@ -224,12 +224,8 @@ void swap(bucket_array<Allocator>& x,bucket_array<Allocator>& y)
|
||||
* somehow invalid archive.
|
||||
*/
|
||||
|
||||
#if defined(BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP)
|
||||
namespace serialization{
|
||||
#else
|
||||
namespace multi_index{
|
||||
namespace detail{
|
||||
#endif
|
||||
|
||||
template<class Archive,typename Allocator>
|
||||
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
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright 2003-2014 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 <boost/config.hpp> /* keep it first to prevent nasty warns in MSVC */
|
||||
#include <boost/mpl/if.hpp>
|
||||
#include <boost/mp11/utility.hpp>
|
||||
#include <boost/tuple/tuple.hpp>
|
||||
#include <tuple>
|
||||
|
||||
@@ -55,11 +55,11 @@ struct cons_stdtuple_ctor_normal
|
||||
|
||||
template<typename StdTuple,std::size_t N=0>
|
||||
struct cons_stdtuple_ctor:
|
||||
boost::mpl::if_c<
|
||||
mp11::mp_if_c<
|
||||
N<std::tuple_size<StdTuple>::value,
|
||||
cons_stdtuple_ctor_normal<StdTuple,N>,
|
||||
cons_stdtuple_ctor_terminal
|
||||
>::type
|
||||
>
|
||||
{};
|
||||
|
||||
template<typename StdTuple,std::size_t N>
|
||||
|
||||
@@ -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,14 +16,13 @@
|
||||
#include <boost/config.hpp> /* keep it first to prevent nasty warns in MSVC */
|
||||
#include <algorithm>
|
||||
#include <boost/core/addressof.hpp>
|
||||
#include <boost/core/allocator_access.hpp>
|
||||
#include <boost/core/no_exceptions_support.hpp>
|
||||
#include <boost/core/noncopyable.hpp>
|
||||
#include <boost/move/core.hpp>
|
||||
#include <boost/move/utility_core.hpp>
|
||||
#include <boost/multi_index/detail/allocator_traits.hpp>
|
||||
#include <boost/multi_index/detail/auto_space.hpp>
|
||||
#include <boost/multi_index/detail/raw_ptr.hpp>
|
||||
#include <functional>
|
||||
#include <utility>
|
||||
|
||||
namespace boost{
|
||||
|
||||
@@ -66,21 +65,18 @@ struct copy_map_value_copier
|
||||
struct copy_map_value_mover
|
||||
{
|
||||
template<typename Value>
|
||||
BOOST_RV_REF(Value) operator()(Value& x)const{return boost::move(x);}
|
||||
Value&& operator()(Value& x)const{return std::move(x);}
|
||||
};
|
||||
|
||||
template <typename Node,typename Allocator>
|
||||
class copy_map:private noncopyable
|
||||
{
|
||||
typedef typename rebind_alloc_for<
|
||||
Allocator,Node
|
||||
>::type allocator_type;
|
||||
typedef allocator_traits<allocator_type> alloc_traits;
|
||||
typedef typename alloc_traits::pointer pointer;
|
||||
typedef allocator_rebind_t<Allocator,Node> allocator_type;
|
||||
typedef allocator_pointer_t<allocator_type> pointer;
|
||||
|
||||
public:
|
||||
typedef const copy_map_entry<Node>* const_iterator;
|
||||
typedef typename alloc_traits::size_type size_type;
|
||||
typedef const copy_map_entry<Node>* const_iterator;
|
||||
typedef allocator_size_type_t<allocator_type> size_type;
|
||||
|
||||
copy_map(
|
||||
const Allocator& al,size_type size,Node* header_org,Node* header_cpy):
|
||||
@@ -92,7 +88,7 @@ public:
|
||||
{
|
||||
if(!released){
|
||||
for(size_type i=0;i<n;++i){
|
||||
alloc_traits::destroy(
|
||||
allocator_destroy(
|
||||
al_,boost::addressof((spc.data()+i)->second->value()));
|
||||
deallocate((spc.data()+i)->second);
|
||||
}
|
||||
@@ -128,12 +124,12 @@ private:
|
||||
|
||||
pointer allocate()
|
||||
{
|
||||
return alloc_traits::allocate(al_,1);
|
||||
return allocator_allocate(al_,1);
|
||||
}
|
||||
|
||||
void deallocate(Node* node)
|
||||
{
|
||||
alloc_traits::deallocate(al_,static_cast<pointer>(node),1);
|
||||
allocator_deallocate(al_,static_cast<pointer>(node),1);
|
||||
}
|
||||
|
||||
template<typename ValueAccess>
|
||||
@@ -142,7 +138,7 @@ private:
|
||||
(spc.data()+n)->first=node;
|
||||
(spc.data()+n)->second=raw_ptr<Node*>(allocate());
|
||||
BOOST_TRY{
|
||||
alloc_traits::construct(
|
||||
allocator_construct(
|
||||
al_,boost::addressof((spc.data()+n)->second->value()),
|
||||
access(node->value()));
|
||||
}
|
||||
|
||||
@@ -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,7 @@
|
||||
#endif
|
||||
|
||||
#include <boost/config.hpp> /* keep it first to prevent nasty warns in MSVC */
|
||||
#include <boost/mpl/contains.hpp>
|
||||
#include <boost/mp11/algorithm.hpp>
|
||||
|
||||
namespace boost{
|
||||
|
||||
@@ -28,9 +28,7 @@ template<typename Tag>
|
||||
struct has_tag
|
||||
{
|
||||
template<typename Index>
|
||||
struct apply:mpl::contains<BOOST_DEDUCED_TYPENAME Index::tag_list,Tag>
|
||||
{
|
||||
};
|
||||
using fn=mp11::mp_contains<typename Index::tag_list,Tag>;
|
||||
};
|
||||
|
||||
} /* namespace multi_index::detail */
|
||||
@@ -39,4 +37,4 @@ struct has_tag
|
||||
|
||||
} /* namespace boost */
|
||||
|
||||
#endif
|
||||
#endif
|
||||
@@ -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)
|
||||
@@ -15,14 +15,12 @@
|
||||
|
||||
#include <boost/config.hpp> /* keep it first to prevent nasty warns in MSVC */
|
||||
#include <boost/container_hash/hash.hpp>
|
||||
#include <boost/mpl/aux_/na.hpp>
|
||||
#include <boost/mpl/eval_if.hpp>
|
||||
#include <boost/mpl/identity.hpp>
|
||||
#include <boost/mpl/if.hpp>
|
||||
#include <boost/mp11/utility.hpp>
|
||||
#include <boost/multi_index/tag.hpp>
|
||||
#include <boost/static_assert.hpp>
|
||||
#include <boost/type_traits/is_same.hpp>
|
||||
#include <functional>
|
||||
#include <type_traits>
|
||||
|
||||
namespace boost{
|
||||
|
||||
@@ -46,54 +44,44 @@ namespace detail{
|
||||
* argument-dependent polymorphism.
|
||||
*/
|
||||
|
||||
template<typename KeyFromValue>
|
||||
struct index_args_default_hash
|
||||
{
|
||||
typedef ::boost::hash<typename KeyFromValue::result_type> type;
|
||||
};
|
||||
|
||||
template<typename KeyFromValue>
|
||||
struct index_args_default_pred
|
||||
{
|
||||
typedef std::equal_to<typename KeyFromValue::result_type> type;
|
||||
};
|
||||
|
||||
template<typename Arg1,typename Arg2,typename Arg3,typename Arg4>
|
||||
struct hashed_index_args
|
||||
{
|
||||
typedef is_tag<Arg1> full_form;
|
||||
|
||||
typedef typename mpl::if_<
|
||||
typedef mp11::mp_if<
|
||||
full_form,
|
||||
Arg1,
|
||||
tag< > >::type tag_list_type;
|
||||
typedef typename mpl::if_<
|
||||
tag< > > tag_list_type;
|
||||
typedef mp11::mp_if<
|
||||
full_form,
|
||||
Arg2,
|
||||
Arg1>::type key_from_value_type;
|
||||
typedef typename mpl::if_<
|
||||
Arg1> key_from_value_type;
|
||||
typedef mp11::mp_if<
|
||||
full_form,
|
||||
Arg3,
|
||||
Arg2>::type supplied_hash_type;
|
||||
typedef typename mpl::eval_if<
|
||||
mpl::is_na<supplied_hash_type>,
|
||||
index_args_default_hash<key_from_value_type>,
|
||||
mpl::identity<supplied_hash_type>
|
||||
>::type hash_type;
|
||||
typedef typename mpl::if_<
|
||||
Arg2> supplied_hash_type;
|
||||
typedef mp11::mp_eval_if_c<
|
||||
!std::is_void<supplied_hash_type>::value,
|
||||
supplied_hash_type,
|
||||
boost::hash,
|
||||
typename key_from_value_type::result_type
|
||||
> hash_type;
|
||||
typedef mp11::mp_if<
|
||||
full_form,
|
||||
Arg4,
|
||||
Arg3>::type supplied_pred_type;
|
||||
typedef typename mpl::eval_if<
|
||||
mpl::is_na<supplied_pred_type>,
|
||||
index_args_default_pred<key_from_value_type>,
|
||||
mpl::identity<supplied_pred_type>
|
||||
>::type pred_type;
|
||||
Arg3> supplied_pred_type;
|
||||
typedef mp11::mp_eval_if_c<
|
||||
!std::is_void<supplied_pred_type>::value,
|
||||
supplied_pred_type,
|
||||
std::equal_to,
|
||||
typename key_from_value_type::result_type
|
||||
> pred_type;
|
||||
|
||||
BOOST_STATIC_ASSERT(is_tag<tag_list_type>::value);
|
||||
BOOST_STATIC_ASSERT(!mpl::is_na<key_from_value_type>::value);
|
||||
BOOST_STATIC_ASSERT(!mpl::is_na<hash_type>::value);
|
||||
BOOST_STATIC_ASSERT(!mpl::is_na<pred_type>::value);
|
||||
BOOST_STATIC_ASSERT(!std::is_void<key_from_value_type>::value);
|
||||
BOOST_STATIC_ASSERT(!std::is_void<hash_type>::value);
|
||||
BOOST_STATIC_ASSERT(!std::is_void<pred_type>::value);
|
||||
};
|
||||
|
||||
} /* namespace multi_index::detail */
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright 2003-2023 Joaquin M Lopez Munoz.
|
||||
/* Copyright 2003-2026 Joaquin M Lopez Munoz.
|
||||
* Distributed under the Boost Software License, Version 1.0.
|
||||
* (See accompanying file LICENSE_1_0.txt or copy at
|
||||
* http://www.boost.org/LICENSE_1_0.txt)
|
||||
@@ -14,6 +14,7 @@
|
||||
#endif
|
||||
|
||||
#include <boost/config.hpp> /* keep it first to prevent nasty warns in MSVC */
|
||||
#include <boost/multi_index/detail/raw_ptr.hpp>
|
||||
#include <boost/operators.hpp>
|
||||
|
||||
#if !defined(BOOST_MULTI_INDEX_DISABLE_SERIALIZATION)
|
||||
@@ -76,7 +77,7 @@ public:
|
||||
template<class Archive>
|
||||
void save(Archive& ar,const unsigned int)const
|
||||
{
|
||||
node_base_type* bnode=node;
|
||||
node_base_type* bnode=get_node();
|
||||
ar<<core::make_nvp("pointer",bnode);
|
||||
}
|
||||
|
||||
@@ -92,7 +93,7 @@ public:
|
||||
{
|
||||
node_base_type* bnode;
|
||||
ar>>core::make_nvp("pointer",bnode);
|
||||
node=static_cast<Node*>(bnode);
|
||||
node=typename Node::pointer(static_cast<Node*>(bnode));
|
||||
if(version<1){
|
||||
BucketArray* throw_away; /* consume unused ptr */
|
||||
ar>>core::make_nvp("pointer",throw_away);
|
||||
@@ -105,13 +106,13 @@ public:
|
||||
{
|
||||
node_base_type* bnode;
|
||||
ar>>core::make_nvp("pointer",bnode);
|
||||
node=static_cast<Node*>(bnode);
|
||||
node=typename Node::pointer(static_cast<Node*>(bnode));
|
||||
if(version<1){
|
||||
BucketArray* buckets;
|
||||
ar>>core::make_nvp("pointer",buckets);
|
||||
if(buckets&&node&&node->impl()==buckets->end()->prior()){
|
||||
if(buckets&&bnode&&node->impl()==buckets->end()->prior()){
|
||||
/* end local_iterators used to point to end node, now they are null */
|
||||
node=0;
|
||||
node=typename Node::pointer(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -121,7 +122,7 @@ public:
|
||||
|
||||
typedef Node node_type;
|
||||
|
||||
Node* get_node()const{return node;}
|
||||
Node* get_node()const{return raw_ptr<Node*>(node);}
|
||||
|
||||
private:
|
||||
|
||||
@@ -135,7 +136,7 @@ private:
|
||||
Node::template increment_local<IndexCategory>(node);
|
||||
}
|
||||
|
||||
Node* node;
|
||||
typename Node::pointer node;
|
||||
};
|
||||
|
||||
template<
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright 2003-2020 Joaquin M Lopez Munoz.
|
||||
/* Copyright 2003-2026 Joaquin M Lopez Munoz.
|
||||
* Distributed under the Boost Software License, Version 1.0.
|
||||
* (See accompanying file LICENSE_1_0.txt or copy at
|
||||
* http://www.boost.org/LICENSE_1_0.txt)
|
||||
@@ -14,7 +14,7 @@
|
||||
#endif
|
||||
|
||||
#include <boost/config.hpp> /* keep it first to prevent nasty warns in MSVC */
|
||||
#include <boost/multi_index/detail/allocator_traits.hpp>
|
||||
#include <boost/core/allocator_access.hpp>
|
||||
#include <boost/multi_index/detail/raw_ptr.hpp>
|
||||
#include <utility>
|
||||
|
||||
@@ -99,19 +99,17 @@ struct hashed_index_node_impl;
|
||||
template<typename Allocator>
|
||||
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<Allocator>
|
||||
>::type node_allocator;
|
||||
typedef allocator_traits<base_allocator> base_alloc_traits;
|
||||
typedef allocator_traits<node_allocator> 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_allocator> base_pointer;
|
||||
typedef allocator_const_pointer_t<base_allocator> const_base_pointer;
|
||||
typedef allocator_pointer_t<node_allocator> 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_;}
|
||||
@@ -689,14 +687,14 @@ private:
|
||||
template<typename Super>
|
||||
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_allocator_type> impl_type;
|
||||
};
|
||||
|
||||
@@ -714,6 +712,13 @@ public:
|
||||
typedef typename trampoline::pointer impl_pointer;
|
||||
typedef typename trampoline::const_pointer const_impl_pointer;
|
||||
typedef typename trampoline::difference_type difference_type;
|
||||
typedef allocator_rebind_t<
|
||||
typename trampoline::impl_allocator_type,
|
||||
hashed_index_node> final_allocator_type;
|
||||
typedef allocator_pointer_t<
|
||||
final_allocator_type> pointer;
|
||||
typedef allocator_const_pointer_t<
|
||||
final_allocator_type> const_pointer;
|
||||
|
||||
template<typename Category>
|
||||
struct node_alg{
|
||||
@@ -756,15 +761,15 @@ public:
|
||||
/* interoperability with hashed_index_iterator */
|
||||
|
||||
template<typename Category>
|
||||
static void increment(hashed_index_node*& x)
|
||||
static void increment(pointer& x)
|
||||
{
|
||||
x=from_impl(node_alg<Category>::type::after(x->impl()));
|
||||
x=pointer(from_impl(node_alg<Category>::type::after(x->impl())));
|
||||
}
|
||||
|
||||
template<typename Category>
|
||||
static void increment_local(hashed_index_node*& x)
|
||||
static void increment_local(pointer& x)
|
||||
{
|
||||
x=from_impl(node_alg<Category>::type::after_local(x->impl()));
|
||||
x=pointer(from_impl(node_alg<Category>::type::after_local(x->impl())));
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -14,8 +14,8 @@
|
||||
#endif
|
||||
|
||||
#include <boost/config.hpp> /* keep it first to prevent nasty warns in MSVC */
|
||||
#include <boost/mpl/if.hpp>
|
||||
#include <boost/mpl/size.hpp>
|
||||
#include <boost/mp11/list.hpp>
|
||||
#include <boost/mp11/utility.hpp>
|
||||
#include <boost/multi_index_container_fwd.hpp>
|
||||
|
||||
namespace boost{
|
||||
@@ -53,20 +53,17 @@ struct index_access_sequence_normal
|
||||
};
|
||||
|
||||
template<typename MultiIndexContainer,int N>
|
||||
struct index_access_sequence_base:
|
||||
mpl::if_c<
|
||||
N<mpl::size<typename MultiIndexContainer::index_type_list>::type::value,
|
||||
index_access_sequence_normal<MultiIndexContainer,N>,
|
||||
index_access_sequence_terminal
|
||||
>
|
||||
{};
|
||||
using index_access_sequence_base=mp11::mp_if_c<
|
||||
N<mp11::mp_size<typename MultiIndexContainer::index_type_list>::value,
|
||||
index_access_sequence_normal<MultiIndexContainer,N>,
|
||||
index_access_sequence_terminal
|
||||
>;
|
||||
|
||||
template<typename MultiIndexContainer,int N>
|
||||
struct index_access_sequence:
|
||||
index_access_sequence_base<MultiIndexContainer,N>::type
|
||||
struct index_access_sequence:index_access_sequence_base<MultiIndexContainer,N>
|
||||
{
|
||||
typedef typename index_access_sequence_base<
|
||||
MultiIndexContainer,N>::type super;
|
||||
typedef index_access_sequence_base<
|
||||
MultiIndexContainer,N> super;
|
||||
|
||||
index_access_sequence(MultiIndexContainer* p):super(p){}
|
||||
};
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright 2003-2021 Joaquin M Lopez Munoz.
|
||||
/* Copyright 2003-2026 Joaquin M Lopez Munoz.
|
||||
* Distributed under the Boost Software License, Version 1.0.
|
||||
* (See accompanying file LICENSE_1_0.txt or copy at
|
||||
* http://www.boost.org/LICENSE_1_0.txt)
|
||||
@@ -15,17 +15,14 @@
|
||||
|
||||
#include <boost/config.hpp> /* keep it first to prevent nasty warns in MSVC */
|
||||
#include <boost/core/addressof.hpp>
|
||||
#include <boost/core/allocator_access.hpp>
|
||||
#include <boost/core/no_exceptions_support.hpp>
|
||||
#include <boost/detail/workaround.hpp>
|
||||
#include <boost/move/utility_core.hpp>
|
||||
#include <boost/mpl/vector.hpp>
|
||||
#include <boost/multi_index/detail/allocator_traits.hpp>
|
||||
#include <boost/multi_index/detail/copy_map.hpp>
|
||||
#include <boost/multi_index/detail/do_not_copy_elements_tag.hpp>
|
||||
#include <boost/multi_index/detail/index_access_sequence.hpp>
|
||||
#include <boost/multi_index/detail/node_handle.hpp>
|
||||
#include <boost/multi_index/detail/node_type.hpp>
|
||||
#include <boost/multi_index/detail/vartempl_support.hpp>
|
||||
#include <boost/multi_index/detail/type_list.hpp>
|
||||
#include <boost/multi_index_container_fwd.hpp>
|
||||
#include <boost/tuple/tuple.hpp>
|
||||
#include <utility>
|
||||
@@ -63,14 +60,12 @@ protected:
|
||||
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 mpl::vector0<> index_type_list;
|
||||
typedef mpl::vector0<> iterator_type_list;
|
||||
typedef mpl::vector0<> const_iterator_type_list;
|
||||
typedef empty_type_list index_type_list;
|
||||
typedef empty_type_list iterator_type_list;
|
||||
typedef empty_type_list const_iterator_type_list;
|
||||
typedef copy_map<
|
||||
final_node_type,
|
||||
final_allocator_type> copy_map_type;
|
||||
@@ -87,14 +82,19 @@ protected:
|
||||
|
||||
private:
|
||||
typedef Value value_type;
|
||||
typedef allocator_traits<Allocator> alloc_traits;
|
||||
typedef typename alloc_traits::size_type size_type;
|
||||
typedef allocator_size_type_t<Allocator> size_type;
|
||||
|
||||
protected:
|
||||
explicit index_base(const ctor_args_list&,const Allocator&){}
|
||||
explicit index_base(
|
||||
const ctor_args_list&,const Allocator&,index_node_type*){}
|
||||
|
||||
index_base(
|
||||
const index_base<Value,IndexSpecifierList,Allocator>&,
|
||||
const Allocator&,index_node_type*){}
|
||||
|
||||
index_base(
|
||||
const index_base<Value,IndexSpecifierList,Allocator>&,
|
||||
const Allocator&,index_node_type*,
|
||||
do_not_copy_elements_tag)
|
||||
{}
|
||||
|
||||
@@ -120,7 +120,7 @@ protected:
|
||||
{
|
||||
x=final().allocate_node();
|
||||
BOOST_TRY{
|
||||
final().construct_value(x,boost::move(const_cast<value_type&>(v)));
|
||||
final().construct_value(x,std::move(const_cast<value_type&>(v)));
|
||||
}
|
||||
BOOST_CATCH(...){
|
||||
final().deallocate_node(x);
|
||||
@@ -183,7 +183,7 @@ protected:
|
||||
|
||||
bool replace_(const value_type& v,index_node_type* x,rvalue_tag)
|
||||
{
|
||||
x->value()=boost::move(const_cast<value_type&>(v));
|
||||
x->value()=std::move(const_cast<value_type&>(v));
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -241,11 +241,10 @@ protected:
|
||||
std::pair<final_node_type*,bool> final_transfer_(Index& x,final_node_type* n)
|
||||
{return final().transfer_(x,n);}
|
||||
|
||||
template<BOOST_MULTI_INDEX_TEMPLATE_PARAM_PACK>
|
||||
std::pair<final_node_type*,bool> final_emplace_(
|
||||
BOOST_MULTI_INDEX_FUNCTION_PARAM_PACK)
|
||||
template<typename... Args>
|
||||
std::pair<final_node_type*,bool> final_emplace_(Args&&... args)
|
||||
{
|
||||
return final().emplace_(BOOST_MULTI_INDEX_FORWARD_PARAM_PACK);
|
||||
return final().emplace_(std::forward<Args>(args)...);
|
||||
}
|
||||
|
||||
std::pair<final_node_type*,bool> final_insert_(
|
||||
@@ -266,12 +265,11 @@ protected:
|
||||
final_node_handle_type& nh,final_node_type* position)
|
||||
{return final().insert_nh_(nh,position);}
|
||||
|
||||
template<BOOST_MULTI_INDEX_TEMPLATE_PARAM_PACK>
|
||||
template<typename... Args>
|
||||
std::pair<final_node_type*,bool> 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>(args)...);
|
||||
}
|
||||
|
||||
final_node_handle_type final_extract_(final_node_type* x)
|
||||
@@ -294,8 +292,8 @@ protected:
|
||||
template<typename Index>
|
||||
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);}
|
||||
|
||||
@@ -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<class Archive,typename Value,typename Allocator>
|
||||
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
|
||||
|
||||
|
||||
@@ -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 <boost/config.hpp> /* keep it first to prevent nasty warns in MSVC */
|
||||
#include <boost/detail/workaround.hpp>
|
||||
|
||||
#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<void() const> fails,
|
||||
* https://bugs.llvm.org/show_bug.cgi?id=20084
|
||||
|
||||
@@ -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,8 +14,46 @@
|
||||
#endif
|
||||
|
||||
#include <boost/config.hpp> /* keep it first to prevent nasty warns in MSVC */
|
||||
#include <boost/mpl/empty.hpp>
|
||||
#include <boost/mpl/is_sequence.hpp>
|
||||
|
||||
#if defined(BOOST_MULTI_INDEX_ENABLE_MPL_SUPPORT)
|
||||
#include <boost/multi_index/detail/mpl_to_mp11_list.hpp>
|
||||
#define BOOST_MULTI_INDEX_BLOCK_BOOSTDEP_HEADER \
|
||||
<boost/mpl/empty.hpp>
|
||||
#include BOOST_MULTI_INDEX_BLOCK_BOOSTDEP_HEADER
|
||||
#undef BOOST_MULTI_INDEX_BLOCK_BOOSTDEP_HEADER
|
||||
#define BOOST_MULTI_INDEX_BLOCK_BOOSTDEP_HEADER \
|
||||
<boost/mpl/is_sequence.hpp>
|
||||
#include BOOST_MULTI_INDEX_BLOCK_BOOSTDEP_HEADER
|
||||
#undef BOOST_MULTI_INDEX_BLOCK_BOOSTDEP_HEADER
|
||||
#include <type_traits>
|
||||
|
||||
namespace boost{
|
||||
|
||||
namespace multi_index{
|
||||
|
||||
namespace detail{
|
||||
|
||||
/* an index list is a non-empty MPL sequence */
|
||||
|
||||
template<typename T>
|
||||
struct is_index_list
|
||||
{
|
||||
BOOST_STATIC_CONSTANT(bool,mpl_sequence=mpl::is_sequence<T>::value);
|
||||
BOOST_STATIC_CONSTANT(bool,non_empty=!(std::conditional<
|
||||
mpl_sequence,mpl::empty<T>,std::false_type>::type::value));
|
||||
BOOST_STATIC_CONSTANT(bool,value=mpl_sequence&&non_empty);
|
||||
};
|
||||
|
||||
template<typename IndexList>
|
||||
using mp11_index_list=mpl_to_mp11_list<IndexList>;
|
||||
|
||||
} /* namespace multi_index::detail */
|
||||
|
||||
} /* namespace multi_index */
|
||||
|
||||
} /* namespace boost */
|
||||
#else
|
||||
#include <type_traits>
|
||||
|
||||
namespace boost{
|
||||
|
||||
@@ -24,17 +62,19 @@ namespace multi_index{
|
||||
namespace detail{
|
||||
|
||||
template<typename T>
|
||||
struct is_index_list
|
||||
{
|
||||
BOOST_STATIC_CONSTANT(bool,mpl_sequence=mpl::is_sequence<T>::value);
|
||||
BOOST_STATIC_CONSTANT(bool,non_empty=!mpl::empty<T>::value);
|
||||
BOOST_STATIC_CONSTANT(bool,value=mpl_sequence&&non_empty);
|
||||
};
|
||||
struct is_index_list:std::false_type{};
|
||||
|
||||
/* an index list is a non-empty Mp11 list */
|
||||
template<template<typename...> class L,typename T,typename... Ts>
|
||||
struct is_index_list<L<T,Ts...>>:std::true_type{};
|
||||
|
||||
template<typename IndexList>
|
||||
using mp11_index_list=IndexList;
|
||||
|
||||
} /* namespace multi_index::detail */
|
||||
|
||||
} /* namespace multi_index */
|
||||
|
||||
} /* namespace boost */
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@@ -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,8 +14,8 @@
|
||||
#endif
|
||||
|
||||
#include <boost/config.hpp> /* keep it first to prevent nasty warns in MSVC */
|
||||
#include <boost/mpl/bool.hpp>
|
||||
#include <boost/type_traits/intrinsics.hpp>
|
||||
#include <type_traits>
|
||||
|
||||
namespace boost{
|
||||
|
||||
@@ -29,7 +29,7 @@ namespace detail{
|
||||
*/
|
||||
|
||||
template<typename F,typename Arg1,typename Arg2,typename=void>
|
||||
struct is_transparent:mpl::true_{};
|
||||
struct is_transparent:std::true_type{};
|
||||
|
||||
} /* namespace multi_index::detail */
|
||||
|
||||
@@ -37,14 +37,10 @@ struct is_transparent:mpl::true_{};
|
||||
|
||||
} /* namespace boost */
|
||||
|
||||
#if !defined(BOOST_NO_SFINAE)&&!defined(BOOST_NO_SFINAE_EXPR)&& \
|
||||
!defined(BOOST_NO_CXX11_DECLTYPE)&& \
|
||||
#if !defined(BOOST_NO_SFINAE_EXPR)&& \
|
||||
(defined(BOOST_NO_CXX11_FINAL)||defined(BOOST_IS_FINAL))
|
||||
|
||||
#include <boost/core/enable_if.hpp>
|
||||
#include <boost/mpl/and.hpp>
|
||||
#include <boost/mpl/not.hpp>
|
||||
#include <boost/mpl/or.hpp>
|
||||
#include <boost/type_traits/declval.hpp>
|
||||
#include <boost/type_traits/function_traits.hpp>
|
||||
#include <boost/type_traits/is_class.hpp>
|
||||
@@ -70,7 +66,7 @@ struct is_transparent_class_helper:F
|
||||
};
|
||||
|
||||
template<typename F,typename Arg1,typename Arg2,typename=void>
|
||||
struct is_transparent_class:mpl::true_{};
|
||||
struct is_transparent_class:std::true_type{};
|
||||
|
||||
template<typename F,typename Arg1,typename Arg2>
|
||||
struct is_transparent_class<
|
||||
@@ -84,38 +80,31 @@ struct is_transparent_class<
|
||||
not_is_transparent_result_type
|
||||
>
|
||||
>::type
|
||||
>:mpl::false_{};
|
||||
>:std::false_type{};
|
||||
|
||||
template<typename F,typename Arg1,typename Arg2>
|
||||
struct is_transparent<
|
||||
F,Arg1,Arg2,
|
||||
typename enable_if<
|
||||
mpl::and_<
|
||||
is_class<F>,
|
||||
mpl::not_<is_final<F> > /* is_transparent_class_helper derives from F */
|
||||
>
|
||||
typename enable_if_c<
|
||||
is_class<F>::value&&
|
||||
!is_final<F>::value /* is_transparent_class_helper derives from F */
|
||||
>::type
|
||||
>:is_transparent_class<F,Arg1,Arg2>{};
|
||||
|
||||
template<typename F,typename Arg1,typename Arg2,typename=void>
|
||||
struct is_transparent_function:mpl::true_{};
|
||||
struct is_transparent_function:std::true_type{};
|
||||
|
||||
template<typename F,typename Arg1,typename Arg2>
|
||||
struct is_transparent_function<
|
||||
F,Arg1,Arg2,
|
||||
typename enable_if<
|
||||
mpl::or_<
|
||||
mpl::not_<mpl::or_<
|
||||
is_same<typename function_traits<F>::arg1_type,const Arg1&>,
|
||||
is_same<typename function_traits<F>::arg1_type,Arg1>
|
||||
> >,
|
||||
mpl::not_<mpl::or_<
|
||||
is_same<typename function_traits<F>::arg2_type,const Arg2&>,
|
||||
is_same<typename function_traits<F>::arg2_type,Arg2>
|
||||
> >
|
||||
>
|
||||
typename enable_if_c<
|
||||
!(is_same<typename function_traits<F>::arg1_type,const Arg1&>::value||
|
||||
is_same<typename function_traits<F>::arg1_type,Arg1>::value)
|
||||
||
|
||||
!(is_same<typename function_traits<F>::arg2_type,const Arg2&>::value||
|
||||
is_same<typename function_traits<F>::arg2_type,Arg2>::value)
|
||||
>::type
|
||||
>:mpl::false_{};
|
||||
>:std::false_type{};
|
||||
|
||||
template<typename F,typename Arg1,typename Arg2>
|
||||
struct is_transparent<
|
||||
|
||||
@@ -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,7 @@
|
||||
#endif
|
||||
|
||||
#include <boost/config.hpp> /* keep it first to prevent nasty warns in MSVC */
|
||||
#include <boost/mpl/apply.hpp>
|
||||
#include <boost/mp11/utility.hpp>
|
||||
#include <boost/operators.hpp>
|
||||
|
||||
namespace boost{
|
||||
@@ -125,10 +125,7 @@ template<>
|
||||
struct iter_adaptor_selector<std::forward_iterator_tag>
|
||||
{
|
||||
template<class Derived,class Base>
|
||||
struct apply
|
||||
{
|
||||
typedef forward_iter_adaptor_base<Derived,Base> type;
|
||||
};
|
||||
using fn=forward_iter_adaptor_base<Derived,Base>;
|
||||
};
|
||||
|
||||
template<class Derived,class Base>
|
||||
@@ -183,10 +180,7 @@ template<>
|
||||
struct iter_adaptor_selector<std::bidirectional_iterator_tag>
|
||||
{
|
||||
template<class Derived,class Base>
|
||||
struct apply
|
||||
{
|
||||
typedef bidirectional_iter_adaptor_base<Derived,Base> type;
|
||||
};
|
||||
using fn=bidirectional_iter_adaptor_base<Derived,Base>;
|
||||
};
|
||||
|
||||
template<class Derived,class Base>
|
||||
@@ -283,23 +277,17 @@ template<>
|
||||
struct iter_adaptor_selector<std::random_access_iterator_tag>
|
||||
{
|
||||
template<class Derived,class Base>
|
||||
struct apply
|
||||
{
|
||||
typedef random_access_iter_adaptor_base<Derived,Base> type;
|
||||
};
|
||||
using fn=random_access_iter_adaptor_base<Derived,Base>;
|
||||
};
|
||||
|
||||
template<class Derived,class Base>
|
||||
struct iter_adaptor_base
|
||||
{
|
||||
typedef iter_adaptor_selector<
|
||||
typename Base::iterator_category> selector;
|
||||
typedef typename mpl::apply2<
|
||||
selector,Derived,Base>::type type;
|
||||
};
|
||||
using iter_adaptor_base=mp11::mp_invoke_q<
|
||||
iter_adaptor_selector<typename Base::iterator_category>,
|
||||
Derived,Base
|
||||
>;
|
||||
|
||||
template<class Derived,class Base>
|
||||
class iter_adaptor:public iter_adaptor_base<Derived,Base>::type
|
||||
class iter_adaptor:public iter_adaptor_base<Derived,Base>
|
||||
{
|
||||
protected:
|
||||
iter_adaptor(){}
|
||||
|
||||
@@ -0,0 +1,62 @@
|
||||
/* 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)
|
||||
*
|
||||
* See http://www.boost.org/libs/multi_index for library home page.
|
||||
*/
|
||||
|
||||
#ifndef BOOST_MULTI_INDEX_DETAIL_MPL_TO_MP11_LIST_HPP
|
||||
#define BOOST_MULTI_INDEX_DETAIL_MPL_TO_MP11_LIST_HPP
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
#if defined(BOOST_MULTI_INDEX_ENABLE_MPL_SUPPORT)
|
||||
#include <boost/config.hpp> /* keep it first to prevent nasty warns in MSVC */
|
||||
#include <boost/mp11/list.hpp>
|
||||
#define BOOST_MULTI_INDEX_BLOCK_BOOSTDEP_HEADER \
|
||||
<boost/mpl/begin_end.hpp>
|
||||
#include BOOST_MULTI_INDEX_BLOCK_BOOSTDEP_HEADER
|
||||
#undef BOOST_MULTI_INDEX_BLOCK_BOOSTDEP_HEADER
|
||||
#define BOOST_MULTI_INDEX_BLOCK_BOOSTDEP_HEADER \
|
||||
<boost/mpl/deref.hpp>
|
||||
#include BOOST_MULTI_INDEX_BLOCK_BOOSTDEP_HEADER
|
||||
#undef BOOST_MULTI_INDEX_BLOCK_BOOSTDEP_HEADER
|
||||
#define BOOST_MULTI_INDEX_BLOCK_BOOSTDEP_HEADER \
|
||||
<boost/mpl/next.hpp>
|
||||
#include BOOST_MULTI_INDEX_BLOCK_BOOSTDEP_HEADER
|
||||
#undef BOOST_MULTI_INDEX_BLOCK_BOOSTDEP_HEADER
|
||||
|
||||
namespace boost{
|
||||
|
||||
namespace multi_index{
|
||||
|
||||
namespace detail{
|
||||
|
||||
template<typename First,typename Last,typename... Ts>
|
||||
struct mpl_to_mp11_list_impl:mpl_to_mp11_list_impl<
|
||||
typename mpl::next<First>::type,Last,
|
||||
Ts...,typename mpl::deref<First>::type
|
||||
>{};
|
||||
|
||||
template<typename Last,typename... Ts>
|
||||
struct mpl_to_mp11_list_impl<Last,Last,Ts...>
|
||||
{
|
||||
using type=mp11::mp_list<Ts...>;
|
||||
};
|
||||
|
||||
template<typename TypeList>
|
||||
using mpl_to_mp11_list=typename mpl_to_mp11_list_impl<
|
||||
typename mpl::begin<TypeList>::type,
|
||||
typename boost::mpl::end<TypeList>::type
|
||||
>::type;
|
||||
|
||||
} /* namespace multi_index::detail */
|
||||
|
||||
} /* namespace multi_index */
|
||||
|
||||
} /* namespace boost */
|
||||
#endif
|
||||
#endif
|
||||
@@ -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,8 +14,8 @@
|
||||
#endif
|
||||
|
||||
#include <boost/config.hpp> /* keep it first to prevent nasty warns in MSVC */
|
||||
#include <boost/mpl/fold.hpp>
|
||||
#include <boost/mpl/set/set0.hpp>
|
||||
#include <boost/mp11/algorithm.hpp>
|
||||
#include <type_traits>
|
||||
|
||||
namespace boost{
|
||||
|
||||
@@ -25,68 +25,11 @@ namespace detail{
|
||||
|
||||
/* no_duplicate_tags check at compile-time that a tag list
|
||||
* has no duplicate tags.
|
||||
* The algorithm deserves some explanation: tags
|
||||
* are sequentially inserted into a mpl::set if they were
|
||||
* not already present. Due to the magic of mpl::set
|
||||
* (mpl::has_key is contant time), this operation takes linear
|
||||
* time, and even MSVC++ 6.5 handles it gracefully (other obvious
|
||||
* solutions are quadratic.)
|
||||
*/
|
||||
|
||||
struct duplicate_tag_mark{};
|
||||
|
||||
struct duplicate_tag_marker
|
||||
{
|
||||
template <typename MplSet,typename Tag>
|
||||
struct apply
|
||||
{
|
||||
typedef mpl::s_item<
|
||||
typename mpl::if_<mpl::has_key<MplSet,Tag>,duplicate_tag_mark,Tag>::type,
|
||||
MplSet
|
||||
> type;
|
||||
};
|
||||
};
|
||||
|
||||
template<typename TagList>
|
||||
struct no_duplicate_tags
|
||||
{
|
||||
typedef typename mpl::fold<
|
||||
TagList,
|
||||
mpl::set0<>,
|
||||
duplicate_tag_marker
|
||||
>::type aux;
|
||||
|
||||
BOOST_STATIC_CONSTANT(
|
||||
bool,value=!(mpl::has_key<aux,duplicate_tag_mark>::value));
|
||||
};
|
||||
|
||||
/* Variant for an index list: duplication is checked
|
||||
* across all the indices.
|
||||
*/
|
||||
|
||||
struct duplicate_tag_list_marker
|
||||
{
|
||||
template <typename MplSet,typename Index>
|
||||
struct apply:mpl::fold<
|
||||
BOOST_DEDUCED_TYPENAME Index::tag_list,
|
||||
MplSet,
|
||||
duplicate_tag_marker>
|
||||
{
|
||||
};
|
||||
};
|
||||
|
||||
template<typename IndexList>
|
||||
struct no_duplicate_tags_in_index_list
|
||||
{
|
||||
typedef typename mpl::fold<
|
||||
IndexList,
|
||||
mpl::set0<>,
|
||||
duplicate_tag_list_marker
|
||||
>::type aux;
|
||||
|
||||
BOOST_STATIC_CONSTANT(
|
||||
bool,value=!(mpl::has_key<aux,duplicate_tag_mark>::value));
|
||||
};
|
||||
using no_duplicate_tags=
|
||||
std::is_same<TagList,mp11::mp_unique<TagList>>;
|
||||
|
||||
} /* namespace multi_index::detail */
|
||||
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
/* 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)
|
||||
*
|
||||
* See http://www.boost.org/libs/multi_index for library home page.
|
||||
*/
|
||||
|
||||
#ifndef BOOST_MULTI_INDEX_DETAIL_NO_DUPLICATE_TAGS_IN_INDEX_LIST_HPP
|
||||
#define BOOST_MULTI_INDEX_DETAIL_NO_DUPLICATE_TAGS_IN_INDEX_LIST_HPP
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
#include <boost/config.hpp> /* keep it first to prevent nasty warns in MSVC */
|
||||
#include <boost/multi_index/tag.hpp>
|
||||
#include <boost/mp11/algorithm.hpp>
|
||||
#include <boost/mp11/list.hpp>
|
||||
#include <type_traits>
|
||||
|
||||
namespace boost{
|
||||
|
||||
namespace multi_index{
|
||||
|
||||
namespace detail{
|
||||
|
||||
/* checks duplication of tags across all indices of a container */
|
||||
|
||||
template<typename Index>
|
||||
using index_tag_list=mp11::mp_rename<
|
||||
mp11_tag_list<typename Index::tag_list>,mp11::mp_list>;
|
||||
|
||||
template<typename IndexList>
|
||||
using no_duplicate_tags_in_index_list=no_duplicate_tags<
|
||||
mp11::mp_flatten<mp11::mp_transform<index_tag_list,IndexList>>>;
|
||||
|
||||
} /* namespace multi_index::detail */
|
||||
|
||||
} /* namespace multi_index */
|
||||
|
||||
} /* namespace boost */
|
||||
|
||||
#endif
|
||||
@@ -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,20 +16,16 @@
|
||||
#include <boost/config.hpp> /* keep it first to prevent nasty warns in MSVC */
|
||||
#include <algorithm>
|
||||
#include <boost/core/addressof.hpp>
|
||||
#include <boost/core/allocator_access.hpp>
|
||||
#include <boost/core/enable_if.hpp>
|
||||
#include <boost/detail/workaround.hpp>
|
||||
#include <boost/move/core.hpp>
|
||||
#include <boost/move/utility_core.hpp>
|
||||
#include <boost/multi_index_container_fwd.hpp>
|
||||
#include <boost/multi_index/detail/allocator_traits.hpp>
|
||||
#include <boost/type_traits/aligned_storage.hpp>
|
||||
#include <boost/type_traits/alignment_of.hpp>
|
||||
#include <new>
|
||||
|
||||
#if !defined(BOOST_NO_SFINAE)
|
||||
#include <boost/core/enable_if.hpp>
|
||||
#include <boost/type_traits/is_const.hpp>
|
||||
#include <boost/type_traits/is_same.hpp>
|
||||
#endif
|
||||
#include <new>
|
||||
#include <utility>
|
||||
|
||||
namespace boost{
|
||||
|
||||
@@ -49,16 +45,12 @@ public:
|
||||
typedef typename Node::value_type value_type;
|
||||
typedef Allocator allocator_type;
|
||||
|
||||
private:
|
||||
typedef allocator_traits<allocator_type> alloc_traits;
|
||||
|
||||
public:
|
||||
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;
|
||||
}
|
||||
@@ -72,15 +64,16 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
node_handle& operator=(BOOST_RV_REF(node_handle) x)
|
||||
node_handle& operator=(node_handle&& x)
|
||||
{
|
||||
if(this!=&x){
|
||||
if(!empty()){
|
||||
delete_node();
|
||||
if(!x.empty()){
|
||||
BOOST_MULTI_INDEX_IF_CONSTEXPR(
|
||||
alloc_traits::propagate_on_container_move_assignment::value){
|
||||
move_assign_allocator(boost::move(x));
|
||||
allocator_propagate_on_container_move_assignment_t<
|
||||
allocator_type>::value){
|
||||
move_assign_allocator(std::move(x));
|
||||
}
|
||||
x.destroy_allocator();
|
||||
}
|
||||
@@ -89,7 +82,7 @@ public:
|
||||
}
|
||||
}
|
||||
else if(!x.empty()){
|
||||
move_construct_allocator(boost::move(x));
|
||||
move_construct_allocator(std::move(x));
|
||||
x.destroy_allocator();
|
||||
}
|
||||
node=x.node;
|
||||
@@ -115,24 +108,24 @@ public:
|
||||
|
||||
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<allocator_type>::value||
|
||||
allocator_is_always_equal_t<allocator_type>::value)
|
||||
{
|
||||
if(!empty()){
|
||||
if(!x.empty()){
|
||||
BOOST_MULTI_INDEX_IF_CONSTEXPR(
|
||||
alloc_traits::propagate_on_container_swap::value){
|
||||
allocator_propagate_on_container_swap_t<allocator_type>::value){
|
||||
using std::swap;
|
||||
swap(*allocator_ptr(),*x.allocator_ptr());
|
||||
}
|
||||
}
|
||||
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);
|
||||
@@ -145,8 +138,6 @@ public:
|
||||
}
|
||||
|
||||
private:
|
||||
BOOST_MOVABLE_BUT_NOT_COPYABLE(node_handle)
|
||||
|
||||
template <typename,typename,typename>
|
||||
friend class boost::multi_index::multi_index_container;
|
||||
|
||||
@@ -177,30 +168,27 @@ private:
|
||||
|
||||
#include <boost/multi_index/detail/restore_wstrict_aliasing.hpp>
|
||||
|
||||
void move_construct_allocator(BOOST_RV_REF(node_handle) x)
|
||||
void move_construct_allocator(node_handle&& x)
|
||||
{
|
||||
::new (static_cast<void*>(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();}
|
||||
|
||||
void delete_node()
|
||||
{
|
||||
typedef typename rebind_alloc_for<
|
||||
allocator_type,Node
|
||||
>::type node_allocator;
|
||||
typedef detail::allocator_traits<node_allocator> node_alloc_traits;
|
||||
typedef typename node_alloc_traits::pointer node_pointer;
|
||||
typedef allocator_rebind_t<allocator_type,Node> node_allocator;
|
||||
typedef allocator_pointer_t<node_allocator> 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_pointer>(node),1);
|
||||
allocator_deallocate(nal,static_cast<node_pointer>(node),1);
|
||||
}
|
||||
|
||||
Node* node;
|
||||
@@ -220,31 +208,26 @@ template<typename Iterator,typename NodeHandle>
|
||||
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 */
|
||||
|
||||
#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&& \
|
||||
@@ -252,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 */
|
||||
|
||||
@@ -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,10 +14,7 @@
|
||||
#endif
|
||||
|
||||
#include <boost/config.hpp> /* keep it first to prevent nasty warns in MSVC */
|
||||
#include <boost/detail/workaround.hpp>
|
||||
#include <boost/mpl/bind.hpp>
|
||||
#include <boost/mpl/reverse_iter_fold.hpp>
|
||||
#include <boost/mpl/deref.hpp>
|
||||
#include <boost/mp11/algorithm.hpp>
|
||||
#include <boost/multi_index_container_fwd.hpp>
|
||||
#include <boost/multi_index/detail/header_holder.hpp>
|
||||
#include <boost/multi_index/detail/index_node_base.hpp>
|
||||
@@ -30,31 +27,23 @@ namespace multi_index{
|
||||
|
||||
namespace detail{
|
||||
|
||||
/* MPL machinery to construct the internal node type associated to an
|
||||
/* Mp11 machinery to construct the internal node type associated to an
|
||||
* index list.
|
||||
*/
|
||||
|
||||
struct index_node_applier
|
||||
{
|
||||
template<typename IndexSpecifierIterator,typename Super>
|
||||
struct apply
|
||||
{
|
||||
typedef typename mpl::deref<IndexSpecifierIterator>::type index_specifier;
|
||||
typedef typename index_specifier::
|
||||
BOOST_NESTED_TEMPLATE node_class<Super>::type type;
|
||||
};
|
||||
};
|
||||
template<typename IndexSpecifier,typename Super>
|
||||
using node_type=typename IndexSpecifier::template node_class<Super>::type;
|
||||
|
||||
template<typename Value,typename IndexSpecifierList,typename Allocator>
|
||||
struct multi_index_node_type
|
||||
{
|
||||
BOOST_STATIC_ASSERT(detail::is_index_list<IndexSpecifierList>::value);
|
||||
|
||||
typedef typename mpl::reverse_iter_fold<
|
||||
IndexSpecifierList,
|
||||
typedef mp11::mp_reverse_fold<
|
||||
detail::mp11_index_list<IndexSpecifierList>,
|
||||
index_node_base<Value,Allocator>,
|
||||
mpl::bind2<index_node_applier,mpl::_2,mpl::_1>
|
||||
>::type type;
|
||||
node_type
|
||||
> type;
|
||||
};
|
||||
|
||||
} /* namespace multi_index::detail */
|
||||
|
||||
@@ -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,14 +14,11 @@
|
||||
#endif
|
||||
|
||||
#include <boost/config.hpp> /* keep it first to prevent nasty warns in MSVC */
|
||||
#include <boost/mpl/aux_/na.hpp>
|
||||
#include <boost/mpl/eval_if.hpp>
|
||||
#include <boost/mpl/identity.hpp>
|
||||
#include <boost/mpl/if.hpp>
|
||||
#include <boost/mp11/utility.hpp>
|
||||
#include <boost/multi_index/tag.hpp>
|
||||
#include <boost/static_assert.hpp>
|
||||
#include <boost/type_traits/is_same.hpp>
|
||||
#include <functional>
|
||||
#include <type_traits>
|
||||
|
||||
namespace boost{
|
||||
|
||||
@@ -40,38 +37,33 @@ namespace detail{
|
||||
* polymorphism.
|
||||
*/
|
||||
|
||||
template<typename KeyFromValue>
|
||||
struct index_args_default_compare
|
||||
{
|
||||
typedef std::less<typename KeyFromValue::result_type> type;
|
||||
};
|
||||
|
||||
template<typename Arg1,typename Arg2,typename Arg3>
|
||||
struct ordered_index_args
|
||||
{
|
||||
typedef is_tag<Arg1> full_form;
|
||||
|
||||
typedef typename mpl::if_<
|
||||
typedef mp11::mp_if<
|
||||
full_form,
|
||||
Arg1,
|
||||
tag< > >::type tag_list_type;
|
||||
typedef typename mpl::if_<
|
||||
tag< > > tag_list_type;
|
||||
typedef mp11::mp_if<
|
||||
full_form,
|
||||
Arg2,
|
||||
Arg1>::type key_from_value_type;
|
||||
typedef typename mpl::if_<
|
||||
Arg1> key_from_value_type;
|
||||
typedef mp11::mp_if<
|
||||
full_form,
|
||||
Arg3,
|
||||
Arg2>::type supplied_compare_type;
|
||||
typedef typename mpl::eval_if<
|
||||
mpl::is_na<supplied_compare_type>,
|
||||
index_args_default_compare<key_from_value_type>,
|
||||
mpl::identity<supplied_compare_type>
|
||||
>::type compare_type;
|
||||
Arg2> supplied_compare_type;
|
||||
typedef mp11::mp_eval_if_c<
|
||||
!std::is_void<supplied_compare_type>::value,
|
||||
supplied_compare_type,
|
||||
std::less,
|
||||
typename key_from_value_type::result_type
|
||||
> compare_type;
|
||||
|
||||
BOOST_STATIC_ASSERT(is_tag<tag_list_type>::value);
|
||||
BOOST_STATIC_ASSERT(!mpl::is_na<key_from_value_type>::value);
|
||||
BOOST_STATIC_ASSERT(!mpl::is_na<compare_type>::value);
|
||||
BOOST_STATIC_ASSERT(!std::is_void<key_from_value_type>::value);
|
||||
BOOST_STATIC_ASSERT(!std::is_void<compare_type>::value);
|
||||
};
|
||||
|
||||
} /* namespace multi_index::detail */
|
||||
@@ -80,4 +72,4 @@ struct ordered_index_args
|
||||
|
||||
} /* namespace boost */
|
||||
|
||||
#endif
|
||||
#endif
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright 2003-2023 Joaquin M Lopez Munoz.
|
||||
/* Copyright 2003-2026 Joaquin M Lopez Munoz.
|
||||
* Distributed under the Boost Software License, Version 1.0.
|
||||
* (See accompanying file LICENSE_1_0.txt or copy at
|
||||
* http://www.boost.org/LICENSE_1_0.txt)
|
||||
@@ -44,18 +44,11 @@
|
||||
#include <algorithm>
|
||||
#include <boost/call_traits.hpp>
|
||||
#include <boost/core/addressof.hpp>
|
||||
#include <boost/core/allocator_access.hpp>
|
||||
#include <boost/core/no_exceptions_support.hpp>
|
||||
#include <boost/core/ref.hpp>
|
||||
#include <boost/detail/workaround.hpp>
|
||||
#include <boost/iterator/reverse_iterator.hpp>
|
||||
#include <boost/move/core.hpp>
|
||||
#include <boost/move/utility_core.hpp>
|
||||
#include <boost/mpl/bool.hpp>
|
||||
#include <boost/mpl/if.hpp>
|
||||
#include <boost/mpl/push_front.hpp>
|
||||
#include <boost/multi_index/detail/access_specifier.hpp>
|
||||
#include <boost/mp11/utility.hpp>
|
||||
#include <boost/multi_index/detail/adl_swap.hpp>
|
||||
#include <boost/multi_index/detail/allocator_traits.hpp>
|
||||
#include <boost/multi_index/detail/bidir_node_iterator.hpp>
|
||||
#include <boost/multi_index/detail/do_not_copy_elements_tag.hpp>
|
||||
#include <boost/multi_index/detail/index_node_base.hpp>
|
||||
@@ -66,17 +59,16 @@
|
||||
#include <boost/multi_index/detail/ord_index_ops.hpp>
|
||||
#include <boost/multi_index/detail/safe_mode.hpp>
|
||||
#include <boost/multi_index/detail/scope_guard.hpp>
|
||||
#include <boost/multi_index/detail/type_list.hpp>
|
||||
#include <boost/multi_index/detail/unbounded.hpp>
|
||||
#include <boost/multi_index/detail/value_compare.hpp>
|
||||
#include <boost/multi_index/detail/vartempl_support.hpp>
|
||||
#include <boost/multi_index/detail/ord_index_impl_fwd.hpp>
|
||||
#include <boost/tuple/tuple.hpp>
|
||||
#include <boost/type_traits/is_same.hpp>
|
||||
#include <utility>
|
||||
|
||||
#if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST)
|
||||
#include <initializer_list>
|
||||
#endif
|
||||
#include <iterator>
|
||||
#include <type_traits>
|
||||
#include <utility>
|
||||
|
||||
#if !defined(BOOST_MULTI_INDEX_DISABLE_SERIALIZATION)
|
||||
#include <boost/bind/bind.hpp>
|
||||
@@ -130,24 +122,10 @@ 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)
|
||||
/* 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
|
||||
|
||||
#if !defined(BOOST_NO_MEMBER_TEMPLATE_FRIENDS)
|
||||
/* cross-index access */
|
||||
|
||||
template <typename,typename,typename> friend class index_base;
|
||||
#endif
|
||||
|
||||
typedef typename SuperMeta::type super;
|
||||
|
||||
@@ -181,19 +159,15 @@ public:
|
||||
#endif
|
||||
|
||||
typedef iterator const_iterator;
|
||||
|
||||
private:
|
||||
typedef allocator_traits<allocator_type> 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<allocator_type> size_type;
|
||||
typedef allocator_difference_type_t<
|
||||
allocator_type> difference_type;
|
||||
typedef allocator_pointer_t<allocator_type> pointer;
|
||||
typedef allocator_const_pointer_t<allocator_type> const_pointer;
|
||||
typedef typename
|
||||
boost::reverse_iterator<iterator> reverse_iterator;
|
||||
std::reverse_iterator<iterator> reverse_iterator;
|
||||
typedef typename
|
||||
boost::reverse_iterator<const_iterator> const_reverse_iterator;
|
||||
std::reverse_iterator<const_iterator> const_reverse_iterator;
|
||||
typedef typename super::final_node_handle_type node_type;
|
||||
typedef detail::insert_return_type<
|
||||
iterator,node_type> insert_return_type;
|
||||
@@ -204,18 +178,18 @@ protected:
|
||||
typedef tuples::cons<
|
||||
ctor_args,
|
||||
typename super::ctor_args_list> ctor_args_list;
|
||||
typedef typename mpl::push_front<
|
||||
typedef type_list_push_front<
|
||||
typename super::index_type_list,
|
||||
ordered_index<
|
||||
KeyFromValue,Compare,
|
||||
SuperMeta,TagList,Category,AugmentPolicy
|
||||
> >::type index_type_list;
|
||||
typedef typename mpl::push_front<
|
||||
>> index_type_list;
|
||||
typedef type_list_push_front<
|
||||
typename super::iterator_type_list,
|
||||
iterator>::type iterator_type_list;
|
||||
typedef typename mpl::push_front<
|
||||
iterator> iterator_type_list;
|
||||
typedef type_list_push_front<
|
||||
typename super::const_iterator_type_list,
|
||||
const_iterator>::type const_iterator_type_list;
|
||||
const_iterator> const_iterator_type_list;
|
||||
typedef typename super::copy_map_type copy_map_type;
|
||||
|
||||
#if !defined(BOOST_MULTI_INDEX_DISABLE_SERIALIZATION)
|
||||
@@ -261,13 +235,13 @@ public:
|
||||
const_iterator
|
||||
end()const BOOST_NOEXCEPT{return make_iterator(header());}
|
||||
reverse_iterator
|
||||
rbegin()BOOST_NOEXCEPT{return boost::make_reverse_iterator(end());}
|
||||
rbegin()BOOST_NOEXCEPT{return reverse_iterator{end()};}
|
||||
const_reverse_iterator
|
||||
rbegin()const BOOST_NOEXCEPT{return boost::make_reverse_iterator(end());}
|
||||
rbegin()const BOOST_NOEXCEPT{return const_reverse_iterator{end()};}
|
||||
reverse_iterator
|
||||
rend()BOOST_NOEXCEPT{return boost::make_reverse_iterator(begin());}
|
||||
rend()BOOST_NOEXCEPT{return reverse_iterator{begin()};}
|
||||
const_reverse_iterator
|
||||
rend()const BOOST_NOEXCEPT{return boost::make_reverse_iterator(begin());}
|
||||
rend()const BOOST_NOEXCEPT{return const_reverse_iterator{begin()};}
|
||||
const_iterator
|
||||
cbegin()const BOOST_NOEXCEPT{return begin();}
|
||||
const_iterator
|
||||
@@ -297,11 +271,27 @@ public:
|
||||
|
||||
/* modifiers */
|
||||
|
||||
BOOST_MULTI_INDEX_OVERLOADS_TO_VARTEMPL(
|
||||
pair_return_type,emplace,emplace_impl)
|
||||
template<typename... Args>
|
||||
std::pair<iterator,bool> emplace(Args&&... args)
|
||||
{
|
||||
BOOST_MULTI_INDEX_ORD_INDEX_CHECK_INVARIANT;
|
||||
std::pair<final_node_type*,bool>p=
|
||||
this->final_emplace_(std::forward<Args>(args)...);
|
||||
return std::pair<iterator,bool>(make_iterator(p.first),p.second);
|
||||
}
|
||||
|
||||
BOOST_MULTI_INDEX_OVERLOADS_TO_VARTEMPL_EXTRA_ARG(
|
||||
iterator,emplace_hint,emplace_hint_impl,iterator,position)
|
||||
template<typename... Args>
|
||||
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::pair<final_node_type*,bool>p=
|
||||
this->final_emplace_hint_(
|
||||
static_cast<final_node_type*>(position.get_node()),
|
||||
std::forward<Args>(args)...);
|
||||
return make_iterator(p.first);
|
||||
}
|
||||
|
||||
std::pair<iterator,bool> insert(const value_type& x)
|
||||
{
|
||||
@@ -310,7 +300,7 @@ public:
|
||||
return std::pair<iterator,bool>(make_iterator(p.first),p.second);
|
||||
}
|
||||
|
||||
std::pair<iterator,bool> insert(BOOST_RV_REF(value_type) x)
|
||||
std::pair<iterator,bool> insert(value_type&& x)
|
||||
{
|
||||
BOOST_MULTI_INDEX_ORD_INDEX_CHECK_INVARIANT;
|
||||
std::pair<final_node_type*,bool> p=this->final_insert_rv_(x);
|
||||
@@ -327,7 +317,7 @@ public:
|
||||
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);
|
||||
@@ -344,22 +334,20 @@ public:
|
||||
for(;first!=last;++first)this->final_insert_ref_(*first);
|
||||
}
|
||||
|
||||
#if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST)
|
||||
void insert(std::initializer_list<value_type> list)
|
||||
{
|
||||
insert(list.begin(),list.end());
|
||||
}
|
||||
#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<final_node_type*,bool> 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);
|
||||
@@ -433,7 +421,7 @@ public:
|
||||
x,static_cast<final_node_type*>(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);
|
||||
@@ -533,12 +521,12 @@ public:
|
||||
|
||||
template<typename Index>
|
||||
BOOST_MULTI_INDEX_ENABLE_IF_MERGEABLE(ordered_index_impl,Index,void)
|
||||
merge(BOOST_RV_REF(Index) x){merge(static_cast<Index&>(x));}
|
||||
merge(Index&& x){merge(static_cast<Index&>(x));}
|
||||
|
||||
template<typename Index>
|
||||
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);
|
||||
@@ -559,7 +547,7 @@ public:
|
||||
template<typename Index>
|
||||
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,typename Index::iterator i)
|
||||
{
|
||||
return merge(static_cast<Index&>(x),i);
|
||||
}
|
||||
@@ -568,8 +556,8 @@ public:
|
||||
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);
|
||||
@@ -586,9 +574,9 @@ public:
|
||||
template<typename Index>
|
||||
BOOST_MULTI_INDEX_ENABLE_IF_MERGEABLE(ordered_index_impl,Index,void)
|
||||
merge(
|
||||
BOOST_RV_REF(Index) x,
|
||||
BOOST_DEDUCED_TYPENAME Index::iterator first,
|
||||
BOOST_DEDUCED_TYPENAME Index::iterator last)
|
||||
Index&& x,
|
||||
typename Index::iterator first,
|
||||
typename Index::iterator last)
|
||||
{
|
||||
merge(static_cast<Index&>(x),first,last);
|
||||
}
|
||||
@@ -701,26 +689,28 @@ public:
|
||||
std::pair<iterator,iterator>
|
||||
range(LowerBounder lower,UpperBounder upper)const
|
||||
{
|
||||
typedef typename mpl::if_<
|
||||
typedef typename mp11::mp_if<
|
||||
is_same<LowerBounder,unbounded_type>,
|
||||
BOOST_DEDUCED_TYPENAME mpl::if_<
|
||||
mp11::mp_if<
|
||||
is_same<UpperBounder,unbounded_type>,
|
||||
both_unbounded_tag,
|
||||
lower_unbounded_tag
|
||||
>::type,
|
||||
BOOST_DEDUCED_TYPENAME mpl::if_<
|
||||
>,
|
||||
mp11::mp_if<
|
||||
is_same<UpperBounder,unbounded_type>,
|
||||
upper_unbounded_tag,
|
||||
none_unbounded_tag
|
||||
>::type
|
||||
>::type dispatch;
|
||||
>
|
||||
> dispatch;
|
||||
|
||||
return range(lower,upper,dispatch());
|
||||
}
|
||||
|
||||
BOOST_MULTI_INDEX_PROTECTED_IF_MEMBER_TEMPLATE_FRIENDS:
|
||||
ordered_index_impl(const ctor_args_list& args_list,const allocator_type& al):
|
||||
super(args_list.get_tail(),al),
|
||||
protected:
|
||||
ordered_index_impl(
|
||||
const ctor_args_list& args_list,
|
||||
const allocator_type& al,index_node_type* h):
|
||||
super(args_list.get_tail(),al,h),
|
||||
key(tuples::get<0>(args_list.get_head())),
|
||||
comp_(tuples::get<1>(args_list.get_head()))
|
||||
|
||||
@@ -734,8 +724,9 @@ BOOST_MULTI_INDEX_PROTECTED_IF_MEMBER_TEMPLATE_FRIENDS:
|
||||
|
||||
ordered_index_impl(
|
||||
const ordered_index_impl<
|
||||
KeyFromValue,Compare,SuperMeta,TagList,Category,AugmentPolicy>& x):
|
||||
super(x),
|
||||
KeyFromValue,Compare,SuperMeta,TagList,Category,AugmentPolicy>& x,
|
||||
const allocator_type& al,index_node_type* h):
|
||||
super(x,al,h),
|
||||
key(x.key),
|
||||
comp_(x.comp_)
|
||||
|
||||
@@ -752,8 +743,9 @@ BOOST_MULTI_INDEX_PROTECTED_IF_MEMBER_TEMPLATE_FRIENDS:
|
||||
ordered_index_impl(
|
||||
const ordered_index_impl<
|
||||
KeyFromValue,Compare,SuperMeta,TagList,Category,AugmentPolicy>& x,
|
||||
const allocator_type& al,index_node_type* h,
|
||||
do_not_copy_elements_tag):
|
||||
super(x,do_not_copy_elements_tag()),
|
||||
super(x,al,h,do_not_copy_elements_tag()),
|
||||
key(x.key),
|
||||
comp_(x.comp_)
|
||||
|
||||
@@ -1351,29 +1343,6 @@ private:
|
||||
}
|
||||
#endif
|
||||
|
||||
template<BOOST_MULTI_INDEX_TEMPLATE_PARAM_PACK>
|
||||
std::pair<iterator,bool> emplace_impl(BOOST_MULTI_INDEX_FUNCTION_PARAM_PACK)
|
||||
{
|
||||
BOOST_MULTI_INDEX_ORD_INDEX_CHECK_INVARIANT;
|
||||
std::pair<final_node_type*,bool>p=
|
||||
this->final_emplace_(BOOST_MULTI_INDEX_FORWARD_PARAM_PACK);
|
||||
return std::pair<iterator,bool>(make_iterator(p.first),p.second);
|
||||
}
|
||||
|
||||
template<BOOST_MULTI_INDEX_TEMPLATE_PARAM_PACK>
|
||||
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::pair<final_node_type*,bool>p=
|
||||
this->final_emplace_hint_(
|
||||
static_cast<final_node_type*>(position.get_node()),
|
||||
BOOST_MULTI_INDEX_FORWARD_PARAM_PACK);
|
||||
return make_iterator(p.first);
|
||||
}
|
||||
|
||||
template<typename LowerBounder,typename UpperBounder>
|
||||
std::pair<iterator,iterator>
|
||||
range(LowerBounder lower,UpperBounder upper,none_unbounded_tag)const
|
||||
@@ -1527,11 +1496,6 @@ protected: /* for the benefit of AugmentPolicy::augmented_interface */
|
||||
#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<
|
||||
@@ -1552,6 +1516,10 @@ class ordered_index:
|
||||
SuperMeta,TagList,Category,AugmentPolicy
|
||||
>
|
||||
>::type super;
|
||||
|
||||
protected:
|
||||
typedef typename super::index_node_type index_node_type;
|
||||
|
||||
public:
|
||||
typedef typename super::ctor_args_list ctor_args_list;
|
||||
typedef typename super::allocator_type allocator_type;
|
||||
@@ -1568,24 +1536,27 @@ public:
|
||||
return *this;
|
||||
}
|
||||
|
||||
#if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST)
|
||||
ordered_index& operator=(
|
||||
std::initializer_list<BOOST_DEDUCED_TYPENAME super::value_type> list)
|
||||
std::initializer_list<typename super::value_type> list)
|
||||
{
|
||||
this->final()=list;
|
||||
return *this;
|
||||
}
|
||||
#endif
|
||||
|
||||
protected:
|
||||
ordered_index(
|
||||
const ctor_args_list& args_list,const allocator_type& al):
|
||||
super(args_list,al){}
|
||||
const ctor_args_list& args_list,
|
||||
const allocator_type& al,index_node_type* h):
|
||||
super(args_list,al,h){}
|
||||
|
||||
ordered_index(const ordered_index& x):super(x){}
|
||||
ordered_index(
|
||||
const ordered_index& x,const allocator_type& al,index_node_type* h):
|
||||
super(x,al,h){}
|
||||
|
||||
ordered_index(const ordered_index& x,do_not_copy_elements_tag):
|
||||
super(x,do_not_copy_elements_tag()){}
|
||||
ordered_index(
|
||||
const ordered_index& x,const allocator_type& al,index_node_type* h,
|
||||
do_not_copy_elements_tag):
|
||||
super(x,al,h,do_not_copy_elements_tag()){}
|
||||
};
|
||||
|
||||
#if defined(BOOST_MSVC)
|
||||
@@ -1732,7 +1703,7 @@ template<
|
||||
struct is_noncopyable<
|
||||
boost::multi_index::detail::ordered_index<
|
||||
KeyFromValue,Compare,SuperMeta,TagList,Category,AugmentPolicy>
|
||||
>:boost::mpl::true_{};
|
||||
>:std::true_type{};
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright 2003-2020 Joaquin M Lopez Munoz.
|
||||
/* Copyright 2003-2026 Joaquin M Lopez Munoz.
|
||||
* Distributed under the Boost Software License, Version 1.0.
|
||||
* (See accompanying file LICENSE_1_0.txt or copy at
|
||||
* http://www.boost.org/LICENSE_1_0.txt)
|
||||
@@ -41,13 +41,12 @@
|
||||
#endif
|
||||
|
||||
#include <boost/config.hpp> /* keep it first to prevent nasty warns in MSVC */
|
||||
#include <boost/core/allocator_access.hpp>
|
||||
#include <cstddef>
|
||||
#include <boost/multi_index/detail/allocator_traits.hpp>
|
||||
#include <boost/multi_index/detail/raw_ptr.hpp>
|
||||
|
||||
#if !defined(BOOST_MULTI_INDEX_DISABLE_COMPRESSED_ORDERED_INDEX_NODES)
|
||||
#include <boost/mpl/and.hpp>
|
||||
#include <boost/mpl/if.hpp>
|
||||
#include <boost/mp11/utility.hpp>
|
||||
#include <boost/multi_index/detail/uintptr_type.hpp>
|
||||
#include <boost/type_traits/alignment_of.hpp>
|
||||
#include <boost/type_traits/is_same.hpp>
|
||||
@@ -70,15 +69,14 @@ struct ordered_index_node_impl; /* fwd decl. */
|
||||
template<typename AugmentPolicy,typename Allocator>
|
||||
struct ordered_index_node_traits
|
||||
{
|
||||
typedef typename rebind_alloc_for<
|
||||
typedef allocator_rebind_t<
|
||||
Allocator,
|
||||
ordered_index_node_impl<AugmentPolicy,Allocator>
|
||||
>::type allocator;
|
||||
typedef allocator_traits<allocator> 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<allocator> pointer;
|
||||
typedef allocator_const_pointer_t<allocator> const_pointer;
|
||||
typedef allocator_difference_type_t<allocator> difference_type;
|
||||
typedef allocator_size_type_t<allocator> size_type;
|
||||
};
|
||||
|
||||
template<typename AugmentPolicy,typename Allocator>
|
||||
@@ -133,6 +131,7 @@ struct ordered_index_node_compressed_base
|
||||
{
|
||||
typedef ordered_index_node_traits<
|
||||
AugmentPolicy,Allocator> node_traits;
|
||||
typedef typename node_traits::allocator node_allocator;
|
||||
typedef ordered_index_node_impl<
|
||||
AugmentPolicy,Allocator>* pointer;
|
||||
typedef const ordered_index_node_impl<
|
||||
@@ -228,7 +227,7 @@ struct ordered_index_node_impl_base:
|
||||
|
||||
#if !defined(BOOST_MULTI_INDEX_DISABLE_COMPRESSED_ORDERED_INDEX_NODES)
|
||||
AugmentPolicy::template augmented_node<
|
||||
typename mpl::if_c<
|
||||
mp11::mp_if_c<
|
||||
!(has_uintptr_type::value)||
|
||||
(alignment_of<
|
||||
ordered_index_node_compressed_base<AugmentPolicy,Allocator>
|
||||
@@ -238,7 +237,7 @@ struct ordered_index_node_impl_base:
|
||||
ordered_index_node_impl<AugmentPolicy,Allocator>*>::value),
|
||||
ordered_index_node_std_base<AugmentPolicy,Allocator>,
|
||||
ordered_index_node_compressed_base<AugmentPolicy,Allocator>
|
||||
>::type
|
||||
>
|
||||
>::type
|
||||
#else
|
||||
AugmentPolicy::template augmented_node<
|
||||
@@ -580,18 +579,18 @@ template<typename AugmentPolicy,typename Super>
|
||||
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;
|
||||
};
|
||||
|
||||
@@ -610,6 +609,14 @@ public:
|
||||
typedef typename trampoline::const_pointer const_impl_pointer;
|
||||
typedef typename trampoline::difference_type difference_type;
|
||||
typedef typename trampoline::size_type size_type;
|
||||
typedef allocator_rebind_t<
|
||||
typename trampoline::node_allocator,
|
||||
ordered_index_node> final_allocator_type;
|
||||
typedef allocator_pointer_t<
|
||||
final_allocator_type> pointer;
|
||||
typedef allocator_const_pointer_t<
|
||||
final_allocator_type> const_pointer;
|
||||
|
||||
|
||||
impl_color_ref color(){return trampoline::color();}
|
||||
ordered_index_color color()const{return trampoline::color();}
|
||||
@@ -648,20 +655,24 @@ public:
|
||||
raw_ptr<const impl_type*>(x)));
|
||||
}
|
||||
|
||||
/* interoperability with bidir_node_iterator */
|
||||
/* Interoperability with bidir_node_iterator and index impl.
|
||||
* Templated for raw-pointer/non-raw-pointer versions.
|
||||
*/
|
||||
|
||||
static void increment(ordered_index_node*& x)
|
||||
template<typename NodePtr>
|
||||
static void increment(NodePtr& x)
|
||||
{
|
||||
impl_pointer xi=x->impl();
|
||||
trampoline::increment(xi);
|
||||
x=from_impl(xi);
|
||||
x=NodePtr(from_impl(xi));
|
||||
}
|
||||
|
||||
static void decrement(ordered_index_node*& x)
|
||||
template<typename NodePtr>
|
||||
static void decrement(NodePtr& x)
|
||||
{
|
||||
impl_pointer xi=x->impl();
|
||||
trampoline::decrement(xi);
|
||||
x=from_impl(xi);
|
||||
x=NodePtr(from_impl(xi));
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright 2003-2014 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)
|
||||
@@ -41,8 +41,9 @@
|
||||
#endif
|
||||
|
||||
#include <boost/config.hpp> /* keep it first to prevent nasty warns in MSVC */
|
||||
#include <boost/mpl/and.hpp>
|
||||
#include <boost/mp11/function.hpp>
|
||||
#include <boost/multi_index/detail/promotes_arg.hpp>
|
||||
#include <type_traits>
|
||||
#include <utility>
|
||||
|
||||
namespace boost{
|
||||
@@ -70,7 +71,7 @@ inline Node* ordered_index_find(
|
||||
|
||||
return ordered_index_find(
|
||||
top,y,key,x,comp,
|
||||
mpl::and_<
|
||||
mp11::mp_and<
|
||||
promotes_1st_arg<CompatibleCompare,CompatibleKey,key_type>,
|
||||
promotes_2nd_arg<CompatibleCompare,key_type,CompatibleKey> >());
|
||||
}
|
||||
@@ -81,10 +82,10 @@ template<
|
||||
>
|
||||
inline Node* ordered_index_find(
|
||||
Node* top,Node* y,const KeyFromValue& key,
|
||||
const BOOST_DEDUCED_TYPENAME KeyFromValue::result_type& x,
|
||||
const CompatibleCompare& comp,mpl::true_)
|
||||
const typename KeyFromValue::result_type& x,
|
||||
const CompatibleCompare& comp,std::true_type)
|
||||
{
|
||||
return ordered_index_find(top,y,key,x,comp,mpl::false_());
|
||||
return ordered_index_find(top,y,key,x,comp,std::false_type());
|
||||
}
|
||||
|
||||
template<
|
||||
@@ -93,7 +94,7 @@ template<
|
||||
>
|
||||
inline Node* ordered_index_find(
|
||||
Node* top,Node* y,const KeyFromValue& key,const CompatibleKey& x,
|
||||
const CompatibleCompare& comp,mpl::false_)
|
||||
const CompatibleCompare& comp,std::false_type)
|
||||
{
|
||||
Node* y0=y;
|
||||
|
||||
@@ -129,10 +130,10 @@ template<
|
||||
>
|
||||
inline Node* ordered_index_lower_bound(
|
||||
Node* top,Node* y,const KeyFromValue& key,
|
||||
const BOOST_DEDUCED_TYPENAME KeyFromValue::result_type& x,
|
||||
const CompatibleCompare& comp,mpl::true_)
|
||||
const typename KeyFromValue::result_type& x,
|
||||
const CompatibleCompare& comp,std::true_type)
|
||||
{
|
||||
return ordered_index_lower_bound(top,y,key,x,comp,mpl::false_());
|
||||
return ordered_index_lower_bound(top,y,key,x,comp,std::false_type());
|
||||
}
|
||||
|
||||
template<
|
||||
@@ -141,7 +142,7 @@ template<
|
||||
>
|
||||
inline Node* ordered_index_lower_bound(
|
||||
Node* top,Node* y,const KeyFromValue& key,const CompatibleKey& x,
|
||||
const CompatibleCompare& comp,mpl::false_)
|
||||
const CompatibleCompare& comp,std::false_type)
|
||||
{
|
||||
while(top){
|
||||
if(!comp(key(top->value()),x)){
|
||||
@@ -175,10 +176,10 @@ template<
|
||||
>
|
||||
inline Node* ordered_index_upper_bound(
|
||||
Node* top,Node* y,const KeyFromValue& key,
|
||||
const BOOST_DEDUCED_TYPENAME KeyFromValue::result_type& x,
|
||||
const CompatibleCompare& comp,mpl::true_)
|
||||
const typename KeyFromValue::result_type& x,
|
||||
const CompatibleCompare& comp,std::true_type)
|
||||
{
|
||||
return ordered_index_upper_bound(top,y,key,x,comp,mpl::false_());
|
||||
return ordered_index_upper_bound(top,y,key,x,comp,std::false_type());
|
||||
}
|
||||
|
||||
template<
|
||||
@@ -187,7 +188,7 @@ template<
|
||||
>
|
||||
inline Node* ordered_index_upper_bound(
|
||||
Node* top,Node* y,const KeyFromValue& key,const CompatibleKey& x,
|
||||
const CompatibleCompare& comp,mpl::false_)
|
||||
const CompatibleCompare& comp,std::false_type)
|
||||
{
|
||||
while(top){
|
||||
if(comp(x,key(top->value()))){
|
||||
@@ -212,7 +213,7 @@ inline std::pair<Node*,Node*> ordered_index_equal_range(
|
||||
|
||||
return ordered_index_equal_range(
|
||||
top,y,key,x,comp,
|
||||
mpl::and_<
|
||||
mp11::mp_and<
|
||||
promotes_1st_arg<CompatibleCompare,CompatibleKey,key_type>,
|
||||
promotes_2nd_arg<CompatibleCompare,key_type,CompatibleKey> >());
|
||||
}
|
||||
@@ -223,10 +224,10 @@ template<
|
||||
>
|
||||
inline std::pair<Node*,Node*> ordered_index_equal_range(
|
||||
Node* top,Node* y,const KeyFromValue& key,
|
||||
const BOOST_DEDUCED_TYPENAME KeyFromValue::result_type& x,
|
||||
const CompatibleCompare& comp,mpl::true_)
|
||||
const typename KeyFromValue::result_type& x,
|
||||
const CompatibleCompare& comp,std::true_type)
|
||||
{
|
||||
return ordered_index_equal_range(top,y,key,x,comp,mpl::false_());
|
||||
return ordered_index_equal_range(top,y,key,x,comp,std::false_type());
|
||||
}
|
||||
|
||||
template<
|
||||
@@ -235,7 +236,7 @@ template<
|
||||
>
|
||||
inline std::pair<Node*,Node*> ordered_index_equal_range(
|
||||
Node* top,Node* y,const KeyFromValue& key,const CompatibleKey& x,
|
||||
const CompatibleCompare& comp,mpl::false_)
|
||||
const CompatibleCompare& comp,std::false_type)
|
||||
{
|
||||
while(top){
|
||||
if(comp(key(top->value()),x)){
|
||||
@@ -248,9 +249,9 @@ inline std::pair<Node*,Node*> ordered_index_equal_range(
|
||||
else{
|
||||
return std::pair<Node*,Node*>(
|
||||
ordered_index_lower_bound(
|
||||
Node::from_impl(top->left()),top,key,x,comp,mpl::false_()),
|
||||
Node::from_impl(top->left()),top,key,x,comp,std::false_type()),
|
||||
ordered_index_upper_bound(
|
||||
Node::from_impl(top->right()),y,key,x,comp,mpl::false_()));
|
||||
Node::from_impl(top->right()),y,key,x,comp,std::false_type()));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* 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)
|
||||
@@ -15,6 +15,7 @@
|
||||
|
||||
#include <boost/config.hpp> /* keep it first to prevent nasty warns in MSVC */
|
||||
#include <boost/detail/workaround.hpp>
|
||||
#include <type_traits>
|
||||
|
||||
/* Metafunctions to check if f(arg1,arg2) promotes either arg1 to the type of
|
||||
* arg2 or viceversa. By default, (i.e. if it cannot be determined), no
|
||||
@@ -30,10 +31,10 @@ namespace multi_index{
|
||||
namespace detail{
|
||||
|
||||
template<typename F,typename Arg1,typename Arg2>
|
||||
struct promotes_1st_arg:mpl::false_{};
|
||||
struct promotes_1st_arg:std::false_type{};
|
||||
|
||||
template<typename F,typename Arg1,typename Arg2>
|
||||
struct promotes_2nd_arg:mpl::false_{};
|
||||
struct promotes_2nd_arg:std::false_type{};
|
||||
|
||||
} /* namespace multi_index::detail */
|
||||
|
||||
@@ -43,9 +44,7 @@ struct promotes_2nd_arg:mpl::false_{};
|
||||
|
||||
#else
|
||||
|
||||
#include <boost/mpl/and.hpp>
|
||||
#include <boost/mpl/bool.hpp>
|
||||
#include <boost/mpl/not.hpp>
|
||||
#include <boost/mp11/function.hpp>
|
||||
#include <boost/multi_index/detail/is_transparent.hpp>
|
||||
#include <boost/type_traits/is_convertible.hpp>
|
||||
|
||||
@@ -57,8 +56,8 @@ namespace detail{
|
||||
|
||||
template<typename F,typename Arg1,typename Arg2>
|
||||
struct promotes_1st_arg:
|
||||
mpl::and_<
|
||||
mpl::not_<is_transparent<F,Arg1,Arg2> >,
|
||||
mp11::mp_and<
|
||||
mp11::mp_not<is_transparent<F,Arg1,Arg2> >,
|
||||
is_convertible<const Arg1,Arg2>,
|
||||
is_transparent<F,Arg2,Arg2>
|
||||
>
|
||||
@@ -66,8 +65,8 @@ struct promotes_1st_arg:
|
||||
|
||||
template<typename F,typename Arg1,typename Arg2>
|
||||
struct promotes_2nd_arg:
|
||||
mpl::and_<
|
||||
mpl::not_<is_transparent<F,Arg1,Arg2> >,
|
||||
mp11::mp_and<
|
||||
mp11::mp_not<is_transparent<F,Arg1,Arg2> >,
|
||||
is_convertible<const Arg2,Arg1>,
|
||||
is_transparent<F,Arg1,Arg1>
|
||||
>
|
||||
|
||||
@@ -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)
|
||||
@@ -14,8 +14,7 @@
|
||||
#endif
|
||||
|
||||
#include <boost/config.hpp> /* keep it first to prevent nasty warns in MSVC */
|
||||
#include <boost/mpl/bool.hpp>
|
||||
#include <boost/type_traits/is_same.hpp>
|
||||
#include <type_traits>
|
||||
|
||||
namespace boost{
|
||||
|
||||
@@ -26,13 +25,13 @@ namespace detail{
|
||||
/* gets the underlying pointer of a pointer-like value */
|
||||
|
||||
template<typename RawPointer>
|
||||
inline RawPointer raw_ptr(RawPointer const& p,mpl::true_)
|
||||
inline RawPointer raw_ptr(RawPointer const& p,std::true_type)
|
||||
{
|
||||
return p;
|
||||
}
|
||||
|
||||
template<typename RawPointer,typename Pointer>
|
||||
inline RawPointer raw_ptr(Pointer const& p,mpl::false_)
|
||||
inline RawPointer raw_ptr(Pointer const& p,std::false_type)
|
||||
{
|
||||
return p==Pointer(0)?0:&*p;
|
||||
}
|
||||
@@ -40,7 +39,7 @@ inline RawPointer raw_ptr(Pointer const& p,mpl::false_)
|
||||
template<typename RawPointer,typename Pointer>
|
||||
inline RawPointer raw_ptr(Pointer const& p)
|
||||
{
|
||||
return raw_ptr<RawPointer>(p,is_same<RawPointer,Pointer>());
|
||||
return raw_ptr<RawPointer>(p,std::is_same<RawPointer,Pointer>());
|
||||
}
|
||||
|
||||
} /* namespace multi_index::detail */
|
||||
|
||||
@@ -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 <boost/config.hpp> /* keep it first to prevent nasty warns in MSVC */
|
||||
#include <boost/core/allocator_access.hpp>
|
||||
#include <algorithm>
|
||||
#include <boost/core/noncopyable.hpp>
|
||||
#include <boost/multi_index/detail/allocator_traits.hpp>
|
||||
#include <boost/multi_index/detail/auto_space.hpp>
|
||||
#include <boost/multi_index/detail/rnd_index_ptr_array.hpp>
|
||||
|
||||
@@ -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<Allocator> ptr_array;
|
||||
@@ -93,8 +93,7 @@ protected:
|
||||
}
|
||||
|
||||
private:
|
||||
typedef allocator_traits<Allocator> alloc_traits;
|
||||
typedef typename alloc_traits::size_type size_type;
|
||||
typedef allocator_size_type_t<Allocator> size_type;
|
||||
|
||||
void preprocess()
|
||||
{
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright 2003-2021 Joaquin M Lopez Munoz.
|
||||
/* Copyright 2003-2026 Joaquin M Lopez Munoz.
|
||||
* Distributed under the Boost Software License, Version 1.0.
|
||||
* (See accompanying file LICENSE_1_0.txt or copy at
|
||||
* http://www.boost.org/LICENSE_1_0.txt)
|
||||
@@ -14,9 +14,9 @@
|
||||
#endif
|
||||
|
||||
#include <boost/config.hpp> /* keep it first to prevent nasty warns in MSVC */
|
||||
#include <boost/core/allocator_access.hpp>
|
||||
#include <algorithm>
|
||||
#include <boost/integer/common_factor_rt.hpp>
|
||||
#include <boost/multi_index/detail/allocator_traits.hpp>
|
||||
#include <boost/multi_index/detail/raw_ptr.hpp>
|
||||
#include <cstddef>
|
||||
#include <functional>
|
||||
@@ -30,18 +30,16 @@ namespace detail{
|
||||
template<typename Allocator>
|
||||
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_allocator> 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<node_allocator> pointer;
|
||||
typedef allocator_const_pointer_t<node_allocator> const_pointer;
|
||||
typedef allocator_difference_type_t<node_allocator> difference_type;
|
||||
typedef allocator_rebind_t<
|
||||
Allocator,pointer
|
||||
>::type ptr_allocator;
|
||||
typedef allocator_traits<ptr_allocator> ptr_alloc_traits;
|
||||
typedef typename ptr_alloc_traits::pointer ptr_pointer;
|
||||
> ptr_allocator;
|
||||
typedef allocator_pointer_t<ptr_allocator> ptr_pointer;
|
||||
|
||||
ptr_pointer& up(){return up_;}
|
||||
ptr_pointer up()const{return up_;}
|
||||
@@ -195,17 +193,17 @@ private:
|
||||
template<typename Super>
|
||||
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;
|
||||
};
|
||||
|
||||
@@ -217,11 +215,18 @@ private:
|
||||
typedef random_access_index_node_trampoline<Super> trampoline;
|
||||
|
||||
public:
|
||||
typedef typename trampoline::impl_type impl_type;
|
||||
typedef typename trampoline::pointer impl_pointer;
|
||||
typedef typename trampoline::const_pointer const_impl_pointer;
|
||||
typedef typename trampoline::difference_type difference_type;
|
||||
typedef typename trampoline::ptr_pointer impl_ptr_pointer;
|
||||
typedef typename trampoline::impl_type impl_type;
|
||||
typedef typename trampoline::pointer impl_pointer;
|
||||
typedef typename trampoline::const_pointer const_impl_pointer;
|
||||
typedef typename trampoline::difference_type difference_type;
|
||||
typedef typename trampoline::ptr_pointer impl_ptr_pointer;
|
||||
typedef allocator_rebind_t<
|
||||
typename trampoline::node_allocator,
|
||||
random_access_index_node> final_allocator_type;
|
||||
typedef allocator_pointer_t<
|
||||
final_allocator_type> pointer;
|
||||
typedef allocator_const_pointer_t<
|
||||
final_allocator_type> const_pointer;
|
||||
|
||||
impl_ptr_pointer& up(){return trampoline::up();}
|
||||
impl_ptr_pointer up()const{return trampoline::up();}
|
||||
@@ -256,25 +261,25 @@ public:
|
||||
|
||||
/* interoperability with rnd_node_iterator */
|
||||
|
||||
static void increment(random_access_index_node*& x)
|
||||
static void increment(pointer& x)
|
||||
{
|
||||
impl_pointer xi=x->impl();
|
||||
trampoline::increment(xi);
|
||||
x=from_impl(xi);
|
||||
x=pointer(from_impl(xi));
|
||||
}
|
||||
|
||||
static void decrement(random_access_index_node*& x)
|
||||
static void decrement(pointer& x)
|
||||
{
|
||||
impl_pointer xi=x->impl();
|
||||
trampoline::decrement(xi);
|
||||
x=from_impl(xi);
|
||||
x=pointer(from_impl(xi));
|
||||
}
|
||||
|
||||
static void advance(random_access_index_node*& x,difference_type n)
|
||||
static void advance(pointer& x,difference_type n)
|
||||
{
|
||||
impl_pointer xi=x->impl();
|
||||
trampoline::advance(xi,n);
|
||||
x=from_impl(xi);
|
||||
x=pointer(from_impl(xi));
|
||||
}
|
||||
|
||||
static difference_type distance(
|
||||
|
||||
@@ -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<typename Node,typename Allocator,typename Compare>
|
||||
void random_access_index_inplace_merge(
|
||||
const Allocator& al,
|
||||
random_access_index_ptr_array<Allocator>& 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;
|
||||
|
||||
@@ -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 <boost/config.hpp> /* keep it first to prevent nasty warns in MSVC */
|
||||
#include <boost/core/allocator_access.hpp>
|
||||
#include <algorithm>
|
||||
#include <boost/core/noncopyable.hpp>
|
||||
#include <boost/multi_index/detail/allocator_traits.hpp>
|
||||
#include <boost/multi_index/detail/auto_space.hpp>
|
||||
#include <boost/multi_index/detail/rnd_index_node.hpp>
|
||||
|
||||
@@ -32,20 +32,21 @@ template<typename Allocator>
|
||||
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<value_allocator> 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):
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright 2003-2023 Joaquin M Lopez Munoz.
|
||||
/* Copyright 2003-2026 Joaquin M Lopez Munoz.
|
||||
* Distributed under the Boost Software License, Version 1.0.
|
||||
* (See accompanying file LICENSE_1_0.txt or copy at
|
||||
* http://www.boost.org/LICENSE_1_0.txt)
|
||||
@@ -14,6 +14,7 @@
|
||||
#endif
|
||||
|
||||
#include <boost/config.hpp> /* keep it first to prevent nasty warns in MSVC */
|
||||
#include <boost/multi_index/detail/raw_ptr.hpp>
|
||||
#include <boost/operators.hpp>
|
||||
|
||||
#if !defined(BOOST_MULTI_INDEX_DISABLE_SERIALIZATION)
|
||||
@@ -87,7 +88,7 @@ public:
|
||||
template<class Archive>
|
||||
void save(Archive& ar,const unsigned int)const
|
||||
{
|
||||
node_base_type* bnode=node;
|
||||
node_base_type* bnode=get_node();
|
||||
ar<<core::make_nvp("pointer",bnode);
|
||||
}
|
||||
|
||||
@@ -96,7 +97,7 @@ public:
|
||||
{
|
||||
node_base_type* bnode;
|
||||
ar>>core::make_nvp("pointer",bnode);
|
||||
node=static_cast<Node*>(bnode);
|
||||
node=typename Node::pointer(static_cast<Node*>(bnode));
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -104,10 +105,10 @@ public:
|
||||
|
||||
typedef Node node_type;
|
||||
|
||||
Node* get_node()const{return node;}
|
||||
Node* get_node()const{return raw_ptr<Node*>(node);}
|
||||
|
||||
private:
|
||||
Node* node;
|
||||
typename Node::pointer node;
|
||||
};
|
||||
|
||||
template<typename Node>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* 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)
|
||||
@@ -15,8 +15,9 @@
|
||||
|
||||
#include <boost/config.hpp> /* keep it first to prevent nasty warns in MSVC */
|
||||
#include <boost/core/pointer_traits.hpp>
|
||||
#include <boost/mpl/and.hpp>
|
||||
#include <boost/mp11/function.hpp>
|
||||
#include <boost/multi_index/detail/promotes_arg.hpp>
|
||||
#include <type_traits>
|
||||
#include <utility>
|
||||
|
||||
namespace boost{
|
||||
@@ -45,7 +46,7 @@ ranked_node_size(Pointer x)
|
||||
|
||||
template<typename Pointer>
|
||||
inline Pointer ranked_index_nth(
|
||||
BOOST_DEDUCED_TYPENAME ranked_node_size_type<Pointer>::type n,Pointer end_)
|
||||
typename ranked_node_size_type<Pointer>::type n,Pointer end_)
|
||||
{
|
||||
typedef typename ranked_node_size_type<Pointer>::type size_type;
|
||||
|
||||
@@ -96,7 +97,7 @@ inline typename Node::size_type ranked_index_find_rank(
|
||||
|
||||
return ranked_index_find_rank(
|
||||
top,y,key,x,comp,
|
||||
mpl::and_<
|
||||
mp11::mp_and<
|
||||
promotes_1st_arg<CompatibleCompare,CompatibleKey,key_type>,
|
||||
promotes_2nd_arg<CompatibleCompare,key_type,CompatibleKey> >());
|
||||
}
|
||||
@@ -107,10 +108,10 @@ 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 CompatibleCompare& comp,mpl::true_)
|
||||
const typename KeyFromValue::result_type& x,
|
||||
const CompatibleCompare& comp,std::true_type)
|
||||
{
|
||||
return ranked_index_find_rank(top,y,key,x,comp,mpl::false_());
|
||||
return ranked_index_find_rank(top,y,key,x,comp,std::false_type());
|
||||
}
|
||||
|
||||
template<
|
||||
@@ -119,7 +120,7 @@ template<
|
||||
>
|
||||
inline typename Node::size_type ranked_index_find_rank(
|
||||
Node* top,Node* y,const KeyFromValue& key,const CompatibleKey& x,
|
||||
const CompatibleCompare& comp,mpl::false_)
|
||||
const CompatibleCompare& comp,std::false_type)
|
||||
{
|
||||
typedef typename Node::size_type size_type;
|
||||
|
||||
@@ -162,10 +163,10 @@ 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 CompatibleCompare& comp,mpl::true_)
|
||||
const typename KeyFromValue::result_type& x,
|
||||
const CompatibleCompare& comp,std::true_type)
|
||||
{
|
||||
return ranked_index_lower_bound_rank(top,y,key,x,comp,mpl::false_());
|
||||
return ranked_index_lower_bound_rank(top,y,key,x,comp,std::false_type());
|
||||
}
|
||||
|
||||
template<
|
||||
@@ -174,7 +175,7 @@ template<
|
||||
>
|
||||
inline typename Node::size_type ranked_index_lower_bound_rank(
|
||||
Node* top,Node* y,const KeyFromValue& key,const CompatibleKey& x,
|
||||
const CompatibleCompare& comp,mpl::false_)
|
||||
const CompatibleCompare& comp,std::false_type)
|
||||
{
|
||||
typedef typename Node::size_type size_type;
|
||||
|
||||
@@ -215,10 +216,10 @@ 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 CompatibleCompare& comp,mpl::true_)
|
||||
const typename KeyFromValue::result_type& x,
|
||||
const CompatibleCompare& comp,std::true_type)
|
||||
{
|
||||
return ranked_index_upper_bound_rank(top,y,key,x,comp,mpl::false_());
|
||||
return ranked_index_upper_bound_rank(top,y,key,x,comp,std::false_type());
|
||||
}
|
||||
|
||||
template<
|
||||
@@ -227,7 +228,7 @@ template<
|
||||
>
|
||||
inline typename Node::size_type ranked_index_upper_bound_rank(
|
||||
Node* top,Node* y,const KeyFromValue& key,const CompatibleKey& x,
|
||||
const CompatibleCompare& comp,mpl::false_)
|
||||
const CompatibleCompare& comp,std::false_type)
|
||||
{
|
||||
typedef typename Node::size_type size_type;
|
||||
|
||||
@@ -260,7 +261,7 @@ ranked_index_equal_range_rank(
|
||||
|
||||
return ranked_index_equal_range_rank(
|
||||
top,y,key,x,comp,
|
||||
mpl::and_<
|
||||
mp11::mp_and<
|
||||
promotes_1st_arg<CompatibleCompare,CompatibleKey,key_type>,
|
||||
promotes_2nd_arg<CompatibleCompare,key_type,CompatibleKey> >());
|
||||
}
|
||||
@@ -272,10 +273,10 @@ template<
|
||||
inline std::pair<typename Node::size_type,typename Node::size_type>
|
||||
ranked_index_equal_range_rank(
|
||||
Node* top,Node* y,const KeyFromValue& key,
|
||||
const BOOST_DEDUCED_TYPENAME KeyFromValue::result_type& x,
|
||||
const CompatibleCompare& comp,mpl::true_)
|
||||
const typename KeyFromValue::result_type& x,
|
||||
const CompatibleCompare& comp,std::true_type)
|
||||
{
|
||||
return ranked_index_equal_range_rank(top,y,key,x,comp,mpl::false_());
|
||||
return ranked_index_equal_range_rank(top,y,key,x,comp,std::false_type());
|
||||
}
|
||||
|
||||
template<
|
||||
@@ -285,11 +286,11 @@ template<
|
||||
inline std::pair<typename Node::size_type,typename Node::size_type>
|
||||
ranked_index_equal_range_rank(
|
||||
Node* top,Node* y,const KeyFromValue& key,const CompatibleKey& x,
|
||||
const CompatibleCompare& comp,mpl::false_)
|
||||
const CompatibleCompare& comp,std::false_type)
|
||||
{
|
||||
typedef typename Node::size_type size_type;
|
||||
|
||||
if(!top)return std::pair<size_type,size_type>(0,0);
|
||||
if(!top)return std::pair<size_type,size_type>((size_type)0,(size_type)0);
|
||||
|
||||
size_type s=top->impl()->size;
|
||||
|
||||
@@ -304,12 +305,12 @@ ranked_index_equal_range_rank(
|
||||
}
|
||||
else{
|
||||
return std::pair<size_type,size_type>(
|
||||
s-top->impl()->size+
|
||||
(size_type)(s-top->impl()->size+
|
||||
ranked_index_lower_bound_rank(
|
||||
Node::from_impl(top->left()),top,key,x,comp,mpl::false_()),
|
||||
s-ranked_node_size(top->right())+
|
||||
Node::from_impl(top->left()),top,key,x,comp,std::false_type())),
|
||||
(size_type)(s-ranked_node_size(top->right())+
|
||||
ranked_index_upper_bound_rank(
|
||||
Node::from_impl(top->right()),y,key,x,comp,mpl::false_()));
|
||||
Node::from_impl(top->right()),y,key,x,comp,std::false_type())));
|
||||
}
|
||||
}while(top);
|
||||
|
||||
|
||||
@@ -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 <algorithm>
|
||||
#include <boost/core/addressof.hpp>
|
||||
#include <boost/core/noncopyable.hpp>
|
||||
#include <boost/multi_index/detail/access_specifier.hpp>
|
||||
#include <boost/multi_index/detail/any_container_view.hpp>
|
||||
#include <boost/multi_index/detail/iter_adaptor.hpp>
|
||||
#include <boost/multi_index/safe_mode_errors.hpp>
|
||||
@@ -349,9 +348,7 @@ protected:
|
||||
|
||||
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<typename>
|
||||
friend class safe_mode::safe_container;
|
||||
@@ -360,7 +357,6 @@ BOOST_MULTI_INDEX_PRIVATE_IF_MEMBER_TEMPLATE_FRIENDS:
|
||||
template<typename Dst,typename Iterator>
|
||||
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<typename Iterator>
|
||||
friend void safe_mode::detach_equivalent_iterators(Iterator&);
|
||||
template<typename Dst,typename Iterator>
|
||||
friend void safe_mode_detail::transfer_equivalent_iterators(
|
||||
Dst&,Iterator,boost::true_type);
|
||||
#endif
|
||||
|
||||
~safe_container_base()
|
||||
{
|
||||
|
||||
@@ -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 <boost/core/no_exceptions_support.hpp>
|
||||
#include <boost/mpl/if.hpp>
|
||||
#include <boost/mp11/utility.hpp>
|
||||
|
||||
namespace boost{
|
||||
|
||||
@@ -120,7 +120,7 @@ struct null_guard : public scope_guard_impl_base
|
||||
template< bool cond, class T >
|
||||
struct null_guard_return
|
||||
{
|
||||
typedef typename boost::mpl::if_c<cond,T,null_guard>::type type;
|
||||
typedef mp11::mp_if_c<cond,T,null_guard> type;
|
||||
};
|
||||
|
||||
template<typename F>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright 2003-2019 Joaquin M Lopez Munoz.
|
||||
/* Copyright 2003-2026 Joaquin M Lopez Munoz.
|
||||
* Distributed under the Boost Software License, Version 1.0.
|
||||
* (See accompanying file LICENSE_1_0.txt or copy at
|
||||
* http://www.boost.org/LICENSE_1_0.txt)
|
||||
@@ -14,8 +14,8 @@
|
||||
#endif
|
||||
|
||||
#include <boost/config.hpp> /* keep it first to prevent nasty warns in MSVC */
|
||||
#include <boost/core/allocator_access.hpp>
|
||||
#include <algorithm>
|
||||
#include <boost/multi_index/detail/allocator_traits.hpp>
|
||||
#include <boost/multi_index/detail/raw_ptr.hpp>
|
||||
|
||||
namespace boost{
|
||||
@@ -29,13 +29,14 @@ namespace detail{
|
||||
template<typename Allocator>
|
||||
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<node_allocator> 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<node_allocator> 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 @@ private:
|
||||
template<typename Super>
|
||||
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;
|
||||
};
|
||||
|
||||
@@ -157,6 +158,13 @@ public:
|
||||
typedef typename trampoline::pointer impl_pointer;
|
||||
typedef typename trampoline::const_pointer const_impl_pointer;
|
||||
typedef typename trampoline::difference_type difference_type;
|
||||
typedef allocator_rebind_t<
|
||||
typename trampoline::node_allocator,
|
||||
sequenced_index_node> final_allocator_type;
|
||||
typedef allocator_pointer_t<
|
||||
final_allocator_type> pointer;
|
||||
typedef allocator_const_pointer_t<
|
||||
final_allocator_type> const_pointer;
|
||||
|
||||
impl_pointer& prior(){return trampoline::prior();}
|
||||
impl_pointer prior()const{return trampoline::prior();}
|
||||
@@ -191,20 +199,24 @@ public:
|
||||
raw_ptr<const impl_type*>(x)));
|
||||
}
|
||||
|
||||
/* interoperability with bidir_node_iterator */
|
||||
/* Interoperability with bidir_node_iterator and index impl.
|
||||
* Templated for raw-pointer/non-raw-pointer versions.
|
||||
*/
|
||||
|
||||
static void increment(sequenced_index_node*& x)
|
||||
template<typename NodePtr>
|
||||
static void increment(NodePtr& x)
|
||||
{
|
||||
impl_pointer xi=x->impl();
|
||||
trampoline::increment(xi);
|
||||
x=from_impl(xi);
|
||||
x=NodePtr(from_impl(xi));
|
||||
}
|
||||
|
||||
static void decrement(sequenced_index_node*& x)
|
||||
template<typename NodePtr>
|
||||
static void decrement(NodePtr& x)
|
||||
{
|
||||
impl_pointer xi=x->impl();
|
||||
trampoline::decrement(xi);
|
||||
x=from_impl(xi);
|
||||
x=NodePtr(from_impl(xi));
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -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<typename Node,typename Compare>
|
||||
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;
|
||||
|
||||
@@ -0,0 +1,62 @@
|
||||
/* 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)
|
||||
*
|
||||
* See http://www.boost.org/libs/multi_index for library home page.
|
||||
*/
|
||||
|
||||
#ifndef BOOST_MULTI_INDEX_DETAIL_TYPE_LIST_HPP
|
||||
#define BOOST_MULTI_INDEX_DETAIL_TYPE_LIST_HPP
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
#if defined(BOOST_MULTI_INDEX_ENABLE_MPL_SUPPORT)
|
||||
#define BOOST_MULTI_INDEX_BLOCK_BOOSTDEP_HEADER \
|
||||
<boost/mpl/push_front.hpp>
|
||||
#include BOOST_MULTI_INDEX_BLOCK_BOOSTDEP_HEADER
|
||||
#undef BOOST_MULTI_INDEX_BLOCK_BOOSTDEP_HEADER
|
||||
#define BOOST_MULTI_INDEX_BLOCK_BOOSTDEP_HEADER \
|
||||
<boost/mpl/vector.hpp>
|
||||
#include BOOST_MULTI_INDEX_BLOCK_BOOSTDEP_HEADER
|
||||
#undef BOOST_MULTI_INDEX_BLOCK_BOOSTDEP_HEADER
|
||||
|
||||
namespace boost{
|
||||
|
||||
namespace multi_index{
|
||||
|
||||
namespace detail{
|
||||
|
||||
using empty_type_list=mpl::vector0<>;
|
||||
|
||||
template<typename TypeList,typename T>
|
||||
using type_list_push_front=typename mpl::push_front<TypeList,T>::type;
|
||||
|
||||
} /* namespace multi_index::detail */
|
||||
|
||||
} /* namespace multi_index */
|
||||
|
||||
} /* namespace boost */
|
||||
#else
|
||||
#include <boost/mp11/list.hpp>
|
||||
|
||||
namespace boost{
|
||||
|
||||
namespace multi_index{
|
||||
|
||||
namespace detail{
|
||||
|
||||
using empty_type_list=mp11::mp_list<>;
|
||||
|
||||
template<typename TypeList,typename T>
|
||||
using type_list_push_front=mp11::mp_push_front<TypeList,T>;
|
||||
|
||||
} /* namespace multi_index::detail */
|
||||
|
||||
} /* namespace multi_index */
|
||||
|
||||
} /* namespace boost */
|
||||
#endif
|
||||
#endif
|
||||
@@ -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,7 @@
|
||||
#endif
|
||||
|
||||
#include <boost/config.hpp> /* keep it first to prevent nasty warns in MSVC */
|
||||
#include <boost/mpl/bool.hpp>
|
||||
#include <boost/mp11/integral.hpp>
|
||||
|
||||
namespace boost{
|
||||
|
||||
@@ -64,8 +64,8 @@ struct uintptr_aux
|
||||
typedef uintptr_candidates<index>::type type;
|
||||
};
|
||||
|
||||
typedef mpl::bool_<uintptr_aux::has_uintptr_type> has_uintptr_type;
|
||||
typedef uintptr_aux::type uintptr_type;
|
||||
typedef mp11::mp_bool<uintptr_aux::has_uintptr_type> has_uintptr_type;
|
||||
typedef uintptr_aux::type uintptr_type;
|
||||
|
||||
} /* namespace multi_index::detail */
|
||||
|
||||
|
||||
@@ -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 <boost/config.hpp> /* keep it first to prevent nasty warns in MSVC */
|
||||
#include <boost/detail/workaround.hpp>
|
||||
|
||||
namespace boost{
|
||||
|
||||
|
||||
@@ -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>(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 <boost/config.hpp>
|
||||
|
||||
#if defined(BOOST_NO_CXX11_RVALUE_REFERENCES)||\
|
||||
defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
|
||||
|
||||
#include <boost/move/core.hpp>
|
||||
#include <boost/move/utility.hpp>
|
||||
#include <boost/preprocessor/arithmetic/add.hpp>
|
||||
#include <boost/preprocessor/arithmetic/sub.hpp>
|
||||
#include <boost/preprocessor/cat.hpp>
|
||||
#include <boost/preprocessor/control/if.hpp>
|
||||
#include <boost/preprocessor/facilities/empty.hpp>
|
||||
#include <boost/preprocessor/facilities/intercept.hpp>
|
||||
#include <boost/preprocessor/logical/and.hpp>
|
||||
#include <boost/preprocessor/punctuation/comma.hpp>
|
||||
#include <boost/preprocessor/punctuation/comma_if.hpp>
|
||||
#include <boost/preprocessor/repetition/enum.hpp>
|
||||
#include <boost/preprocessor/repetition/enum_params.hpp>
|
||||
#include <boost/preprocessor/repetition/repeat_from_to.hpp>
|
||||
#include <boost/preprocessor/seq/elem.hpp>
|
||||
|
||||
#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)>(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<BOOST_PP_ENUM_PARAMS(n,typename T)>
|
||||
|
||||
#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 <utility>
|
||||
|
||||
#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>(args)...
|
||||
#define BOOST_MULTI_INDEX_NULL_PARAM_PACK
|
||||
|
||||
#define BOOST_MULTI_INDEX_OVERLOADS_TO_VARTEMPL( \
|
||||
ret,name_from,name_to) \
|
||||
template<typename... Args> ret name_from(Args&&... args) \
|
||||
{ \
|
||||
return name_to(std::forward<Args>(args)...); \
|
||||
}
|
||||
|
||||
#define BOOST_MULTI_INDEX_OVERLOADS_TO_VARTEMPL_EXTRA_ARG( \
|
||||
ret,name_from,name_to,extra_arg_type,extra_arg_name) \
|
||||
template<typename... Args> ret name_from( \
|
||||
extra_arg_type extra_arg_name,Args&&... args) \
|
||||
{ \
|
||||
return name_to(extra_arg_name,std::forward<Args>(args)...); \
|
||||
}
|
||||
|
||||
namespace boost{
|
||||
|
||||
namespace multi_index{
|
||||
|
||||
namespace detail{
|
||||
|
||||
template<typename Value,typename... Args>
|
||||
Value* vartempl_placement_new(Value*x,Args&&... args)
|
||||
{
|
||||
return new(x) Value(std::forward<Args>(args)...);
|
||||
}
|
||||
|
||||
} /* namespace multi_index::detail */
|
||||
|
||||
} /* namespace multi_index */
|
||||
|
||||
} /* namespace boost */
|
||||
|
||||
#endif
|
||||
#endif
|
||||
@@ -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,16 +16,13 @@
|
||||
#include <boost/config.hpp> /* keep it first to prevent nasty warns in MSVC */
|
||||
#include <boost/core/enable_if.hpp>
|
||||
#include <boost/detail/workaround.hpp>
|
||||
#include <boost/mpl/if.hpp>
|
||||
#include <boost/mp11/utility.hpp>
|
||||
#include <boost/type_traits/is_const.hpp>
|
||||
#include <boost/type_traits/is_convertible.hpp>
|
||||
#include <boost/type_traits/is_reference.hpp>
|
||||
#include <boost/type_traits/remove_const.hpp>
|
||||
#include <boost/type_traits/remove_reference.hpp>
|
||||
|
||||
#if !defined(BOOST_NO_SFINAE)
|
||||
#include <boost/type_traits/is_convertible.hpp>
|
||||
#endif
|
||||
|
||||
namespace boost{
|
||||
|
||||
template<class T> class reference_wrapper; /* fwd decl. */
|
||||
@@ -54,13 +51,8 @@ struct const_ref_global_fun_base
|
||||
|
||||
template<typename ChainedPtr>
|
||||
|
||||
#if !defined(BOOST_NO_SFINAE)
|
||||
typename disable_if<
|
||||
is_convertible<const ChainedPtr&,Value>,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<typename ChainedPtr>
|
||||
|
||||
#if !defined(BOOST_NO_SFINAE)
|
||||
typename disable_if<
|
||||
is_convertible<ChainedPtr&,Value>,Type>::type
|
||||
#else
|
||||
Type
|
||||
#endif
|
||||
|
||||
operator()(const ChainedPtr& x)const
|
||||
{
|
||||
return operator()(*x);
|
||||
@@ -133,13 +120,8 @@ struct non_ref_global_fun_base
|
||||
|
||||
template<typename ChainedPtr>
|
||||
|
||||
#if !defined(BOOST_NO_SFINAE)
|
||||
typename disable_if<
|
||||
is_convertible<const ChainedPtr&,const Value&>,Type>::type
|
||||
#else
|
||||
Type
|
||||
#endif
|
||||
|
||||
operator()(const ChainedPtr& x)const
|
||||
{
|
||||
return operator()(*x);
|
||||
@@ -166,15 +148,15 @@ struct non_ref_global_fun_base
|
||||
|
||||
template<class Value,typename Type,Type (*PtrToFunction)(Value)>
|
||||
struct global_fun:
|
||||
mpl::if_c<
|
||||
is_reference<Value>::value,
|
||||
typename mpl::if_c<
|
||||
is_const<typename remove_reference<Value>::type>::value,
|
||||
mp11::mp_if<
|
||||
is_reference<Value>,
|
||||
typename mp11::mp_if<
|
||||
is_const<typename remove_reference<Value>::type>,
|
||||
detail::const_ref_global_fun_base<Value,Type,PtrToFunction>,
|
||||
detail::non_const_ref_global_fun_base<Value,Type,PtrToFunction>
|
||||
>::type,
|
||||
>,
|
||||
detail::non_ref_global_fun_base<Value,Type,PtrToFunction>
|
||||
>::type
|
||||
>
|
||||
{
|
||||
};
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright 2003-2023 Joaquin M Lopez Munoz.
|
||||
/* Copyright 2003-2026 Joaquin M Lopez Munoz.
|
||||
* Distributed under the Boost Software License, Version 1.0.
|
||||
* (See accompanying file LICENSE_1_0.txt or copy at
|
||||
* http://www.boost.org/LICENSE_1_0.txt)
|
||||
@@ -17,17 +17,11 @@
|
||||
#include <algorithm>
|
||||
#include <boost/call_traits.hpp>
|
||||
#include <boost/core/addressof.hpp>
|
||||
#include <boost/core/allocator_access.hpp>
|
||||
#include <boost/core/no_exceptions_support.hpp>
|
||||
#include <boost/detail/workaround.hpp>
|
||||
#include <boost/limits.hpp>
|
||||
#include <boost/move/core.hpp>
|
||||
#include <boost/move/utility_core.hpp>
|
||||
#include <boost/mpl/bool.hpp>
|
||||
#include <boost/mpl/if.hpp>
|
||||
#include <boost/mpl/push_front.hpp>
|
||||
#include <boost/multi_index/detail/access_specifier.hpp>
|
||||
#include <boost/mp11/utility.hpp>
|
||||
#include <boost/multi_index/detail/adl_swap.hpp>
|
||||
#include <boost/multi_index/detail/allocator_traits.hpp>
|
||||
#include <boost/multi_index/detail/auto_space.hpp>
|
||||
#include <boost/multi_index/detail/bucket_array.hpp>
|
||||
#include <boost/multi_index/detail/do_not_copy_elements_tag.hpp>
|
||||
@@ -39,19 +33,17 @@
|
||||
#include <boost/multi_index/detail/promotes_arg.hpp>
|
||||
#include <boost/multi_index/detail/safe_mode.hpp>
|
||||
#include <boost/multi_index/detail/scope_guard.hpp>
|
||||
#include <boost/multi_index/detail/vartempl_support.hpp>
|
||||
#include <boost/multi_index/detail/type_list.hpp>
|
||||
#include <boost/multi_index/hashed_index_fwd.hpp>
|
||||
#include <boost/tuple/tuple.hpp>
|
||||
#include <boost/type_traits/is_same.hpp>
|
||||
#include <cmath>
|
||||
#include <cstddef>
|
||||
#include <functional>
|
||||
#include <iterator>
|
||||
#include <utility>
|
||||
|
||||
#if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST)
|
||||
#include <initializer_list>
|
||||
#endif
|
||||
#include <iterator>
|
||||
#include <type_traits>
|
||||
#include <utility>
|
||||
|
||||
#if !defined(BOOST_MULTI_INDEX_DISABLE_SERIALIZATION)
|
||||
#include <boost/core/serialization.hpp>
|
||||
@@ -91,24 +83,10 @@ 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)
|
||||
/* 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
|
||||
|
||||
#if !defined(BOOST_NO_MEMBER_TEMPLATE_FRIENDS)
|
||||
/* cross-index access */
|
||||
|
||||
template <typename,typename,typename> friend class index_base;
|
||||
#endif
|
||||
|
||||
typedef typename SuperMeta::type super;
|
||||
|
||||
@@ -134,17 +112,14 @@ public:
|
||||
typedef Hash hasher;
|
||||
typedef Pred key_equal;
|
||||
typedef typename super::final_allocator_type allocator_type;
|
||||
|
||||
private:
|
||||
typedef allocator_traits<allocator_type> alloc_traits;
|
||||
|
||||
public:
|
||||
typedef typename alloc_traits::pointer pointer;
|
||||
typedef typename alloc_traits::const_pointer const_pointer;
|
||||
typedef allocator_pointer_t<allocator_type> 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<allocator_type> size_type;
|
||||
typedef allocator_difference_type_t<
|
||||
allocator_type> difference_type;
|
||||
typedef tuple<size_type,
|
||||
key_from_value,hasher,key_equal> ctor_args;
|
||||
|
||||
@@ -177,15 +152,15 @@ protected:
|
||||
typedef tuples::cons<
|
||||
ctor_args,
|
||||
typename super::ctor_args_list> ctor_args_list;
|
||||
typedef typename mpl::push_front<
|
||||
typedef type_list_push_front<
|
||||
typename super::index_type_list,
|
||||
hashed_index>::type index_type_list;
|
||||
typedef typename mpl::push_front<
|
||||
hashed_index> index_type_list;
|
||||
typedef type_list_push_front<
|
||||
typename super::iterator_type_list,
|
||||
iterator>::type iterator_type_list;
|
||||
typedef typename mpl::push_front<
|
||||
iterator> iterator_type_list;
|
||||
typedef type_list_push_front<
|
||||
typename super::const_iterator_type_list,
|
||||
const_iterator>::type const_iterator_type_list;
|
||||
const_iterator> const_iterator_type_list;
|
||||
typedef typename super::copy_map_type copy_map_type;
|
||||
|
||||
#if !defined(BOOST_MULTI_INDEX_DISABLE_SERIALIZATION)
|
||||
@@ -220,14 +195,12 @@ public:
|
||||
return *this;
|
||||
}
|
||||
|
||||
#if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST)
|
||||
hashed_index<KeyFromValue,Hash,Pred,SuperMeta,TagList,Category>& operator=(
|
||||
std::initializer_list<value_type> list)
|
||||
{
|
||||
this->final()=list;
|
||||
return *this;
|
||||
}
|
||||
#endif
|
||||
|
||||
allocator_type get_allocator()const BOOST_NOEXCEPT
|
||||
{
|
||||
@@ -273,11 +246,27 @@ public:
|
||||
|
||||
/* modifiers */
|
||||
|
||||
BOOST_MULTI_INDEX_OVERLOADS_TO_VARTEMPL(
|
||||
pair_return_type,emplace,emplace_impl)
|
||||
template<typename...Args>
|
||||
std::pair<iterator,bool> emplace(Args&&... args)
|
||||
{
|
||||
BOOST_MULTI_INDEX_HASHED_INDEX_CHECK_INVARIANT;
|
||||
std::pair<final_node_type*,bool>p=
|
||||
this->final_emplace_(std::forward<Args>(args)...);
|
||||
return std::pair<iterator,bool>(make_iterator(p.first),p.second);
|
||||
}
|
||||
|
||||
BOOST_MULTI_INDEX_OVERLOADS_TO_VARTEMPL_EXTRA_ARG(
|
||||
iterator,emplace_hint,emplace_hint_impl,iterator,position)
|
||||
template<typename...Args>
|
||||
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::pair<final_node_type*,bool>p=
|
||||
this->final_emplace_hint_(
|
||||
static_cast<final_node_type*>(position.get_node()),
|
||||
std::forward<Args>(args)...);
|
||||
return make_iterator(p.first);
|
||||
}
|
||||
|
||||
std::pair<iterator,bool> insert(const value_type& x)
|
||||
{
|
||||
@@ -286,7 +275,7 @@ public:
|
||||
return std::pair<iterator,bool>(make_iterator(p.first),p.second);
|
||||
}
|
||||
|
||||
std::pair<iterator,bool> insert(BOOST_RV_REF(value_type) x)
|
||||
std::pair<iterator,bool> insert(value_type&& x)
|
||||
{
|
||||
BOOST_MULTI_INDEX_HASHED_INDEX_CHECK_INVARIANT;
|
||||
std::pair<final_node_type*,bool> p=this->final_insert_rv_(x);
|
||||
@@ -303,7 +292,7 @@ public:
|
||||
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);
|
||||
@@ -320,22 +309,20 @@ public:
|
||||
for(;first!=last;++first)this->final_insert_ref_(*first);
|
||||
}
|
||||
|
||||
#if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST)
|
||||
void insert(std::initializer_list<value_type> list)
|
||||
{
|
||||
insert(list.begin(),list.end());
|
||||
}
|
||||
#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<final_node_type*,bool> 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);
|
||||
@@ -420,7 +407,7 @@ public:
|
||||
x,static_cast<final_node_type*>(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);
|
||||
@@ -518,11 +505,11 @@ public:
|
||||
|
||||
template<typename Index>
|
||||
BOOST_MULTI_INDEX_ENABLE_IF_MERGEABLE(hashed_index,Index,void)
|
||||
merge(BOOST_RV_REF(Index) x){merge(static_cast<Index&>(x));}
|
||||
merge(Index&& x){merge(static_cast<Index&>(x));}
|
||||
|
||||
template<typename Index>
|
||||
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);
|
||||
@@ -542,7 +529,7 @@ public:
|
||||
|
||||
template<typename Index>
|
||||
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,typename Index::iterator i)
|
||||
{
|
||||
return merge(static_cast<Index&>(x),i);
|
||||
}
|
||||
@@ -551,8 +538,8 @@ public:
|
||||
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);
|
||||
@@ -569,9 +556,9 @@ public:
|
||||
template<typename Index>
|
||||
BOOST_MULTI_INDEX_ENABLE_IF_MERGEABLE(hashed_index,Index,void)
|
||||
merge(
|
||||
BOOST_RV_REF(Index) x,
|
||||
BOOST_DEDUCED_TYPENAME Index::iterator first,
|
||||
BOOST_DEDUCED_TYPENAME Index::iterator last)
|
||||
Index&& x,
|
||||
typename Index::iterator first,
|
||||
typename Index::iterator last)
|
||||
{
|
||||
merge(static_cast<Index&>(x),first,last);
|
||||
}
|
||||
@@ -747,13 +734,15 @@ public:
|
||||
rehash(static_cast<size_type>(std::ceil(static_cast<float>(n)/mlf)));
|
||||
}
|
||||
|
||||
BOOST_MULTI_INDEX_PROTECTED_IF_MEMBER_TEMPLATE_FRIENDS:
|
||||
hashed_index(const ctor_args_list& args_list,const allocator_type& al):
|
||||
super(args_list.get_tail(),al),
|
||||
protected:
|
||||
hashed_index(
|
||||
const ctor_args_list& args_list,
|
||||
const allocator_type& al,index_node_type* h):
|
||||
super(args_list.get_tail(),al,h),
|
||||
key(tuples::get<1>(args_list.get_head())),
|
||||
hash_(tuples::get<2>(args_list.get_head())),
|
||||
eq_(tuples::get<3>(args_list.get_head())),
|
||||
buckets(al,header()->impl(),tuples::get<0>(args_list.get_head())),
|
||||
buckets(al,h->impl(),tuples::get<0>(args_list.get_head())),
|
||||
mlf(1.0f)
|
||||
|
||||
#if defined(BOOST_MULTI_INDEX_ENABLE_SAFE_MODE)
|
||||
@@ -765,12 +754,13 @@ BOOST_MULTI_INDEX_PROTECTED_IF_MEMBER_TEMPLATE_FRIENDS:
|
||||
}
|
||||
|
||||
hashed_index(
|
||||
const hashed_index<KeyFromValue,Hash,Pred,SuperMeta,TagList,Category>& x):
|
||||
super(x),
|
||||
const hashed_index<KeyFromValue,Hash,Pred,SuperMeta,TagList,Category>& x,
|
||||
const allocator_type& al,index_node_type* h):
|
||||
super(x,al,h),
|
||||
key(x.key),
|
||||
hash_(x.hash_),
|
||||
eq_(x.eq_),
|
||||
buckets(x.get_allocator(),header()->impl(),x.buckets.size()),
|
||||
buckets(al,h->impl(),x.buckets.size()),
|
||||
mlf(x.mlf),
|
||||
max_load(x.max_load)
|
||||
|
||||
@@ -786,12 +776,13 @@ BOOST_MULTI_INDEX_PROTECTED_IF_MEMBER_TEMPLATE_FRIENDS:
|
||||
|
||||
hashed_index(
|
||||
const hashed_index<KeyFromValue,Hash,Pred,SuperMeta,TagList,Category>& x,
|
||||
const allocator_type& al,index_node_type* h,
|
||||
do_not_copy_elements_tag):
|
||||
super(x,do_not_copy_elements_tag()),
|
||||
super(x,al,h,do_not_copy_elements_tag()),
|
||||
key(x.key),
|
||||
hash_(x.hash_),
|
||||
eq_(x.eq_),
|
||||
buckets(x.get_allocator(),header()->impl(),0),
|
||||
buckets(al,h->impl(),0),
|
||||
mlf(1.0f)
|
||||
|
||||
#if defined(BOOST_MULTI_INDEX_ENABLE_SAFE_MODE)
|
||||
@@ -1178,13 +1169,9 @@ BOOST_MULTI_INDEX_PROTECTED_IF_MEMBER_TEMPLATE_FRIENDS:
|
||||
|
||||
/* comparison */
|
||||
|
||||
#if !defined(BOOST_NO_MEMBER_TEMPLATE_FRIENDS)
|
||||
/* defect macro refers to class, not function, templates, but anyway */
|
||||
|
||||
template<typename K,typename H,typename P,typename S,typename T,typename C>
|
||||
friend bool operator==(
|
||||
const hashed_index<K,H,P,S,T,C>&,const hashed_index<K,H,P,S,T,C>& y);
|
||||
#endif
|
||||
|
||||
bool equals(const hashed_index& x)const{return equals(x,Category());}
|
||||
|
||||
@@ -1303,11 +1290,11 @@ private:
|
||||
node_impl_base_pointer first,last;
|
||||
};
|
||||
|
||||
typedef typename mpl::if_<
|
||||
typedef mp11::mp_if<
|
||||
is_same<Category,hashed_unique_tag>,
|
||||
node_impl_base_pointer,
|
||||
link_info_non_unique
|
||||
>::type link_info;
|
||||
> link_info;
|
||||
|
||||
bool link_point(value_param_type v,link_info& pos)
|
||||
{
|
||||
@@ -1449,7 +1436,11 @@ private:
|
||||
if(n>max_load){
|
||||
size_type bc =(std::numeric_limits<size_type>::max)();
|
||||
float fbc=1.0f+static_cast<float>(n)/mlf;
|
||||
if(bc>fbc)bc =static_cast<size_type>(fbc);
|
||||
if(bc>fbc){
|
||||
bc =(std::max)(
|
||||
static_cast<size_type>(fbc),
|
||||
static_cast<size_type>(bucket_count()+1));
|
||||
}
|
||||
unchecked_rehash(bc);
|
||||
}
|
||||
}
|
||||
@@ -1659,37 +1650,14 @@ private:
|
||||
}
|
||||
#endif
|
||||
|
||||
template<BOOST_MULTI_INDEX_TEMPLATE_PARAM_PACK>
|
||||
std::pair<iterator,bool> emplace_impl(BOOST_MULTI_INDEX_FUNCTION_PARAM_PACK)
|
||||
{
|
||||
BOOST_MULTI_INDEX_HASHED_INDEX_CHECK_INVARIANT;
|
||||
std::pair<final_node_type*,bool>p=
|
||||
this->final_emplace_(BOOST_MULTI_INDEX_FORWARD_PARAM_PACK);
|
||||
return std::pair<iterator,bool>(make_iterator(p.first),p.second);
|
||||
}
|
||||
|
||||
template<BOOST_MULTI_INDEX_TEMPLATE_PARAM_PACK>
|
||||
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::pair<final_node_type*,bool>p=
|
||||
this->final_emplace_hint_(
|
||||
static_cast<final_node_type*>(position.get_node()),
|
||||
BOOST_MULTI_INDEX_FORWARD_PARAM_PACK);
|
||||
return make_iterator(p.first);
|
||||
}
|
||||
|
||||
template<
|
||||
typename CompatibleHash,typename CompatiblePred
|
||||
>
|
||||
iterator find(
|
||||
const key_type& k,
|
||||
const CompatibleHash& hash,const CompatiblePred& eq,mpl::true_)const
|
||||
const CompatibleHash& hash,const CompatiblePred& eq,std::true_type)const
|
||||
{
|
||||
return find(k,hash,eq,mpl::false_());
|
||||
return find(k,hash,eq,std::false_type());
|
||||
}
|
||||
|
||||
template<
|
||||
@@ -1697,7 +1665,7 @@ private:
|
||||
>
|
||||
iterator find(
|
||||
const CompatibleKey& k,
|
||||
const CompatibleHash& hash,const CompatiblePred& eq,mpl::false_)const
|
||||
const CompatibleHash& hash,const CompatiblePred& eq,std::false_type)const
|
||||
{
|
||||
std::size_t buc=buckets.position(hash(k));
|
||||
for(node_impl_pointer x=buckets.at(buc)->prior();
|
||||
@@ -1714,9 +1682,9 @@ private:
|
||||
>
|
||||
size_type count(
|
||||
const key_type& k,
|
||||
const CompatibleHash& hash,const CompatiblePred& eq,mpl::true_)const
|
||||
const CompatibleHash& hash,const CompatiblePred& eq,std::true_type)const
|
||||
{
|
||||
return count(k,hash,eq,mpl::false_());
|
||||
return count(k,hash,eq,std::false_type());
|
||||
}
|
||||
|
||||
template<
|
||||
@@ -1724,7 +1692,7 @@ private:
|
||||
>
|
||||
size_type count(
|
||||
const CompatibleKey& k,
|
||||
const CompatibleHash& hash,const CompatiblePred& eq,mpl::false_)const
|
||||
const CompatibleHash& hash,const CompatiblePred& eq,std::false_type)const
|
||||
{
|
||||
std::size_t buc=buckets.position(hash(k));
|
||||
for(node_impl_pointer x=buckets.at(buc)->prior();
|
||||
@@ -1747,9 +1715,9 @@ private:
|
||||
>
|
||||
std::pair<iterator,iterator> equal_range(
|
||||
const key_type& k,
|
||||
const CompatibleHash& hash,const CompatiblePred& eq,mpl::true_)const
|
||||
const CompatibleHash& hash,const CompatiblePred& eq,std::true_type)const
|
||||
{
|
||||
return equal_range(k,hash,eq,mpl::false_());
|
||||
return equal_range(k,hash,eq,std::false_type());
|
||||
}
|
||||
|
||||
template<
|
||||
@@ -1757,7 +1725,7 @@ private:
|
||||
>
|
||||
std::pair<iterator,iterator> equal_range(
|
||||
const CompatibleKey& k,
|
||||
const CompatibleHash& hash,const CompatiblePred& eq,mpl::false_)const
|
||||
const CompatibleHash& hash,const CompatiblePred& eq,std::false_type)const
|
||||
{
|
||||
std::size_t buc=buckets.position(hash(k));
|
||||
for(node_impl_pointer x=buckets.at(buc)->prior();
|
||||
@@ -1781,11 +1749,6 @@ private:
|
||||
#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)
|
||||
@@ -1838,7 +1801,7 @@ struct hashed_unique
|
||||
{
|
||||
typedef typename detail::hashed_index_args<
|
||||
Arg1,Arg2,Arg3,Arg4> index_args;
|
||||
typedef typename index_args::tag_list_type::type tag_list_type;
|
||||
typedef typename index_args::tag_list_type tag_list_type;
|
||||
typedef typename index_args::key_from_value_type key_from_value_type;
|
||||
typedef typename index_args::hash_type hash_type;
|
||||
typedef typename index_args::pred_type pred_type;
|
||||
@@ -1863,7 +1826,7 @@ struct hashed_non_unique
|
||||
{
|
||||
typedef typename detail::hashed_index_args<
|
||||
Arg1,Arg2,Arg3,Arg4> index_args;
|
||||
typedef typename index_args::tag_list_type::type tag_list_type;
|
||||
typedef typename index_args::tag_list_type tag_list_type;
|
||||
typedef typename index_args::key_from_value_type key_from_value_type;
|
||||
typedef typename index_args::hash_type hash_type;
|
||||
typedef typename index_args::pred_type pred_type;
|
||||
@@ -1901,7 +1864,7 @@ template<
|
||||
>
|
||||
struct is_noncopyable<boost::multi_index::detail::hashed_index<
|
||||
KeyFromValue,Hash,Pred,SuperMeta,TagList,Category>
|
||||
>:boost::mpl::true_{};
|
||||
>:std::true_type{};
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
@@ -56,14 +56,14 @@ void swap(
|
||||
/* hashed_index specifiers */
|
||||
|
||||
template<
|
||||
typename Arg1,typename Arg2=mpl::na,
|
||||
typename Arg3=mpl::na,typename Arg4=mpl::na
|
||||
typename Arg1,typename Arg2=void,
|
||||
typename Arg3=void,typename Arg4=void
|
||||
>
|
||||
struct hashed_unique;
|
||||
|
||||
template<
|
||||
typename Arg1,typename Arg2=mpl::na,
|
||||
typename Arg3=mpl::na,typename Arg4=mpl::na
|
||||
typename Arg1,typename Arg2=void,
|
||||
typename Arg3=void,typename Arg4=void
|
||||
>
|
||||
struct hashed_non_unique;
|
||||
|
||||
|
||||
@@ -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,14 +16,11 @@
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/core/enable_if.hpp>
|
||||
#include <boost/detail/workaround.hpp>
|
||||
#include <boost/mpl/if.hpp>
|
||||
#include <boost/mp11/utility.hpp>
|
||||
#include <boost/multi_index/identity_fwd.hpp>
|
||||
#include <boost/type_traits/is_const.hpp>
|
||||
#include <boost/type_traits/remove_const.hpp>
|
||||
|
||||
#if !defined(BOOST_NO_SFINAE)
|
||||
#include <boost/type_traits/is_convertible.hpp>
|
||||
#endif
|
||||
#include <boost/type_traits/remove_const.hpp>
|
||||
|
||||
namespace boost{
|
||||
|
||||
@@ -50,12 +47,7 @@ struct const_identity_base
|
||||
|
||||
template<typename ChainedPtr>
|
||||
|
||||
#if !defined(BOOST_NO_SFINAE)
|
||||
typename disable_if<is_convertible<const ChainedPtr&,Type&>,Type&>::type
|
||||
#else
|
||||
Type&
|
||||
#endif
|
||||
|
||||
operator()(const ChainedPtr& x)const
|
||||
{
|
||||
return operator()(*x);
|
||||
@@ -94,13 +86,8 @@ struct non_const_identity_base
|
||||
|
||||
template<typename ChainedPtr>
|
||||
|
||||
#if !defined(BOOST_NO_SFINAE)
|
||||
typename disable_if<
|
||||
is_convertible<const ChainedPtr&,const Type&>,Type&>::type
|
||||
#else
|
||||
Type&
|
||||
#endif
|
||||
|
||||
operator()(const ChainedPtr& x)const
|
||||
{
|
||||
return operator()(*x);
|
||||
@@ -131,10 +118,10 @@ struct non_const_identity_base
|
||||
|
||||
template<class Type>
|
||||
struct identity:
|
||||
mpl::if_c<
|
||||
is_const<Type>::value,
|
||||
mp11::mp_if<
|
||||
is_const<Type>,
|
||||
detail::const_identity_base<Type>,detail::non_const_identity_base<Type>
|
||||
>::type
|
||||
>
|
||||
{
|
||||
};
|
||||
|
||||
|
||||
@@ -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,17 +14,23 @@
|
||||
#endif
|
||||
|
||||
#include <boost/config.hpp> /* keep it first to prevent nasty warns in MSVC */
|
||||
#include <boost/mpl/vector.hpp>
|
||||
|
||||
/* An Mp11 list containing the index specifiers for instantiation
|
||||
* of a multi_index_container.
|
||||
* If BOOST_MULTI_INDEX_ENABLE_MPL_SUPPORT is defined, the old
|
||||
* MPL-based definition of indexed_by is kept.
|
||||
*/
|
||||
|
||||
#if defined(BOOST_MULTI_INDEX_ENABLE_MPL_SUPPORT)
|
||||
#define BOOST_MULTI_INDEX_BLOCK_BOOSTDEP_HEADER \
|
||||
<boost/mpl/vector.hpp>
|
||||
#include BOOST_MULTI_INDEX_BLOCK_BOOSTDEP_HEADER
|
||||
#undef BOOST_MULTI_INDEX_BLOCK_BOOSTDEP_HEADER
|
||||
#include <boost/preprocessor/cat.hpp>
|
||||
#include <boost/preprocessor/control/expr_if.hpp>
|
||||
#include <boost/preprocessor/repetition/enum.hpp>
|
||||
#include <boost/preprocessor/repetition/enum_params.hpp>
|
||||
|
||||
/* An alias to mpl::vector used to hide MPL from the user.
|
||||
* indexed_by contains the index specifiers for instantiation
|
||||
* of a multi_index_container.
|
||||
*/
|
||||
|
||||
/* This user_definable macro limits the number of elements of an index list;
|
||||
* useful for shortening resulting symbol names (MSVC++ 6.0, for instance,
|
||||
* has problems coping with very long symbol names.)
|
||||
@@ -64,5 +70,16 @@ struct indexed_by:
|
||||
|
||||
#undef BOOST_MULTI_INDEX_INDEXED_BY_TEMPLATE_PARM
|
||||
#undef BOOST_MULTI_INDEX_INDEXED_BY_SIZE
|
||||
#else
|
||||
namespace boost{
|
||||
|
||||
namespace multi_index{
|
||||
|
||||
template<typename T,typename... Ts>
|
||||
struct indexed_by;
|
||||
|
||||
} /* namespace multi_index */
|
||||
|
||||
} /* namespace boost */
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@@ -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)
|
||||
@@ -159,29 +159,10 @@ struct key_impl<Key0,Keys...>
|
||||
>;
|
||||
};
|
||||
|
||||
template<typename=composite_key<void,void>>
|
||||
struct composite_key_size;
|
||||
|
||||
template<typename... Args>
|
||||
struct composite_key_size<composite_key<Args...>>
|
||||
{
|
||||
static constexpr auto value=sizeof...(Args)-1;
|
||||
};
|
||||
|
||||
template<auto... Keys>
|
||||
struct limited_size_key_impl
|
||||
{
|
||||
static_assert(
|
||||
sizeof...(Keys)<=composite_key_size<>::value,
|
||||
"specified number of keys must meet the limits of "
|
||||
"boost::multi_index::composite_key");
|
||||
using type=typename key_impl<Keys...>::type;
|
||||
};
|
||||
|
||||
} /* namespace multi_index::detail */
|
||||
|
||||
template<auto... Keys>
|
||||
using key=typename detail::limited_size_key_impl<Keys...>::type;
|
||||
using key=typename detail::key_impl<Keys...>::type;
|
||||
|
||||
} /* namespace multi_index */
|
||||
|
||||
|
||||
@@ -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)
|
||||
@@ -15,12 +15,8 @@
|
||||
|
||||
#include <boost/config.hpp> /* keep it first to prevent nasty warns in MSVC */
|
||||
#include <boost/core/enable_if.hpp>
|
||||
#include <boost/mpl/if.hpp>
|
||||
#include <boost/type_traits/remove_reference.hpp>
|
||||
|
||||
#if !defined(BOOST_NO_SFINAE)
|
||||
#include <boost/type_traits/is_convertible.hpp>
|
||||
#endif
|
||||
#include <boost/type_traits/remove_reference.hpp>
|
||||
|
||||
namespace boost{
|
||||
|
||||
@@ -59,13 +55,8 @@ struct const_mem_fun_impl
|
||||
|
||||
template<typename ChainedPtr>
|
||||
|
||||
#if !defined(BOOST_NO_SFINAE)
|
||||
typename disable_if<
|
||||
is_convertible<const ChainedPtr&,const Class&>,Type>::type
|
||||
#else
|
||||
Type
|
||||
#endif
|
||||
|
||||
operator()(const ChainedPtr& x)const
|
||||
{
|
||||
return operator()(*x);
|
||||
@@ -97,13 +88,8 @@ struct mem_fun_impl
|
||||
|
||||
template<typename ChainedPtr>
|
||||
|
||||
#if !defined(BOOST_NO_SFINAE)
|
||||
typename disable_if<
|
||||
is_convertible<ChainedPtr&,Class&>,Type>::type
|
||||
#else
|
||||
Type
|
||||
#endif
|
||||
|
||||
operator()(const ChainedPtr& x)const
|
||||
{
|
||||
return operator()(*x);
|
||||
@@ -199,13 +185,8 @@ struct const_mem_fun_explicit
|
||||
|
||||
template<typename ChainedPtr>
|
||||
|
||||
#if !defined(BOOST_NO_SFINAE)
|
||||
typename disable_if<
|
||||
is_convertible<const ChainedPtr&,const Class&>,Type>::type
|
||||
#else
|
||||
Type
|
||||
#endif
|
||||
|
||||
operator()(const ChainedPtr& x)const
|
||||
{
|
||||
return operator()(*x);
|
||||
@@ -237,13 +218,8 @@ struct mem_fun_explicit
|
||||
|
||||
template<typename ChainedPtr>
|
||||
|
||||
#if !defined(BOOST_NO_SFINAE)
|
||||
typename disable_if<
|
||||
is_convertible<ChainedPtr&,Class&>,Type>::type
|
||||
#else
|
||||
Type
|
||||
#endif
|
||||
|
||||
operator()(const ChainedPtr& x)const
|
||||
{
|
||||
return operator()(*x);
|
||||
|
||||
@@ -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)
|
||||
@@ -15,13 +15,10 @@
|
||||
|
||||
#include <boost/config.hpp> /* keep it first to prevent nasty warns in MSVC */
|
||||
#include <boost/core/enable_if.hpp>
|
||||
#include <boost/mpl/if.hpp>
|
||||
#include <boost/mp11/utility.hpp>
|
||||
#include <boost/type_traits/is_const.hpp>
|
||||
#include <cstddef>
|
||||
|
||||
#if !defined(BOOST_NO_SFINAE)
|
||||
#include <boost/type_traits/is_convertible.hpp>
|
||||
#endif
|
||||
#include <cstddef>
|
||||
|
||||
namespace boost{
|
||||
|
||||
@@ -48,13 +45,8 @@ struct const_member_base
|
||||
|
||||
template<typename ChainedPtr>
|
||||
|
||||
#if !defined(BOOST_NO_SFINAE)
|
||||
typename disable_if<
|
||||
is_convertible<const ChainedPtr&,const Class&>,Type&>::type
|
||||
#else
|
||||
Type&
|
||||
#endif
|
||||
|
||||
operator()(const ChainedPtr& x)const
|
||||
{
|
||||
return operator()(*x);
|
||||
@@ -83,13 +75,8 @@ struct non_const_member_base
|
||||
|
||||
template<typename ChainedPtr>
|
||||
|
||||
#if !defined(BOOST_NO_SFINAE)
|
||||
typename disable_if<
|
||||
is_convertible<const ChainedPtr&,const Class&>,Type&>::type
|
||||
#else
|
||||
Type&
|
||||
#endif
|
||||
|
||||
operator()(const ChainedPtr& x)const
|
||||
{
|
||||
return operator()(*x);
|
||||
@@ -120,11 +107,11 @@ struct non_const_member_base
|
||||
|
||||
template<class Class,typename Type,Type Class::*PtrToMember>
|
||||
struct member:
|
||||
mpl::if_c<
|
||||
is_const<Type>::value,
|
||||
mp11::mp_if<
|
||||
is_const<Type>,
|
||||
detail::const_member_base<Class,Type,PtrToMember>,
|
||||
detail::non_const_member_base<Class,Type,PtrToMember>
|
||||
>::type
|
||||
>
|
||||
{
|
||||
};
|
||||
|
||||
@@ -154,13 +141,8 @@ struct const_member_offset_base
|
||||
|
||||
template<typename ChainedPtr>
|
||||
|
||||
#if !defined(BOOST_NO_SFINAE)
|
||||
typename disable_if<
|
||||
is_convertible<const ChainedPtr&,const Class&>,Type&>::type
|
||||
#else
|
||||
Type&
|
||||
#endif
|
||||
|
||||
operator()(const ChainedPtr& x)const
|
||||
{
|
||||
return operator()(*x);
|
||||
@@ -192,13 +174,8 @@ struct non_const_member_offset_base
|
||||
|
||||
template<typename ChainedPtr>
|
||||
|
||||
#if !defined(BOOST_NO_SFINAE)
|
||||
typename disable_if<
|
||||
is_convertible<const ChainedPtr&,const Class&>,Type&>::type
|
||||
#else
|
||||
Type&
|
||||
#endif
|
||||
|
||||
operator()(const ChainedPtr& x)const
|
||||
{
|
||||
return operator()(*x);
|
||||
@@ -234,26 +211,21 @@ struct non_const_member_offset_base
|
||||
|
||||
template<class Class,typename Type,std::size_t OffsetOfMember>
|
||||
struct member_offset:
|
||||
mpl::if_c<
|
||||
is_const<Type>::value,
|
||||
mp11::mp_if<
|
||||
is_const<Type>,
|
||||
detail::const_member_offset_base<Class,Type,OffsetOfMember>,
|
||||
detail::non_const_member_offset_base<Class,Type,OffsetOfMember>
|
||||
>::type
|
||||
>
|
||||
{
|
||||
};
|
||||
|
||||
/* 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 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 */
|
||||
|
||||
|
||||
@@ -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)
|
||||
@@ -62,7 +62,7 @@ struct ordered_unique
|
||||
{
|
||||
typedef typename detail::ordered_index_args<
|
||||
Arg1,Arg2,Arg3> index_args;
|
||||
typedef typename index_args::tag_list_type::type tag_list_type;
|
||||
typedef typename index_args::tag_list_type tag_list_type;
|
||||
typedef typename index_args::key_from_value_type key_from_value_type;
|
||||
typedef typename index_args::compare_type compare_type;
|
||||
|
||||
@@ -87,7 +87,7 @@ struct ordered_non_unique
|
||||
{
|
||||
typedef detail::ordered_index_args<
|
||||
Arg1,Arg2,Arg3> index_args;
|
||||
typedef typename index_args::tag_list_type::type tag_list_type;
|
||||
typedef typename index_args::tag_list_type tag_list_type;
|
||||
typedef typename index_args::key_from_value_type key_from_value_type;
|
||||
typedef typename index_args::compare_type compare_type;
|
||||
|
||||
|
||||
@@ -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)
|
||||
@@ -22,10 +22,10 @@ namespace multi_index{
|
||||
|
||||
/* ordered_index specifiers */
|
||||
|
||||
template<typename Arg1,typename Arg2=mpl::na,typename Arg3=mpl::na>
|
||||
template<typename Arg1,typename Arg2=void,typename Arg3=void>
|
||||
struct ordered_unique;
|
||||
|
||||
template<typename Arg1,typename Arg2=mpl::na,typename Arg3=mpl::na>
|
||||
template<typename Arg1,typename Arg2=void,typename Arg3=void>
|
||||
struct ordered_non_unique;
|
||||
|
||||
} /* namespace multi_index */
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright 2003-2023 Joaquin M Lopez Munoz.
|
||||
/* Copyright 2003-2026 Joaquin M Lopez Munoz.
|
||||
* Distributed under the Boost Software License, Version 1.0.
|
||||
* (See accompanying file LICENSE_1_0.txt or copy at
|
||||
* http://www.boost.org/LICENSE_1_0.txt)
|
||||
@@ -18,16 +18,9 @@
|
||||
#include <boost/bind/bind.hpp>
|
||||
#include <boost/call_traits.hpp>
|
||||
#include <boost/core/addressof.hpp>
|
||||
#include <boost/core/allocator_access.hpp>
|
||||
#include <boost/core/no_exceptions_support.hpp>
|
||||
#include <boost/detail/workaround.hpp>
|
||||
#include <boost/iterator/reverse_iterator.hpp>
|
||||
#include <boost/move/core.hpp>
|
||||
#include <boost/move/utility_core.hpp>
|
||||
#include <boost/mpl/bool.hpp>
|
||||
#include <boost/mpl/not.hpp>
|
||||
#include <boost/mpl/push_front.hpp>
|
||||
#include <boost/multi_index/detail/access_specifier.hpp>
|
||||
#include <boost/multi_index/detail/allocator_traits.hpp>
|
||||
#include <boost/mp11/function.hpp>
|
||||
#include <boost/multi_index/detail/do_not_copy_elements_tag.hpp>
|
||||
#include <boost/multi_index/detail/index_node_base.hpp>
|
||||
#include <boost/multi_index/detail/node_handle.hpp>
|
||||
@@ -37,20 +30,19 @@
|
||||
#include <boost/multi_index/detail/rnd_index_ptr_array.hpp>
|
||||
#include <boost/multi_index/detail/safe_mode.hpp>
|
||||
#include <boost/multi_index/detail/scope_guard.hpp>
|
||||
#include <boost/multi_index/detail/vartempl_support.hpp>
|
||||
#include <boost/multi_index/detail/type_list.hpp>
|
||||
#include <boost/multi_index/random_access_index_fwd.hpp>
|
||||
#include <boost/throw_exception.hpp>
|
||||
#include <boost/tuple/tuple.hpp>
|
||||
#include <boost/type_traits/is_copy_constructible.hpp>
|
||||
#include <boost/type_traits/is_integral.hpp>
|
||||
#include <functional>
|
||||
#include <initializer_list>
|
||||
#include <iterator>
|
||||
#include <stdexcept>
|
||||
#include <type_traits>
|
||||
#include <utility>
|
||||
|
||||
#if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST)
|
||||
#include<initializer_list>
|
||||
#endif
|
||||
|
||||
#if !defined(BOOST_MULTI_INDEX_DISABLE_SERIALIZATION)
|
||||
#include <boost/multi_index/detail/rnd_index_loader.hpp>
|
||||
#endif
|
||||
@@ -83,24 +75,10 @@ namespace detail{
|
||||
#endif
|
||||
|
||||
template<typename SuperMeta,typename TagList>
|
||||
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)
|
||||
/* 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
|
||||
|
||||
#if !defined(BOOST_NO_MEMBER_TEMPLATE_FRIENDS)
|
||||
/* cross-index access */
|
||||
|
||||
template <typename,typename,typename> friend class index_base;
|
||||
#endif
|
||||
|
||||
typedef typename SuperMeta::type super;
|
||||
|
||||
@@ -131,19 +109,16 @@ public:
|
||||
#endif
|
||||
|
||||
typedef iterator const_iterator;
|
||||
|
||||
private:
|
||||
typedef allocator_traits<allocator_type> 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<allocator_type> pointer;
|
||||
typedef allocator_const_pointer_t<
|
||||
allocator_type> const_pointer;
|
||||
typedef allocator_size_type_t<allocator_type> size_type;
|
||||
typedef allocator_difference_type_t<
|
||||
allocator_type> difference_type;
|
||||
typedef typename
|
||||
boost::reverse_iterator<iterator> reverse_iterator;
|
||||
std::reverse_iterator<iterator> reverse_iterator;
|
||||
typedef typename
|
||||
boost::reverse_iterator<const_iterator> const_reverse_iterator;
|
||||
std::reverse_iterator<const_iterator> const_reverse_iterator;
|
||||
typedef typename super::final_node_handle_type node_type;
|
||||
typedef detail::insert_return_type<
|
||||
iterator,node_type> insert_return_type;
|
||||
@@ -154,15 +129,15 @@ protected:
|
||||
typedef tuples::cons<
|
||||
ctor_args,
|
||||
typename super::ctor_args_list> ctor_args_list;
|
||||
typedef typename mpl::push_front<
|
||||
typedef type_list_push_front<
|
||||
typename super::index_type_list,
|
||||
random_access_index>::type index_type_list;
|
||||
typedef typename mpl::push_front<
|
||||
random_access_index> index_type_list;
|
||||
typedef type_list_push_front<
|
||||
typename super::iterator_type_list,
|
||||
iterator>::type iterator_type_list;
|
||||
typedef typename mpl::push_front<
|
||||
iterator> iterator_type_list;
|
||||
typedef type_list_push_front<
|
||||
typename super::const_iterator_type_list,
|
||||
const_iterator>::type const_iterator_type_list;
|
||||
const_iterator> const_iterator_type_list;
|
||||
typedef typename super::copy_map_type copy_map_type;
|
||||
|
||||
#if !defined(BOOST_MULTI_INDEX_DISABLE_SERIALIZATION)
|
||||
@@ -196,27 +171,23 @@ public:
|
||||
return *this;
|
||||
}
|
||||
|
||||
#if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST)
|
||||
random_access_index<SuperMeta,TagList>& operator=(
|
||||
std::initializer_list<value_type> list)
|
||||
{
|
||||
this->final()=list;
|
||||
return *this;
|
||||
}
|
||||
#endif
|
||||
|
||||
template <class InputIterator>
|
||||
void assign(InputIterator first,InputIterator last)
|
||||
{
|
||||
assign_iter(first,last,mpl::not_<is_integral<InputIterator> >());
|
||||
assign_iter(first,last,mp11::mp_not<is_integral<InputIterator> >());
|
||||
}
|
||||
|
||||
#if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST)
|
||||
void assign(std::initializer_list<value_type> list)
|
||||
{
|
||||
assign(list.begin(),list.end());
|
||||
}
|
||||
#endif
|
||||
|
||||
void assign(size_type n,value_param_type value)
|
||||
{
|
||||
@@ -241,13 +212,13 @@ public:
|
||||
const_iterator
|
||||
end()const BOOST_NOEXCEPT{return make_iterator(header());}
|
||||
reverse_iterator
|
||||
rbegin()BOOST_NOEXCEPT{return boost::make_reverse_iterator(end());}
|
||||
rbegin()BOOST_NOEXCEPT{return reverse_iterator{end()};}
|
||||
const_reverse_iterator
|
||||
rbegin()const BOOST_NOEXCEPT{return boost::make_reverse_iterator(end());}
|
||||
rbegin()const BOOST_NOEXCEPT{return const_reverse_iterator{end()};}
|
||||
reverse_iterator
|
||||
rend()BOOST_NOEXCEPT{return boost::make_reverse_iterator(begin());}
|
||||
rend()BOOST_NOEXCEPT{return reverse_iterator{begin()};}
|
||||
const_reverse_iterator
|
||||
rend()const BOOST_NOEXCEPT{return boost::make_reverse_iterator(begin());}
|
||||
rend()const BOOST_NOEXCEPT{return const_reverse_iterator{begin()};}
|
||||
const_iterator
|
||||
cbegin()const BOOST_NOEXCEPT{return begin();}
|
||||
const_iterator
|
||||
@@ -291,10 +262,12 @@ public:
|
||||
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(n<size())erase(begin()+n,end());
|
||||
if(n>size()){
|
||||
for(size_type m=n-size();m--;)this->final_emplace_();
|
||||
}
|
||||
else if(n<size()){
|
||||
erase(begin()+n,end());
|
||||
}
|
||||
}
|
||||
|
||||
void resize(size_type n,value_param_type x)
|
||||
@@ -325,26 +298,43 @@ public:
|
||||
|
||||
/* modifiers */
|
||||
|
||||
BOOST_MULTI_INDEX_OVERLOADS_TO_VARTEMPL(
|
||||
pair_return_type,emplace_front,emplace_front_impl)
|
||||
template<typename... Args>
|
||||
std::pair<iterator,bool> emplace_front(Args&&... args)
|
||||
{
|
||||
return emplace(begin(),std::forward<Args>(args)...);
|
||||
}
|
||||
|
||||
std::pair<iterator,bool> push_front(const value_type& x)
|
||||
{return insert(begin(),x);}
|
||||
std::pair<iterator,bool> push_front(BOOST_RV_REF(value_type) x)
|
||||
{return insert(begin(),boost::move(x));}
|
||||
std::pair<iterator,bool> push_front(value_type&& x)
|
||||
{return insert(begin(),std::move(x));}
|
||||
void pop_front(){erase(begin());}
|
||||
|
||||
BOOST_MULTI_INDEX_OVERLOADS_TO_VARTEMPL(
|
||||
pair_return_type,emplace_back,emplace_back_impl)
|
||||
template<typename... Args>
|
||||
std::pair<iterator,bool> emplace_back(Args&&... args)
|
||||
{
|
||||
return emplace(end(),std::forward<Args>(args)...);
|
||||
}
|
||||
|
||||
std::pair<iterator,bool> push_back(const value_type& x)
|
||||
{return insert(end(),x);}
|
||||
std::pair<iterator,bool> push_back(BOOST_RV_REF(value_type) x)
|
||||
{return insert(end(),boost::move(x));}
|
||||
std::pair<iterator,bool> push_back(value_type&& x)
|
||||
{return insert(end(),std::move(x));}
|
||||
void pop_back(){erase(--end());}
|
||||
|
||||
BOOST_MULTI_INDEX_OVERLOADS_TO_VARTEMPL_EXTRA_ARG(
|
||||
pair_return_type,emplace,emplace_impl,iterator,position)
|
||||
template<typename... Args>
|
||||
std::pair<iterator,bool> 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<final_node_type*,bool> p=
|
||||
this->final_emplace_(std::forward<Args>(args)...);
|
||||
if(p.second&&position.get_node()!=header()){
|
||||
relocate(position.get_node(),p.first);
|
||||
}
|
||||
return std::pair<iterator,bool>(make_iterator(p.first),p.second);
|
||||
}
|
||||
|
||||
std::pair<iterator,bool> insert(iterator position,const value_type& x)
|
||||
{
|
||||
@@ -358,7 +348,7 @@ public:
|
||||
return std::pair<iterator,bool>(make_iterator(p.first),p.second);
|
||||
}
|
||||
|
||||
std::pair<iterator,bool> insert(iterator position,BOOST_RV_REF(value_type) x)
|
||||
std::pair<iterator,bool> insert(iterator position,value_type&& x)
|
||||
{
|
||||
BOOST_MULTI_INDEX_CHECK_VALID_ITERATOR(position);
|
||||
BOOST_MULTI_INDEX_CHECK_IS_OWNER(position,*this);
|
||||
@@ -392,17 +382,15 @@ public:
|
||||
template<typename InputIterator>
|
||||
void insert(iterator position,InputIterator first,InputIterator last)
|
||||
{
|
||||
insert_iter(position,first,last,mpl::not_<is_integral<InputIterator> >());
|
||||
insert_iter(position,first,last,mp11::mp_not<is_integral<InputIterator> >());
|
||||
}
|
||||
|
||||
#if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST)
|
||||
void insert(iterator position,std::initializer_list<value_type> list)
|
||||
{
|
||||
insert(position,list.begin(),list.end());
|
||||
}
|
||||
#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);
|
||||
@@ -412,7 +400,7 @@ public:
|
||||
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)
|
||||
@@ -459,7 +447,7 @@ public:
|
||||
x,static_cast<final_node_type*>(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);
|
||||
@@ -546,7 +534,7 @@ public:
|
||||
|
||||
template<typename Index>
|
||||
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<Index&>(x));
|
||||
}
|
||||
@@ -555,7 +543,7 @@ public:
|
||||
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);
|
||||
@@ -581,8 +569,8 @@ public:
|
||||
BOOST_MULTI_INDEX_ENABLE_IF_MERGEABLE(
|
||||
random_access_index,Index,pair_return_type)
|
||||
splice(
|
||||
iterator position,BOOST_RV_REF(Index) x,
|
||||
BOOST_DEDUCED_TYPENAME Index::iterator i)
|
||||
iterator position,Index&& x,
|
||||
typename Index::iterator i)
|
||||
{
|
||||
return splice(position,static_cast<Index&>(x),i);
|
||||
}
|
||||
@@ -591,8 +579,8 @@ public:
|
||||
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);
|
||||
@@ -615,9 +603,9 @@ public:
|
||||
template<typename Index>
|
||||
BOOST_MULTI_INDEX_ENABLE_IF_MERGEABLE(random_access_index,Index,void)
|
||||
splice(
|
||||
iterator position,BOOST_RV_REF(Index) x,
|
||||
BOOST_DEDUCED_TYPENAME Index::iterator first,
|
||||
BOOST_DEDUCED_TYPENAME Index::iterator last)
|
||||
iterator position,Index&& x,
|
||||
typename Index::iterator first,
|
||||
typename Index::iterator last)
|
||||
{
|
||||
splice(position,static_cast<Index&>(x),first,last);
|
||||
}
|
||||
@@ -751,11 +739,12 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
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),
|
||||
ptrs(al,header()->impl(),0)
|
||||
const ctor_args_list& args_list,
|
||||
const allocator_type& al,index_node_type* h):
|
||||
super(args_list.get_tail(),al,h),
|
||||
ptrs(al,h->impl(),0)
|
||||
|
||||
#if defined(BOOST_MULTI_INDEX_ENABLE_SAFE_MODE)
|
||||
,safe(*this)
|
||||
@@ -764,9 +753,11 @@ BOOST_MULTI_INDEX_PROTECTED_IF_MEMBER_TEMPLATE_FRIENDS:
|
||||
{
|
||||
}
|
||||
|
||||
random_access_index(const random_access_index<SuperMeta,TagList>& x):
|
||||
super(x),
|
||||
ptrs(x.get_allocator(),header()->impl(),x.size())
|
||||
random_access_index(
|
||||
const random_access_index<SuperMeta,TagList>& x,
|
||||
const allocator_type& al,index_node_type* h):
|
||||
super(x,al,h),
|
||||
ptrs(al,h->impl(),x.size())
|
||||
|
||||
#if defined(BOOST_MULTI_INDEX_ENABLE_SAFE_MODE)
|
||||
,safe(*this)
|
||||
@@ -778,9 +769,11 @@ BOOST_MULTI_INDEX_PROTECTED_IF_MEMBER_TEMPLATE_FRIENDS:
|
||||
}
|
||||
|
||||
random_access_index(
|
||||
const random_access_index<SuperMeta,TagList>& x,do_not_copy_elements_tag):
|
||||
super(x,do_not_copy_elements_tag()),
|
||||
ptrs(x.get_allocator(),header()->impl(),0)
|
||||
const random_access_index<SuperMeta,TagList>& x,
|
||||
const allocator_type& al,index_node_type* h,
|
||||
do_not_copy_elements_tag):
|
||||
super(x,al,h,do_not_copy_elements_tag()),
|
||||
ptrs(al,h->impl(),0)
|
||||
|
||||
#if defined(BOOST_MULTI_INDEX_ENABLE_SAFE_MODE)
|
||||
,safe(*this)
|
||||
@@ -1027,14 +1020,14 @@ private:
|
||||
#endif
|
||||
|
||||
template <class InputIterator>
|
||||
void assign_iter(InputIterator first,InputIterator last,mpl::true_)
|
||||
void assign_iter(InputIterator first,InputIterator last,std::true_type)
|
||||
{
|
||||
BOOST_MULTI_INDEX_RND_INDEX_CHECK_INVARIANT;
|
||||
clear();
|
||||
for(;first!=last;++first)this->final_insert_ref_(*first);
|
||||
}
|
||||
|
||||
void assign_iter(size_type n,value_param_type value,mpl::false_)
|
||||
void assign_iter(size_type n,value_param_type value,std::false_type)
|
||||
{
|
||||
BOOST_MULTI_INDEX_RND_INDEX_CHECK_INVARIANT;
|
||||
clear();
|
||||
@@ -1043,7 +1036,7 @@ private:
|
||||
|
||||
template<typename InputIterator>
|
||||
void insert_iter(
|
||||
iterator position,InputIterator first,InputIterator last,mpl::true_)
|
||||
iterator position,InputIterator first,InputIterator last,std::true_type)
|
||||
{
|
||||
BOOST_MULTI_INDEX_RND_INDEX_CHECK_INVARIANT;
|
||||
size_type s=0;
|
||||
@@ -1061,7 +1054,7 @@ private:
|
||||
}
|
||||
|
||||
void insert_iter(
|
||||
iterator position,size_type n,value_param_type x,mpl::false_)
|
||||
iterator position,size_type n,value_param_type x,std::false_type)
|
||||
{
|
||||
BOOST_MULTI_INDEX_CHECK_VALID_ITERATOR(position);
|
||||
BOOST_MULTI_INDEX_CHECK_IS_OWNER(position,*this);
|
||||
@@ -1080,38 +1073,9 @@ private:
|
||||
relocate(position,end()-s,end());
|
||||
}
|
||||
|
||||
template<BOOST_MULTI_INDEX_TEMPLATE_PARAM_PACK>
|
||||
std::pair<iterator,bool> emplace_front_impl(
|
||||
BOOST_MULTI_INDEX_FUNCTION_PARAM_PACK)
|
||||
{
|
||||
return emplace_impl(begin(),BOOST_MULTI_INDEX_FORWARD_PARAM_PACK);
|
||||
}
|
||||
|
||||
template<BOOST_MULTI_INDEX_TEMPLATE_PARAM_PACK>
|
||||
std::pair<iterator,bool> emplace_back_impl(
|
||||
BOOST_MULTI_INDEX_FUNCTION_PARAM_PACK)
|
||||
{
|
||||
return emplace_impl(end(),BOOST_MULTI_INDEX_FORWARD_PARAM_PACK);
|
||||
}
|
||||
|
||||
template<BOOST_MULTI_INDEX_TEMPLATE_PARAM_PACK>
|
||||
std::pair<iterator,bool> 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<final_node_type*,bool> 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<iterator,bool>(make_iterator(p.first),p.second);
|
||||
}
|
||||
|
||||
template<typename Index>
|
||||
std::pair<final_node_type*,bool> 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()){
|
||||
@@ -1129,7 +1093,7 @@ private:
|
||||
|
||||
template<typename Index>
|
||||
std::pair<final_node_type*,bool> 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);
|
||||
@@ -1173,8 +1137,8 @@ private:
|
||||
template<typename Index>
|
||||
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()){
|
||||
@@ -1202,8 +1166,8 @@ private:
|
||||
template<typename Index>
|
||||
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);
|
||||
@@ -1224,11 +1188,6 @@ private:
|
||||
#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)
|
||||
@@ -1331,8 +1290,7 @@ struct random_access
|
||||
template<typename SuperMeta>
|
||||
struct index_class
|
||||
{
|
||||
typedef detail::random_access_index<
|
||||
SuperMeta,typename TagList::type> type;
|
||||
typedef detail::random_access_index<SuperMeta,TagList> type;
|
||||
};
|
||||
};
|
||||
|
||||
@@ -1351,7 +1309,7 @@ struct is_noncopyable;
|
||||
template<typename SuperMeta,typename TagList>
|
||||
struct is_noncopyable<
|
||||
boost::multi_index::detail::random_access_index<SuperMeta,TagList>
|
||||
>:boost::mpl::true_{};
|
||||
>:std::true_type{};
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright 2003-2022 Joaquin M Lopez Munoz.
|
||||
/* Copyright 2003-2026 Joaquin M Lopez Munoz.
|
||||
* Distributed under the Boost Software License, Version 1.0.
|
||||
* (See accompanying file LICENSE_1_0.txt or copy at
|
||||
* http://www.boost.org/LICENSE_1_0.txt)
|
||||
@@ -14,6 +14,7 @@
|
||||
#endif
|
||||
|
||||
#include <boost/config.hpp> /* keep it first to prevent nasty warns in MSVC */
|
||||
#include <boost/mp11/utility.hpp>
|
||||
#include <boost/multi_index/detail/ord_index_impl.hpp>
|
||||
#include <boost/multi_index/detail/rnk_index_ops.hpp>
|
||||
#include <boost/multi_index/ranked_index_fwd.hpp>
|
||||
@@ -146,32 +147,37 @@ public:
|
||||
std::pair<size_type,size_type>
|
||||
range_rank(LowerBounder lower,UpperBounder upper)const
|
||||
{
|
||||
typedef typename mpl::if_<
|
||||
typedef mp11::mp_if<
|
||||
is_same<LowerBounder,unbounded_type>,
|
||||
BOOST_DEDUCED_TYPENAME mpl::if_<
|
||||
mp11::mp_if<
|
||||
is_same<UpperBounder,unbounded_type>,
|
||||
both_unbounded_tag,
|
||||
lower_unbounded_tag
|
||||
>::type,
|
||||
BOOST_DEDUCED_TYPENAME mpl::if_<
|
||||
>,
|
||||
mp11::mp_if<
|
||||
is_same<UpperBounder,unbounded_type>,
|
||||
upper_unbounded_tag,
|
||||
none_unbounded_tag
|
||||
>::type
|
||||
>::type dispatch;
|
||||
>
|
||||
> dispatch;
|
||||
|
||||
return range_rank(lower,upper,dispatch());
|
||||
}
|
||||
|
||||
protected:
|
||||
ranked_index(const ranked_index& x):super(x){};
|
||||
|
||||
ranked_index(const ranked_index& x,do_not_copy_elements_tag):
|
||||
super(x,do_not_copy_elements_tag()){};
|
||||
ranked_index(
|
||||
const ranked_index& x,const allocator_type& al,index_node_type* h):
|
||||
super(x,al,h){};
|
||||
|
||||
ranked_index(
|
||||
const ctor_args_list& args_list,const allocator_type& al):
|
||||
super(args_list,al){}
|
||||
const ranked_index& x,const allocator_type& al,index_node_type* h,
|
||||
do_not_copy_elements_tag):
|
||||
super(x,al,h,do_not_copy_elements_tag()){};
|
||||
|
||||
ranked_index(
|
||||
const ctor_args_list& args_list,
|
||||
const allocator_type& al,index_node_type* h):
|
||||
super(args_list,al,h){}
|
||||
|
||||
private:
|
||||
template<typename LowerBounder,typename UpperBounder>
|
||||
@@ -181,7 +187,7 @@ private:
|
||||
index_node_type* y=this->header();
|
||||
index_node_type* z=this->root();
|
||||
|
||||
if(!z)return std::pair<size_type,size_type>(0,0);
|
||||
if(!z)return std::pair<size_type,size_type>((size_type)0,(size_type)0);
|
||||
|
||||
size_type s=z->impl()->size;
|
||||
|
||||
@@ -211,7 +217,7 @@ private:
|
||||
range_rank(LowerBounder,UpperBounder upper,lower_unbounded_tag)const
|
||||
{
|
||||
return std::pair<size_type,size_type>(
|
||||
0,
|
||||
(size_type)0,
|
||||
upper_range_rank(this->root(),this->header(),upper));
|
||||
}
|
||||
|
||||
@@ -228,7 +234,7 @@ private:
|
||||
std::pair<size_type,size_type>
|
||||
range_rank(LowerBounder,UpperBounder,both_unbounded_tag)const
|
||||
{
|
||||
return std::pair<size_type,size_type>(0,this->size());
|
||||
return std::pair<size_type,size_type>((size_type)0,this->size());
|
||||
}
|
||||
|
||||
template<typename LowerBounder>
|
||||
@@ -350,7 +356,7 @@ struct ranked_unique
|
||||
{
|
||||
typedef typename detail::ordered_index_args<
|
||||
Arg1,Arg2,Arg3> index_args;
|
||||
typedef typename index_args::tag_list_type::type tag_list_type;
|
||||
typedef typename index_args::tag_list_type tag_list_type;
|
||||
typedef typename index_args::key_from_value_type key_from_value_type;
|
||||
typedef typename index_args::compare_type compare_type;
|
||||
|
||||
@@ -375,7 +381,7 @@ struct ranked_non_unique
|
||||
{
|
||||
typedef detail::ordered_index_args<
|
||||
Arg1,Arg2,Arg3> index_args;
|
||||
typedef typename index_args::tag_list_type::type tag_list_type;
|
||||
typedef typename index_args::tag_list_type tag_list_type;
|
||||
typedef typename index_args::key_from_value_type key_from_value_type;
|
||||
typedef typename index_args::compare_type compare_type;
|
||||
|
||||
|
||||
@@ -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)
|
||||
@@ -22,10 +22,10 @@ namespace multi_index{
|
||||
|
||||
/* ranked_index specifiers */
|
||||
|
||||
template<typename Arg1,typename Arg2=mpl::na,typename Arg3=mpl::na>
|
||||
template<typename Arg1,typename Arg2=void,typename Arg3=void>
|
||||
struct ranked_unique;
|
||||
|
||||
template<typename Arg1,typename Arg2=mpl::na,typename Arg3=mpl::na>
|
||||
template<typename Arg1,typename Arg2=void,typename Arg3=void>
|
||||
struct ranked_non_unique;
|
||||
|
||||
} /* namespace multi_index */
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright 2003-2023 Joaquin M Lopez Munoz.
|
||||
/* Copyright 2003-2026 Joaquin M Lopez Munoz.
|
||||
* Distributed under the Boost Software License, Version 1.0.
|
||||
* (See accompanying file LICENSE_1_0.txt or copy at
|
||||
* http://www.boost.org/LICENSE_1_0.txt)
|
||||
@@ -17,16 +17,9 @@
|
||||
#include <boost/bind/bind.hpp>
|
||||
#include <boost/call_traits.hpp>
|
||||
#include <boost/core/addressof.hpp>
|
||||
#include <boost/core/allocator_access.hpp>
|
||||
#include <boost/core/no_exceptions_support.hpp>
|
||||
#include <boost/detail/workaround.hpp>
|
||||
#include <boost/iterator/reverse_iterator.hpp>
|
||||
#include <boost/move/core.hpp>
|
||||
#include <boost/move/utility_core.hpp>
|
||||
#include <boost/mpl/bool.hpp>
|
||||
#include <boost/mpl/not.hpp>
|
||||
#include <boost/mpl/push_front.hpp>
|
||||
#include <boost/multi_index/detail/access_specifier.hpp>
|
||||
#include <boost/multi_index/detail/allocator_traits.hpp>
|
||||
#include <boost/mp11/function.hpp>
|
||||
#include <boost/multi_index/detail/bidir_node_iterator.hpp>
|
||||
#include <boost/multi_index/detail/do_not_copy_elements_tag.hpp>
|
||||
#include <boost/multi_index/detail/index_node_base.hpp>
|
||||
@@ -35,18 +28,17 @@
|
||||
#include <boost/multi_index/detail/scope_guard.hpp>
|
||||
#include <boost/multi_index/detail/seq_index_node.hpp>
|
||||
#include <boost/multi_index/detail/seq_index_ops.hpp>
|
||||
#include <boost/multi_index/detail/vartempl_support.hpp>
|
||||
#include <boost/multi_index/detail/type_list.hpp>
|
||||
#include <boost/multi_index/sequenced_index_fwd.hpp>
|
||||
#include <boost/tuple/tuple.hpp>
|
||||
#include <boost/type_traits/is_copy_constructible.hpp>
|
||||
#include <boost/type_traits/is_integral.hpp>
|
||||
#include <functional>
|
||||
#include <initializer_list>
|
||||
#include <iterator>
|
||||
#include <type_traits>
|
||||
#include <utility>
|
||||
|
||||
#if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST)
|
||||
#include<initializer_list>
|
||||
#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__)= \
|
||||
@@ -73,24 +65,10 @@ namespace detail{
|
||||
#endif
|
||||
|
||||
template<typename SuperMeta,typename TagList>
|
||||
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)
|
||||
/* 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
|
||||
|
||||
#if !defined(BOOST_NO_MEMBER_TEMPLATE_FRIENDS)
|
||||
/* cross-index access */
|
||||
|
||||
template <typename,typename,typename> friend class index_base;
|
||||
#endif
|
||||
|
||||
typedef typename SuperMeta::type super;
|
||||
|
||||
@@ -118,19 +96,16 @@ public:
|
||||
#endif
|
||||
|
||||
typedef iterator const_iterator;
|
||||
|
||||
private:
|
||||
typedef allocator_traits<allocator_type> 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<allocator_type> pointer;
|
||||
typedef allocator_const_pointer<
|
||||
allocator_type> const_pointer;
|
||||
typedef allocator_size_type_t<allocator_type> size_type;
|
||||
typedef allocator_difference_type_t<
|
||||
allocator_type> difference_type;
|
||||
typedef typename
|
||||
boost::reverse_iterator<iterator> reverse_iterator;
|
||||
std::reverse_iterator<iterator> reverse_iterator;
|
||||
typedef typename
|
||||
boost::reverse_iterator<const_iterator> const_reverse_iterator;
|
||||
std::reverse_iterator<const_iterator> const_reverse_iterator;
|
||||
typedef typename super::final_node_handle_type node_type;
|
||||
typedef detail::insert_return_type<
|
||||
iterator,node_type> insert_return_type;
|
||||
@@ -141,15 +116,15 @@ protected:
|
||||
typedef tuples::cons<
|
||||
ctor_args,
|
||||
typename super::ctor_args_list> ctor_args_list;
|
||||
typedef typename mpl::push_front<
|
||||
typedef type_list_push_front<
|
||||
typename super::index_type_list,
|
||||
sequenced_index>::type index_type_list;
|
||||
typedef typename mpl::push_front<
|
||||
sequenced_index> index_type_list;
|
||||
typedef type_list_push_front<
|
||||
typename super::iterator_type_list,
|
||||
iterator>::type iterator_type_list;
|
||||
typedef typename mpl::push_front<
|
||||
iterator> iterator_type_list;
|
||||
typedef type_list_push_front<
|
||||
typename super::const_iterator_type_list,
|
||||
const_iterator>::type const_iterator_type_list;
|
||||
const_iterator> const_iterator_type_list;
|
||||
typedef typename super::copy_map_type copy_map_type;
|
||||
|
||||
#if !defined(BOOST_MULTI_INDEX_DISABLE_SERIALIZATION)
|
||||
@@ -182,27 +157,23 @@ public:
|
||||
return *this;
|
||||
}
|
||||
|
||||
#if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST)
|
||||
sequenced_index<SuperMeta,TagList>& operator=(
|
||||
std::initializer_list<value_type> list)
|
||||
{
|
||||
this->final()=list;
|
||||
return *this;
|
||||
}
|
||||
#endif
|
||||
|
||||
template <class InputIterator>
|
||||
void assign(InputIterator first,InputIterator last)
|
||||
{
|
||||
assign_iter(first,last,mpl::not_<is_integral<InputIterator> >());
|
||||
assign_iter(first,last,mp11::mp_not<is_integral<InputIterator> >());
|
||||
}
|
||||
|
||||
#if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST)
|
||||
void assign(std::initializer_list<value_type> list)
|
||||
{
|
||||
assign(list.begin(),list.end());
|
||||
}
|
||||
#endif
|
||||
|
||||
void assign(size_type n,value_param_type value)
|
||||
{
|
||||
@@ -227,13 +198,13 @@ public:
|
||||
const_iterator
|
||||
end()const BOOST_NOEXCEPT{return make_iterator(header());}
|
||||
reverse_iterator
|
||||
rbegin()BOOST_NOEXCEPT{return boost::make_reverse_iterator(end());}
|
||||
rbegin()BOOST_NOEXCEPT{return reverse_iterator{end()};}
|
||||
const_reverse_iterator
|
||||
rbegin()const BOOST_NOEXCEPT{return boost::make_reverse_iterator(end());}
|
||||
rbegin()const BOOST_NOEXCEPT{return const_reverse_iterator{end()};}
|
||||
reverse_iterator
|
||||
rend()BOOST_NOEXCEPT{return boost::make_reverse_iterator(begin());}
|
||||
rend()BOOST_NOEXCEPT{return reverse_iterator{begin()};}
|
||||
const_reverse_iterator
|
||||
rend()const BOOST_NOEXCEPT{return boost::make_reverse_iterator(begin());}
|
||||
rend()const BOOST_NOEXCEPT{return const_reverse_iterator{begin()};}
|
||||
const_iterator
|
||||
cbegin()const BOOST_NOEXCEPT{return begin();}
|
||||
const_iterator
|
||||
@@ -265,10 +236,11 @@ public:
|
||||
{
|
||||
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<size()){
|
||||
for(size_type m=size()-n;m--;)pop_back();
|
||||
}
|
||||
else if(n<size()){for(size_type m=size()-n;m--;)pop_back();}
|
||||
}
|
||||
|
||||
void resize(size_type n,value_param_type x)
|
||||
@@ -287,26 +259,43 @@ public:
|
||||
|
||||
/* modifiers */
|
||||
|
||||
BOOST_MULTI_INDEX_OVERLOADS_TO_VARTEMPL(
|
||||
pair_return_type,emplace_front,emplace_front_impl)
|
||||
template<typename... Args>
|
||||
std::pair<iterator,bool> emplace_front(Args&&... args)
|
||||
{
|
||||
return emplace(begin(),std::forward<Args>(args)...);
|
||||
}
|
||||
|
||||
std::pair<iterator,bool> push_front(const value_type& x)
|
||||
{return insert(begin(),x);}
|
||||
std::pair<iterator,bool> push_front(BOOST_RV_REF(value_type) x)
|
||||
{return insert(begin(),boost::move(x));}
|
||||
std::pair<iterator,bool> push_front(value_type&& x)
|
||||
{return insert(begin(),std::move(x));}
|
||||
void pop_front(){erase(begin());}
|
||||
|
||||
BOOST_MULTI_INDEX_OVERLOADS_TO_VARTEMPL(
|
||||
pair_return_type,emplace_back,emplace_back_impl)
|
||||
template<typename... Args>
|
||||
std::pair<iterator,bool> emplace_back(Args&&... args)
|
||||
{
|
||||
return emplace(end(),std::forward<Args>(args)...);
|
||||
}
|
||||
|
||||
std::pair<iterator,bool> push_back(const value_type& x)
|
||||
{return insert(end(),x);}
|
||||
std::pair<iterator,bool> push_back(BOOST_RV_REF(value_type) x)
|
||||
{return insert(end(),boost::move(x));}
|
||||
std::pair<iterator,bool> push_back(value_type&& x)
|
||||
{return insert(end(),std::move(x));}
|
||||
void pop_back(){erase(--end());}
|
||||
|
||||
BOOST_MULTI_INDEX_OVERLOADS_TO_VARTEMPL_EXTRA_ARG(
|
||||
pair_return_type,emplace,emplace_impl,iterator,position)
|
||||
template<typename... Args>
|
||||
std::pair<iterator,bool> 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<final_node_type*,bool> p=
|
||||
this->final_emplace_(std::forward<Args>(args)...);
|
||||
if(p.second&&position.get_node()!=header()){
|
||||
relink(position.get_node(),p.first);
|
||||
}
|
||||
return std::pair<iterator,bool>(make_iterator(p.first),p.second);
|
||||
}
|
||||
|
||||
std::pair<iterator,bool> insert(iterator position,const value_type& x)
|
||||
{
|
||||
@@ -320,7 +309,7 @@ public:
|
||||
return std::pair<iterator,bool>(make_iterator(p.first),p.second);
|
||||
}
|
||||
|
||||
std::pair<iterator,bool> insert(iterator position,BOOST_RV_REF(value_type) x)
|
||||
std::pair<iterator,bool> insert(iterator position,value_type&& x)
|
||||
{
|
||||
BOOST_MULTI_INDEX_CHECK_VALID_ITERATOR(position);
|
||||
BOOST_MULTI_INDEX_CHECK_IS_OWNER(position,*this);
|
||||
@@ -343,17 +332,15 @@ public:
|
||||
template<typename InputIterator>
|
||||
void insert(iterator position,InputIterator first,InputIterator last)
|
||||
{
|
||||
insert_iter(position,first,last,mpl::not_<is_integral<InputIterator> >());
|
||||
insert_iter(position,first,last,mp11::mp_not<is_integral<InputIterator> >());
|
||||
}
|
||||
|
||||
#if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST)
|
||||
void insert(iterator position,std::initializer_list<value_type> list)
|
||||
{
|
||||
insert(position,list.begin(),list.end());
|
||||
}
|
||||
#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);
|
||||
@@ -363,7 +350,7 @@ public:
|
||||
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)
|
||||
@@ -410,7 +397,7 @@ public:
|
||||
x,static_cast<final_node_type*>(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);
|
||||
@@ -497,7 +484,7 @@ public:
|
||||
|
||||
template<typename Index>
|
||||
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<Index&>(x));
|
||||
}
|
||||
@@ -506,7 +493,7 @@ public:
|
||||
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);
|
||||
@@ -532,8 +519,8 @@ public:
|
||||
BOOST_MULTI_INDEX_ENABLE_IF_MERGEABLE(
|
||||
sequenced_index,Index,pair_return_type)
|
||||
splice(
|
||||
iterator position,BOOST_RV_REF(Index) x,
|
||||
BOOST_DEDUCED_TYPENAME Index::iterator i)
|
||||
iterator position,Index&& x,
|
||||
typename Index::iterator i)
|
||||
{
|
||||
return splice(position,static_cast<Index&>(x),i);
|
||||
}
|
||||
@@ -542,8 +529,8 @@ public:
|
||||
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);
|
||||
@@ -566,9 +553,9 @@ public:
|
||||
template<typename Index>
|
||||
BOOST_MULTI_INDEX_ENABLE_IF_MERGEABLE(sequenced_index,Index,void)
|
||||
splice(
|
||||
iterator position,BOOST_RV_REF(Index) x,
|
||||
BOOST_DEDUCED_TYPENAME Index::iterator first,
|
||||
BOOST_DEDUCED_TYPENAME Index::iterator last)
|
||||
iterator position,Index&& x,
|
||||
typename Index::iterator first,
|
||||
typename Index::iterator last)
|
||||
{
|
||||
splice(position,static_cast<Index&>(x),first,last);
|
||||
}
|
||||
@@ -667,9 +654,11 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
BOOST_MULTI_INDEX_PROTECTED_IF_MEMBER_TEMPLATE_FRIENDS:
|
||||
sequenced_index(const ctor_args_list& args_list,const allocator_type& al):
|
||||
super(args_list.get_tail(),al)
|
||||
protected:
|
||||
sequenced_index(
|
||||
const ctor_args_list& args_list,
|
||||
const allocator_type& al,index_node_type* h):
|
||||
super(args_list.get_tail(),al,h)
|
||||
|
||||
#if defined(BOOST_MULTI_INDEX_ENABLE_SAFE_MODE)
|
||||
,safe(*this)
|
||||
@@ -679,8 +668,10 @@ BOOST_MULTI_INDEX_PROTECTED_IF_MEMBER_TEMPLATE_FRIENDS:
|
||||
empty_initialize();
|
||||
}
|
||||
|
||||
sequenced_index(const sequenced_index<SuperMeta,TagList>& x):
|
||||
super(x)
|
||||
sequenced_index(
|
||||
const sequenced_index<SuperMeta,TagList>& x,
|
||||
const allocator_type& al,index_node_type* h):
|
||||
super(x,al,h)
|
||||
|
||||
#if defined(BOOST_MULTI_INDEX_ENABLE_SAFE_MODE)
|
||||
,safe(*this)
|
||||
@@ -691,8 +682,10 @@ BOOST_MULTI_INDEX_PROTECTED_IF_MEMBER_TEMPLATE_FRIENDS:
|
||||
}
|
||||
|
||||
sequenced_index(
|
||||
const sequenced_index<SuperMeta,TagList>& x,do_not_copy_elements_tag):
|
||||
super(x,do_not_copy_elements_tag())
|
||||
const sequenced_index<SuperMeta,TagList>& x,
|
||||
const allocator_type& al,index_node_type* h,
|
||||
do_not_copy_elements_tag):
|
||||
super(x,al,h,do_not_copy_elements_tag())
|
||||
|
||||
#if defined(BOOST_MULTI_INDEX_ENABLE_SAFE_MODE)
|
||||
,safe(*this)
|
||||
@@ -955,14 +948,14 @@ private:
|
||||
#endif
|
||||
|
||||
template <class InputIterator>
|
||||
void assign_iter(InputIterator first,InputIterator last,mpl::true_)
|
||||
void assign_iter(InputIterator first,InputIterator last,std::true_type)
|
||||
{
|
||||
BOOST_MULTI_INDEX_SEQ_INDEX_CHECK_INVARIANT;
|
||||
clear();
|
||||
for(;first!=last;++first)this->final_insert_ref_(*first);
|
||||
}
|
||||
|
||||
void assign_iter(size_type n,value_param_type value,mpl::false_)
|
||||
void assign_iter(size_type n,value_param_type value,std::false_type)
|
||||
{
|
||||
BOOST_MULTI_INDEX_SEQ_INDEX_CHECK_INVARIANT;
|
||||
clear();
|
||||
@@ -971,7 +964,7 @@ private:
|
||||
|
||||
template<typename InputIterator>
|
||||
void insert_iter(
|
||||
iterator position,InputIterator first,InputIterator last,mpl::true_)
|
||||
iterator position,InputIterator first,InputIterator last,std::true_type)
|
||||
{
|
||||
BOOST_MULTI_INDEX_SEQ_INDEX_CHECK_INVARIANT;
|
||||
for(;first!=last;++first){
|
||||
@@ -984,7 +977,7 @@ private:
|
||||
}
|
||||
|
||||
void insert_iter(
|
||||
iterator position,size_type n,value_param_type x,mpl::false_)
|
||||
iterator position,size_type n,value_param_type x,std::false_type)
|
||||
{
|
||||
BOOST_MULTI_INDEX_CHECK_VALID_ITERATOR(position);
|
||||
BOOST_MULTI_INDEX_CHECK_IS_OWNER(position,*this);
|
||||
@@ -992,38 +985,9 @@ private:
|
||||
for(size_type i=0;i<n;++i)insert(position,x);
|
||||
}
|
||||
|
||||
template<BOOST_MULTI_INDEX_TEMPLATE_PARAM_PACK>
|
||||
std::pair<iterator,bool> emplace_front_impl(
|
||||
BOOST_MULTI_INDEX_FUNCTION_PARAM_PACK)
|
||||
{
|
||||
return emplace_impl(begin(),BOOST_MULTI_INDEX_FORWARD_PARAM_PACK);
|
||||
}
|
||||
|
||||
template<BOOST_MULTI_INDEX_TEMPLATE_PARAM_PACK>
|
||||
std::pair<iterator,bool> emplace_back_impl(
|
||||
BOOST_MULTI_INDEX_FUNCTION_PARAM_PACK)
|
||||
{
|
||||
return emplace_impl(end(),BOOST_MULTI_INDEX_FORWARD_PARAM_PACK);
|
||||
}
|
||||
|
||||
template<BOOST_MULTI_INDEX_TEMPLATE_PARAM_PACK>
|
||||
std::pair<iterator,bool> 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<final_node_type*,bool> 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<iterator,bool>(make_iterator(p.first),p.second);
|
||||
}
|
||||
|
||||
template<typename Index>
|
||||
std::pair<final_node_type*,bool> 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()){
|
||||
@@ -1041,7 +1005,7 @@ private:
|
||||
|
||||
template<typename Index>
|
||||
std::pair<final_node_type*,bool> 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);
|
||||
@@ -1073,8 +1037,8 @@ private:
|
||||
template<typename Index>
|
||||
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()){
|
||||
@@ -1093,8 +1057,8 @@ private:
|
||||
template<typename Index>
|
||||
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);
|
||||
@@ -1120,11 +1084,6 @@ private:
|
||||
#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)
|
||||
@@ -1227,7 +1186,7 @@ struct sequenced
|
||||
template<typename SuperMeta>
|
||||
struct index_class
|
||||
{
|
||||
typedef detail::sequenced_index<SuperMeta,typename TagList::type> type;
|
||||
typedef detail::sequenced_index<SuperMeta,TagList> type;
|
||||
};
|
||||
};
|
||||
|
||||
@@ -1246,7 +1205,7 @@ struct is_noncopyable;
|
||||
template<typename SuperMeta,typename TagList>
|
||||
struct is_noncopyable<
|
||||
boost::multi_index::detail::sequenced_index<SuperMeta,TagList>
|
||||
>:boost::mpl::true_{};
|
||||
>:std::true_type{};
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
@@ -15,14 +15,32 @@
|
||||
|
||||
#include <boost/config.hpp> /* keep it first to prevent nasty warns in MSVC */
|
||||
#include <boost/multi_index/detail/no_duplicate_tags.hpp>
|
||||
#include <boost/mpl/identity.hpp>
|
||||
#include <boost/mpl/transform.hpp>
|
||||
#include <boost/mpl/vector.hpp>
|
||||
#include <boost/static_assert.hpp>
|
||||
#include <boost/type_traits/is_base_and_derived.hpp>
|
||||
|
||||
/* A Mp11 list containing types used as tag names for indices in get()
|
||||
* functions.
|
||||
* If BOOST_MULTI_INDEX_ENABLE_MPL_SUPPORT is defined, the old
|
||||
* MPL-based definition of tag is kept.
|
||||
*/
|
||||
|
||||
#if defined(BOOST_MULTI_INDEX_ENABLE_MPL_SUPPORT)
|
||||
#include <boost/multi_index/detail/mpl_to_mp11_list.hpp>
|
||||
#define BOOST_MULTI_INDEX_BLOCK_BOOSTDEP_HEADER \
|
||||
<boost/mpl/identity.hpp>
|
||||
#include BOOST_MULTI_INDEX_BLOCK_BOOSTDEP_HEADER
|
||||
#undef BOOST_MULTI_INDEX_BLOCK_BOOSTDEP_HEADER
|
||||
#define BOOST_MULTI_INDEX_BLOCK_BOOSTDEP_HEADER \
|
||||
<boost/mpl/transform.hpp>
|
||||
#include BOOST_MULTI_INDEX_BLOCK_BOOSTDEP_HEADER
|
||||
#undef BOOST_MULTI_INDEX_BLOCK_BOOSTDEP_HEADER
|
||||
#define BOOST_MULTI_INDEX_BLOCK_BOOSTDEP_HEADER \
|
||||
<boost/mpl/vector.hpp>
|
||||
#include BOOST_MULTI_INDEX_BLOCK_BOOSTDEP_HEADER
|
||||
#undef BOOST_MULTI_INDEX_BLOCK_BOOSTDEP_HEADER
|
||||
#include <boost/preprocessor/facilities/intercept.hpp>
|
||||
#include <boost/preprocessor/repetition/enum_binary_params.hpp>
|
||||
#include <boost/preprocessor/repetition/enum_params.hpp>
|
||||
#include <boost/static_assert.hpp>
|
||||
#include <boost/type_traits/is_base_and_derived.hpp>
|
||||
|
||||
/* A wrapper of mpl::vector used to hide MPL from the user.
|
||||
* tag contains types used as tag names for indices in get() functions.
|
||||
@@ -76,13 +94,46 @@ struct tag:private detail::tag_marker
|
||||
mpl::identity<mpl::_1>
|
||||
>::type type;
|
||||
|
||||
BOOST_STATIC_ASSERT(detail::no_duplicate_tags<type>::value);
|
||||
BOOST_STATIC_ASSERT(
|
||||
detail::no_duplicate_tags<detail::mpl_to_mp11_list<type>>::value);
|
||||
};
|
||||
|
||||
template<typename TagList>
|
||||
using mp11_tag_list=detail::mpl_to_mp11_list<typename TagList::type>;
|
||||
|
||||
} /* namespace multi_index */
|
||||
|
||||
} /* namespace boost */
|
||||
|
||||
#undef BOOST_MULTI_INDEX_TAG_SIZE
|
||||
#else
|
||||
namespace boost{
|
||||
|
||||
namespace multi_index{
|
||||
|
||||
namespace detail{
|
||||
|
||||
struct tag_marker{};
|
||||
|
||||
template<typename T>
|
||||
struct is_tag
|
||||
{
|
||||
BOOST_STATIC_CONSTANT(bool,value=(is_base_and_derived<tag_marker,T>::value));
|
||||
};
|
||||
|
||||
} /* namespace multi_index::detail */
|
||||
|
||||
template<typename... Ts>
|
||||
struct tag:private detail::tag_marker
|
||||
{
|
||||
BOOST_STATIC_ASSERT(detail::no_duplicate_tags<tag>::value);
|
||||
};
|
||||
|
||||
template<typename TagList>
|
||||
using mp11_tag_list=TagList;
|
||||
|
||||
} /* namespace multi_index */
|
||||
|
||||
} /* namespace boost */
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* Multiply indexed container.
|
||||
*
|
||||
* Copyright 2003-2023 Joaquin M Lopez Munoz.
|
||||
* Copyright 2003-2026 Joaquin M Lopez Munoz.
|
||||
* Distributed under the Boost Software License, Version 1.0.
|
||||
* (See accompanying file LICENSE_1_0.txt or copy at
|
||||
* http://www.boost.org/LICENSE_1_0.txt)
|
||||
@@ -18,39 +18,31 @@
|
||||
#include <boost/config.hpp> /* keep it first to prevent nasty warns in MSVC */
|
||||
#include <algorithm>
|
||||
#include <boost/core/addressof.hpp>
|
||||
#include <boost/core/allocator_access.hpp>
|
||||
#include <boost/core/no_exceptions_support.hpp>
|
||||
#include <boost/detail/workaround.hpp>
|
||||
#include <boost/move/core.hpp>
|
||||
#include <boost/move/utility_core.hpp>
|
||||
#include <boost/mpl/at.hpp>
|
||||
#include <boost/mpl/contains.hpp>
|
||||
#include <boost/mpl/find_if.hpp>
|
||||
#include <boost/mpl/identity.hpp>
|
||||
#include <boost/mpl/int.hpp>
|
||||
#include <boost/mpl/size.hpp>
|
||||
#include <boost/mpl/deref.hpp>
|
||||
#include <boost/mp11/algorithm.hpp>
|
||||
#include <boost/mp11/integral.hpp>
|
||||
#include <boost/mp11/utility.hpp>
|
||||
#include <boost/multi_index_container_fwd.hpp>
|
||||
#include <boost/multi_index/detail/access_specifier.hpp>
|
||||
#include <boost/multi_index/detail/adl_swap.hpp>
|
||||
#include <boost/multi_index/detail/allocator_traits.hpp>
|
||||
#include <boost/multi_index/detail/base_type.hpp>
|
||||
#include <boost/multi_index/detail/do_not_copy_elements_tag.hpp>
|
||||
#include <boost/multi_index/detail/converter.hpp>
|
||||
#include <boost/multi_index/detail/header_holder.hpp>
|
||||
#include <boost/multi_index/detail/has_tag.hpp>
|
||||
#include <boost/multi_index/detail/invalidate_iterators.hpp>
|
||||
#include <boost/multi_index/detail/is_index_list.hpp>
|
||||
#include <boost/multi_index/detail/no_duplicate_tags.hpp>
|
||||
#include <boost/multi_index/detail/no_duplicate_tags_in_index_list.hpp>
|
||||
#include <boost/multi_index/detail/safe_mode.hpp>
|
||||
#include <boost/multi_index/detail/scope_guard.hpp>
|
||||
#include <boost/multi_index/detail/vartempl_support.hpp>
|
||||
#include <boost/static_assert.hpp>
|
||||
#include <boost/type_traits/integral_constant.hpp>
|
||||
#include <boost/type_traits/is_same.hpp>
|
||||
#include <boost/utility/base_from_member.hpp>
|
||||
|
||||
#if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST)
|
||||
#include <initializer_list>
|
||||
#endif
|
||||
#include <utility>
|
||||
|
||||
#if !defined(BOOST_MULTI_INDEX_DISABLE_SERIALIZATION)
|
||||
#include <boost/core/serialization.hpp>
|
||||
@@ -98,51 +90,36 @@ struct unequal_alloc_move_ctor_tag{};
|
||||
template<typename Value,typename IndexSpecifierList,typename Allocator>
|
||||
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<
|
||||
private detail::header_holder<
|
||||
allocator_pointer_t<
|
||||
allocator_rebind_t<
|
||||
Allocator,
|
||||
typename detail::multi_index_node_type<
|
||||
Value,IndexSpecifierList,Allocator>::type
|
||||
>::type
|
||||
>::pointer,
|
||||
>
|
||||
>,
|
||||
multi_index_container<Value,IndexSpecifierList,Allocator> >,
|
||||
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:
|
||||
BOOST_COPYABLE_AND_MOVABLE(multi_index_container)
|
||||
|
||||
#if !defined(BOOST_NO_MEMBER_TEMPLATE_FRIENDS)
|
||||
template <typename,typename,typename> friend class detail::index_base;
|
||||
template <typename,typename> friend struct detail::header_holder;
|
||||
template <typename,typename> friend struct detail::converter;
|
||||
#endif
|
||||
|
||||
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_allocator> node_alloc_traits;
|
||||
typedef typename node_alloc_traits::pointer node_pointer;
|
||||
> node_allocator;
|
||||
typedef allocator_pointer_t<node_allocator> node_pointer;
|
||||
typedef ::boost::base_from_member<
|
||||
node_allocator> bfm_allocator;
|
||||
typedef detail::header_holder<
|
||||
@@ -168,7 +145,8 @@ public:
|
||||
typedef typename super::const_iterator const_iterator;
|
||||
|
||||
BOOST_STATIC_ASSERT(
|
||||
detail::no_duplicate_tags_in_index_list<index_type_list>::value);
|
||||
detail::no_duplicate_tags_in_index_list<
|
||||
detail::mp11_index_list<index_type_list>>::value);
|
||||
|
||||
/* global project() needs to see this publicly */
|
||||
|
||||
@@ -178,7 +156,7 @@ public:
|
||||
|
||||
multi_index_container():
|
||||
bfm_allocator(allocator_type()),
|
||||
super(ctor_args_list(),bfm_allocator::member),
|
||||
super(ctor_args_list(),bfm_allocator::member,&*bfm_header::member),
|
||||
node_count(0)
|
||||
{
|
||||
BOOST_MULTI_INDEX_CHECK_INVARIANT;
|
||||
@@ -186,21 +164,9 @@ public:
|
||||
|
||||
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 mpl::identity<multi_index_container>::type::
|
||||
allocator_type()):
|
||||
#else
|
||||
const allocator_type& al=allocator_type()):
|
||||
#endif
|
||||
|
||||
bfm_allocator(al),
|
||||
super(args_list,bfm_allocator::member),
|
||||
super(args_list,bfm_allocator::member,&*bfm_header::member),
|
||||
node_count(0)
|
||||
{
|
||||
BOOST_MULTI_INDEX_CHECK_INVARIANT;
|
||||
@@ -208,7 +174,7 @@ public:
|
||||
|
||||
explicit multi_index_container(const allocator_type& al):
|
||||
bfm_allocator(al),
|
||||
super(ctor_args_list(),bfm_allocator::member),
|
||||
super(ctor_args_list(),bfm_allocator::member,&*bfm_header::member),
|
||||
node_count(0)
|
||||
{
|
||||
BOOST_MULTI_INDEX_CHECK_INVARIANT;
|
||||
@@ -217,25 +183,10 @@ public:
|
||||
template<typename InputIterator>
|
||||
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 mpl::identity<multi_index_container>::type::
|
||||
ctor_args_list(),
|
||||
const allocator_type& al=
|
||||
typename mpl::identity<multi_index_container>::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),
|
||||
super(args_list,bfm_allocator::member,&*bfm_header::member),
|
||||
node_count(0)
|
||||
{
|
||||
BOOST_MULTI_INDEX_CHECK_INVARIANT;
|
||||
@@ -254,13 +205,12 @@ public:
|
||||
BOOST_CATCH_END
|
||||
}
|
||||
|
||||
#if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST)
|
||||
multi_index_container(
|
||||
std::initializer_list<Value> list,
|
||||
const ctor_args_list& args_list=ctor_args_list(),
|
||||
const allocator_type& al=allocator_type()):
|
||||
bfm_allocator(al),
|
||||
super(args_list,bfm_allocator::member),
|
||||
super(args_list,bfm_allocator::member,&*bfm_header::member),
|
||||
node_count(0)
|
||||
{
|
||||
BOOST_MULTI_INDEX_CHECK_INVARIANT;
|
||||
@@ -280,24 +230,23 @@ public:
|
||||
}
|
||||
BOOST_CATCH_END
|
||||
}
|
||||
#endif
|
||||
|
||||
multi_index_container(
|
||||
const multi_index_container<Value,IndexSpecifierList,Allocator>& 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),
|
||||
super(x,bfm_allocator::member,&*bfm_header::member),
|
||||
node_count(0)
|
||||
{
|
||||
copy_construct_from(x);
|
||||
}
|
||||
|
||||
multi_index_container(BOOST_RV_REF(multi_index_container) x):
|
||||
bfm_allocator(boost::move(x.bfm_allocator::member)),
|
||||
bfm_header(),
|
||||
super(x,detail::do_not_copy_elements_tag()),
|
||||
multi_index_container(multi_index_container&& x):
|
||||
bfm_allocator(std::move(x.bfm_allocator::member)),
|
||||
super(
|
||||
x,bfm_allocator::member,&*bfm_header::member,
|
||||
detail::do_not_copy_elements_tag()),
|
||||
node_count(0)
|
||||
{
|
||||
BOOST_MULTI_INDEX_CHECK_INVARIANT;
|
||||
@@ -309,18 +258,18 @@ public:
|
||||
const multi_index_container<Value,IndexSpecifierList,Allocator>& x,
|
||||
const allocator_type& al):
|
||||
bfm_allocator(al),
|
||||
bfm_header(),
|
||||
super(x),
|
||||
super(x,bfm_allocator::member,&*bfm_header::member),
|
||||
node_count(0)
|
||||
{
|
||||
copy_construct_from(x);
|
||||
}
|
||||
|
||||
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()),
|
||||
super(
|
||||
x,bfm_allocator::member,&*bfm_header::member,
|
||||
detail::do_not_copy_elements_tag()),
|
||||
node_count(0)
|
||||
{
|
||||
BOOST_MULTI_INDEX_CHECK_INVARIANT;
|
||||
@@ -340,48 +289,33 @@ public:
|
||||
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<Value,IndexSpecifierList,Allocator>& operator=(
|
||||
const multi_index_container<Value,IndexSpecifierList,Allocator>& x)
|
||||
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<Value,IndexSpecifierList,Allocator>& operator=(
|
||||
BOOST_COPY_ASSIGN_REF(multi_index_container) x)
|
||||
{
|
||||
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;
|
||||
}
|
||||
|
||||
multi_index_container<Value,IndexSpecifierList,Allocator>& operator=(
|
||||
BOOST_RV_REF(multi_index_container) x)
|
||||
multi_index_container&& x)
|
||||
{
|
||||
#include <boost/multi_index/detail/define_if_constexpr_macro.hpp>
|
||||
|
||||
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()){
|
||||
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;
|
||||
@@ -389,7 +323,6 @@ public:
|
||||
#include <boost/multi_index/detail/undef_if_constexpr_macro.hpp>
|
||||
}
|
||||
|
||||
#if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST)
|
||||
multi_index_container<Value,IndexSpecifierList,Allocator>& operator=(
|
||||
std::initializer_list<Value> list)
|
||||
{
|
||||
@@ -406,7 +339,6 @@ public:
|
||||
x.swap_elements_(*this);
|
||||
return*this;
|
||||
}
|
||||
#endif
|
||||
|
||||
allocator_type get_allocator()const BOOST_NOEXCEPT
|
||||
{
|
||||
@@ -415,45 +347,42 @@ public:
|
||||
|
||||
/* retrieval of indices by number */
|
||||
|
||||
#if !defined(BOOST_NO_MEMBER_TEMPLATES)
|
||||
template<int N>
|
||||
struct nth_index
|
||||
{
|
||||
BOOST_STATIC_ASSERT(N>=0&&N<mpl::size<index_type_list>::type::value);
|
||||
typedef typename mpl::at_c<index_type_list,N>::type type;
|
||||
BOOST_STATIC_ASSERT(N>=0&&N<mp11::mp_size<index_type_list>::value);
|
||||
typedef typename mp11::mp_at_c<index_type_list,N> type;
|
||||
};
|
||||
|
||||
template<int N>
|
||||
typename nth_index<N>::type& get()BOOST_NOEXCEPT
|
||||
{
|
||||
BOOST_STATIC_ASSERT(N>=0&&N<mpl::size<index_type_list>::type::value);
|
||||
BOOST_STATIC_ASSERT(N>=0&&N<mp11::mp_size<index_type_list>::value);
|
||||
return *this;
|
||||
}
|
||||
|
||||
template<int N>
|
||||
const typename nth_index<N>::type& get()const BOOST_NOEXCEPT
|
||||
{
|
||||
BOOST_STATIC_ASSERT(N>=0&&N<mpl::size<index_type_list>::type::value);
|
||||
BOOST_STATIC_ASSERT(N>=0&&N<mp11::mp_size<index_type_list>::value);
|
||||
return *this;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* retrieval of indices by tag */
|
||||
|
||||
#if !defined(BOOST_NO_MEMBER_TEMPLATES)
|
||||
template<typename Tag>
|
||||
struct index
|
||||
{
|
||||
typedef typename mpl::find_if<
|
||||
typedef mp11::mp_find_if_q<
|
||||
index_type_list,
|
||||
detail::has_tag<Tag>
|
||||
>::type iter;
|
||||
> pos;
|
||||
|
||||
BOOST_STATIC_CONSTANT(
|
||||
bool,index_found=!(is_same<iter,typename mpl::end<index_type_list>::type >::value));
|
||||
bool,index_found=(pos::value<mp11::mp_size<index_type_list>::value));
|
||||
BOOST_STATIC_ASSERT(index_found);
|
||||
|
||||
typedef typename mpl::deref<iter>::type type;
|
||||
typedef mp11::mp_at<index_type_list,pos> type;
|
||||
};
|
||||
|
||||
template<typename Tag>
|
||||
@@ -467,11 +396,9 @@ public:
|
||||
{
|
||||
return *this;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* projection of iterators by number */
|
||||
|
||||
#if !defined(BOOST_NO_MEMBER_TEMPLATES)
|
||||
template<int N>
|
||||
struct nth_index_iterator
|
||||
{
|
||||
@@ -489,10 +416,8 @@ public:
|
||||
{
|
||||
typedef typename nth_index<N>::type index_type;
|
||||
|
||||
#if !defined(__SUNPRO_CC)||!(__SUNPRO_CC<0x580) /* fails in Sun C++ 5.7 */
|
||||
BOOST_STATIC_ASSERT(
|
||||
(mpl::contains<iterator_type_list,IteratorType>::value));
|
||||
#endif
|
||||
(mp11::mp_contains<iterator_type_list,IteratorType>::value));
|
||||
|
||||
BOOST_MULTI_INDEX_CHECK_VALID_ITERATOR(it);
|
||||
BOOST_MULTI_INDEX_CHECK_BELONGS_IN_SOME_INDEX(it,*this);
|
||||
@@ -505,22 +430,18 @@ public:
|
||||
{
|
||||
typedef typename nth_index<N>::type index_type;
|
||||
|
||||
#if !defined(__SUNPRO_CC)||!(__SUNPRO_CC<0x580) /* fails in Sun C++ 5.7 */
|
||||
BOOST_STATIC_ASSERT((
|
||||
mpl::contains<iterator_type_list,IteratorType>::value||
|
||||
mpl::contains<const_iterator_type_list,IteratorType>::value));
|
||||
#endif
|
||||
mp11::mp_contains<iterator_type_list,IteratorType>::value||
|
||||
mp11::mp_contains<const_iterator_type_list,IteratorType>::value));
|
||||
|
||||
BOOST_MULTI_INDEX_CHECK_VALID_ITERATOR(it);
|
||||
BOOST_MULTI_INDEX_CHECK_BELONGS_IN_SOME_INDEX(it,*this);
|
||||
return index_type::make_iterator(
|
||||
static_cast<final_node_type*>(it.get_node()));
|
||||
}
|
||||
#endif
|
||||
|
||||
/* projection of iterators by tag */
|
||||
|
||||
#if !defined(BOOST_NO_MEMBER_TEMPLATES)
|
||||
template<typename Tag>
|
||||
struct index_iterator
|
||||
{
|
||||
@@ -538,10 +459,8 @@ public:
|
||||
{
|
||||
typedef typename index<Tag>::type index_type;
|
||||
|
||||
#if !defined(__SUNPRO_CC)||!(__SUNPRO_CC<0x580) /* fails in Sun C++ 5.7 */
|
||||
BOOST_STATIC_ASSERT(
|
||||
(mpl::contains<iterator_type_list,IteratorType>::value));
|
||||
#endif
|
||||
(mp11::mp_contains<iterator_type_list,IteratorType>::value));
|
||||
|
||||
BOOST_MULTI_INDEX_CHECK_VALID_ITERATOR(it);
|
||||
BOOST_MULTI_INDEX_CHECK_BELONGS_IN_SOME_INDEX(it,*this);
|
||||
@@ -554,20 +473,17 @@ public:
|
||||
{
|
||||
typedef typename index<Tag>::type index_type;
|
||||
|
||||
#if !defined(__SUNPRO_CC)||!(__SUNPRO_CC<0x580) /* fails in Sun C++ 5.7 */
|
||||
BOOST_STATIC_ASSERT((
|
||||
mpl::contains<iterator_type_list,IteratorType>::value||
|
||||
mpl::contains<const_iterator_type_list,IteratorType>::value));
|
||||
#endif
|
||||
mp11::mp_contains<iterator_type_list,IteratorType>::value||
|
||||
mp11::mp_contains<const_iterator_type_list,IteratorType>::value));
|
||||
|
||||
BOOST_MULTI_INDEX_CHECK_VALID_ITERATOR(it);
|
||||
BOOST_MULTI_INDEX_CHECK_BELONGS_IN_SOME_INDEX(it,*this);
|
||||
return index_type::make_iterator(
|
||||
static_cast<final_node_type*>(it.get_node()));
|
||||
}
|
||||
#endif
|
||||
|
||||
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;
|
||||
|
||||
@@ -576,8 +492,7 @@ BOOST_MULTI_INDEX_PROTECTED_IF_MEMBER_TEMPLATE_FRIENDS:
|
||||
const allocator_type& al,
|
||||
detail::unequal_alloc_move_ctor_tag):
|
||||
bfm_allocator(al),
|
||||
bfm_header(),
|
||||
super(x),
|
||||
super(x,bfm_allocator::member,&*bfm_header::member),
|
||||
node_count(0)
|
||||
{
|
||||
BOOST_MULTI_INDEX_CHECK_INVARIANT_OF(x);
|
||||
@@ -604,18 +519,17 @@ BOOST_MULTI_INDEX_PROTECTED_IF_MEMBER_TEMPLATE_FRIENDS:
|
||||
BOOST_MULTI_INDEX_CHECK_INVARIANT;
|
||||
}
|
||||
|
||||
#if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST)
|
||||
multi_index_container(
|
||||
const multi_index_container<Value,IndexSpecifierList,Allocator>& x,
|
||||
detail::do_not_copy_elements_tag):
|
||||
bfm_allocator(x.bfm_allocator::member),
|
||||
bfm_header(),
|
||||
super(x,detail::do_not_copy_elements_tag()),
|
||||
super(
|
||||
x,bfm_allocator::member,&*bfm_header::member,
|
||||
detail::do_not_copy_elements_tag()),
|
||||
node_count(0)
|
||||
{
|
||||
BOOST_MULTI_INDEX_CHECK_INVARIANT;
|
||||
}
|
||||
#endif
|
||||
|
||||
void copy_construct_from(
|
||||
const multi_index_container<Value,IndexSpecifierList,Allocator>& x)
|
||||
@@ -642,33 +556,26 @@ BOOST_MULTI_INDEX_PROTECTED_IF_MEMBER_TEMPLATE_FRIENDS:
|
||||
|
||||
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<node_pointer>(x),1);
|
||||
}
|
||||
|
||||
void construct_value(final_node_type* x,const Value& v)
|
||||
template<typename... Args>
|
||||
void construct_value(final_node_type* x,Args&&... args)
|
||||
{
|
||||
node_alloc_traits::construct(
|
||||
bfm_allocator::member,boost::addressof(x->value()),v);
|
||||
allocator_construct(
|
||||
bfm_allocator::member,boost::addressof(x->value()),
|
||||
std::forward<Args>(args)...);
|
||||
}
|
||||
|
||||
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));
|
||||
}
|
||||
|
||||
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(
|
||||
allocator_destroy(
|
||||
bfm_allocator::member,boost::addressof(x->value()));
|
||||
}
|
||||
|
||||
@@ -781,13 +688,12 @@ BOOST_MULTI_INDEX_PROTECTED_IF_MEMBER_TEMPLATE_FRIENDS:
|
||||
}
|
||||
}
|
||||
|
||||
template<BOOST_MULTI_INDEX_TEMPLATE_PARAM_PACK>
|
||||
std::pair<final_node_type*,bool> emplace_(
|
||||
BOOST_MULTI_INDEX_FUNCTION_PARAM_PACK)
|
||||
template<typename... Args>
|
||||
std::pair<final_node_type*,bool> 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>(args)...);
|
||||
BOOST_TRY{
|
||||
final_node_type* res=super::insert_(
|
||||
x->value(),x,detail::emplaced_tag());
|
||||
@@ -901,14 +807,13 @@ BOOST_MULTI_INDEX_PROTECTED_IF_MEMBER_TEMPLATE_FRIENDS:
|
||||
}
|
||||
}
|
||||
|
||||
template<BOOST_MULTI_INDEX_TEMPLATE_PARAM_PACK>
|
||||
template<typename... Args>
|
||||
std::pair<final_node_type*,bool> 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>(args)...);
|
||||
BOOST_TRY{
|
||||
final_node_type* res=super::insert_(
|
||||
x->value(),position,x,detail::emplaced_tag());
|
||||
@@ -976,8 +881,8 @@ BOOST_MULTI_INDEX_PROTECTED_IF_MEMBER_TEMPLATE_FRIENDS:
|
||||
template<typename Index>
|
||||
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<final_node_type*>((first++).get_node()));
|
||||
@@ -989,7 +894,8 @@ BOOST_MULTI_INDEX_PROTECTED_IF_MEMBER_TEMPLATE_FRIENDS:
|
||||
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_(
|
||||
@@ -1207,21 +1113,7 @@ BOOST_MULTI_INDEX_PROTECTED_IF_MEMBER_TEMPLATE_FRIENDS:
|
||||
#endif
|
||||
|
||||
private:
|
||||
template<BOOST_MULTI_INDEX_TEMPLATE_PARAM_PACK>
|
||||
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)&&\
|
||||
BOOST_WORKAROUND(__MWERKS__,<=0x3003)
|
||||
#pragma parse_mfunc_templ reset
|
||||
#endif
|
||||
};
|
||||
|
||||
#if BOOST_WORKAROUND(BOOST_MSVC,BOOST_TESTED_AT(1500))
|
||||
@@ -1235,10 +1127,10 @@ struct nth_index
|
||||
{
|
||||
BOOST_STATIC_CONSTANT(
|
||||
int,
|
||||
M=mpl::size<typename MultiIndexContainer::index_type_list>::type::value);
|
||||
M=mp11::mp_size<typename MultiIndexContainer::index_type_list>::value);
|
||||
BOOST_STATIC_ASSERT(N>=0&&N<M);
|
||||
typedef typename mpl::at_c<
|
||||
typename MultiIndexContainer::index_type_list,N>::type type;
|
||||
typedef typename mp11::mp_at_c<
|
||||
typename MultiIndexContainer::index_type_list,N> type;
|
||||
};
|
||||
|
||||
template<int N,typename Value,typename IndexSpecifierList,typename Allocator>
|
||||
@@ -1257,9 +1149,9 @@ get(
|
||||
|
||||
BOOST_STATIC_ASSERT(N>=0&&
|
||||
N<
|
||||
mpl::size<
|
||||
BOOST_DEDUCED_TYPENAME multi_index_type::index_type_list
|
||||
>::type::value);
|
||||
mp11::mp_size<
|
||||
typename multi_index_type::index_type_list
|
||||
>::value);
|
||||
|
||||
return detail::converter<multi_index_type,index_type>::index(m);
|
||||
}
|
||||
@@ -1281,9 +1173,9 @@ get(
|
||||
|
||||
BOOST_STATIC_ASSERT(N>=0&&
|
||||
N<
|
||||
mpl::size<
|
||||
BOOST_DEDUCED_TYPENAME multi_index_type::index_type_list
|
||||
>::type::value);
|
||||
mp11::mp_size<
|
||||
typename multi_index_type::index_type_list
|
||||
>::value);
|
||||
|
||||
return detail::converter<multi_index_type,index_type>::index(m);
|
||||
}
|
||||
@@ -1295,16 +1187,16 @@ struct index
|
||||
{
|
||||
typedef typename MultiIndexContainer::index_type_list index_type_list;
|
||||
|
||||
typedef typename mpl::find_if<
|
||||
typedef mp11::mp_find_if_q<
|
||||
index_type_list,
|
||||
detail::has_tag<Tag>
|
||||
>::type iter;
|
||||
> pos;
|
||||
|
||||
BOOST_STATIC_CONSTANT(
|
||||
bool,index_found=!(is_same<iter,typename mpl::end<index_type_list>::type >::value));
|
||||
bool,index_found=(pos::value<mp11::mp_size<index_type_list>::value));
|
||||
BOOST_STATIC_ASSERT(index_found);
|
||||
|
||||
typedef typename mpl::deref<iter>::type type;
|
||||
typedef mp11::mp_at<index_type_list,pos> type;
|
||||
};
|
||||
|
||||
template<
|
||||
@@ -1373,12 +1265,10 @@ project(
|
||||
Value,IndexSpecifierList,Allocator> multi_index_type;
|
||||
typedef typename nth_index<multi_index_type,N>::type index_type;
|
||||
|
||||
#if !defined(__SUNPRO_CC)||!(__SUNPRO_CC<0x580) /* Sun C++ 5.7 fails */
|
||||
BOOST_STATIC_ASSERT((
|
||||
mpl::contains<
|
||||
BOOST_DEDUCED_TYPENAME multi_index_type::iterator_type_list,
|
||||
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);
|
||||
@@ -1399,15 +1289,13 @@ project(
|
||||
Value,IndexSpecifierList,Allocator> multi_index_type;
|
||||
typedef typename nth_index<multi_index_type,N>::type index_type;
|
||||
|
||||
#if !defined(__SUNPRO_CC)||!(__SUNPRO_CC<0x580) /* Sun C++ 5.7 fails */
|
||||
BOOST_STATIC_ASSERT((
|
||||
mpl::contains<
|
||||
BOOST_DEDUCED_TYPENAME multi_index_type::iterator_type_list,
|
||||
mp11::mp_contains<
|
||||
typename multi_index_type::iterator_type_list,
|
||||
IteratorType>::value||
|
||||
mpl::contains<
|
||||
BOOST_DEDUCED_TYPENAME multi_index_type::const_iterator_type_list,
|
||||
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);
|
||||
@@ -1445,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((
|
||||
mpl::contains<
|
||||
BOOST_DEDUCED_TYPENAME multi_index_type::iterator_type_list,
|
||||
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);
|
||||
@@ -1472,15 +1358,13 @@ 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((
|
||||
mpl::contains<
|
||||
BOOST_DEDUCED_TYPENAME multi_index_type::iterator_type_list,
|
||||
mp11::mp_contains<
|
||||
typename multi_index_type::iterator_type_list,
|
||||
IteratorType>::value||
|
||||
mpl::contains<
|
||||
BOOST_DEDUCED_TYPENAME multi_index_type::const_iterator_type_list,
|
||||
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);
|
||||
|
||||
+1
-1
@@ -12,5 +12,5 @@
|
||||
"maintainers": [
|
||||
"Joaquin M Lopez Munoz <joaquin.lopezmunoz -at- gmail.com>"
|
||||
],
|
||||
"cxxstd": "03"
|
||||
"cxxstd": "11"
|
||||
}
|
||||
|
||||
+13
-3
@@ -1,6 +1,6 @@
|
||||
# Boost.MultiIndex tests Jamfile
|
||||
#
|
||||
# Copyright 2003-2020 Joaqu�n M L�pez Mu�oz.
|
||||
# Copyright 2003-2026 Joaquín M López Muñoz.
|
||||
# Distributed under the Boost Software License, Version 1.0.
|
||||
# (See accompanying file LICENSE_1_0.txt or copy at
|
||||
# http://www.boost.org/LICENSE_1_0.txt)
|
||||
@@ -30,10 +30,14 @@ rule change-test_update-exe-name ( name : type ? : property-set )
|
||||
project
|
||||
: requirements
|
||||
<library>/boost/multi_index//boost_multi_index
|
||||
<library>/boost/foreach//boost_foreach
|
||||
<library>/boost/iterator//boost_iterator
|
||||
<library>/boost/mpl//boost_mpl
|
||||
<toolset>msvc:<define>_SCL_SECURE_NO_WARNINGS
|
||||
<toolset>msvc:<define>_CRT_SECURE_NO_WARNINGS
|
||||
<toolset>msvc:<define>_SILENCE_ALL_CXX17_DEPRECATION_WARNINGS
|
||||
<toolset>msvc:<cxxflags>/wd4494
|
||||
<toolset>gcc-16:<cxxflags>-fno-thread-jumps # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119321
|
||||
;
|
||||
|
||||
obj boost_multi_index_key_supported : check_bmi_key_supported.cpp ;
|
||||
@@ -49,7 +53,7 @@ test-suite "multi_index" :
|
||||
[ run test_copy_assignment.cpp test_copy_assignment_main.cpp ]
|
||||
[ run test_hash_ops.cpp test_hash_ops_main.cpp ]
|
||||
[ run test_iterators.cpp test_iterators_main.cpp
|
||||
/boost/foreach//boost_foreach ]
|
||||
/boost/foreach//boost_foreach ]
|
||||
[ run test_key.cpp test_key_main.cpp
|
||||
: : :
|
||||
[ check-target-builds boost_multi_index_key_supported
|
||||
@@ -57,6 +61,9 @@ test-suite "multi_index" :
|
||||
: : <build>no ] ]
|
||||
[ run test_key_extractors.cpp test_key_extractors_main.cpp ]
|
||||
[ run test_list_ops.cpp test_list_ops_main.cpp ]
|
||||
[ run test_mmap.cpp test_mmap_main.cpp
|
||||
/boost/interprocess//boost_interprocess
|
||||
/boost/uuid//boost_uuid ]
|
||||
[ run test_modifiers.cpp test_modifiers_main.cpp ]
|
||||
[ run test_mpl_ops.cpp test_mpl_ops_main.cpp ]
|
||||
[ run test_node_handling.cpp test_node_handling_main.cpp ]
|
||||
@@ -69,7 +76,10 @@ test-suite "multi_index" :
|
||||
[ run test_serialization.cpp test_serialization1.cpp
|
||||
test_serialization2.cpp test_serialization3.cpp
|
||||
test_serialization_main.cpp
|
||||
/boost/serialization//boost_serialization ]
|
||||
/boost/serialization//boost_serialization
|
||||
: : :
|
||||
<toolset>clang-3.5:<build>no
|
||||
<toolset>clang-3.6:<build>no ]
|
||||
[ run test_set_ops.cpp test_set_ops_main.cpp ]
|
||||
[ run test_special_set_ops.cpp test_special_set_ops_main.cpp ]
|
||||
[ run test_update.cpp test_update_main.cpp
|
||||
|
||||
+10
-26
@@ -1,6 +1,6 @@
|
||||
/* Used in Boost.MultiIndex tests.
|
||||
*
|
||||
* 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,6 @@
|
||||
#define BOOST_MULTI_INDEX_TEST_EMPLOYEE_HPP
|
||||
|
||||
#include <boost/config.hpp> /* keep it first to prevent nasty warns in MSVC */
|
||||
#include <boost/move/core.hpp>
|
||||
#include <boost/move/utility_core.hpp>
|
||||
#include <boost/mpl/vector.hpp>
|
||||
#include <boost/multi_index_container.hpp>
|
||||
#include <boost/multi_index/hashed_index.hpp>
|
||||
#include <boost/multi_index/identity.hpp>
|
||||
@@ -25,6 +22,7 @@
|
||||
#include <boost/multi_index/sequenced_index.hpp>
|
||||
#include <ostream>
|
||||
#include <string>
|
||||
#include <utility>
|
||||
#include "non_std_allocator.hpp"
|
||||
|
||||
struct employee
|
||||
@@ -42,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;
|
||||
@@ -55,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;
|
||||
@@ -90,9 +88,6 @@ struct employee
|
||||
os<<e.id<<" "<<e.name<<" "<<e.age<<std::endl;
|
||||
return os;
|
||||
}
|
||||
|
||||
private:
|
||||
BOOST_COPYABLE_AND_MOVABLE(employee)
|
||||
};
|
||||
|
||||
struct name{};
|
||||
@@ -102,8 +97,8 @@ struct as_inserted{};
|
||||
struct ssn{};
|
||||
struct randomly{};
|
||||
|
||||
struct employee_set_indices:
|
||||
boost::mpl::vector<
|
||||
using employee_set_indices=
|
||||
boost::multi_index::indexed_by<
|
||||
boost::multi_index::ordered_unique<
|
||||
boost::multi_index::identity<employee> >,
|
||||
boost::multi_index::hashed_non_unique<
|
||||
@@ -118,8 +113,7 @@ struct employee_set_indices:
|
||||
boost::multi_index::tag<ssn>,
|
||||
BOOST_MULTI_INDEX_MEMBER(employee,int,ssn)>,
|
||||
boost::multi_index::random_access<
|
||||
boost::multi_index::tag<randomly> > >
|
||||
{};
|
||||
boost::multi_index::tag<randomly> > >;
|
||||
|
||||
typedef
|
||||
boost::multi_index::multi_index_container<
|
||||
@@ -127,12 +121,7 @@ typedef
|
||||
employee_set_indices,
|
||||
non_std_allocator<employee> > 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;
|
||||
@@ -141,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
|
||||
|
||||
+1
-11
@@ -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<class Archive>
|
||||
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
|
||||
|
||||
@@ -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)
|
||||
@@ -12,7 +12,6 @@
|
||||
#define BOOST_MULTI_INDEX_TEST_PRE_MULTI_INDEX_HPP
|
||||
|
||||
#include <boost/config.hpp> /* keep it first to prevent nasty warns in MSVC */
|
||||
#include <boost/detail/workaround.hpp>
|
||||
#include <boost/multi_index/safe_mode_errors.hpp>
|
||||
|
||||
#if defined(__GNUC__)&&defined(__APPLE__)&&\
|
||||
@@ -30,10 +29,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_):
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* Boost.MultiIndex test suite.
|
||||
*
|
||||
* Copyright 2003-2020 Joaquin M Lopez Munoz.
|
||||
* Copyright 2003-2026 Joaquin M Lopez Munoz.
|
||||
* Distributed under the Boost Software License, Version 1.0.
|
||||
* (See accompanying file LICENSE_1_0.txt or copy at
|
||||
* http://www.boost.org/LICENSE_1_0.txt)
|
||||
@@ -21,6 +21,7 @@
|
||||
#include "test_key.hpp"
|
||||
#include "test_key_extractors.hpp"
|
||||
#include "test_list_ops.hpp"
|
||||
#include "test_mmap.hpp"
|
||||
#include "test_modifiers.hpp"
|
||||
#include "test_mpl_ops.hpp"
|
||||
#include "test_node_handling.hpp"
|
||||
@@ -49,6 +50,7 @@ int main()
|
||||
test_key();
|
||||
test_key_extractors();
|
||||
test_list_ops();
|
||||
test_mmap();
|
||||
test_modifiers();
|
||||
test_mpl_ops();
|
||||
test_node_handling();
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* Boost.MultiIndex test for allocator awareness.
|
||||
*
|
||||
* Copyright 2003-2020 Joaquin M Lopez Munoz.
|
||||
* Copyright 2003-2026 Joaquin M Lopez Munoz.
|
||||
* Distributed under the Boost Software License, Version 1.0.
|
||||
* (See accompanying file LICENSE_1_0.txt or copy at
|
||||
* http://www.boost.org/LICENSE_1_0.txt)
|
||||
@@ -12,8 +12,6 @@
|
||||
|
||||
#include <boost/config.hpp> /* keep it first to prevent nasty warns in MSVC */
|
||||
#include <boost/detail/lightweight_test.hpp>
|
||||
#include <boost/move/core.hpp>
|
||||
#include <boost/move/utility_core.hpp>
|
||||
#include "pre_multi_index.hpp"
|
||||
#include <boost/multi_index_container.hpp>
|
||||
#include <boost/multi_index/hashed_index.hpp>
|
||||
@@ -22,22 +20,20 @@
|
||||
#include <boost/multi_index/random_access_index.hpp>
|
||||
#include <boost/multi_index/ranked_index.hpp>
|
||||
#include <boost/multi_index/sequenced_index.hpp>
|
||||
#include <utility>
|
||||
#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)
|
||||
@@ -50,20 +46,12 @@ inline bool operator<(const move_tracker& x,const move_tracker& y)
|
||||
return x.n<y.n;
|
||||
}
|
||||
|
||||
#if defined(BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP)
|
||||
namespace boost{
|
||||
#endif
|
||||
|
||||
inline std::size_t hash_value(const move_tracker& x)
|
||||
{
|
||||
boost::hash<int> 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 */
|
||||
@@ -101,7 +89,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,14 +108,14 @@ 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());
|
||||
BOOST_TEST(element_transfer==(&*c3.begin()==pfirst));
|
||||
BOOST_TEST(!element_transfer==(c3.begin()->move_cted));
|
||||
}
|
||||
if(Propagate||AlwaysEqual){
|
||||
BOOST_IF_CONSTEXPR(Propagate||AlwaysEqual){
|
||||
container c2(c);
|
||||
const move_tracker* pfirst=&*c2.begin();
|
||||
container c3(root2);
|
||||
|
||||
+1
-13
@@ -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)
|
||||
@@ -46,30 +46,18 @@ bool operator<(const no_addressof_type& x,const no_addressof_type& y)
|
||||
return x.n<y.n;
|
||||
}
|
||||
|
||||
#if defined(BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP)
|
||||
namespace boost{
|
||||
#endif
|
||||
|
||||
inline std::size_t hash_value(const no_addressof_type& x)
|
||||
{
|
||||
boost::hash<int> h;
|
||||
return h(x.n);
|
||||
}
|
||||
|
||||
#if defined(BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP)
|
||||
} /* namespace boost */
|
||||
#endif
|
||||
|
||||
void test_basic()
|
||||
{
|
||||
employee_set es;
|
||||
std::vector<employee> v;
|
||||
|
||||
#if defined(BOOST_NO_MEMBER_TEMPLATES)
|
||||
employee_set_by_name& i1=get<by_name>(es);
|
||||
#else
|
||||
employee_set_by_name& i1=es.get<by_name>();
|
||||
#endif
|
||||
|
||||
const employee_set_by_age& i2=get<2>(es);
|
||||
employee_set_as_inserted& i3=get<3>(es);
|
||||
|
||||
+148
-140
@@ -1,6 +1,6 @@
|
||||
/* Boost.MultiIndex test for composite_key.
|
||||
*
|
||||
* 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,102 +13,25 @@
|
||||
#include <boost/config.hpp> /* keep it first to prevent nasty warns in MSVC */
|
||||
#include <boost/detail/lightweight_test.hpp>
|
||||
#include "pre_multi_index.hpp"
|
||||
#include <boost/mp11/utility.hpp>
|
||||
#include <boost/multi_index_container.hpp>
|
||||
#include <boost/multi_index/composite_key.hpp>
|
||||
#include <boost/multi_index/hashed_index.hpp>
|
||||
#include <boost/multi_index/member.hpp>
|
||||
#include <boost/multi_index/ordered_index.hpp>
|
||||
#include <boost/preprocessor/repetition/enum_binary_params.hpp>
|
||||
#include <boost/preprocessor/repetition/enum_params.hpp>
|
||||
#include <boost/preprocessor/repetition/repeat_from_to.hpp>
|
||||
|
||||
using namespace boost::multi_index;
|
||||
using namespace boost::tuples;
|
||||
|
||||
struct is_composite_key_result_helper
|
||||
{
|
||||
typedef char yes;
|
||||
struct no{char m[2];};
|
||||
|
||||
static no test(void*);
|
||||
|
||||
template<typename CompositeKey>
|
||||
static yes test(composite_key_result<CompositeKey>*);
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
struct is_composite_key_result
|
||||
{
|
||||
typedef is_composite_key_result_helper helper;
|
||||
struct composite_object_length:std::tuple_size<T>{};
|
||||
|
||||
BOOST_STATIC_CONSTANT(bool,
|
||||
value=(
|
||||
sizeof(helper::test((T*)0))==
|
||||
sizeof(typename helper::yes)));
|
||||
};
|
||||
|
||||
template<typename CompositeKeyResult>
|
||||
struct composite_key_result_length
|
||||
{
|
||||
BOOST_STATIC_CONSTANT(int,
|
||||
value=boost::tuples::length<
|
||||
BOOST_DEDUCED_TYPENAME
|
||||
CompositeKeyResult::composite_key_type::key_extractor_tuple
|
||||
>::value);
|
||||
};
|
||||
|
||||
#if !defined(BOOST_NO_CXX11_HDR_TUPLE)&&\
|
||||
!defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
|
||||
struct is_boost_tuple_helper
|
||||
{
|
||||
typedef char yes;
|
||||
struct no{char m[2];};
|
||||
|
||||
static no test(void*);
|
||||
|
||||
template<BOOST_PP_ENUM_PARAMS(10,typename T)>
|
||||
static yes test(boost::tuple<BOOST_PP_ENUM_PARAMS(10,T)>*);
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
struct is_boost_tuple
|
||||
{
|
||||
typedef is_boost_tuple_helper helper;
|
||||
|
||||
BOOST_STATIC_CONSTANT(bool,
|
||||
value=(
|
||||
sizeof(helper::test((T*)0))==
|
||||
sizeof(typename helper::yes)));
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
struct composite_object_length
|
||||
{
|
||||
typedef typename boost::mpl::if_c<
|
||||
is_composite_key_result<T>::value,
|
||||
composite_key_result_length<T>,
|
||||
typename boost::mpl::if_c<
|
||||
is_boost_tuple<T>::value,
|
||||
boost::tuples::length<T>,
|
||||
std::tuple_size<T>
|
||||
>::type
|
||||
>::type type;
|
||||
|
||||
BOOST_STATIC_CONSTANT(int,value=type::value);
|
||||
};
|
||||
#else
|
||||
template<typename T>
|
||||
struct composite_object_length
|
||||
{
|
||||
typedef typename boost::mpl::if_c<
|
||||
is_composite_key_result<T>::value,
|
||||
composite_key_result_length<T>,
|
||||
boost::tuples::length<T>
|
||||
>::type type;
|
||||
|
||||
BOOST_STATIC_CONSTANT(int,value=type::value);
|
||||
};
|
||||
#endif
|
||||
template<typename CompositeKey>
|
||||
struct composite_object_length<composite_key_result<CompositeKey>>:
|
||||
std::tuple_size<
|
||||
typename composite_key_result<CompositeKey>::
|
||||
composite_key_type::key_extractor_tuple
|
||||
>
|
||||
{};
|
||||
|
||||
template<typename CompositeKeyResult,typename T2>
|
||||
struct comparison_equal_length
|
||||
@@ -240,12 +163,12 @@ struct comparison_different_length
|
||||
|
||||
template<typename CompositeKeyResult,typename T2>
|
||||
struct comparison_helper:
|
||||
boost::mpl::if_c<
|
||||
composite_key_result_length<CompositeKeyResult>::value==
|
||||
boost::mp11::mp_if_c<
|
||||
composite_object_length<CompositeKeyResult>::value==
|
||||
composite_object_length<T2>::value,
|
||||
comparison_equal_length<CompositeKeyResult,T2>,
|
||||
comparison_different_length<CompositeKeyResult,T2>
|
||||
>::type
|
||||
>
|
||||
{
|
||||
};
|
||||
|
||||
@@ -333,30 +256,15 @@ struct xystr
|
||||
std::string str;
|
||||
};
|
||||
|
||||
#define TUPLE_MAKER_CREATE(z,n,tuple) \
|
||||
template<BOOST_PP_ENUM_PARAMS(n,typename T)> \
|
||||
static tuple<BOOST_PP_ENUM_PARAMS(n,T)> \
|
||||
create(BOOST_PP_ENUM_BINARY_PARAMS(n,const T,& t)){ \
|
||||
return tuple<BOOST_PP_ENUM_PARAMS(n,T)>( \
|
||||
BOOST_PP_ENUM_PARAMS(n,t)); \
|
||||
}
|
||||
|
||||
#define DEFINE_TUPLE_MAKER(name,tuple) \
|
||||
struct name \
|
||||
{ \
|
||||
static tuple<> create(){return tuple<>();} \
|
||||
BOOST_PP_REPEAT_FROM_TO(1,5,TUPLE_MAKER_CREATE,tuple) \
|
||||
template<template<typename...>class Tuple>
|
||||
struct tuple_maker
|
||||
{
|
||||
template<typename... Ts>
|
||||
static Tuple<Ts...> create(const Ts&... args){return Tuple<Ts...>{args...};}
|
||||
};
|
||||
|
||||
DEFINE_TUPLE_MAKER(boost_tuple_maker,boost::tuple)
|
||||
|
||||
#if !defined(BOOST_NO_CXX11_HDR_TUPLE)&&\
|
||||
!defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
|
||||
DEFINE_TUPLE_MAKER(std_tuple_maker,std::tuple)
|
||||
#endif
|
||||
|
||||
#undef DEFINE_TUPLE_MAKER
|
||||
#undef TUPLE_MAKER_CREATE
|
||||
using boost_tuple_maker=tuple_maker<boost::tuple>;
|
||||
using std_tuple_maker=tuple_maker<std::tuple>;
|
||||
|
||||
template<typename TupleMaker>
|
||||
void test_composite_key_template()
|
||||
@@ -398,13 +306,10 @@ void test_composite_key_template()
|
||||
std::distance(
|
||||
mc1.lower_bound(TupleMaker::create(0,0)),
|
||||
mc1.upper_bound(TupleMaker::create(1,0)))==6);
|
||||
|
||||
#if !defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING)
|
||||
BOOST_TEST(
|
||||
std::distance(
|
||||
mc1.lower_bound(1),
|
||||
mc1.upper_bound(1))==4);
|
||||
#endif
|
||||
|
||||
ckey_t1 ck1;
|
||||
ckey_t1 ck2(ck1);
|
||||
@@ -414,8 +319,13 @@ void test_composite_key_template()
|
||||
BOOST_MULTI_INDEX_MEMBER(xyz,int,y)(),
|
||||
BOOST_MULTI_INDEX_MEMBER(xyz,int,z)()));
|
||||
ckey_t1 ck4(get<0>(ck1.key_extractors()));
|
||||
ckey_t1 ck5(
|
||||
std::make_tuple(
|
||||
BOOST_MULTI_INDEX_MEMBER(xyz,int,x)(),
|
||||
BOOST_MULTI_INDEX_MEMBER(xyz,int,y)(),
|
||||
BOOST_MULTI_INDEX_MEMBER(xyz,int,z)()));
|
||||
|
||||
(void)ck3; /* prevent unused var */
|
||||
ck3=ck5; /* prevent unused var */
|
||||
|
||||
get<2>(ck4.key_extractors())=
|
||||
get<2>(ck2.key_extractors());
|
||||
@@ -449,11 +359,9 @@ void test_composite_key_template()
|
||||
BOOST_TEST(is_less (ck1(xyz(0,0,0)),TupleMaker::create(1),cp1));
|
||||
BOOST_TEST(is_greater(ck1(xyz(0,0,0)),TupleMaker::create(-1),cp1));
|
||||
|
||||
#if !defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING)
|
||||
BOOST_TEST(is_equiv (ck1(xyz(0,0,0)),0,cp1));
|
||||
BOOST_TEST(is_less (ck1(xyz(0,0,0)),1,cp1));
|
||||
BOOST_TEST(is_greater(ck1(xyz(0,0,0)),-1,cp1));
|
||||
#endif
|
||||
|
||||
BOOST_TEST(is_equiv (ck1(xyz(0,0,0)),TupleMaker::create(0,0),cp1));
|
||||
BOOST_TEST(is_less (ck1(xyz(0,0,0)),TupleMaker::create(0,1),cp1));
|
||||
@@ -497,9 +405,16 @@ void test_composite_key_template()
|
||||
ckey_eq_t2 eq4(
|
||||
get<0>(eq3.key_eqs()),
|
||||
get<1>(eq3.key_eqs()));
|
||||
ckey_eq_t2 eq5(
|
||||
std::make_tuple(
|
||||
modulo_equal(2),
|
||||
modulo_equal(3),
|
||||
std::equal_to<int>(),
|
||||
std::equal_to<int>()));
|
||||
|
||||
eq3=eq4; /* prevent unused var */
|
||||
eq4=eq3; /* prevent unused var */
|
||||
eq5=eq4; /* prevent unused var */
|
||||
|
||||
BOOST_TEST( eq2(ck1(xyz(0,0,0)),ck1(xyz(0,0,0))));
|
||||
BOOST_TEST(!eq2(ck1(xyz(0,1,0)),ck1(xyz(0,0,0))));
|
||||
@@ -541,10 +456,16 @@ void test_composite_key_template()
|
||||
std::greater<int>(),
|
||||
std::less<int>()));
|
||||
ckey_comp_t3 cp6(get<0>(cp3.key_comps()));
|
||||
ckey_comp_t3 cp7(
|
||||
std::make_tuple(
|
||||
std::less<int>(),
|
||||
std::greater<int>(),
|
||||
std::less<int>()));
|
||||
|
||||
cp4=cp5; /* prevent unused var */
|
||||
cp5=cp6; /* prevent unused var */
|
||||
cp6=cp4; /* prevent unused var */
|
||||
cp7=cp4; /* prevent unused var */
|
||||
|
||||
BOOST_TEST(is_equiv (ck1(xyz(0,0,0)),ck2(xyz(0,0,0)),cp3));
|
||||
BOOST_TEST(is_greater(ck1(xyz(0,0,1)),ck2(xyz(0,1,0)),cp3));
|
||||
@@ -566,23 +487,23 @@ void test_composite_key_template()
|
||||
BOOST_MULTI_INDEX_MEMBER(xyz,int,x)
|
||||
> ckey_t2;
|
||||
|
||||
ckey_t2 ck5;
|
||||
ckey_t2 ck6;
|
||||
|
||||
BOOST_TEST(is_equiv (ck1(xyz(0,0,1)),ck5(xyz(0,0,0))));
|
||||
BOOST_TEST(is_less (ck1(xyz(0,0,0)),ck5(xyz(-1,1,0))));
|
||||
BOOST_TEST(is_greater(ck1(xyz(0,0,0)),ck5(xyz(1,-1,0))));
|
||||
BOOST_TEST(is_equiv (ck1(xyz(0,0,1)),ck6(xyz(0,0,0))));
|
||||
BOOST_TEST(is_less (ck1(xyz(0,0,0)),ck6(xyz(-1,1,0))));
|
||||
BOOST_TEST(is_greater(ck1(xyz(0,0,0)),ck6(xyz(1,-1,0))));
|
||||
|
||||
BOOST_TEST(is_equiv (ck1(xyz(0,0,1)),ck5(xyz(0,0,0)),cp1));
|
||||
BOOST_TEST(is_less (ck1(xyz(0,0,0)),ck5(xyz(-1,1,0)),cp1));
|
||||
BOOST_TEST(is_greater(ck1(xyz(0,0,0)),ck5(xyz(1,-1,0)),cp1));
|
||||
BOOST_TEST(is_equiv (ck1(xyz(0,0,1)),ck6(xyz(0,0,0)),cp1));
|
||||
BOOST_TEST(is_less (ck1(xyz(0,0,0)),ck6(xyz(-1,1,0)),cp1));
|
||||
BOOST_TEST(is_greater(ck1(xyz(0,0,0)),ck6(xyz(1,-1,0)),cp1));
|
||||
|
||||
BOOST_TEST(is_equiv (ck1(xyz(0,0,1)),ck5(xyz(0,0,0)),cp2));
|
||||
BOOST_TEST(is_greater(ck1(xyz(0,0,0)),ck5(xyz(-1,1,0)),cp2));
|
||||
BOOST_TEST(is_less (ck1(xyz(0,0,0)),ck5(xyz(1,-1,0)),cp2));
|
||||
BOOST_TEST(is_equiv (ck1(xyz(0,0,1)),ck6(xyz(0,0,0)),cp2));
|
||||
BOOST_TEST(is_greater(ck1(xyz(0,0,0)),ck6(xyz(-1,1,0)),cp2));
|
||||
BOOST_TEST(is_less (ck1(xyz(0,0,0)),ck6(xyz(1,-1,0)),cp2));
|
||||
|
||||
BOOST_TEST(is_equiv (ck1(xyz(0,0,1)),ck5(xyz(0,0,0)),cp3));
|
||||
BOOST_TEST(is_less (ck1(xyz(0,0,0)),ck5(xyz(-1,1,0)),cp3));
|
||||
BOOST_TEST(is_greater(ck1(xyz(0,0,0)),ck5(xyz(1,-1,0)),cp3));
|
||||
BOOST_TEST(is_equiv (ck1(xyz(0,0,1)),ck6(xyz(0,0,0)),cp3));
|
||||
BOOST_TEST(is_less (ck1(xyz(0,0,0)),ck6(xyz(-1,1,0)),cp3));
|
||||
BOOST_TEST(is_greater(ck1(xyz(0,0,0)),ck6(xyz(1,-1,0)),cp3));
|
||||
|
||||
typedef multi_index_container<
|
||||
xyz,
|
||||
@@ -621,7 +542,7 @@ void test_composite_key_template()
|
||||
BOOST_MULTI_INDEX_MEMBER(xystr,int,y)
|
||||
> ckey_t3;
|
||||
|
||||
ckey_t3 ck6;
|
||||
ckey_t3 ck7;
|
||||
|
||||
typedef composite_key_hash<
|
||||
boost::hash<std::string>,
|
||||
@@ -637,16 +558,22 @@ void test_composite_key_template()
|
||||
boost::hash<int>(),
|
||||
boost::hash<int>()));
|
||||
ckey_hash_t ch4(get<0>(ch1.key_hash_functions()));
|
||||
ckey_hash_t ch5(
|
||||
std::make_tuple(
|
||||
boost::hash<std::string>(),
|
||||
boost::hash<int>(),
|
||||
boost::hash<int>()));
|
||||
|
||||
ch2=ch3; /* prevent unused var */
|
||||
ch3=ch4; /* prevent unused var */
|
||||
ch4=ch2; /* prevent unused var */
|
||||
ch5=ch2; /* prevent unused var */
|
||||
|
||||
BOOST_TEST(
|
||||
ch1(ck6(xystr(0,0,"hello")))==
|
||||
ch1(ck7(xystr(0,0,"hello")))==
|
||||
ch1(TupleMaker::create(std::string("hello"),0,0)));
|
||||
BOOST_TEST(
|
||||
ch1(ck6(xystr(4,5,"world")))==
|
||||
ch1(ck7(xystr(4,5,"world")))==
|
||||
ch1(TupleMaker::create(std::string("world"),4,5)));
|
||||
|
||||
typedef boost::hash<composite_key_result<ckey_t3> > ckeyres_hash_t;
|
||||
@@ -654,17 +581,98 @@ void test_composite_key_template()
|
||||
ckeyres_hash_t crh;
|
||||
|
||||
BOOST_TEST(
|
||||
ch1(ck6(xystr(0,0,"hello")))==crh(ck6(xystr(0,0,"hello"))));
|
||||
ch1(ck7(xystr(0,0,"hello")))==crh(ck7(xystr(0,0,"hello"))));
|
||||
BOOST_TEST(
|
||||
ch1(ck6(xystr(4,5,"world")))==crh(ck6(xystr(4,5,"world"))));
|
||||
ch1(ck7(xystr(4,5,"world")))==crh(ck7(xystr(4,5,"world"))));
|
||||
}
|
||||
|
||||
void test_composite_key_with_long_tuple()
|
||||
{
|
||||
/* length greater than what boost::tuple allows */
|
||||
|
||||
typedef composite_key<
|
||||
xystr,
|
||||
BOOST_MULTI_INDEX_MEMBER(xystr,std::string,str),
|
||||
BOOST_MULTI_INDEX_MEMBER(xystr,int,x),
|
||||
BOOST_MULTI_INDEX_MEMBER(xystr,int,y),
|
||||
BOOST_MULTI_INDEX_MEMBER(xystr,std::string,str),
|
||||
BOOST_MULTI_INDEX_MEMBER(xystr,int,x),
|
||||
BOOST_MULTI_INDEX_MEMBER(xystr,int,y),
|
||||
BOOST_MULTI_INDEX_MEMBER(xystr,std::string,str),
|
||||
BOOST_MULTI_INDEX_MEMBER(xystr,int,x),
|
||||
BOOST_MULTI_INDEX_MEMBER(xystr,int,y),
|
||||
BOOST_MULTI_INDEX_MEMBER(xystr,std::string,str),
|
||||
BOOST_MULTI_INDEX_MEMBER(xystr,int,x),
|
||||
BOOST_MULTI_INDEX_MEMBER(xystr,int,y)
|
||||
> ckey_t;
|
||||
|
||||
ckey_t ck{
|
||||
BOOST_MULTI_INDEX_MEMBER(xystr,std::string,str)(),
|
||||
BOOST_MULTI_INDEX_MEMBER(xystr,int,x)(),
|
||||
BOOST_MULTI_INDEX_MEMBER(xystr,int,y)(),
|
||||
BOOST_MULTI_INDEX_MEMBER(xystr,std::string,str)(),
|
||||
BOOST_MULTI_INDEX_MEMBER(xystr,int,x)(),
|
||||
BOOST_MULTI_INDEX_MEMBER(xystr,int,y)(),
|
||||
BOOST_MULTI_INDEX_MEMBER(xystr,std::string,str)(),
|
||||
BOOST_MULTI_INDEX_MEMBER(xystr,int,x)(),
|
||||
BOOST_MULTI_INDEX_MEMBER(xystr,int,y)(),
|
||||
BOOST_MULTI_INDEX_MEMBER(xystr,std::string,str)(),
|
||||
BOOST_MULTI_INDEX_MEMBER(xystr,int,x)(),
|
||||
BOOST_MULTI_INDEX_MEMBER(xystr,int,y)()
|
||||
};
|
||||
|
||||
typedef composite_key_equal_to<
|
||||
std::equal_to<std::string>,std::equal_to<int>,std::equal_to<int>,
|
||||
std::equal_to<std::string>,std::equal_to<int>,std::equal_to<int>,
|
||||
std::equal_to<std::string>,std::equal_to<int>,std::equal_to<int>,
|
||||
std::equal_to<std::string>,std::equal_to<int>,std::equal_to<int>
|
||||
> ceq_t;
|
||||
|
||||
ceq_t eq{
|
||||
std::equal_to<std::string>(),std::equal_to<int>(),std::equal_to<int>(),
|
||||
std::equal_to<std::string>(),std::equal_to<int>(),std::equal_to<int>(),
|
||||
std::equal_to<std::string>(),std::equal_to<int>(),std::equal_to<int>(),
|
||||
std::equal_to<std::string>(),std::equal_to<int>(),std::equal_to<int>()
|
||||
};
|
||||
|
||||
typedef composite_key_compare<
|
||||
std::less<std::string>,std::less<int>,std::less<int>,
|
||||
std::less<std::string>,std::less<int>,std::less<int>,
|
||||
std::less<std::string>,std::less<int>,std::less<int>,
|
||||
std::less<std::string>,std::less<int>,std::less<int>
|
||||
> clt_t;
|
||||
|
||||
clt_t lt{
|
||||
std::less<std::string>(),std::less<int>(),std::less<int>(),
|
||||
std::less<std::string>(),std::less<int>(),std::less<int>(),
|
||||
std::less<std::string>(),std::less<int>(),std::less<int>(),
|
||||
std::less<std::string>(),std::less<int>(),std::less<int>()
|
||||
};
|
||||
|
||||
typedef composite_key_hash<
|
||||
boost::hash<std::string>,boost::hash<int>,boost::hash<int>,
|
||||
boost::hash<std::string>,boost::hash<int>,boost::hash<int>,
|
||||
boost::hash<std::string>,boost::hash<int>,boost::hash<int>,
|
||||
boost::hash<std::string>,boost::hash<int>,boost::hash<int>
|
||||
> ch_t;
|
||||
|
||||
ch_t ch{
|
||||
boost::hash<std::string>(),boost::hash<int>(),boost::hash<int>(),
|
||||
boost::hash<std::string>(),boost::hash<int>(),boost::hash<int>(),
|
||||
boost::hash<std::string>(),boost::hash<int>(),boost::hash<int>(),
|
||||
boost::hash<std::string>(),boost::hash<int>(),boost::hash<int>()
|
||||
};
|
||||
|
||||
xystr v{0,1,""};
|
||||
|
||||
BOOST_TEST(eq(ck(v),std::make_tuple("",0,1,"",0,1,"",0,1,"",0,1)));
|
||||
BOOST_TEST(!lt(std::make_tuple("",0,1,"",0,1,"",0,1,"",0,1),ck(v)));
|
||||
BOOST_TEST((ch(ck(v))==ch(std::make_tuple("",0,1,"",0,1,"",0,1,"",0,1))));
|
||||
}
|
||||
|
||||
void test_composite_key()
|
||||
{
|
||||
test_composite_key_template<boost_tuple_maker>();
|
||||
|
||||
#if !defined(BOOST_NO_CXX11_HDR_TUPLE)&&\
|
||||
!defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
|
||||
test_composite_key_template<std_tuple_maker>();
|
||||
#endif
|
||||
test_composite_key_with_long_tuple();
|
||||
}
|
||||
|
||||
@@ -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 <boost/config.hpp> /* keep it first to prevent nasty warns in MSVC */
|
||||
#include <algorithm>
|
||||
#include <boost/move/utility_core.hpp>
|
||||
#include <list>
|
||||
#include <numeric>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
#include "pre_multi_index.hpp"
|
||||
#include "employee.hpp"
|
||||
@@ -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<int> copyable_and_movable;
|
||||
|
||||
struct holder
|
||||
@@ -53,11 +44,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]));
|
||||
|
||||
@@ -68,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<typename Sequence>
|
||||
static void test_integral_assign()
|
||||
{
|
||||
@@ -156,8 +139,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,16 +178,15 @@ 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);
|
||||
|
||||
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);
|
||||
|
||||
|
||||
@@ -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
|
||||
*/
|
||||
@@ -583,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<test_class> tl;
|
||||
for(int i=0;i<20;++i)tl.push_back(test_class(i));
|
||||
|
||||
+1
-14
@@ -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<typename Sequence>
|
||||
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<
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user