fix doc example typo
[boost.git] / boost / lambda / numeric.hpp
blob40a95c74bb0fe9d3feeea297d2ea41c5a6be40b5
1 // -- numeric.hpp -- Boost Lambda Library -----------------------------------
2 // Copyright (C) 2002 Jaakko Jarvi (jaakko.jarvi@cs.utu.fi)
3 // Copyright (C) 2002 Gary Powell (gwpowell@hotmail.com)
4 //
5 // Distributed under the Boost Software License, Version 1.0. (See
6 // accompanying file LICENSE_1_0.txt or copy at
7 // http://www.boost.org/LICENSE_1_0.txt)
8 //
9 // For more information, see http://www.boost.org
11 #ifndef BOOST_LAMBDA_NUMERIC_HPP
12 #define BOOST_LAMBDA_NUMERIC_HPP
14 #include "boost/lambda/core.hpp"
16 #include <numeric>
18 namespace boost {
19 namespace lambda {
21 namespace ll {
23 // accumulate ---------------------------------
25 struct accumulate {
27 template <class Args>
28 struct sig {
29 typedef typename boost::remove_const<
30 typename boost::tuples::element<3, Args>::type
31 >::type type;
34 template <class A, class B, class C>
36 operator()(A a, B b, C c) const
37 { return ::std::accumulate(a, b, c); }
39 template <class A, class B, class C, class D>
41 operator()(A a, B b, C c, D d) const
42 { return ::std::accumulate(a, b, c, d); }
45 // inner_product ---------------------------------
47 struct inner_product {
49 template <class Args>
50 struct sig {
51 typedef typename boost::remove_const<
52 typename boost::tuples::element<4, Args>::type
53 >::type type;
56 template <class A, class B, class C, class D>
58 operator()(A a, B b, C c, D d) const
59 { return ::std::inner_product(a, b, c, d); }
61 template <class A, class B, class C, class D, class E, class F>
63 operator()(A a, B b, C c, D d, E e, F f) const
64 { return ::std::inner_product(a, b, c, d, e, f); }
68 // partial_sum ---------------------------------
70 struct partial_sum {
72 template <class Args>
73 struct sig {
74 typedef typename boost::remove_const<
75 typename boost::tuples::element<3, Args>::type
76 >::type type;
79 template <class A, class B, class C>
81 operator()(A a, B b, C c) const
82 { return ::std::partial_sum(a, b, c); }
84 template <class A, class B, class C, class D>
86 operator()(A a, B b, C c, D d) const
87 { return ::std::partial_sum(a, b, c, d); }
90 // adjacent_difference ---------------------------------
92 struct adjacent_difference {
94 template <class Args>
95 struct sig {
96 typedef typename boost::remove_const<
97 typename boost::tuples::element<3, Args>::type
98 >::type type;
101 template <class A, class B, class C>
103 operator()(A a, B b, C c) const
104 { return ::std::adjacent_difference(a, b, c); }
106 template <class A, class B, class C, class D>
108 operator()(A a, B b, C c, D d) const
109 { return ::std::adjacent_difference(a, b, c, d); }
112 } // end of ll namespace
114 } // end of lambda namespace
115 } // end of boost namespace
119 #endif