File indexing completed on 2025-01-18 09:42:12
0001
0002
0003
0004
0005
0006
0007
0008
0009 #ifndef BOOST_MULTI_INDEX_TAG_HPP
0010 #define BOOST_MULTI_INDEX_TAG_HPP
0011
0012 #if defined(_MSC_VER)
0013 #pragma once
0014 #endif
0015
0016 #include <boost/config.hpp> /* keep it first to prevent nasty warns in MSVC */
0017 #include <boost/multi_index/detail/no_duplicate_tags.hpp>
0018 #include <boost/mpl/identity.hpp>
0019 #include <boost/mpl/transform.hpp>
0020 #include <boost/mpl/vector.hpp>
0021 #include <boost/preprocessor/facilities/intercept.hpp>
0022 #include <boost/preprocessor/repetition/enum_binary_params.hpp>
0023 #include <boost/preprocessor/repetition/enum_params.hpp>
0024 #include <boost/static_assert.hpp>
0025 #include <boost/type_traits/is_base_and_derived.hpp>
0026
0027
0028
0029
0030
0031
0032
0033
0034
0035
0036 #if !defined(BOOST_MULTI_INDEX_LIMIT_TAG_SIZE)
0037 #define BOOST_MULTI_INDEX_LIMIT_TAG_SIZE BOOST_MPL_LIMIT_VECTOR_SIZE
0038 #endif
0039
0040 #if BOOST_MULTI_INDEX_LIMIT_TAG_SIZE<BOOST_MPL_LIMIT_VECTOR_SIZE
0041 #define BOOST_MULTI_INDEX_TAG_SIZE BOOST_MULTI_INDEX_LIMIT_TAG_SIZE
0042 #else
0043 #define BOOST_MULTI_INDEX_TAG_SIZE BOOST_MPL_LIMIT_VECTOR_SIZE
0044 #endif
0045
0046 namespace boost{
0047
0048 namespace multi_index{
0049
0050 namespace detail{
0051
0052 struct tag_marker{};
0053
0054 template<typename T>
0055 struct is_tag
0056 {
0057 BOOST_STATIC_CONSTANT(bool,value=(is_base_and_derived<tag_marker,T>::value));
0058 };
0059
0060 }
0061
0062 template<
0063 BOOST_PP_ENUM_BINARY_PARAMS(
0064 BOOST_MULTI_INDEX_TAG_SIZE,
0065 typename T,
0066 =mpl::na BOOST_PP_INTERCEPT)
0067 >
0068 struct tag:private detail::tag_marker
0069 {
0070
0071
0072
0073
0074 typedef typename mpl::transform<
0075 mpl::vector<BOOST_PP_ENUM_PARAMS(BOOST_MULTI_INDEX_TAG_SIZE,T)>,
0076 mpl::identity<mpl::_1>
0077 >::type type;
0078
0079 BOOST_STATIC_ASSERT(detail::no_duplicate_tags<type>::value);
0080 };
0081
0082 }
0083
0084 }
0085
0086 #undef BOOST_MULTI_INDEX_TAG_SIZE
0087
0088 #endif