| 1 | // Boost.Bimap |
| 2 | // |
| 3 | // Copyright (c) 2006-2007 Matias Capeletto |
| 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 | /// \file detail/generate_index_binder.hpp |
| 10 | /// \brief Define macros to help building the set type of definitions |
| 11 | |
| 12 | |
| 13 | #ifndef BOOST_BIMAP_DETAIL_GENERATE_INDEX_BINDER_HPP |
| 14 | #define BOOST_BIMAP_DETAIL_GENERATE_INDEX_BINDER_HPP |
| 15 | |
| 16 | #if defined(_MSC_VER) |
| 17 | #pragma once |
| 18 | #endif |
| 19 | |
| 20 | #include <boost/config.hpp> |
| 21 | |
| 22 | #include <boost/multi_index/tag.hpp> |
| 23 | |
| 24 | |
| 25 | /*===========================================================================*/ |
| 26 | #define BOOST_BIMAP_GENERATE_INDEX_BINDER_0CP( \ |
| 27 | \ |
| 28 | MULTI_INDEX_TYPE \ |
| 29 | \ |
| 30 | ) \ |
| 31 | \ |
| 32 | template< class KeyExtractor, class Tag > \ |
| 33 | struct index_bind \ |
| 34 | { \ |
| 35 | typedef MULTI_INDEX_TYPE \ |
| 36 | < \ |
| 37 | multi_index::tag< Tag >, \ |
| 38 | KeyExtractor \ |
| 39 | \ |
| 40 | > type; \ |
| 41 | }; |
| 42 | /*===========================================================================*/ |
| 43 | |
| 44 | |
| 45 | |
| 46 | /*===========================================================================*/ |
| 47 | #define BOOST_BIMAP_GENERATE_INDEX_BINDER_1CP( \ |
| 48 | \ |
| 49 | MULTI_INDEX_TYPE, \ |
| 50 | CONFIG_PARAMETER \ |
| 51 | \ |
| 52 | ) \ |
| 53 | \ |
| 54 | template< class KeyExtractor, class Tag > \ |
| 55 | struct index_bind \ |
| 56 | { \ |
| 57 | typedef MULTI_INDEX_TYPE \ |
| 58 | < \ |
| 59 | multi_index::tag< Tag >, \ |
| 60 | KeyExtractor, \ |
| 61 | CONFIG_PARAMETER \ |
| 62 | \ |
| 63 | > type; \ |
| 64 | }; |
| 65 | /*===========================================================================*/ |
| 66 | |
| 67 | |
| 68 | |
| 69 | |
| 70 | /*===========================================================================*/ |
| 71 | #define BOOST_BIMAP_GENERATE_INDEX_BINDER_2CP( \ |
| 72 | \ |
| 73 | MULTI_INDEX_TYPE, \ |
| 74 | CONFIG_PARAMETER_1, \ |
| 75 | CONFIG_PARAMETER_2 \ |
| 76 | ) \ |
| 77 | \ |
| 78 | template< class KeyExtractor, class Tag > \ |
| 79 | struct index_bind \ |
| 80 | { \ |
| 81 | typedef MULTI_INDEX_TYPE \ |
| 82 | < \ |
| 83 | multi_index::tag< Tag >, \ |
| 84 | KeyExtractor, \ |
| 85 | CONFIG_PARAMETER_1, \ |
| 86 | CONFIG_PARAMETER_2 \ |
| 87 | \ |
| 88 | > type; \ |
| 89 | \ |
| 90 | }; |
| 91 | /*===========================================================================*/ |
| 92 | |
| 93 | |
| 94 | // This is a special registration to allow sequenced and random access indices |
| 95 | // to play along smoothly with the other index types. |
| 96 | |
| 97 | /*===========================================================================*/ |
| 98 | #define ( \ |
| 99 | \ |
| 100 | MULTI_INDEX_TYPE \ |
| 101 | \ |
| 102 | ) \ |
| 103 | \ |
| 104 | template< class KeyExtractor, class Tag > \ |
| 105 | struct index_bind \ |
| 106 | { \ |
| 107 | typedef MULTI_INDEX_TYPE< multi_index::tag< Tag > > type; \ |
| 108 | }; |
| 109 | /*===========================================================================*/ |
| 110 | |
| 111 | |
| 112 | // This is yet another special registration to allow unconstrained sets |
| 113 | // to play along smoothly with the other index types. |
| 114 | |
| 115 | /*===========================================================================*/ |
| 116 | #define BOOST_BIMAP_GENERATE_INDEX_BINDER_FAKE \ |
| 117 | \ |
| 118 | template< class KeyExtractor, class Tag > \ |
| 119 | struct index_bind \ |
| 120 | { \ |
| 121 | typedef void type; \ |
| 122 | }; \ |
| 123 | /*===========================================================================*/ |
| 124 | |
| 125 | #endif // BOOST_BIMAP_DETAIL_GENERATE_INDEX_BINDER_HPP |
| 126 | |