File indexing completed on 2025-11-04 09:53:29
0001 
0002 
0003 
0004 
0005 
0006 
0007 
0008 
0009 #ifndef BOOST_MULTI_INDEX_DETAIL_HASH_INDEX_ARGS_HPP
0010 #define BOOST_MULTI_INDEX_DETAIL_HASH_INDEX_ARGS_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/container_hash/hash.hpp>
0018 #include <boost/mpl/aux_/na.hpp>
0019 #include <boost/mpl/eval_if.hpp>
0020 #include <boost/mpl/identity.hpp>
0021 #include <boost/mpl/if.hpp>
0022 #include <boost/multi_index/tag.hpp>
0023 #include <boost/static_assert.hpp>
0024 #include <boost/type_traits/is_same.hpp>
0025 #include <functional>
0026 
0027 namespace boost{
0028 
0029 namespace multi_index{
0030 
0031 namespace detail{
0032 
0033 
0034 
0035 
0036 
0037 
0038 
0039 
0040 
0041 
0042 
0043 
0044 
0045 
0046 
0047 
0048 
0049 template<typename KeyFromValue>
0050 struct index_args_default_hash
0051 {
0052   typedef ::boost::hash<typename KeyFromValue::result_type> type;
0053 };
0054 
0055 template<typename KeyFromValue>
0056 struct index_args_default_pred
0057 {
0058   typedef std::equal_to<typename KeyFromValue::result_type> type;
0059 };
0060 
0061 template<typename Arg1,typename Arg2,typename Arg3,typename Arg4>
0062 struct hashed_index_args
0063 {
0064   typedef is_tag<Arg1> full_form;
0065 
0066   typedef typename mpl::if_<
0067     full_form,
0068     Arg1,
0069     tag< > >::type                                   tag_list_type;
0070   typedef typename mpl::if_<
0071     full_form,
0072     Arg2,
0073     Arg1>::type                                      key_from_value_type;
0074   typedef typename mpl::if_<
0075     full_form,
0076     Arg3,
0077     Arg2>::type                                      supplied_hash_type;
0078   typedef typename mpl::eval_if<
0079     mpl::is_na<supplied_hash_type>,
0080     index_args_default_hash<key_from_value_type>,
0081     mpl::identity<supplied_hash_type>
0082   >::type                                            hash_type;
0083   typedef typename mpl::if_<
0084     full_form,
0085     Arg4,
0086     Arg3>::type                                      supplied_pred_type;
0087   typedef typename mpl::eval_if<
0088     mpl::is_na<supplied_pred_type>,
0089     index_args_default_pred<key_from_value_type>,
0090     mpl::identity<supplied_pred_type>
0091   >::type                                            pred_type;
0092 
0093   BOOST_STATIC_ASSERT(is_tag<tag_list_type>::value);
0094   BOOST_STATIC_ASSERT(!mpl::is_na<key_from_value_type>::value);
0095   BOOST_STATIC_ASSERT(!mpl::is_na<hash_type>::value);
0096   BOOST_STATIC_ASSERT(!mpl::is_na<pred_type>::value);
0097 };
0098 
0099 } 
0100 
0101 } 
0102 
0103 } 
0104 
0105 #endif