os/ossrv/ossrv_pub/boost_apis/boost/lambda/numeric.hpp
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/ossrv/ossrv_pub/boost_apis/boost/lambda/numeric.hpp	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,119 @@
     1.4 +// -- numeric.hpp -- Boost Lambda Library -----------------------------------
     1.5 +// Copyright (C) 2002 Jaakko Järvi (jaakko.jarvi@cs.utu.fi)
     1.6 +// Copyright (C) 2002 Gary Powell (gwpowell@hotmail.com)
     1.7 +//
     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 +//
    1.12 +// For more information, see http://www.boost.org
    1.13 +
    1.14 +#ifndef BOOST_LAMBDA_NUMERIC_HPP
    1.15 +#define BOOST_LAMBDA_NUMERIC_HPP
    1.16 +
    1.17 +#include "boost/lambda/core.hpp"
    1.18 +
    1.19 +#include <numeric>
    1.20 +
    1.21 +namespace boost {
    1.22 +  namespace lambda {
    1.23 +
    1.24 +namespace ll {
    1.25 +
    1.26 +// accumulate ---------------------------------
    1.27 +
    1.28 +struct accumulate {
    1.29 +  
    1.30 +  template <class Args>
    1.31 +  struct sig { 
    1.32 +    typedef typename boost::remove_const<
    1.33 +        typename boost::tuples::element<3, Args>::type 
    1.34 +     >::type type; 
    1.35 +  };
    1.36 +
    1.37 +  template <class A, class B, class C>
    1.38 +  C
    1.39 +  operator()(A a, B b, C c) const
    1.40 +  { return ::std::accumulate(a, b, c); }
    1.41 +
    1.42 +  template <class A, class B, class C, class D>
    1.43 +  C
    1.44 +  operator()(A a, B b, C c, D d) const
    1.45 +  { return ::std::accumulate(a, b, c, d); }
    1.46 +};
    1.47 +
    1.48 +// inner_product ---------------------------------
    1.49 +
    1.50 +struct inner_product {
    1.51 +  
    1.52 +  template <class Args>
    1.53 +  struct sig { 
    1.54 +    typedef typename boost::remove_const<
    1.55 +        typename boost::tuples::element<4, Args>::type 
    1.56 +     >::type type; 
    1.57 +  };
    1.58 +
    1.59 +  template <class A, class B, class C, class D>
    1.60 +  D
    1.61 +  operator()(A a, B b, C c, D d) const
    1.62 +  { return ::std::inner_product(a, b, c, d); }
    1.63 +
    1.64 +  template <class A, class B, class C, class D, class E, class F>
    1.65 +  D
    1.66 +  operator()(A a, B b, C c, D d, E e, F f) const
    1.67 +  { return ::std::inner_product(a, b, c, d, e, f); }
    1.68 +};
    1.69 +
    1.70 +
    1.71 +// partial_sum ---------------------------------
    1.72 +
    1.73 +struct partial_sum {
    1.74 +  
    1.75 +  template <class Args>
    1.76 +  struct sig { 
    1.77 +    typedef typename boost::remove_const<
    1.78 +        typename boost::tuples::element<3, Args>::type 
    1.79 +     >::type type; 
    1.80 +  };
    1.81 +
    1.82 +  template <class A, class B, class C>
    1.83 +  C
    1.84 +  operator()(A a, B b, C c) const
    1.85 +  { return ::std::partial_sum(a, b, c); }
    1.86 +
    1.87 +  template <class A, class B, class C, class D>
    1.88 +  C
    1.89 +  operator()(A a, B b, C c, D d) const
    1.90 +  { return ::std::partial_sum(a, b, c, d); }
    1.91 +};
    1.92 +
    1.93 +// adjacent_difference ---------------------------------
    1.94 +
    1.95 +struct adjacent_difference {
    1.96 +  
    1.97 +  template <class Args>
    1.98 +  struct sig { 
    1.99 +    typedef typename boost::remove_const<
   1.100 +        typename boost::tuples::element<3, Args>::type 
   1.101 +     >::type type; 
   1.102 +  };
   1.103 +
   1.104 +  template <class A, class B, class C>
   1.105 +  C
   1.106 +  operator()(A a, B b, C c) const
   1.107 +  { return ::std::adjacent_difference(a, b, c); }
   1.108 +
   1.109 +  template <class A, class B, class C, class D>
   1.110 +  C
   1.111 +  operator()(A a, B b, C c, D d) const
   1.112 +  { return ::std::adjacent_difference(a, b, c, d); }
   1.113 +};
   1.114 +
   1.115 +} // end of ll namespace
   1.116 +
   1.117 +} // end of lambda namespace
   1.118 +} // end of boost namespace
   1.119 +
   1.120 +
   1.121 +
   1.122 +#endif