Skip to content

Commit 869fcaf

Browse files
committed
adapted core to Mp11-based index specification in MultiIndex
1 parent f64de6d commit 869fcaf

File tree

3 files changed

+77
-0
lines changed

3 files changed

+77
-0
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ on:
77
- master
88
- develop
99
- feature/**
10+
- fix/**
1011

1112
env:
1213
UBSAN_OPTIONS: print_stacktrace=1

include/boost/bimap/detail/bimap_core.hpp

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// Boost.Bimap
22
//
33
// Copyright (c) 2006-2007 Matias Capeletto
4+
// Copyright (c) 2025 Joaquin M Lopez Munoz
45
//
56
// Distributed under the Boost Software License, Version 1.0.
67
// (See accompanying file LICENSE_1_0.txt or copy at
@@ -45,6 +46,10 @@
4546
#include <boost/bimap/detail/map_view_iterator.hpp>
4647
#include <boost/bimap/detail/set_view_iterator.hpp>
4748

49+
#ifndef BOOST_MULTI_INDEX_ENABLE_MPL_SUPPORT
50+
#include <boost/bimap/detail/mpl_to_mp11_list.hpp>
51+
#endif
52+
4853
#include <boost/bimap/set_of.hpp>
4954
#include <boost/bimap/unconstrained_set_of.hpp>
5055
#include <boost/core/allocator_access.hpp>
@@ -394,8 +399,16 @@ class bimap_core
394399

395400
>::type complete_core_indices;
396401

402+
#ifndef BOOST_MULTI_INDEX_ENABLE_MPL_SUPPORT
403+
404+
using core_indices = mpl_to_mp11_list< complete_core_indices >;
405+
406+
#else
407+
397408
struct core_indices : public complete_core_indices {};
398409

410+
#endif
411+
399412
// Define the core using compute_index_type to translate the
400413
// set type to an multi-index specification
401414
// --------------------------------------------------------------------
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
// Boost.Bimap
2+
//
3+
// Copyright (c) 2025 Joaquin M Lopez Munoz
4+
//
5+
// Distributed under the Boost Software License, Version 1.0.
6+
// (See accompanying file LICENSE_1_0.txt or copy at
7+
// http://www.boost.org/LICENSE_1_0.txt)
8+
9+
10+
#ifndef BOOST_BIMAP_DETAIL_MPL_TO_MP11_LIST_HPP
11+
#define BOOST_BIMAP_DETAIL_MPL_TO_MP11_LIST_HPP
12+
13+
#if defined(_MSC_VER)
14+
#pragma once
15+
#endif
16+
17+
#include <boost/mp11/list.hpp>
18+
#include <boost/mpl/begin_end.hpp>
19+
#include <boost/mpl/deref.hpp>
20+
#include <boost/mpl/next.hpp>
21+
22+
/** \struct boost::bimaps::detail::mpl_to_mp11_list
23+
24+
\brief Converts a MPL sequence to a Mp11 list
25+
26+
\code
27+
using mp11_list = mpl_to_mp11_list< mpl_sequence >;
28+
\endcode
29+
**/
30+
31+
#ifndef BOOST_BIMAP_DOXYGEN_WILL_NOT_PROCESS_THE_FOLLOWING_LINES
32+
33+
namespace boost {
34+
namespace bimaps {
35+
namespace detail {
36+
37+
template< typename First, typename Last, typename... Ts >
38+
struct mpl_to_mp11_list_impl: mpl_to_mp11_list_impl
39+
<
40+
typename mpl::next<First>::type, Last,
41+
Ts..., typename mpl::deref<First>::type
42+
> {};
43+
44+
template< typename Last, typename... Ts >
45+
struct mpl_to_mp11_list_impl< Last, Last, Ts... >
46+
{
47+
using type = mp11::mp_list< Ts... >;
48+
};
49+
50+
template< typename TypeList >
51+
using mpl_to_mp11_list=typename mpl_to_mp11_list_impl
52+
<
53+
typename mpl::begin<TypeList>::type,
54+
typename mpl::end<TypeList>::type
55+
>::type;
56+
57+
} // namespace detail
58+
} // namespace bimaps
59+
} // namespace boost
60+
61+
#endif // BOOST_BIMAP_DOXYGEN_WILL_NOT_PROCESS_THE_FOLLOWING_LINES
62+
63+
#endif // BOOST_BIMAP_DETAIL_MPL_TO_MP11_LIST_HPP

0 commit comments

Comments
 (0)