[857] | 1 | /* Copyright 2003-2005 Joaquín M López Muñoz.
|
---|
| 2 | * Distributed under the Boost Software License, Version 1.0.
|
---|
| 3 | * (See accompanying file LICENSE_1_0.txt or copy at
|
---|
| 4 | * http://www.boost.org/LICENSE_1_0.txt)
|
---|
| 5 | *
|
---|
| 6 | * See http://www.boost.org/libs/multi_index for library home page.
|
---|
| 7 | */
|
---|
| 8 |
|
---|
| 9 | #ifndef BOOST_MULTI_INDEX_INDEXED_BY_HPP
|
---|
| 10 | #define BOOST_MULTI_INDEX_INDEXED_BY_HPP
|
---|
| 11 |
|
---|
| 12 | #if defined(_MSC_VER)&&(_MSC_VER>=1200)
|
---|
| 13 | #pragma once
|
---|
| 14 | #endif
|
---|
| 15 |
|
---|
| 16 | #include <boost/config.hpp> /* keep it first to prevent nasty warns in MSVC */
|
---|
| 17 | #include <boost/mpl/vector.hpp>
|
---|
| 18 | #include <boost/preprocessor/cat.hpp>
|
---|
| 19 | #include <boost/preprocessor/control/expr_if.hpp>
|
---|
| 20 | #include <boost/preprocessor/repetition/enum.hpp>
|
---|
| 21 | #include <boost/preprocessor/repetition/enum_params.hpp>
|
---|
| 22 |
|
---|
| 23 | /* An alias to mpl::vector used to hide MPL from the user.
|
---|
| 24 | * indexed_by contains the index specifiers for instantiation
|
---|
| 25 | * of a multi_index_container.
|
---|
| 26 | */
|
---|
| 27 |
|
---|
| 28 | /* This user_definable macro limits the number of elements of an index list;
|
---|
| 29 | * useful for shortening resulting symbol names (MSVC++ 6.0, for instance,
|
---|
| 30 | * has problems coping with very long symbol names.)
|
---|
| 31 | */
|
---|
| 32 |
|
---|
| 33 | #if !defined(BOOST_MULTI_INDEX_LIMIT_INDEXED_BY_SIZE)
|
---|
| 34 | #if defined(BOOST_MSVC)&&(BOOST_MSVC<1300)
|
---|
| 35 | #define BOOST_MULTI_INDEX_LIMIT_INDEXED_BY_SIZE 5
|
---|
| 36 | #else
|
---|
| 37 | #define BOOST_MULTI_INDEX_LIMIT_INDEXED_BY_SIZE BOOST_MPL_LIMIT_VECTOR_SIZE
|
---|
| 38 | #endif
|
---|
| 39 | #endif
|
---|
| 40 |
|
---|
| 41 | #if BOOST_MULTI_INDEX_LIMIT_INDEXED_BY_SIZE<BOOST_MPL_LIMIT_VECTOR_SIZE
|
---|
| 42 | #define BOOST_MULTI_INDEX_INDEXED_BY_SIZE \
|
---|
| 43 | BOOST_MULTI_INDEX_LIMIT_INDEXED_BY_SIZE
|
---|
| 44 | #else
|
---|
| 45 | #define BOOST_MULTI_INDEX_INDEXED_BY_SIZE BOOST_MPL_LIMIT_VECTOR_SIZE
|
---|
| 46 | #endif
|
---|
| 47 |
|
---|
| 48 | #define BOOST_MULTI_INDEX_INDEXED_BY_TEMPLATE_PARM(z,n,var) \
|
---|
| 49 | typename BOOST_PP_CAT(var,n) BOOST_PP_EXPR_IF(n,=mpl::na)
|
---|
| 50 |
|
---|
| 51 | namespace boost{
|
---|
| 52 |
|
---|
| 53 | namespace multi_index{
|
---|
| 54 |
|
---|
| 55 | template<
|
---|
| 56 | BOOST_PP_ENUM(
|
---|
| 57 | BOOST_MULTI_INDEX_INDEXED_BY_SIZE,
|
---|
| 58 | BOOST_MULTI_INDEX_INDEXED_BY_TEMPLATE_PARM,T)
|
---|
| 59 | >
|
---|
| 60 | struct indexed_by:
|
---|
| 61 | mpl::vector<BOOST_PP_ENUM_PARAMS(BOOST_MULTI_INDEX_INDEXED_BY_SIZE,T)>
|
---|
| 62 | {
|
---|
| 63 | };
|
---|
| 64 |
|
---|
| 65 | } /* namespace multi_index */
|
---|
| 66 |
|
---|
| 67 | } /* namespace boost */
|
---|
| 68 |
|
---|
| 69 | #undef BOOST_MULTI_INDEX_INDEXED_BY_TEMPLATE_PARM
|
---|
| 70 | #undef BOOST_MULTI_INDEX_INDEXED_BY_SIZE
|
---|
| 71 |
|
---|
| 72 | #endif
|
---|