epoc32/include/stdapis/boost/lambda/detail/operators.hpp
branchSymbian3
changeset 4 837f303aceeb
parent 3 e1b950c65cb4
     1.1 --- a/epoc32/include/stdapis/boost/lambda/detail/operators.hpp	Wed Mar 31 12:27:01 2010 +0100
     1.2 +++ b/epoc32/include/stdapis/boost/lambda/detail/operators.hpp	Wed Mar 31 12:33:34 2010 +0100
     1.3 @@ -1,941 +1,370 @@
     1.4 -//  Boost operators.hpp header file  ----------------------------------------//
     1.5 +// Boost Lambda Library - operators.hpp --------------------------------------
     1.6  
     1.7 -//  (C) Copyright David Abrahams, Jeremy Siek, Daryle Walker 1999-2001.
     1.8 -//  Distributed under the Boost Software License, Version 1.0. (See
     1.9 -//  accompanying file LICENSE_1_0.txt or copy at
    1.10 -//  http://www.boost.org/LICENSE_1_0.txt)
    1.11 +// Copyright (C) 1999, 2000 Jaakko Järvi (jaakko.jarvi@cs.utu.fi)
    1.12 +//
    1.13 +// Distributed under the Boost Software License, Version 1.0. (See
    1.14 +// accompanying file LICENSE_1_0.txt or copy at
    1.15 +// http://www.boost.org/LICENSE_1_0.txt)
    1.16 +//
    1.17 +// For more information, see www.boost.org
    1.18  
    1.19 -//  See http://www.boost.org/libs/utility/operators.htm for documentation.
    1.20 +// ---------------------------------------------------------------
    1.21  
    1.22 -//  Revision History
    1.23 -//  21 Oct 02 Modified implementation of operators to allow compilers with a
    1.24 -//            correct named return value optimization (NRVO) to produce optimal
    1.25 -//            code.  (Daniel Frey)
    1.26 -//  02 Dec 01 Bug fixed in random_access_iteratable.  (Helmut Zeisel)
    1.27 -//  28 Sep 01 Factored out iterator operator groups.  (Daryle Walker)
    1.28 -//  27 Aug 01 'left' form for non commutative operators added;
    1.29 -//            additional classes for groups of related operators added;
    1.30 -//            workaround for empty base class optimization
    1.31 -//            bug of GCC 3.0 (Helmut Zeisel)
    1.32 -//  25 Jun 01 output_iterator_helper changes: removed default template 
    1.33 -//            parameters, added support for self-proxying, additional 
    1.34 -//            documentation and tests (Aleksey Gurtovoy)
    1.35 -//  29 May 01 Added operator classes for << and >>.  Added input and output
    1.36 -//            iterator helper classes.  Added classes to connect equality and
    1.37 -//            relational operators.  Added classes for groups of related
    1.38 -//            operators.  Reimplemented example operator and iterator helper
    1.39 -//            classes in terms of the new groups.  (Daryle Walker, with help
    1.40 -//            from Alexy Gurtovoy)
    1.41 -//  11 Feb 01 Fixed bugs in the iterator helpers which prevented explicitly
    1.42 -//            supplied arguments from actually being used (Dave Abrahams)
    1.43 -//  04 Jul 00 Fixed NO_OPERATORS_IN_NAMESPACE bugs, major cleanup and
    1.44 -//            refactoring of compiler workarounds, additional documentation
    1.45 -//            (Alexy Gurtovoy and Mark Rodgers with some help and prompting from
    1.46 -//            Dave Abrahams) 
    1.47 -//  28 Jun 00 General cleanup and integration of bugfixes from Mark Rodgers and
    1.48 -//            Jeremy Siek (Dave Abrahams)
    1.49 -//  20 Jun 00 Changes to accommodate Borland C++Builder 4 and Borland C++ 5.5
    1.50 -//            (Mark Rodgers)
    1.51 -//  20 Jun 00 Minor fixes to the prior revision (Aleksey Gurtovoy)
    1.52 -//  10 Jun 00 Support for the base class chaining technique was added
    1.53 -//            (Aleksey Gurtovoy). See documentation and the comments below 
    1.54 -//            for the details. 
    1.55 -//  12 Dec 99 Initial version with iterator operators (Jeremy Siek)
    1.56 -//  18 Nov 99 Change name "divideable" to "dividable", remove unnecessary
    1.57 -//            specializations of dividable, subtractable, modable (Ed Brey) 
    1.58 -//  17 Nov 99 Add comments (Beman Dawes)
    1.59 -//            Remove unnecessary specialization of operators<> (Ed Brey)
    1.60 -//  15 Nov 99 Fix less_than_comparable<T,U> second operand type for first two
    1.61 -//            operators.(Beman Dawes)
    1.62 -//  12 Nov 99 Add operators templates (Ed Brey)
    1.63 -//  11 Nov 99 Add single template parameter version for compilers without
    1.64 -//            partial specialization (Beman Dawes)
    1.65 -//  10 Nov 99 Initial version
    1.66 +#ifndef BOOST_LAMBDA_OPERATORS_HPP
    1.67 +#define BOOST_LAMBDA_OPERATORS_HPP
    1.68  
    1.69 -// 10 Jun 00:
    1.70 -// An additional optional template parameter was added to most of 
    1.71 -// operator templates to support the base class chaining technique (see 
    1.72 -// documentation for the details). Unfortunately, a straightforward
    1.73 -// implementation of this change would have broken compatibility with the
    1.74 -// previous version of the library by making it impossible to use the same
    1.75 -// template name (e.g. 'addable') for both the 1- and 2-argument versions of
    1.76 -// an operator template. This implementation solves the backward-compatibility
    1.77 -// issue at the cost of some simplicity.
    1.78 -//
    1.79 -// One of the complications is an existence of special auxiliary class template
    1.80 -// 'is_chained_base<>' (see 'detail' namespace below), which is used
    1.81 -// to determine whether its template parameter is a library's operator template
    1.82 -// or not. You have to specialize 'is_chained_base<>' for each new 
    1.83 -// operator template you add to the library.
    1.84 -//
    1.85 -// However, most of the non-trivial implementation details are hidden behind 
    1.86 -// several local macros defined below, and as soon as you understand them,
    1.87 -// you understand the whole library implementation. 
    1.88 +#include "boost/lambda/detail/is_instance_of.hpp"
    1.89  
    1.90 -#ifndef BOOST_OPERATORS_HPP
    1.91 -#define BOOST_OPERATORS_HPP
    1.92 +namespace boost { 
    1.93 +namespace lambda {
    1.94  
    1.95 -#include <boost/config.hpp>
    1.96 -#include <boost/iterator.hpp>
    1.97 -#include <boost/detail/workaround.hpp>
    1.98 -
    1.99 -#if defined(__sgi) && !defined(__GNUC__)
   1.100 -#   pragma set woff 1234
   1.101 +#if defined BOOST_LAMBDA_BE1
   1.102 +#error "Multiple defines of BOOST_LAMBDA_BE1"
   1.103  #endif
   1.104  
   1.105 -#if defined(BOOST_MSVC)
   1.106 -#   pragma warning( disable : 4284 ) // complaint about return type of 
   1.107 -#endif                               // operator-> not begin a UDT
   1.108 +  // For all BOOSTA_LAMBDA_BE* macros:
   1.109  
   1.110 -namespace boost {
   1.111 +  // CONSTA must be either 'A' or 'const A'
   1.112 +  // CONSTB must be either 'B' or 'const B'
   1.113 +
   1.114 +  // It is stupid to have the names A and B as macro arguments, but it avoids
   1.115 +  // the need to pass in emtpy macro arguments, which gives warnings on some
   1.116 +  // compilers
   1.117 +
   1.118 +#define BOOST_LAMBDA_BE1(OPER_NAME, ACTION, CONSTA, CONSTB, CONVERSION)      \
   1.119 +template<class Arg, class B>                                                 \
   1.120 +inline const                                                                 \
   1.121 +lambda_functor<                                                              \
   1.122 +  lambda_functor_base<                                                       \
   1.123 +    ACTION,                                                                  \
   1.124 +    tuple<lambda_functor<Arg>, typename CONVERSION <CONSTB>::type>         \
   1.125 +  >                                                                          \
   1.126 +>                                                                            \
   1.127 +OPER_NAME (const lambda_functor<Arg>& a, CONSTB& b) {                      \
   1.128 +  return                                                                     \
   1.129 +    lambda_functor_base<                                                     \
   1.130 +      ACTION,                                                                \
   1.131 +      tuple<lambda_functor<Arg>, typename CONVERSION <CONSTB>::type>       \
   1.132 +    >                                                                        \
   1.133 +   (tuple<lambda_functor<Arg>, typename CONVERSION <CONSTB>::type>(a, b)); \
   1.134 +}
   1.135 +
   1.136 +
   1.137 +#if defined BOOST_LAMBDA_BE2
   1.138 +#error "Multiple defines of BOOST_LAMBDA_BE2"
   1.139 +#endif
   1.140 +
   1.141 +#define BOOST_LAMBDA_BE2(OPER_NAME, ACTION, CONSTA, CONSTB, CONVERSION)      \
   1.142 +template<class A, class Arg>                                                 \
   1.143 +inline const                                                                 \
   1.144 +lambda_functor<                                                              \
   1.145 +  lambda_functor_base<                                                       \
   1.146 +    ACTION,                                                                  \
   1.147 +    tuple<typename CONVERSION <CONSTA>::type, lambda_functor<Arg> >        \
   1.148 +  >                                                                          \
   1.149 +>                                                                            \
   1.150 +OPER_NAME (CONSTA& a, const lambda_functor<Arg>& b) {                      \
   1.151 +  return                                                                     \
   1.152 +    lambda_functor_base<                                                     \
   1.153 +      ACTION,                                                                \
   1.154 +      tuple<typename CONVERSION <CONSTA>::type, lambda_functor<Arg> >      \
   1.155 +    >                                                                        \
   1.156 +  (tuple<typename CONVERSION <CONSTA>::type, lambda_functor<Arg> >(a, b)); \
   1.157 +}
   1.158 +
   1.159 +
   1.160 +#if defined BOOST_LAMBDA_BE3
   1.161 +#error "Multiple defines of BOOST_LAMBDA_BE3"
   1.162 +#endif
   1.163 +
   1.164 +#define BOOST_LAMBDA_BE3(OPER_NAME, ACTION, CONSTA, CONSTB, CONVERSION)    \
   1.165 +template<class ArgA, class ArgB>                                           \
   1.166 +inline const                                                               \
   1.167 +lambda_functor<                                                            \
   1.168 +  lambda_functor_base<                                                     \
   1.169 +    ACTION,                                                                \
   1.170 +    tuple<lambda_functor<ArgA>, lambda_functor<ArgB> >                     \
   1.171 +  >                                                                        \
   1.172 +>                                                                          \
   1.173 +OPER_NAME (const lambda_functor<ArgA>& a, const lambda_functor<ArgB>& b) { \
   1.174 +  return                                                                   \
   1.175 +    lambda_functor_base<                                                   \
   1.176 +      ACTION,                                                              \
   1.177 +      tuple<lambda_functor<ArgA>, lambda_functor<ArgB> >                   \
   1.178 +    >                                                                      \
   1.179 +  (tuple<lambda_functor<ArgA>, lambda_functor<ArgB> >(a, b));              \
   1.180 +}
   1.181 +
   1.182 +#if defined BOOST_LAMBDA_BE
   1.183 +#error "Multiple defines of BOOST_LAMBDA_BE"
   1.184 +#endif
   1.185 +
   1.186 +#define BOOST_LAMBDA_BE(OPER_NAME, ACTION, CONSTA, CONSTB, CONST_CONVERSION) \
   1.187 +BOOST_LAMBDA_BE1(OPER_NAME, ACTION, CONSTA, CONSTB, CONST_CONVERSION)        \
   1.188 +BOOST_LAMBDA_BE2(OPER_NAME, ACTION, CONSTA, CONSTB, CONST_CONVERSION)        \
   1.189 +BOOST_LAMBDA_BE3(OPER_NAME, ACTION, CONSTA, CONSTB, CONST_CONVERSION)
   1.190 +
   1.191 +#define BOOST_LAMBDA_EMPTY() 
   1.192 +
   1.193 +BOOST_LAMBDA_BE(operator+, arithmetic_action<plus_action>, const A, const B, const_copy_argument)
   1.194 +BOOST_LAMBDA_BE(operator-, arithmetic_action<minus_action>, const A, const B, const_copy_argument)
   1.195 +BOOST_LAMBDA_BE(operator*, arithmetic_action<multiply_action>, const A, const B, const_copy_argument)
   1.196 +BOOST_LAMBDA_BE(operator/, arithmetic_action<divide_action>, const A, const B, const_copy_argument)
   1.197 +BOOST_LAMBDA_BE(operator%, arithmetic_action<remainder_action>, const A, const B, const_copy_argument)
   1.198 +BOOST_LAMBDA_BE(operator<<, bitwise_action<leftshift_action>, const A, const B, const_copy_argument)
   1.199 +BOOST_LAMBDA_BE(operator>>, bitwise_action<rightshift_action>, const A, const B, const_copy_argument)
   1.200 +BOOST_LAMBDA_BE(operator&, bitwise_action<and_action>, const A, const B, const_copy_argument)
   1.201 +BOOST_LAMBDA_BE(operator|, bitwise_action<or_action>, const A, const B, const_copy_argument)
   1.202 +BOOST_LAMBDA_BE(operator^, bitwise_action<xor_action>, const A, const B, const_copy_argument)
   1.203 +BOOST_LAMBDA_BE(operator&&, logical_action<and_action>, const A, const B, const_copy_argument)
   1.204 +BOOST_LAMBDA_BE(operator||, logical_action<or_action>, const A, const B, const_copy_argument)
   1.205 +BOOST_LAMBDA_BE(operator<, relational_action<less_action>, const A, const B, const_copy_argument)
   1.206 +BOOST_LAMBDA_BE(operator>, relational_action<greater_action>, const A, const B, const_copy_argument)
   1.207 +BOOST_LAMBDA_BE(operator<=, relational_action<lessorequal_action>, const A, const B, const_copy_argument)
   1.208 +BOOST_LAMBDA_BE(operator>=, relational_action<greaterorequal_action>, const A, const B, const_copy_argument)
   1.209 +BOOST_LAMBDA_BE(operator==, relational_action<equal_action>, const A, const B, const_copy_argument)
   1.210 +BOOST_LAMBDA_BE(operator!=, relational_action<notequal_action>, const A, const B, const_copy_argument)
   1.211 +
   1.212 +BOOST_LAMBDA_BE(operator+=, arithmetic_assignment_action<plus_action>, A, const B, reference_argument)
   1.213 +BOOST_LAMBDA_BE(operator-=, arithmetic_assignment_action<minus_action>, A, const B, reference_argument)
   1.214 +BOOST_LAMBDA_BE(operator*=, arithmetic_assignment_action<multiply_action>, A, const B, reference_argument)
   1.215 +BOOST_LAMBDA_BE(operator/=, arithmetic_assignment_action<divide_action>, A, const B, reference_argument)
   1.216 +BOOST_LAMBDA_BE(operator%=, arithmetic_assignment_action<remainder_action>, A, const B, reference_argument)
   1.217 +BOOST_LAMBDA_BE(operator<<=, bitwise_assignment_action<leftshift_action>, A, const B, reference_argument)
   1.218 +BOOST_LAMBDA_BE(operator>>=, bitwise_assignment_action<rightshift_action>, A, const B, reference_argument)
   1.219 +BOOST_LAMBDA_BE(operator&=, bitwise_assignment_action<and_action>, A, const B, reference_argument)
   1.220 +BOOST_LAMBDA_BE(operator|=, bitwise_assignment_action<or_action>, A, const B, reference_argument)
   1.221 +BOOST_LAMBDA_BE(operator^=, bitwise_assignment_action<xor_action>, A, const B, reference_argument)
   1.222 +
   1.223 +
   1.224 +// A special trick for comma operator for correct preprocessing
   1.225 +#if defined BOOST_LAMBDA_COMMA_OPERATOR_NAME
   1.226 +#error "Multiple defines of BOOST_LAMBDA_COMMA_OPERATOR_NAME"
   1.227 +#endif
   1.228 +
   1.229 +#define BOOST_LAMBDA_COMMA_OPERATOR_NAME operator,
   1.230 +
   1.231 +BOOST_LAMBDA_BE1(BOOST_LAMBDA_COMMA_OPERATOR_NAME, other_action<comma_action>, const A, const B, const_copy_argument)
   1.232 +BOOST_LAMBDA_BE2(BOOST_LAMBDA_COMMA_OPERATOR_NAME, other_action<comma_action>, const A, const B, const_copy_argument)
   1.233 +BOOST_LAMBDA_BE3(BOOST_LAMBDA_COMMA_OPERATOR_NAME, other_action<comma_action>, const A, const B, const_copy_argument)
   1.234 +
   1.235 +
   1.236 +
   1.237  namespace detail {
   1.238  
   1.239 -// Helmut Zeisel, empty base class optimization bug with GCC 3.0.0
   1.240 -#if defined(__GNUC__) && __GNUC__==3 && __GNUC_MINOR__==0 && __GNU_PATCHLEVEL__==0
   1.241 -class empty_base {
   1.242 -  bool dummy; 
   1.243 +// special cases for ostream& << Any and istream& >> Any ---------------
   1.244 +// the actual stream classes may vary and thus a specialisation for, 
   1.245 +// say ostream& does not match (the general case above is chosen). 
   1.246 +// Therefore we specialise for non-const reference:
   1.247 +// if the left argument is a stream, we store the stream as reference
   1.248 +// if it is something else, we store a const plain by default
   1.249 +
   1.250 +// Note that the overloading is const vs. non-const first argument
   1.251 +
   1.252 +#ifdef BOOST_NO_TEMPLATED_STREAMS
   1.253 +template<class T> struct convert_ostream_to_ref_others_to_c_plain_by_default {
   1.254 +  typedef typename detail::IF<
   1.255 +                       boost::is_convertible<T*, std::ostream*>::value,
   1.256 +                       T&,
   1.257 +                       typename const_copy_argument <T>::type
   1.258 +                     >::RET type;
   1.259 +};
   1.260 +
   1.261 +template<class T> struct convert_istream_to_ref_others_to_c_plain_by_default {
   1.262 +  typedef typename detail::IF<
   1.263 +                       boost::is_convertible<T*, std::istream*>::value,
   1.264 +                       T&,
   1.265 +                       typename const_copy_argument <T>::type
   1.266 +                     >::RET type;
   1.267  };
   1.268  #else
   1.269 -class empty_base {};
   1.270 +
   1.271 +template<class T> struct convert_ostream_to_ref_others_to_c_plain_by_default {
   1.272 +  typedef typename detail::IF<
   1.273 +                       is_instance_of_2<
   1.274 +                         T, std::basic_ostream
   1.275 +                       >::value,
   1.276 +                       T&,
   1.277 +                       typename const_copy_argument <T>::type
   1.278 +                     >::RET type;
   1.279 +};
   1.280 +
   1.281 +template<class T> struct convert_istream_to_ref_others_to_c_plain_by_default {
   1.282 +  typedef typename detail::IF<
   1.283 +                       is_instance_of_2<
   1.284 +                         T, std::basic_istream
   1.285 +                       >::value,
   1.286 +                       T&,
   1.287 +                       typename const_copy_argument <T>::type
   1.288 +                     >::RET type;
   1.289 +};
   1.290  #endif
   1.291  
   1.292 -} // namespace detail
   1.293 +} // detail
   1.294 +
   1.295 +BOOST_LAMBDA_BE2(operator<<, bitwise_action< leftshift_action>, A, const B, detail::convert_ostream_to_ref_others_to_c_plain_by_default)
   1.296 +BOOST_LAMBDA_BE2(operator>>, bitwise_action< rightshift_action>, A, const B, detail::convert_istream_to_ref_others_to_c_plain_by_default)      
   1.297 +
   1.298 +
   1.299 +// special case for io_manipulators.
   1.300 +// function references cannot be given as arguments to lambda operator
   1.301 +// expressions in general. With << and >> the use of manipulators is
   1.302 +// so common, that specializations are provided to make them work.
   1.303 +
   1.304 +template<class Arg, class Ret, class ManipArg>
   1.305 +inline const 
   1.306 +lambda_functor<
   1.307 +  lambda_functor_base<
   1.308 +    bitwise_action<leftshift_action>,
   1.309 +    tuple<lambda_functor<Arg>, Ret(&)(ManipArg)> 
   1.310 +  > 
   1.311 +>
   1.312 +operator<<(const lambda_functor<Arg>& a, Ret(&b)(ManipArg))
   1.313 +{
   1.314 +  return 
   1.315 +      lambda_functor_base<
   1.316 +        bitwise_action<leftshift_action>,
   1.317 +        tuple<lambda_functor<Arg>, Ret(&)(ManipArg)>
   1.318 +      > 
   1.319 +    ( tuple<lambda_functor<Arg>, Ret(&)(ManipArg)>(a, b) );
   1.320 +}
   1.321 +
   1.322 +template<class Arg, class Ret, class ManipArg>
   1.323 +inline const 
   1.324 +lambda_functor<
   1.325 +  lambda_functor_base<
   1.326 +    bitwise_action<rightshift_action>,
   1.327 +    tuple<lambda_functor<Arg>, Ret(&)(ManipArg)>
   1.328 +  > 
   1.329 +>
   1.330 +operator>>(const lambda_functor<Arg>& a, Ret(&b)(ManipArg))
   1.331 +{
   1.332 +  return 
   1.333 +      lambda_functor_base<
   1.334 +        bitwise_action<rightshift_action>,
   1.335 +        tuple<lambda_functor<Arg>, Ret(&)(ManipArg)>
   1.336 +      > 
   1.337 +    ( tuple<lambda_functor<Arg>, Ret(&)(ManipArg)>(a, b) );
   1.338 +}
   1.339 +
   1.340 +
   1.341 +// (+ and -) take their arguments as const references. 
   1.342 +// This has consquences with pointer artihmetic
   1.343 +// E.g int a[]; ... *a = 1 works but not *(a+1) = 1. 
   1.344 +// the result of a+1 would be const
   1.345 +// To make the latter work too, 
   1.346 +// non-const arrays are taken as non-const and stored as non-const as well.
   1.347 +#if defined  BOOST_LAMBDA_PTR_ARITHMETIC_E1
   1.348 +#error "Multiple defines of  BOOST_LAMBDA_PTR_ARITHMETIC_E1"
   1.349 +#endif
   1.350 +
   1.351 +#define BOOST_LAMBDA_PTR_ARITHMETIC_E1(OPER_NAME, ACTION, CONSTB)            \
   1.352 +template<class Arg, int N, class B>                                         \
   1.353 +inline const                                                                \
   1.354 +lambda_functor<                                                             \
   1.355 +  lambda_functor_base<ACTION, tuple<lambda_functor<Arg>, CONSTB(&)[N]> >   \
   1.356 +>                                                                           \
   1.357 +OPER_NAME (const lambda_functor<Arg>& a, CONSTB(&b)[N])                    \
   1.358 +{                                                                           \
   1.359 +  return lambda_functor<                                                    \
   1.360 +    lambda_functor_base<ACTION, tuple<lambda_functor<Arg>, CONSTB(&)[N]> > \
   1.361 +  >(tuple<lambda_functor<Arg>, CONSTB(&)[N]>(a, b));                       \
   1.362 +}
   1.363 +
   1.364 +
   1.365 +#if defined  BOOST_LAMBDA_PTR_ARITHMETIC_E2
   1.366 +#error "Multiple defines of  BOOST_LAMBDA_PTR_ARITHMETIC_E2"
   1.367 +#endif
   1.368 +
   1.369 +#define BOOST_LAMBDA_PTR_ARITHMETIC_E2(OPER_NAME, ACTION, CONSTA)             \
   1.370 +template<int N, class A, class Arg>                                          \
   1.371 +inline const                                                                 \
   1.372 +lambda_functor<                                                              \
   1.373 +  lambda_functor_base<ACTION, tuple<CONSTA(&)[N], lambda_functor<Arg> > >   \
   1.374 +>                                                                            \
   1.375 +OPER_NAME (CONSTA(&a)[N], const lambda_functor<Arg>& b)                     \
   1.376 +{                                                                            \
   1.377 +  return                                                                     \
   1.378 +    lambda_functor_base<ACTION, tuple<CONSTA(&)[N], lambda_functor<Arg> > > \
   1.379 +    (tuple<CONSTA(&)[N], lambda_functor<Arg> >(a, b));                      \
   1.380 +}
   1.381 +
   1.382 +
   1.383 +BOOST_LAMBDA_PTR_ARITHMETIC_E1(operator+, arithmetic_action<plus_action>, B)
   1.384 +BOOST_LAMBDA_PTR_ARITHMETIC_E2(operator+, arithmetic_action<plus_action>, A)
   1.385 +BOOST_LAMBDA_PTR_ARITHMETIC_E1(operator+, arithmetic_action<plus_action>,const B)
   1.386 +BOOST_LAMBDA_PTR_ARITHMETIC_E2(operator+, arithmetic_action<plus_action>,const A)
   1.387 +
   1.388 +
   1.389 +//BOOST_LAMBDA_PTR_ARITHMETIC_E1(operator-, arithmetic_action<minus_action>)
   1.390 +// This is not needed, since the result of ptr-ptr is an rvalue anyway
   1.391 +
   1.392 +BOOST_LAMBDA_PTR_ARITHMETIC_E2(operator-, arithmetic_action<minus_action>, A)
   1.393 +BOOST_LAMBDA_PTR_ARITHMETIC_E2(operator-, arithmetic_action<minus_action>, const A)
   1.394 +
   1.395 +
   1.396 +#undef BOOST_LAMBDA_BE1
   1.397 +#undef BOOST_LAMBDA_BE2
   1.398 +#undef BOOST_LAMBDA_BE3
   1.399 +#undef BOOST_LAMBDA_BE
   1.400 +#undef BOOST_LAMBDA_COMMA_OPERATOR_NAME
   1.401 +
   1.402 +#undef BOOST_LAMBDA_PTR_ARITHMETIC_E1
   1.403 +#undef BOOST_LAMBDA_PTR_ARITHMETIC_E2
   1.404 +
   1.405 +
   1.406 +// ---------------------------------------------------------------------
   1.407 +// unary operators -----------------------------------------------------
   1.408 +// ---------------------------------------------------------------------
   1.409 +
   1.410 +#if defined BOOST_LAMBDA_UE
   1.411 +#error "Multiple defines of BOOST_LAMBDA_UE"
   1.412 +#endif
   1.413 +
   1.414 +#define BOOST_LAMBDA_UE(OPER_NAME, ACTION)                                 \
   1.415 +template<class Arg>                                                        \
   1.416 +inline const                                                               \
   1.417 +lambda_functor<lambda_functor_base<ACTION, tuple<lambda_functor<Arg> > > > \
   1.418 +OPER_NAME (const lambda_functor<Arg>& a)                                   \
   1.419 +{                                                                          \
   1.420 +  return                                                                   \
   1.421 +    lambda_functor_base<ACTION, tuple<lambda_functor<Arg> > >              \
   1.422 +    ( tuple<lambda_functor<Arg> >(a) );                                    \
   1.423 +}
   1.424 +
   1.425 +
   1.426 +BOOST_LAMBDA_UE(operator+, unary_arithmetic_action<plus_action>)
   1.427 +BOOST_LAMBDA_UE(operator-, unary_arithmetic_action<minus_action>)
   1.428 +BOOST_LAMBDA_UE(operator~, bitwise_action<not_action>)
   1.429 +BOOST_LAMBDA_UE(operator!, logical_action<not_action>)
   1.430 +BOOST_LAMBDA_UE(operator++, pre_increment_decrement_action<increment_action>)
   1.431 +BOOST_LAMBDA_UE(operator--, pre_increment_decrement_action<decrement_action>)
   1.432 +BOOST_LAMBDA_UE(operator*, other_action<contentsof_action>)
   1.433 +BOOST_LAMBDA_UE(operator&, other_action<addressof_action>)
   1.434 +
   1.435 +#if defined BOOST_LAMBDA_POSTFIX_UE
   1.436 +#error "Multiple defines of BOOST_LAMBDA_POSTFIX_UE"
   1.437 +#endif
   1.438 +
   1.439 +#define BOOST_LAMBDA_POSTFIX_UE(OPER_NAME, ACTION)                         \
   1.440 +template<class Arg>                                                        \
   1.441 +inline const                                                               \
   1.442 +lambda_functor<lambda_functor_base<ACTION, tuple<lambda_functor<Arg> > > > \
   1.443 +OPER_NAME (const lambda_functor<Arg>& a, int)                              \
   1.444 +{                                                                          \
   1.445 +  return                                                                   \
   1.446 +    lambda_functor_base<ACTION, tuple<lambda_functor<Arg> > >              \
   1.447 +    ( tuple<lambda_functor<Arg> >(a) );                                    \
   1.448 +}
   1.449 +
   1.450 +
   1.451 +BOOST_LAMBDA_POSTFIX_UE(operator++, post_increment_decrement_action<increment_action>)
   1.452 +BOOST_LAMBDA_POSTFIX_UE(operator--, post_increment_decrement_action<decrement_action>)
   1.453 +
   1.454 +#undef BOOST_LAMBDA_UE
   1.455 +#undef BOOST_LAMBDA_POSTFIX_UE
   1.456 +
   1.457 +} // namespace lambda
   1.458  } // namespace boost
   1.459  
   1.460 -// In this section we supply the xxxx1 and xxxx2 forms of the operator
   1.461 -// templates, which are explicitly targeted at the 1-type-argument and
   1.462 -// 2-type-argument operator forms, respectively. Some compilers get confused
   1.463 -// when inline friend functions are overloaded in namespaces other than the
   1.464 -// global namespace. When BOOST_NO_OPERATORS_IN_NAMESPACE is defined, all of
   1.465 -// these templates must go in the global namespace.
   1.466 -
   1.467 -#ifndef BOOST_NO_OPERATORS_IN_NAMESPACE
   1.468 -namespace boost
   1.469 -{
   1.470  #endif
   1.471 -
   1.472 -//  Basic operator classes (contributed by Dave Abrahams) ------------------//
   1.473 -
   1.474 -//  Note that friend functions defined in a class are implicitly inline.
   1.475 -//  See the C++ std, 11.4 [class.friend] paragraph 5
   1.476 -
   1.477 -template <class T, class U, class B = ::boost::detail::empty_base>
   1.478 -struct less_than_comparable2 : B
   1.479 -{
   1.480 -     friend bool operator<=(const T& x, const U& y) { return !(x > y); }
   1.481 -     friend bool operator>=(const T& x, const U& y) { return !(x < y); }
   1.482 -     friend bool operator>(const U& x, const T& y)  { return y < x; }
   1.483 -     friend bool operator<(const U& x, const T& y)  { return y > x; }
   1.484 -     friend bool operator<=(const U& x, const T& y) { return !(y < x); }
   1.485 -     friend bool operator>=(const U& x, const T& y) { return !(y > x); }
   1.486 -};
   1.487 -
   1.488 -template <class T, class B = ::boost::detail::empty_base>
   1.489 -struct less_than_comparable1 : B
   1.490 -{
   1.491 -     friend bool operator>(const T& x, const T& y)  { return y < x; }
   1.492 -     friend bool operator<=(const T& x, const T& y) { return !(y < x); }
   1.493 -     friend bool operator>=(const T& x, const T& y) { return !(x < y); }
   1.494 -};
   1.495 -
   1.496 -template <class T, class U, class B = ::boost::detail::empty_base>
   1.497 -struct equality_comparable2 : B
   1.498 -{
   1.499 -     friend bool operator==(const U& y, const T& x) { return x == y; }
   1.500 -     friend bool operator!=(const U& y, const T& x) { return !(x == y); }
   1.501 -     friend bool operator!=(const T& y, const U& x) { return !(y == x); }
   1.502 -};
   1.503 -
   1.504 -template <class T, class B = ::boost::detail::empty_base>
   1.505 -struct equality_comparable1 : B
   1.506 -{
   1.507 -     friend bool operator!=(const T& x, const T& y) { return !(x == y); }
   1.508 -};
   1.509 -
   1.510 -// A macro which produces "name_2left" from "name".
   1.511 -#define BOOST_OPERATOR2_LEFT(name) name##2##_##left
   1.512 -
   1.513 -//  NRVO-friendly implementation (contributed by Daniel Frey) ---------------//
   1.514 -
   1.515 -#if defined(BOOST_HAS_NRVO) || defined(BOOST_FORCE_SYMMETRIC_OPERATORS)
   1.516 -
   1.517 -// This is the optimal implementation for ISO/ANSI C++,
   1.518 -// but it requires the compiler to implement the NRVO.
   1.519 -// If the compiler has no NRVO, this is the best symmetric
   1.520 -// implementation available.
   1.521 -
   1.522 -#define BOOST_BINARY_OPERATOR_COMMUTATIVE( NAME, OP )                         \
   1.523 -template <class T, class U, class B = ::boost::detail::empty_base>            \
   1.524 -struct NAME##2 : B                                                            \
   1.525 -{                                                                             \
   1.526 -  friend T operator OP( const T& lhs, const U& rhs )                          \
   1.527 -    { T nrv( lhs ); nrv OP##= rhs; return nrv; }                              \
   1.528 -  friend T operator OP( const U& lhs, const T& rhs )                          \
   1.529 -    { T nrv( rhs ); nrv OP##= lhs; return nrv; }                              \
   1.530 -};                                                                            \
   1.531 -                                                                              \
   1.532 -template <class T, class B = ::boost::detail::empty_base>                     \
   1.533 -struct NAME##1 : B                                                            \
   1.534 -{                                                                             \
   1.535 -  friend T operator OP( const T& lhs, const T& rhs )                          \
   1.536 -    { T nrv( lhs ); nrv OP##= rhs; return nrv; }                              \
   1.537 -};
   1.538 -
   1.539 -#define BOOST_BINARY_OPERATOR_NON_COMMUTATIVE( NAME, OP )           \
   1.540 -template <class T, class U, class B = ::boost::detail::empty_base>  \
   1.541 -struct NAME##2 : B                                                  \
   1.542 -{                                                                   \
   1.543 -  friend T operator OP( const T& lhs, const U& rhs )                \
   1.544 -    { T nrv( lhs ); nrv OP##= rhs; return nrv; }                    \
   1.545 -};                                                                  \
   1.546 -                                                                    \
   1.547 -template <class T, class U, class B = ::boost::detail::empty_base>  \
   1.548 -struct BOOST_OPERATOR2_LEFT(NAME) : B                               \
   1.549 -{                                                                   \
   1.550 -  friend T operator OP( const U& lhs, const T& rhs )                \
   1.551 -    { T nrv( lhs ); nrv OP##= rhs; return nrv; }                    \
   1.552 -};                                                                  \
   1.553 -                                                                    \
   1.554 -template <class T, class B = ::boost::detail::empty_base>           \
   1.555 -struct NAME##1 : B                                                  \
   1.556 -{                                                                   \
   1.557 -  friend T operator OP( const T& lhs, const T& rhs )                \
   1.558 -    { T nrv( lhs ); nrv OP##= rhs; return nrv; }                    \
   1.559 -};
   1.560 -
   1.561 -#else // defined(BOOST_HAS_NRVO) || defined(BOOST_FORCE_SYMMETRIC_OPERATORS)
   1.562 -
   1.563 -// For compilers without NRVO the following code is optimal, but not
   1.564 -// symmetric!  Note that the implementation of
   1.565 -// BOOST_OPERATOR2_LEFT(NAME) only looks cool, but doesn't provide
   1.566 -// optimization opportunities to the compiler :)
   1.567 -
   1.568 -#define BOOST_BINARY_OPERATOR_COMMUTATIVE( NAME, OP )                         \
   1.569 -template <class T, class U, class B = ::boost::detail::empty_base>            \
   1.570 -struct NAME##2 : B                                                            \
   1.571 -{                                                                             \
   1.572 -  friend T operator OP( T lhs, const U& rhs ) { return lhs OP##= rhs; }       \
   1.573 -  friend T operator OP( const U& lhs, T rhs ) { return rhs OP##= lhs; }       \
   1.574 -};                                                                            \
   1.575 -                                                                              \
   1.576 -template <class T, class B = ::boost::detail::empty_base>                     \
   1.577 -struct NAME##1 : B                                                            \
   1.578 -{                                                                             \
   1.579 -  friend T operator OP( T lhs, const T& rhs ) { return lhs OP##= rhs; }       \
   1.580 -};
   1.581 -
   1.582 -#define BOOST_BINARY_OPERATOR_NON_COMMUTATIVE( NAME, OP )               \
   1.583 -template <class T, class U, class B = ::boost::detail::empty_base>      \
   1.584 -struct NAME##2 : B                                                      \
   1.585 -{                                                                       \
   1.586 -  friend T operator OP( T lhs, const U& rhs ) { return lhs OP##= rhs; } \
   1.587 -};                                                                      \
   1.588 -                                                                        \
   1.589 -template <class T, class U, class B = ::boost::detail::empty_base>      \
   1.590 -struct BOOST_OPERATOR2_LEFT(NAME) : B                                   \
   1.591 -{                                                                       \
   1.592 -  friend T operator OP( const U& lhs, const T& rhs )                    \
   1.593 -    { return T( lhs ) OP##= rhs; }                                      \
   1.594 -};                                                                      \
   1.595 -                                                                        \
   1.596 -template <class T, class B = ::boost::detail::empty_base>               \
   1.597 -struct NAME##1 : B                                                      \
   1.598 -{                                                                       \
   1.599 -  friend T operator OP( T lhs, const T& rhs ) { return lhs OP##= rhs; } \
   1.600 -};
   1.601 -
   1.602 -#endif // defined(BOOST_HAS_NRVO) || defined(BOOST_FORCE_SYMMETRIC_OPERATORS)
   1.603 -
   1.604 -BOOST_BINARY_OPERATOR_COMMUTATIVE( multipliable, * )
   1.605 -BOOST_BINARY_OPERATOR_COMMUTATIVE( addable, + )
   1.606 -BOOST_BINARY_OPERATOR_NON_COMMUTATIVE( subtractable, - )
   1.607 -BOOST_BINARY_OPERATOR_NON_COMMUTATIVE( dividable, / )
   1.608 -BOOST_BINARY_OPERATOR_NON_COMMUTATIVE( modable, % )
   1.609 -BOOST_BINARY_OPERATOR_COMMUTATIVE( xorable, ^ )
   1.610 -BOOST_BINARY_OPERATOR_COMMUTATIVE( andable, & )
   1.611 -BOOST_BINARY_OPERATOR_COMMUTATIVE( orable, | )
   1.612 -
   1.613 -#undef BOOST_BINARY_OPERATOR_COMMUTATIVE
   1.614 -#undef BOOST_BINARY_OPERATOR_NON_COMMUTATIVE
   1.615 -#undef BOOST_OPERATOR2_LEFT
   1.616 -
   1.617 -//  incrementable and decrementable contributed by Jeremy Siek
   1.618 -
   1.619 -template <class T, class B = ::boost::detail::empty_base>
   1.620 -struct incrementable : B
   1.621 -{
   1.622 -  friend T operator++(T& x, int)
   1.623 -  {
   1.624 -    incrementable_type nrv(x);
   1.625 -    ++x;
   1.626 -    return nrv;
   1.627 -  }
   1.628 -private: // The use of this typedef works around a Borland bug
   1.629 -  typedef T incrementable_type;
   1.630 -};
   1.631 -
   1.632 -template <class T, class B = ::boost::detail::empty_base>
   1.633 -struct decrementable : B
   1.634 -{
   1.635 -  friend T operator--(T& x, int)
   1.636 -  {
   1.637 -    decrementable_type nrv(x);
   1.638 -    --x;
   1.639 -    return nrv;
   1.640 -  }
   1.641 -private: // The use of this typedef works around a Borland bug
   1.642 -  typedef T decrementable_type;
   1.643 -};
   1.644 -
   1.645 -//  Iterator operator classes (contributed by Jeremy Siek) ------------------//
   1.646 -
   1.647 -template <class T, class P, class B = ::boost::detail::empty_base>
   1.648 -struct dereferenceable : B
   1.649 -{
   1.650 -  P operator->() const
   1.651 -  { 
   1.652 -    return &*static_cast<const T&>(*this); 
   1.653 -  }
   1.654 -};
   1.655 -
   1.656 -template <class T, class I, class R, class B = ::boost::detail::empty_base>
   1.657 -struct indexable : B
   1.658 -{
   1.659 -  R operator[](I n) const
   1.660 -  {
   1.661 -    return *(static_cast<const T&>(*this) + n);
   1.662 -  }
   1.663 -};
   1.664 -
   1.665 -//  More operator classes (contributed by Daryle Walker) --------------------//
   1.666 -//  (NRVO-friendly implementation contributed by Daniel Frey) ---------------//
   1.667 -
   1.668 -#if defined(BOOST_HAS_NRVO) || defined(BOOST_FORCE_SYMMETRIC_OPERATORS)
   1.669 -
   1.670 -#define BOOST_BINARY_OPERATOR( NAME, OP )                                     \
   1.671 -template <class T, class U, class B = ::boost::detail::empty_base>            \
   1.672 -struct NAME##2 : B                                                            \
   1.673 -{                                                                             \
   1.674 -  friend T operator OP( const T& lhs, const U& rhs )                          \
   1.675 -    { T nrv( lhs ); nrv OP##= rhs; return nrv; }                              \
   1.676 -};                                                                            \
   1.677 -                                                                              \
   1.678 -template <class T, class B = ::boost::detail::empty_base>                     \
   1.679 -struct NAME##1 : B                                                            \
   1.680 -{                                                                             \
   1.681 -  friend T operator OP( const T& lhs, const T& rhs )                          \
   1.682 -    { T nrv( lhs ); nrv OP##= rhs; return nrv; }                              \
   1.683 -};
   1.684 -
   1.685 -#else // defined(BOOST_HAS_NRVO) || defined(BOOST_FORCE_SYMMETRIC_OPERATORS)
   1.686 -
   1.687 -#define BOOST_BINARY_OPERATOR( NAME, OP )                                     \
   1.688 -template <class T, class U, class B = ::boost::detail::empty_base>            \
   1.689 -struct NAME##2 : B                                                            \
   1.690 -{                                                                             \
   1.691 -  friend T operator OP( T lhs, const U& rhs ) { return lhs OP##= rhs; }       \
   1.692 -};                                                                            \
   1.693 -                                                                              \
   1.694 -template <class T, class B = ::boost::detail::empty_base>                     \
   1.695 -struct NAME##1 : B                                                            \
   1.696 -{                                                                             \
   1.697 -  friend T operator OP( T lhs, const T& rhs ) { return lhs OP##= rhs; }       \
   1.698 -};
   1.699 -
   1.700 -#endif // defined(BOOST_HAS_NRVO) || defined(BOOST_FORCE_SYMMETRIC_OPERATORS)
   1.701 -
   1.702 -BOOST_BINARY_OPERATOR( left_shiftable, << )
   1.703 -BOOST_BINARY_OPERATOR( right_shiftable, >> )
   1.704 -
   1.705 -#undef BOOST_BINARY_OPERATOR
   1.706 -
   1.707 -template <class T, class U, class B = ::boost::detail::empty_base>
   1.708 -struct equivalent2 : B
   1.709 -{
   1.710 -  friend bool operator==(const T& x, const U& y)
   1.711 -  {
   1.712 -    return !(x < y) && !(x > y);
   1.713 -  }
   1.714 -};
   1.715 -
   1.716 -template <class T, class B = ::boost::detail::empty_base>
   1.717 -struct equivalent1 : B
   1.718 -{
   1.719 -  friend bool operator==(const T&x, const T&y)
   1.720 -  {
   1.721 -    return !(x < y) && !(y < x);
   1.722 -  }
   1.723 -};
   1.724 -
   1.725 -template <class T, class U, class B = ::boost::detail::empty_base>
   1.726 -struct partially_ordered2 : B
   1.727 -{
   1.728 -  friend bool operator<=(const T& x, const U& y)
   1.729 -    { return (x < y) || (x == y); }
   1.730 -  friend bool operator>=(const T& x, const U& y)
   1.731 -    { return (x > y) || (x == y); }
   1.732 -  friend bool operator>(const U& x, const T& y)
   1.733 -    { return y < x; }
   1.734 -  friend bool operator<(const U& x, const T& y)
   1.735 -    { return y > x; }
   1.736 -  friend bool operator<=(const U& x, const T& y)
   1.737 -    { return (y > x) || (y == x); }
   1.738 -  friend bool operator>=(const U& x, const T& y)
   1.739 -    { return (y < x) || (y == x); }
   1.740 -};
   1.741 -
   1.742 -template <class T, class B = ::boost::detail::empty_base>
   1.743 -struct partially_ordered1 : B
   1.744 -{
   1.745 -  friend bool operator>(const T& x, const T& y)
   1.746 -    { return y < x; }
   1.747 -  friend bool operator<=(const T& x, const T& y)
   1.748 -    { return (x < y) || (x == y); }
   1.749 -  friend bool operator>=(const T& x, const T& y)
   1.750 -    { return (y < x) || (x == y); }
   1.751 -};
   1.752 -
   1.753 -//  Combined operator classes (contributed by Daryle Walker) ----------------//
   1.754 -
   1.755 -template <class T, class U, class B = ::boost::detail::empty_base>
   1.756 -struct totally_ordered2
   1.757 -    : less_than_comparable2<T, U
   1.758 -    , equality_comparable2<T, U, B
   1.759 -      > > {};
   1.760 -
   1.761 -template <class T, class B = ::boost::detail::empty_base>
   1.762 -struct totally_ordered1
   1.763 -    : less_than_comparable1<T
   1.764 -    , equality_comparable1<T, B
   1.765 -      > > {};
   1.766 -
   1.767 -template <class T, class U, class B = ::boost::detail::empty_base>
   1.768 -struct additive2
   1.769 -    : addable2<T, U
   1.770 -    , subtractable2<T, U, B
   1.771 -      > > {};
   1.772 -
   1.773 -template <class T, class B = ::boost::detail::empty_base>
   1.774 -struct additive1
   1.775 -    : addable1<T
   1.776 -    , subtractable1<T, B
   1.777 -      > > {};
   1.778 -
   1.779 -template <class T, class U, class B = ::boost::detail::empty_base>
   1.780 -struct multiplicative2
   1.781 -    : multipliable2<T, U
   1.782 -    , dividable2<T, U, B
   1.783 -      > > {};
   1.784 -
   1.785 -template <class T, class B = ::boost::detail::empty_base>
   1.786 -struct multiplicative1
   1.787 -    : multipliable1<T
   1.788 -    , dividable1<T, B
   1.789 -      > > {};
   1.790 -
   1.791 -template <class T, class U, class B = ::boost::detail::empty_base>
   1.792 -struct integer_multiplicative2
   1.793 -    : multiplicative2<T, U
   1.794 -    , modable2<T, U, B
   1.795 -      > > {};
   1.796 -
   1.797 -template <class T, class B = ::boost::detail::empty_base>
   1.798 -struct integer_multiplicative1
   1.799 -    : multiplicative1<T
   1.800 -    , modable1<T, B
   1.801 -      > > {};
   1.802 -
   1.803 -template <class T, class U, class B = ::boost::detail::empty_base>
   1.804 -struct arithmetic2
   1.805 -    : additive2<T, U
   1.806 -    , multiplicative2<T, U, B
   1.807 -      > > {};
   1.808 -
   1.809 -template <class T, class B = ::boost::detail::empty_base>
   1.810 -struct arithmetic1
   1.811 -    : additive1<T
   1.812 -    , multiplicative1<T, B
   1.813 -      > > {};
   1.814 -
   1.815 -template <class T, class U, class B = ::boost::detail::empty_base>
   1.816 -struct integer_arithmetic2
   1.817 -    : additive2<T, U
   1.818 -    , integer_multiplicative2<T, U, B
   1.819 -      > > {};
   1.820 -
   1.821 -template <class T, class B = ::boost::detail::empty_base>
   1.822 -struct integer_arithmetic1
   1.823 -    : additive1<T
   1.824 -    , integer_multiplicative1<T, B
   1.825 -      > > {};
   1.826 -
   1.827 -template <class T, class U, class B = ::boost::detail::empty_base>
   1.828 -struct bitwise2
   1.829 -    : xorable2<T, U
   1.830 -    , andable2<T, U
   1.831 -    , orable2<T, U, B
   1.832 -      > > > {};
   1.833 -
   1.834 -template <class T, class B = ::boost::detail::empty_base>
   1.835 -struct bitwise1
   1.836 -    : xorable1<T
   1.837 -    , andable1<T
   1.838 -    , orable1<T, B
   1.839 -      > > > {};
   1.840 -
   1.841 -template <class T, class B = ::boost::detail::empty_base>
   1.842 -struct unit_steppable
   1.843 -    : incrementable<T
   1.844 -    , decrementable<T, B
   1.845 -      > > {};
   1.846 -
   1.847 -template <class T, class U, class B = ::boost::detail::empty_base>
   1.848 -struct shiftable2
   1.849 -    : left_shiftable2<T, U
   1.850 -    , right_shiftable2<T, U, B
   1.851 -      > > {};
   1.852 -
   1.853 -template <class T, class B = ::boost::detail::empty_base>
   1.854 -struct shiftable1
   1.855 -    : left_shiftable1<T
   1.856 -    , right_shiftable1<T, B
   1.857 -      > > {};
   1.858 -
   1.859 -template <class T, class U, class B = ::boost::detail::empty_base>
   1.860 -struct ring_operators2
   1.861 -    : additive2<T, U
   1.862 -    , subtractable2_left<T, U
   1.863 -    , multipliable2<T, U, B
   1.864 -      > > > {};
   1.865 -
   1.866 -template <class T, class B = ::boost::detail::empty_base>
   1.867 -struct ring_operators1
   1.868 -    : additive1<T
   1.869 -    , multipliable1<T, B
   1.870 -      > > {};
   1.871 -
   1.872 -template <class T, class U, class B = ::boost::detail::empty_base>
   1.873 -struct ordered_ring_operators2
   1.874 -    : ring_operators2<T, U
   1.875 -    , totally_ordered2<T, U, B
   1.876 -      > > {};
   1.877 -
   1.878 -template <class T, class B = ::boost::detail::empty_base>
   1.879 -struct ordered_ring_operators1
   1.880 -    : ring_operators1<T
   1.881 -    , totally_ordered1<T, B
   1.882 -      > > {};
   1.883 -
   1.884 -template <class T, class U, class B = ::boost::detail::empty_base>
   1.885 -struct field_operators2
   1.886 -    : ring_operators2<T, U
   1.887 -    , dividable2<T, U
   1.888 -    , dividable2_left<T, U, B
   1.889 -      > > > {};
   1.890 -
   1.891 -template <class T, class B = ::boost::detail::empty_base>
   1.892 -struct field_operators1
   1.893 -    : ring_operators1<T
   1.894 -    , dividable1<T, B
   1.895 -      > > {};
   1.896 -
   1.897 -template <class T, class U, class B = ::boost::detail::empty_base>
   1.898 -struct ordered_field_operators2
   1.899 -    : field_operators2<T, U
   1.900 -    , totally_ordered2<T, U, B
   1.901 -      > > {};
   1.902 -
   1.903 -template <class T, class B = ::boost::detail::empty_base>
   1.904 -struct ordered_field_operators1
   1.905 -    : field_operators1<T
   1.906 -    , totally_ordered1<T, B
   1.907 -      > > {};
   1.908 -
   1.909 -template <class T, class U, class B = ::boost::detail::empty_base>
   1.910 -struct euclidian_ring_operators2
   1.911 -    : ring_operators2<T, U
   1.912 -    , dividable2<T, U
   1.913 -    , dividable2_left<T, U
   1.914 -    , modable2<T, U
   1.915 -    , modable2_left<T, U, B
   1.916 -      > > > > > {};
   1.917 -
   1.918 -template <class T, class B = ::boost::detail::empty_base>
   1.919 -struct euclidian_ring_operators1
   1.920 -    : ring_operators1<T
   1.921 -    , dividable1<T
   1.922 -    , modable1<T, B
   1.923 -      > > > {};
   1.924 -
   1.925 -template <class T, class U, class B = ::boost::detail::empty_base>
   1.926 -struct ordered_euclidian_ring_operators2
   1.927 -    : totally_ordered2<T, U
   1.928 -    , euclidian_ring_operators2<T, U, B
   1.929 -      > > {};
   1.930 -
   1.931 -template <class T, class B = ::boost::detail::empty_base>
   1.932 -struct ordered_euclidian_ring_operators1
   1.933 -    : totally_ordered1<T
   1.934 -    , euclidian_ring_operators1<T, B
   1.935 -      > > {};
   1.936 -      
   1.937 -template <class T, class P, class B = ::boost::detail::empty_base>
   1.938 -struct input_iteratable
   1.939 -    : equality_comparable1<T
   1.940 -    , incrementable<T
   1.941 -    , dereferenceable<T, P, B
   1.942 -      > > > {};
   1.943 -
   1.944 -template <class T, class B = ::boost::detail::empty_base>
   1.945 -struct output_iteratable
   1.946 -    : incrementable<T, B
   1.947 -      > {};
   1.948 -
   1.949 -template <class T, class P, class B = ::boost::detail::empty_base>
   1.950 -struct forward_iteratable
   1.951 -    : input_iteratable<T, P, B
   1.952 -      > {};
   1.953 -
   1.954 -template <class T, class P, class B = ::boost::detail::empty_base>
   1.955 -struct bidirectional_iteratable
   1.956 -    : forward_iteratable<T, P
   1.957 -    , decrementable<T, B
   1.958 -      > > {};
   1.959 -
   1.960 -//  To avoid repeated derivation from equality_comparable,
   1.961 -//  which is an indirect base class of bidirectional_iterable,
   1.962 -//  random_access_iteratable must not be derived from totally_ordered1
   1.963 -//  but from less_than_comparable1 only. (Helmut Zeisel, 02-Dec-2001)
   1.964 -template <class T, class P, class D, class R, class B = ::boost::detail::empty_base>
   1.965 -struct random_access_iteratable
   1.966 -    : bidirectional_iteratable<T, P
   1.967 -    , less_than_comparable1<T
   1.968 -    , additive2<T, D
   1.969 -    , indexable<T, D, R, B
   1.970 -      > > > > {};
   1.971 -
   1.972 -#ifndef BOOST_NO_OPERATORS_IN_NAMESPACE
   1.973 -} // namespace boost
   1.974 -#endif // BOOST_NO_OPERATORS_IN_NAMESPACE
   1.975 -
   1.976 -
   1.977 -// BOOST_IMPORT_TEMPLATE1 .. BOOST_IMPORT_TEMPLATE4 -
   1.978 -//
   1.979 -// When BOOST_NO_OPERATORS_IN_NAMESPACE is defined we need a way to import an
   1.980 -// operator template into the boost namespace. BOOST_IMPORT_TEMPLATE1 is used
   1.981 -// for one-argument forms of operator templates; BOOST_IMPORT_TEMPLATE2 for
   1.982 -// two-argument forms. Note that these macros expect to be invoked from within
   1.983 -// boost.
   1.984 -
   1.985 -#ifndef BOOST_NO_OPERATORS_IN_NAMESPACE
   1.986 -
   1.987 -  // The template is already in boost so we have nothing to do.
   1.988 -# define BOOST_IMPORT_TEMPLATE4(template_name)
   1.989 -# define BOOST_IMPORT_TEMPLATE3(template_name)
   1.990 -# define BOOST_IMPORT_TEMPLATE2(template_name)
   1.991 -# define BOOST_IMPORT_TEMPLATE1(template_name)
   1.992 -
   1.993 -#else // BOOST_NO_OPERATORS_IN_NAMESPACE
   1.994 -
   1.995 -#  ifndef BOOST_NO_USING_TEMPLATE
   1.996 -
   1.997 -     // Bring the names in with a using-declaration
   1.998 -     // to avoid stressing the compiler.
   1.999 -#    define BOOST_IMPORT_TEMPLATE4(template_name) using ::template_name;
  1.1000 -#    define BOOST_IMPORT_TEMPLATE3(template_name) using ::template_name;
  1.1001 -#    define BOOST_IMPORT_TEMPLATE2(template_name) using ::template_name;
  1.1002 -#    define BOOST_IMPORT_TEMPLATE1(template_name) using ::template_name;
  1.1003 -
  1.1004 -#  else
  1.1005 -
  1.1006 -     // Otherwise, because a Borland C++ 5.5 bug prevents a using declaration
  1.1007 -     // from working, we are forced to use inheritance for that compiler.
  1.1008 -#    define BOOST_IMPORT_TEMPLATE4(template_name)                                          \
  1.1009 -     template <class T, class U, class V, class W, class B = ::boost::detail::empty_base>  \
  1.1010 -     struct template_name : ::template_name<T, U, V, W, B> {};
  1.1011 -
  1.1012 -#    define BOOST_IMPORT_TEMPLATE3(template_name)                                 \
  1.1013 -     template <class T, class U, class V, class B = ::boost::detail::empty_base>  \
  1.1014 -     struct template_name : ::template_name<T, U, V, B> {};
  1.1015 -
  1.1016 -#    define BOOST_IMPORT_TEMPLATE2(template_name)                              \
  1.1017 -     template <class T, class U, class B = ::boost::detail::empty_base>        \
  1.1018 -     struct template_name : ::template_name<T, U, B> {};
  1.1019 -
  1.1020 -#    define BOOST_IMPORT_TEMPLATE1(template_name)                              \
  1.1021 -     template <class T, class B = ::boost::detail::empty_base>                 \
  1.1022 -     struct template_name : ::template_name<T, B> {};
  1.1023 -
  1.1024 -#  endif // BOOST_NO_USING_TEMPLATE
  1.1025 -
  1.1026 -#endif // BOOST_NO_OPERATORS_IN_NAMESPACE
  1.1027 -
  1.1028 -//
  1.1029 -// Here's where we put it all together, defining the xxxx forms of the templates
  1.1030 -// in namespace boost. We also define specializations of is_chained_base<> for
  1.1031 -// the xxxx, xxxx1, and xxxx2 templates, importing them into boost:: as
  1.1032 -// necessary.
  1.1033 -//
  1.1034 -#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
  1.1035 -
  1.1036 -// is_chained_base<> - a traits class used to distinguish whether an operator
  1.1037 -// template argument is being used for base class chaining, or is specifying a
  1.1038 -// 2nd argument type.
  1.1039 -
  1.1040 -namespace boost {
  1.1041 -// A type parameter is used instead of a plain bool because Borland's compiler
  1.1042 -// didn't cope well with the more obvious non-type template parameter.
  1.1043 -namespace detail {
  1.1044 -  struct true_t {};
  1.1045 -  struct false_t {};
  1.1046 -} // namespace detail
  1.1047 -
  1.1048 -// Unspecialized version assumes that most types are not being used for base
  1.1049 -// class chaining. We specialize for the operator templates defined in this
  1.1050 -// library.
  1.1051 -template<class T> struct is_chained_base {
  1.1052 -  typedef ::boost::detail::false_t value;
  1.1053 -};
  1.1054 -
  1.1055 -} // namespace boost
  1.1056 -
  1.1057 -// Import a 4-type-argument operator template into boost (if necessary) and
  1.1058 -// provide a specialization of 'is_chained_base<>' for it.
  1.1059 -# define BOOST_OPERATOR_TEMPLATE4(template_name4)                     \
  1.1060 -  BOOST_IMPORT_TEMPLATE4(template_name4)                              \
  1.1061 -  template<class T, class U, class V, class W, class B>               \
  1.1062 -  struct is_chained_base< ::boost::template_name4<T, U, V, W, B> > {  \
  1.1063 -    typedef ::boost::detail::true_t value;                            \
  1.1064 -  };
  1.1065 -
  1.1066 -// Import a 3-type-argument operator template into boost (if necessary) and
  1.1067 -// provide a specialization of 'is_chained_base<>' for it.
  1.1068 -# define BOOST_OPERATOR_TEMPLATE3(template_name3)                     \
  1.1069 -  BOOST_IMPORT_TEMPLATE3(template_name3)                              \
  1.1070 -  template<class T, class U, class V, class B>                        \
  1.1071 -  struct is_chained_base< ::boost::template_name3<T, U, V, B> > {     \
  1.1072 -    typedef ::boost::detail::true_t value;                            \
  1.1073 -  };
  1.1074 -
  1.1075 -// Import a 2-type-argument operator template into boost (if necessary) and
  1.1076 -// provide a specialization of 'is_chained_base<>' for it.
  1.1077 -# define BOOST_OPERATOR_TEMPLATE2(template_name2)                  \
  1.1078 -  BOOST_IMPORT_TEMPLATE2(template_name2)                           \
  1.1079 -  template<class T, class U, class B>                              \
  1.1080 -  struct is_chained_base< ::boost::template_name2<T, U, B> > {     \
  1.1081 -    typedef ::boost::detail::true_t value;                         \
  1.1082 -  };
  1.1083 -
  1.1084 -// Import a 1-type-argument operator template into boost (if necessary) and
  1.1085 -// provide a specialization of 'is_chained_base<>' for it.
  1.1086 -# define BOOST_OPERATOR_TEMPLATE1(template_name1)                  \
  1.1087 -  BOOST_IMPORT_TEMPLATE1(template_name1)                           \
  1.1088 -  template<class T, class B>                                       \
  1.1089 -  struct is_chained_base< ::boost::template_name1<T, B> > {        \
  1.1090 -    typedef ::boost::detail::true_t value;                         \
  1.1091 -  };
  1.1092 -
  1.1093 -// BOOST_OPERATOR_TEMPLATE(template_name) defines template_name<> such that it
  1.1094 -// can be used for specifying both 1-argument and 2-argument forms. Requires the
  1.1095 -// existence of two previously defined class templates named '<template_name>1'
  1.1096 -// and '<template_name>2' which must implement the corresponding 1- and 2-
  1.1097 -// argument forms.
  1.1098 -//
  1.1099 -// The template type parameter O == is_chained_base<U>::value is used to
  1.1100 -// distinguish whether the 2nd argument to <template_name> is being used for
  1.1101 -// base class chaining from another boost operator template or is describing a
  1.1102 -// 2nd operand type. O == true_t only when U is actually an another operator
  1.1103 -// template from the library. Partial specialization is used to select an
  1.1104 -// implementation in terms of either '<template_name>1' or '<template_name>2'.
  1.1105 -//
  1.1106 -
  1.1107 -# define BOOST_OPERATOR_TEMPLATE(template_name)                    \
  1.1108 -template <class T                                                  \
  1.1109 -         ,class U = T                                              \
  1.1110 -         ,class B = ::boost::detail::empty_base                    \
  1.1111 -         ,class O = typename is_chained_base<U>::value             \
  1.1112 -         >                                                         \
  1.1113 -struct template_name : template_name##2<T, U, B> {};               \
  1.1114 -                                                                   \
  1.1115 -template<class T, class U, class B>                                \
  1.1116 -struct template_name<T, U, B, ::boost::detail::true_t>             \
  1.1117 -  : template_name##1<T, U> {};                                     \
  1.1118 -                                                                   \
  1.1119 -template <class T, class B>                                        \
  1.1120 -struct template_name<T, T, B, ::boost::detail::false_t>            \
  1.1121 -  : template_name##1<T, B> {};                                     \
  1.1122 -                                                                   \
  1.1123 -template<class T, class U, class B, class O>                       \
  1.1124 -struct is_chained_base< ::boost::template_name<T, U, B, O> > {     \
  1.1125 -  typedef ::boost::detail::true_t value;                           \
  1.1126 -};                                                                 \
  1.1127 -                                                                   \
  1.1128 -BOOST_OPERATOR_TEMPLATE2(template_name##2)                         \
  1.1129 -BOOST_OPERATOR_TEMPLATE1(template_name##1)
  1.1130 -
  1.1131 -
  1.1132 -#else // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
  1.1133 -
  1.1134 -#  define BOOST_OPERATOR_TEMPLATE4(template_name4) \
  1.1135 -        BOOST_IMPORT_TEMPLATE4(template_name4)
  1.1136 -#  define BOOST_OPERATOR_TEMPLATE3(template_name3) \
  1.1137 -        BOOST_IMPORT_TEMPLATE3(template_name3)
  1.1138 -#  define BOOST_OPERATOR_TEMPLATE2(template_name2) \
  1.1139 -        BOOST_IMPORT_TEMPLATE2(template_name2)
  1.1140 -#  define BOOST_OPERATOR_TEMPLATE1(template_name1) \
  1.1141 -        BOOST_IMPORT_TEMPLATE1(template_name1)
  1.1142 -
  1.1143 -   // In this case we can only assume that template_name<> is equivalent to the
  1.1144 -   // more commonly needed template_name1<> form.
  1.1145 -#  define BOOST_OPERATOR_TEMPLATE(template_name)                   \
  1.1146 -   template <class T, class B = ::boost::detail::empty_base>       \
  1.1147 -   struct template_name : template_name##1<T, B> {};
  1.1148 -
  1.1149 -#endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
  1.1150 -
  1.1151 -namespace boost {
  1.1152 -    
  1.1153 -BOOST_OPERATOR_TEMPLATE(less_than_comparable)
  1.1154 -BOOST_OPERATOR_TEMPLATE(equality_comparable)
  1.1155 -BOOST_OPERATOR_TEMPLATE(multipliable)
  1.1156 -BOOST_OPERATOR_TEMPLATE(addable)
  1.1157 -BOOST_OPERATOR_TEMPLATE(subtractable)
  1.1158 -BOOST_OPERATOR_TEMPLATE2(subtractable2_left)
  1.1159 -BOOST_OPERATOR_TEMPLATE(dividable)
  1.1160 -BOOST_OPERATOR_TEMPLATE2(dividable2_left)
  1.1161 -BOOST_OPERATOR_TEMPLATE(modable)
  1.1162 -BOOST_OPERATOR_TEMPLATE2(modable2_left)
  1.1163 -BOOST_OPERATOR_TEMPLATE(xorable)
  1.1164 -BOOST_OPERATOR_TEMPLATE(andable)
  1.1165 -BOOST_OPERATOR_TEMPLATE(orable)
  1.1166 -
  1.1167 -BOOST_OPERATOR_TEMPLATE1(incrementable)
  1.1168 -BOOST_OPERATOR_TEMPLATE1(decrementable)
  1.1169 -
  1.1170 -BOOST_OPERATOR_TEMPLATE2(dereferenceable)
  1.1171 -BOOST_OPERATOR_TEMPLATE3(indexable)
  1.1172 -
  1.1173 -BOOST_OPERATOR_TEMPLATE(left_shiftable)
  1.1174 -BOOST_OPERATOR_TEMPLATE(right_shiftable)
  1.1175 -BOOST_OPERATOR_TEMPLATE(equivalent)
  1.1176 -BOOST_OPERATOR_TEMPLATE(partially_ordered)
  1.1177 -
  1.1178 -BOOST_OPERATOR_TEMPLATE(totally_ordered)
  1.1179 -BOOST_OPERATOR_TEMPLATE(additive)
  1.1180 -BOOST_OPERATOR_TEMPLATE(multiplicative)
  1.1181 -BOOST_OPERATOR_TEMPLATE(integer_multiplicative)
  1.1182 -BOOST_OPERATOR_TEMPLATE(arithmetic)
  1.1183 -BOOST_OPERATOR_TEMPLATE(integer_arithmetic)
  1.1184 -BOOST_OPERATOR_TEMPLATE(bitwise)
  1.1185 -BOOST_OPERATOR_TEMPLATE1(unit_steppable)
  1.1186 -BOOST_OPERATOR_TEMPLATE(shiftable)
  1.1187 -BOOST_OPERATOR_TEMPLATE(ring_operators)
  1.1188 -BOOST_OPERATOR_TEMPLATE(ordered_ring_operators)
  1.1189 -BOOST_OPERATOR_TEMPLATE(field_operators)
  1.1190 -BOOST_OPERATOR_TEMPLATE(ordered_field_operators)
  1.1191 -BOOST_OPERATOR_TEMPLATE(euclidian_ring_operators)
  1.1192 -BOOST_OPERATOR_TEMPLATE(ordered_euclidian_ring_operators)
  1.1193 -BOOST_OPERATOR_TEMPLATE2(input_iteratable)
  1.1194 -BOOST_OPERATOR_TEMPLATE1(output_iteratable)
  1.1195 -BOOST_OPERATOR_TEMPLATE2(forward_iteratable)
  1.1196 -BOOST_OPERATOR_TEMPLATE2(bidirectional_iteratable)
  1.1197 -BOOST_OPERATOR_TEMPLATE4(random_access_iteratable)
  1.1198 -
  1.1199 -#undef BOOST_OPERATOR_TEMPLATE
  1.1200 -#undef BOOST_OPERATOR_TEMPLATE4
  1.1201 -#undef BOOST_OPERATOR_TEMPLATE3
  1.1202 -#undef BOOST_OPERATOR_TEMPLATE2
  1.1203 -#undef BOOST_OPERATOR_TEMPLATE1
  1.1204 -#undef BOOST_IMPORT_TEMPLATE1
  1.1205 -#undef BOOST_IMPORT_TEMPLATE2
  1.1206 -#undef BOOST_IMPORT_TEMPLATE3
  1.1207 -#undef BOOST_IMPORT_TEMPLATE4
  1.1208 -
  1.1209 -// The following 'operators' classes can only be used portably if the derived class
  1.1210 -// declares ALL of the required member operators.
  1.1211 -template <class T, class U>
  1.1212 -struct operators2
  1.1213 -    : totally_ordered2<T,U
  1.1214 -    , integer_arithmetic2<T,U
  1.1215 -    , bitwise2<T,U
  1.1216 -      > > > {};
  1.1217 -
  1.1218 -#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
  1.1219 -template <class T, class U = T>
  1.1220 -struct operators : operators2<T, U> {};
  1.1221 -
  1.1222 -template <class T> struct operators<T, T>
  1.1223 -#else
  1.1224 -template <class T> struct operators
  1.1225 -#endif
  1.1226 -    : totally_ordered<T
  1.1227 -    , integer_arithmetic<T
  1.1228 -    , bitwise<T
  1.1229 -    , unit_steppable<T
  1.1230 -      > > > > {};
  1.1231 -
  1.1232 -//  Iterator helper classes (contributed by Jeremy Siek) -------------------//
  1.1233 -//  (Input and output iterator helpers contributed by Daryle Walker) -------//
  1.1234 -//  (Changed to use combined operator classes by Daryle Walker) ------------//
  1.1235 -template <class T,
  1.1236 -          class V,
  1.1237 -          class D = std::ptrdiff_t,
  1.1238 -          class P = V const *,
  1.1239 -          class R = V const &>
  1.1240 -struct input_iterator_helper
  1.1241 -  : input_iteratable<T, P
  1.1242 -  , boost::iterator<std::input_iterator_tag, V, D, P, R
  1.1243 -    > > {};
  1.1244 -
  1.1245 -template<class T>
  1.1246 -struct output_iterator_helper
  1.1247 -  : output_iteratable<T
  1.1248 -  , boost::iterator<std::output_iterator_tag, void, void, void, void
  1.1249 -  > >
  1.1250 -{
  1.1251 -  T& operator*()  { return static_cast<T&>(*this); }
  1.1252 -  T& operator++() { return static_cast<T&>(*this); }
  1.1253 -};
  1.1254 -
  1.1255 -template <class T,
  1.1256 -          class V,
  1.1257 -          class D = std::ptrdiff_t,
  1.1258 -          class P = V*,
  1.1259 -          class R = V&>
  1.1260 -struct forward_iterator_helper
  1.1261 -  : forward_iteratable<T, P
  1.1262 -  , boost::iterator<std::forward_iterator_tag, V, D, P, R
  1.1263 -    > > {};
  1.1264 -
  1.1265 -template <class T,
  1.1266 -          class V,
  1.1267 -          class D = std::ptrdiff_t,
  1.1268 -          class P = V*,
  1.1269 -          class R = V&>
  1.1270 -struct bidirectional_iterator_helper
  1.1271 -  : bidirectional_iteratable<T, P
  1.1272 -  , boost::iterator<std::bidirectional_iterator_tag, V, D, P, R
  1.1273 -    > > {};
  1.1274 -
  1.1275 -template <class T,
  1.1276 -          class V, 
  1.1277 -          class D = std::ptrdiff_t,
  1.1278 -          class P = V*,
  1.1279 -          class R = V&>
  1.1280 -struct random_access_iterator_helper
  1.1281 -  : random_access_iteratable<T, P, D, R
  1.1282 -  , boost::iterator<std::random_access_iterator_tag, V, D, P, R
  1.1283 -    > >
  1.1284 -{
  1.1285 -  friend D requires_difference_operator(const T& x, const T& y) {
  1.1286 -    return x - y;
  1.1287 -  }
  1.1288 -}; // random_access_iterator_helper
  1.1289 -
  1.1290 -} // namespace boost
  1.1291 -
  1.1292 -#if defined(__sgi) && !defined(__GNUC__)
  1.1293 -#pragma reset woff 1234
  1.1294 -#endif
  1.1295 -
  1.1296 -#endif // BOOST_OPERATORS_HPP