| 1 | /* Copyright 2003-2015 Joaquin M Lopez Munoz. | 
|---|
| 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) | 
|---|
| 5 | * | 
|---|
| 6 | * See http://www.boost.org/libs/multi_index for library home page. | 
|---|
| 7 | */ | 
|---|
| 8 |  | 
|---|
| 9 | #ifndef BOOST_MULTI_INDEX_ORDERED_INDEX_HPP | 
|---|
| 10 | #define BOOST_MULTI_INDEX_ORDERED_INDEX_HPP | 
|---|
| 11 |  | 
|---|
| 12 | #if defined(_MSC_VER) | 
|---|
| 13 | #pragma once | 
|---|
| 14 | #endif | 
|---|
| 15 |  | 
|---|
| 16 | #include <boost/config.hpp> /* keep it first to prevent nasty warns in MSVC */ | 
|---|
| 17 | #include <boost/multi_index/detail/ord_index_impl.hpp> | 
|---|
| 18 | #include <boost/multi_index/ordered_index_fwd.hpp> | 
|---|
| 19 |  | 
|---|
| 20 | namespace boost{ | 
|---|
| 21 |  | 
|---|
| 22 | namespace multi_index{ | 
|---|
| 23 |  | 
|---|
| 24 | namespace detail{ | 
|---|
| 25 |  | 
|---|
| 26 | /* no augment policy for plain ordered indices */ | 
|---|
| 27 |  | 
|---|
| 28 | struct null_augment_policy | 
|---|
| 29 | { | 
|---|
| 30 | template<typename OrderedIndexImpl> | 
|---|
| 31 | struct augmented_interface | 
|---|
| 32 | { | 
|---|
| 33 | typedef OrderedIndexImpl type; | 
|---|
| 34 | }; | 
|---|
| 35 |  | 
|---|
| 36 | template<typename OrderedIndexNodeImpl> | 
|---|
| 37 | struct augmented_node | 
|---|
| 38 | { | 
|---|
| 39 | typedef OrderedIndexNodeImpl type; | 
|---|
| 40 | }; | 
|---|
| 41 |  | 
|---|
| 42 | template<typename Pointer> static void add(Pointer,Pointer){} | 
|---|
| 43 | template<typename Pointer> static void remove(Pointer,Pointer){} | 
|---|
| 44 | template<typename Pointer> static void copy(Pointer,Pointer){} | 
|---|
| 45 | template<typename Pointer> static void rotate_left(Pointer,Pointer){} | 
|---|
| 46 | template<typename Pointer> static void rotate_right(Pointer,Pointer){} | 
|---|
| 47 |  | 
|---|
| 48 | #if defined(BOOST_MULTI_INDEX_ENABLE_INVARIANT_CHECKING) | 
|---|
| 49 | /* invariant stuff */ | 
|---|
| 50 |  | 
|---|
| 51 | template<typename Pointer> static bool invariant(Pointer){return true;} | 
|---|
| 52 |  | 
|---|
| 53 | #endif | 
|---|
| 54 | }; | 
|---|
| 55 |  | 
|---|
| 56 | } /* namespace multi_index::detail */ | 
|---|
| 57 |  | 
|---|
| 58 | /* ordered_index specifiers */ | 
|---|
| 59 |  | 
|---|
| 60 | template<typename Arg1,typename Arg2,typename Arg3> | 
|---|
| 61 | struct ordered_unique | 
|---|
| 62 | { | 
|---|
| 63 | typedef typename detail::ordered_index_args< | 
|---|
| 64 | Arg1,Arg2,Arg3>                                index_args; | 
|---|
| 65 | typedef typename index_args::tag_list_type::type tag_list_type; | 
|---|
| 66 | typedef typename index_args::key_from_value_type key_from_value_type; | 
|---|
| 67 | typedef typename index_args::compare_type        compare_type; | 
|---|
| 68 |  | 
|---|
| 69 | template<typename Super> | 
|---|
| 70 | struct node_class | 
|---|
| 71 | { | 
|---|
| 72 | typedef detail::ordered_index_node<detail::null_augment_policy,Super> type; | 
|---|
| 73 | }; | 
|---|
| 74 |  | 
|---|
| 75 | template<typename SuperMeta> | 
|---|
| 76 | struct index_class | 
|---|
| 77 | { | 
|---|
| 78 | typedef detail::ordered_index< | 
|---|
| 79 | key_from_value_type,compare_type, | 
|---|
| 80 | SuperMeta,tag_list_type,detail::ordered_unique_tag, | 
|---|
| 81 | detail::null_augment_policy>                        type; | 
|---|
| 82 | }; | 
|---|
| 83 | }; | 
|---|
| 84 |  | 
|---|
| 85 | template<typename Arg1,typename Arg2,typename Arg3> | 
|---|
| 86 | struct ordered_non_unique | 
|---|
| 87 | { | 
|---|
| 88 | typedef detail::ordered_index_args< | 
|---|
| 89 | Arg1,Arg2,Arg3>                                index_args; | 
|---|
| 90 | typedef typename index_args::tag_list_type::type tag_list_type; | 
|---|
| 91 | typedef typename index_args::key_from_value_type key_from_value_type; | 
|---|
| 92 | typedef typename index_args::compare_type        compare_type; | 
|---|
| 93 |  | 
|---|
| 94 | template<typename Super> | 
|---|
| 95 | struct node_class | 
|---|
| 96 | { | 
|---|
| 97 | typedef detail::ordered_index_node<detail::null_augment_policy,Super> type; | 
|---|
| 98 | }; | 
|---|
| 99 |  | 
|---|
| 100 | template<typename SuperMeta> | 
|---|
| 101 | struct index_class | 
|---|
| 102 | { | 
|---|
| 103 | typedef detail::ordered_index< | 
|---|
| 104 | key_from_value_type,compare_type, | 
|---|
| 105 | SuperMeta,tag_list_type,detail::ordered_non_unique_tag, | 
|---|
| 106 | detail::null_augment_policy>                            type; | 
|---|
| 107 | }; | 
|---|
| 108 | }; | 
|---|
| 109 |  | 
|---|
| 110 | } /* namespace multi_index */ | 
|---|
| 111 |  | 
|---|
| 112 | } /* namespace boost */ | 
|---|
| 113 |  | 
|---|
| 114 | #endif | 
|---|
| 115 |  | 
|---|