annotate DEPENDENCIES/generic/include/boost/multi_index/detail/hash_index_args.hpp @ 125:34e428693f5d vext

Vext -> Repoint
author Chris Cannam
date Thu, 14 Jun 2018 11:15:39 +0100
parents c530137014c0
children
rev   line source
Chris@101 1 /* Copyright 2003-2013 Joaquin M Lopez Munoz.
Chris@16 2 * Distributed under the Boost Software License, Version 1.0.
Chris@16 3 * (See accompanying file LICENSE_1_0.txt or copy at
Chris@16 4 * http://www.boost.org/LICENSE_1_0.txt)
Chris@16 5 *
Chris@16 6 * See http://www.boost.org/libs/multi_index for library home page.
Chris@16 7 */
Chris@16 8
Chris@16 9 #ifndef BOOST_MULTI_INDEX_DETAIL_HASH_INDEX_ARGS_HPP
Chris@16 10 #define BOOST_MULTI_INDEX_DETAIL_HASH_INDEX_ARGS_HPP
Chris@16 11
Chris@101 12 #if defined(_MSC_VER)
Chris@16 13 #pragma once
Chris@16 14 #endif
Chris@16 15
Chris@16 16 #include <boost/config.hpp> /* keep it first to prevent nasty warns in MSVC */
Chris@16 17 #include <boost/functional/hash.hpp>
Chris@16 18 #include <boost/mpl/aux_/na.hpp>
Chris@16 19 #include <boost/mpl/eval_if.hpp>
Chris@16 20 #include <boost/mpl/identity.hpp>
Chris@16 21 #include <boost/mpl/if.hpp>
Chris@16 22 #include <boost/multi_index/tag.hpp>
Chris@16 23 #include <boost/static_assert.hpp>
Chris@16 24 #include <boost/type_traits/is_same.hpp>
Chris@16 25 #include <functional>
Chris@16 26
Chris@16 27 namespace boost{
Chris@16 28
Chris@16 29 namespace multi_index{
Chris@16 30
Chris@16 31 namespace detail{
Chris@16 32
Chris@16 33 /* Hashed index specifiers can be instantiated in two forms:
Chris@16 34 *
Chris@16 35 * (hashed_unique|hashed_non_unique)<
Chris@16 36 * KeyFromValue,
Chris@16 37 * Hash=boost::hash<KeyFromValue::result_type>,
Chris@16 38 * Pred=std::equal_to<KeyFromValue::result_type> >
Chris@16 39 * (hashed_unique|hashed_non_unique)<
Chris@16 40 * TagList,
Chris@16 41 * KeyFromValue,
Chris@16 42 * Hash=boost::hash<KeyFromValue::result_type>,
Chris@16 43 * Pred=std::equal_to<KeyFromValue::result_type> >
Chris@16 44 *
Chris@16 45 * hashed_index_args implements the machinery to accept this
Chris@16 46 * argument-dependent polymorphism.
Chris@16 47 */
Chris@16 48
Chris@16 49 template<typename KeyFromValue>
Chris@16 50 struct index_args_default_hash
Chris@16 51 {
Chris@16 52 typedef ::boost::hash<typename KeyFromValue::result_type> type;
Chris@16 53 };
Chris@16 54
Chris@16 55 template<typename KeyFromValue>
Chris@16 56 struct index_args_default_pred
Chris@16 57 {
Chris@16 58 typedef std::equal_to<typename KeyFromValue::result_type> type;
Chris@16 59 };
Chris@16 60
Chris@16 61 template<typename Arg1,typename Arg2,typename Arg3,typename Arg4>
Chris@16 62 struct hashed_index_args
Chris@16 63 {
Chris@16 64 typedef is_tag<Arg1> full_form;
Chris@16 65
Chris@16 66 typedef typename mpl::if_<
Chris@16 67 full_form,
Chris@16 68 Arg1,
Chris@16 69 tag< > >::type tag_list_type;
Chris@16 70 typedef typename mpl::if_<
Chris@16 71 full_form,
Chris@16 72 Arg2,
Chris@16 73 Arg1>::type key_from_value_type;
Chris@16 74 typedef typename mpl::if_<
Chris@16 75 full_form,
Chris@16 76 Arg3,
Chris@16 77 Arg2>::type supplied_hash_type;
Chris@16 78 typedef typename mpl::eval_if<
Chris@16 79 mpl::is_na<supplied_hash_type>,
Chris@16 80 index_args_default_hash<key_from_value_type>,
Chris@16 81 mpl::identity<supplied_hash_type>
Chris@16 82 >::type hash_type;
Chris@16 83 typedef typename mpl::if_<
Chris@16 84 full_form,
Chris@16 85 Arg4,
Chris@16 86 Arg3>::type supplied_pred_type;
Chris@16 87 typedef typename mpl::eval_if<
Chris@16 88 mpl::is_na<supplied_pred_type>,
Chris@16 89 index_args_default_pred<key_from_value_type>,
Chris@16 90 mpl::identity<supplied_pred_type>
Chris@16 91 >::type pred_type;
Chris@16 92
Chris@16 93 BOOST_STATIC_ASSERT(is_tag<tag_list_type>::value);
Chris@16 94 BOOST_STATIC_ASSERT(!mpl::is_na<key_from_value_type>::value);
Chris@16 95 BOOST_STATIC_ASSERT(!mpl::is_na<hash_type>::value);
Chris@16 96 BOOST_STATIC_ASSERT(!mpl::is_na<pred_type>::value);
Chris@16 97 };
Chris@16 98
Chris@16 99 } /* namespace multi_index::detail */
Chris@16 100
Chris@16 101 } /* namespace multi_index */
Chris@16 102
Chris@16 103 } /* namespace boost */
Chris@16 104
Chris@16 105 #endif