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)
6 * See http://www.boost.org/libs/multi_index for library home page.
9 #ifndef BOOST_MULTI_INDEX_DETAIL_ORD_INDEX_ARGS_HPP
10 #define BOOST_MULTI_INDEX_DETAIL_ORD_INDEX_ARGS_HPP
12 #if defined(_MSC_VER)&&(_MSC_VER>=1200)
16 #include <boost/config.hpp> /* keep it first to prevent nasty warns in MSVC */
17 #include <boost/mpl/aux_/na.hpp>
18 #include <boost/mpl/eval_if.hpp>
19 #include <boost/mpl/identity.hpp>
20 #include <boost/mpl/if.hpp>
21 #include <boost/multi_index/tag.hpp>
22 #include <boost/static_assert.hpp>
23 #include <boost/type_traits/is_same.hpp>
28 namespace multi_index{
32 /* Oredered index specifiers can be instantiated in two forms:
34 * (ordered_unique|ordered_non_unique)<
35 * KeyFromValue,Compare=std::less<KeyFromValue::result_type> >
36 * (ordered_unique|ordered_non_unique)<
37 * TagList,KeyFromValue,Compare=std::less<KeyFromValue::result_type> >
39 * index_args implements the machinery to accept this argument-dependent
43 template<typename KeyFromValue>
44 struct index_args_default_compare
46 typedef std::less<typename KeyFromValue::result_type> type;
49 template<typename Arg1,typename Arg2,typename Arg3>
50 struct ordered_index_args
52 typedef is_tag<Arg1> full_form;
54 typedef typename mpl::if_<
57 tag< > >::type tag_list_type;
58 typedef typename mpl::if_<
61 Arg1>::type key_from_value_type;
62 typedef typename mpl::if_<
65 Arg2>::type supplied_compare_type;
66 typedef typename mpl::eval_if<
67 mpl::is_na<supplied_compare_type>,
68 index_args_default_compare<key_from_value_type>,
69 mpl::identity<supplied_compare_type>
72 BOOST_STATIC_ASSERT(is_tag<tag_list_type>::value);
73 BOOST_STATIC_ASSERT(!mpl::is_na<key_from_value_type>::value);
74 BOOST_STATIC_ASSERT(!mpl::is_na<compare_type>::value);
77 } /* namespace multi_index::detail */
79 } /* namespace multi_index */
81 } /* namespace boost */