annotate DEPENDENCIES/generic/include/boost/mpl/lower_bound.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@16 1
Chris@16 2 #ifndef BOOST_MPL_LOWER_BOUND_HPP_INCLUDED
Chris@16 3 #define BOOST_MPL_LOWER_BOUND_HPP_INCLUDED
Chris@16 4
Chris@16 5 // Copyright Aleksey Gurtovoy 2001-2004
Chris@16 6 //
Chris@16 7 // Distributed under the Boost Software License, Version 1.0.
Chris@16 8 // (See accompanying file LICENSE_1_0.txt or copy at
Chris@16 9 // http://www.boost.org/LICENSE_1_0.txt)
Chris@16 10 //
Chris@16 11 // See http://www.boost.org/libs/mpl for documentation.
Chris@16 12
Chris@101 13 // $Id$
Chris@101 14 // $Date$
Chris@101 15 // $Revision$
Chris@16 16
Chris@16 17 #include <boost/mpl/less.hpp>
Chris@16 18 #include <boost/mpl/lambda.hpp>
Chris@16 19 #include <boost/mpl/aux_/na_spec.hpp>
Chris@16 20 #include <boost/mpl/aux_/config/workaround.hpp>
Chris@16 21
Chris@16 22 #if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x610))
Chris@16 23 # define BOOST_MPL_CFG_STRIPPED_DOWN_LOWER_BOUND_IMPL
Chris@16 24 #endif
Chris@16 25
Chris@16 26 #if !defined(BOOST_MPL_CFG_STRIPPED_DOWN_LOWER_BOUND_IMPL)
Chris@16 27 # include <boost/mpl/minus.hpp>
Chris@16 28 # include <boost/mpl/divides.hpp>
Chris@16 29 # include <boost/mpl/size.hpp>
Chris@16 30 # include <boost/mpl/advance.hpp>
Chris@16 31 # include <boost/mpl/begin_end.hpp>
Chris@16 32 # include <boost/mpl/long.hpp>
Chris@16 33 # include <boost/mpl/eval_if.hpp>
Chris@16 34 # include <boost/mpl/prior.hpp>
Chris@16 35 # include <boost/mpl/deref.hpp>
Chris@16 36 # include <boost/mpl/apply.hpp>
Chris@16 37 # include <boost/mpl/aux_/value_wknd.hpp>
Chris@16 38 #else
Chris@16 39 # include <boost/mpl/not.hpp>
Chris@16 40 # include <boost/mpl/find.hpp>
Chris@16 41 # include <boost/mpl/bind.hpp>
Chris@16 42 #endif
Chris@16 43
Chris@16 44 #include <boost/config.hpp>
Chris@16 45
Chris@16 46 namespace boost { namespace mpl {
Chris@16 47
Chris@16 48 #if defined(BOOST_MPL_CFG_STRIPPED_DOWN_LOWER_BOUND_IMPL)
Chris@16 49
Chris@16 50 // agurt 23/oct/02: has a wrong complexity etc., but at least it works
Chris@16 51 // feel free to contribute a better implementation!
Chris@16 52 template<
Chris@16 53 typename BOOST_MPL_AUX_NA_PARAM(Sequence)
Chris@16 54 , typename BOOST_MPL_AUX_NA_PARAM(T)
Chris@16 55 , typename Predicate = less<>
Chris@16 56 , typename pred_ = typename lambda<Predicate>::type
Chris@16 57 >
Chris@16 58 struct lower_bound
Chris@16 59 : find_if< Sequence, bind1< not_<>, bind2<pred_,_,T> > >
Chris@16 60 {
Chris@16 61 };
Chris@16 62
Chris@16 63 #else
Chris@16 64
Chris@16 65 namespace aux {
Chris@16 66
Chris@16 67 template<
Chris@16 68 typename Distance
Chris@16 69 , typename Predicate
Chris@16 70 , typename T
Chris@16 71 , typename DeferredIterator
Chris@16 72 >
Chris@16 73 struct lower_bound_step_impl;
Chris@16 74
Chris@16 75 template<
Chris@16 76 typename Distance
Chris@16 77 , typename Predicate
Chris@16 78 , typename T
Chris@16 79 , typename DeferredIterator
Chris@16 80 >
Chris@16 81 struct lower_bound_step
Chris@16 82 {
Chris@16 83 typedef typename eval_if<
Chris@16 84 Distance
Chris@16 85 , lower_bound_step_impl<Distance,Predicate,T,DeferredIterator>
Chris@16 86 , DeferredIterator
Chris@16 87 >::type type;
Chris@16 88 };
Chris@16 89
Chris@16 90 template<
Chris@16 91 typename Distance
Chris@16 92 , typename Predicate
Chris@16 93 , typename T
Chris@16 94 , typename DeferredIterator
Chris@16 95 >
Chris@16 96 struct lower_bound_step_impl
Chris@16 97 {
Chris@16 98 typedef typename divides< Distance, long_<2> >::type offset_;
Chris@16 99 typedef typename DeferredIterator::type iter_;
Chris@16 100 typedef typename advance< iter_,offset_ >::type middle_;
Chris@16 101 typedef typename apply2<
Chris@16 102 Predicate
Chris@16 103 , typename deref<middle_>::type
Chris@16 104 , T
Chris@16 105 >::type cond_;
Chris@16 106
Chris@16 107 typedef typename prior< minus< Distance, offset_> >::type step_;
Chris@16 108 typedef lower_bound_step< offset_,Predicate,T,DeferredIterator > step_forward_;
Chris@16 109 typedef lower_bound_step< step_,Predicate,T,next<middle_> > step_backward_;
Chris@16 110 typedef typename eval_if<
Chris@16 111 cond_
Chris@16 112 , step_backward_
Chris@16 113 , step_forward_
Chris@16 114 >::type type;
Chris@16 115 };
Chris@16 116
Chris@16 117
Chris@16 118 } // namespace aux
Chris@16 119
Chris@16 120 template<
Chris@16 121 typename BOOST_MPL_AUX_NA_PARAM(Sequence)
Chris@16 122 , typename BOOST_MPL_AUX_NA_PARAM(T)
Chris@16 123 , typename Predicate = less<>
Chris@16 124 >
Chris@16 125 struct lower_bound
Chris@16 126 {
Chris@16 127 private:
Chris@16 128 typedef typename lambda<Predicate>::type pred_;
Chris@16 129 typedef typename size<Sequence>::type size_;
Chris@16 130
Chris@16 131 public:
Chris@16 132 typedef typename aux::lower_bound_step<
Chris@16 133 size_,pred_,T,begin<Sequence>
Chris@16 134 >::type type;
Chris@16 135 };
Chris@16 136
Chris@16 137 #endif // BOOST_MPL_CFG_STRIPPED_DOWN_LOWER_BOUND_IMPL
Chris@16 138
Chris@16 139 BOOST_MPL_AUX_NA_SPEC(2, lower_bound)
Chris@16 140
Chris@16 141 }}
Chris@16 142
Chris@16 143 #endif // BOOST_MPL_LOWER_BOUND_HPP_INCLUDED