Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:42:12

0001 /* Copyright 2003-2013 Joaquin M Lopez Munoz.
0002  * Distributed under the Boost Software License, Version 1.0.
0003  * (See accompanying file LICENSE_1_0.txt or copy at
0004  * http://www.boost.org/LICENSE_1_0.txt)
0005  *
0006  * See http://www.boost.org/libs/multi_index for library home page.
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 /* A wrapper of mpl::vector used to hide MPL from the user.
0028  * tag contains types used as tag names for indices in get() functions.
0029  */
0030 
0031 /* This user_definable macro limits the number of elements of a tag;
0032  * useful for shortening resulting symbol names (MSVC++ 6.0, for instance,
0033  * has problems coping with very long symbol names.)
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 } /* namespace multi_index::detail */
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   /* The mpl::transform pass produces shorter symbols (without
0071    * trailing mpl::na's.)
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 } /* namespace multi_index */
0083 
0084 } /* namespace boost */
0085 
0086 #undef BOOST_MULTI_INDEX_TAG_SIZE
0087 
0088 #endif