annotate DEPENDENCIES/generic/include/boost/range/adaptor/define_adaptor.hpp @ 125:34e428693f5d vext

Vext -> Repoint
author Chris Cannam
date Thu, 14 Jun 2018 11:15:39 +0100
parents 2665513ce2d3
children
rev   line source
Chris@16 1 // Boost.Range library
Chris@16 2 //
Chris@16 3 // Copyright Neil Groves 2010. Use, modification and
Chris@16 4 // distribution is subject to the Boost Software License, Version
Chris@16 5 // 1.0. (See accompanying file LICENSE_1_0.txt or copy at
Chris@16 6 // http://www.boost.org/LICENSE_1_0.txt)
Chris@16 7 //
Chris@16 8 // For more information, see http://www.boost.org/libs/range/
Chris@16 9 //
Chris@16 10
Chris@16 11 #ifndef BOOST_RANGE_DEFINE_ADAPTOR_HPP_INCLUDED
Chris@16 12 #define BOOST_RANGE_DEFINE_ADAPTOR_HPP_INCLUDED
Chris@16 13
Chris@16 14 #include <boost/tuple/tuple.hpp>
Chris@16 15
Chris@16 16 #define BOOST_DEFINE_RANGE_ADAPTOR( adaptor_name, range_adaptor ) \
Chris@16 17 struct adaptor_name##_forwarder {}; \
Chris@16 18 \
Chris@16 19 template<typename Range> range_adaptor <Range> \
Chris@16 20 operator|(Range& rng, adaptor_name##_forwarder) \
Chris@16 21 { \
Chris@16 22 return range_adaptor <Range>( rng ); \
Chris@16 23 } \
Chris@16 24 \
Chris@16 25 template<typename Range> range_adaptor <const Range> \
Chris@16 26 operator|(const Range& rng, adaptor_name##_forwarder) \
Chris@16 27 { \
Chris@16 28 return range_adaptor <const Range>( rng ); \
Chris@16 29 } \
Chris@16 30 \
Chris@16 31 static adaptor_name##_forwarder adaptor_name = adaptor_name##_forwarder(); \
Chris@16 32 \
Chris@16 33 template<typename Range> \
Chris@16 34 range_adaptor <Range> \
Chris@16 35 make_##adaptor_name(Range& rng) \
Chris@16 36 { \
Chris@16 37 return range_adaptor <Range>(rng); \
Chris@16 38 } \
Chris@16 39 \
Chris@16 40 template<typename Range> \
Chris@16 41 range_adaptor <const Range> \
Chris@16 42 make_##adaptor_name(const Range& rng) \
Chris@16 43 { \
Chris@16 44 return range_adaptor <const Range>(rng); \
Chris@16 45 }
Chris@16 46
Chris@16 47 #define BOOST_DEFINE_RANGE_ADAPTOR_1( adaptor_name, range_adaptor, arg1_type ) \
Chris@16 48 struct adaptor_name \
Chris@16 49 { \
Chris@16 50 explicit adaptor_name (arg1_type arg1_) \
Chris@16 51 : arg1(arg1_) {} \
Chris@16 52 arg1_type arg1; \
Chris@16 53 }; \
Chris@16 54 \
Chris@16 55 template<typename Range> range_adaptor <Range> \
Chris@16 56 operator|(Range& rng, adaptor_name args) \
Chris@16 57 { \
Chris@16 58 return range_adaptor <Range>(rng, args.arg1); \
Chris@16 59 } \
Chris@16 60 \
Chris@16 61 template<typename Range> range_adaptor <const Range> \
Chris@16 62 operator|(const Range& rng, adaptor_name args) \
Chris@16 63 { \
Chris@16 64 return range_adaptor <const Range>(rng, args.arg1); \
Chris@16 65 } \
Chris@16 66 \
Chris@16 67 template<typename Range> \
Chris@16 68 range_adaptor <Range> \
Chris@16 69 make_##adaptor_name(Range& rng, arg1_type arg1) \
Chris@16 70 { \
Chris@16 71 return range_adaptor <Range>(rng, arg1); \
Chris@16 72 } \
Chris@16 73 \
Chris@16 74 template<typename Range> \
Chris@16 75 range_adaptor <const Range> \
Chris@16 76 make_##adaptor_name(const Range& rng, arg1_type arg1) \
Chris@16 77 { \
Chris@16 78 return range_adaptor <const Range>(rng, arg1); \
Chris@16 79 }
Chris@16 80
Chris@16 81 #define BOOST_RANGE_ADAPTOR_2( adaptor_name, range_adaptor, arg1_type, arg2_type ) \
Chris@16 82 struct adaptor_name \
Chris@16 83 { \
Chris@16 84 explicit adaptor_name (arg1_type arg1_, arg2_type arg2_) \
Chris@16 85 : arg1(arg1_), arg2(arg2_) {} \
Chris@16 86 arg1_type arg1; \
Chris@16 87 arg2_type arg2; \
Chris@16 88 }; \
Chris@16 89 \
Chris@16 90 template<typename Range> range_adaptor <Range> \
Chris@16 91 operator|(Range& rng, adaptor_name args) \
Chris@16 92 { \
Chris@16 93 return range_adaptor <Range>(rng, args.arg1, args.arg2); \
Chris@16 94 } \
Chris@16 95 template<typename Range> \
Chris@16 96 range_adaptor <Range> \
Chris@16 97 make_##adaptor_name(Range& rng, arg1_type arg1, arg2_type arg2) \
Chris@16 98 { \
Chris@16 99 return range_adaptor <Range>(rng, arg1, arg2); \
Chris@16 100 } \
Chris@16 101 template<typename Range> \
Chris@16 102 range_adaptor <const Range> \
Chris@16 103 make_##adaptor_name(const Range& rng, arg1_type arg1, arg2_type arg2) \
Chris@16 104 { \
Chris@16 105 return range_adaptor <const Range>(rng, arg1, arg2); \
Chris@16 106 }
Chris@16 107
Chris@16 108
Chris@16 109 #endif // include guard