]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/boost/accumulators/statistics/times2_iterator.hpp
update sources to v12.2.3
[ceph.git] / ceph / src / boost / boost / accumulators / statistics / times2_iterator.hpp
1 ///////////////////////////////////////////////////////////////////////////////
2 // times2_iterator.hpp
3 //
4 // Copyright 2006 Eric Niebler. Distributed under the Boost
5 // Software License, Version 1.0. (See accompanying file
6 // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
7
8 #ifndef BOOST_ACCUMULATORS_STATISTICS_TIMES2_ITERATOR_HPP_DE_01_01_2006
9 #define BOOST_ACCUMULATORS_STATISTICS_TIMES2_ITERATOR_HPP_DE_01_01_2006
10
11 #include <functional>
12 #include <boost/detail/workaround.hpp>
13 #include <boost/range/begin.hpp>
14 #include <boost/range/end.hpp>
15 #include <boost/range/iterator_range.hpp>
16 #include <boost/iterator/transform_iterator.hpp>
17 #include <boost/iterator/counting_iterator.hpp>
18 #include <boost/iterator/permutation_iterator.hpp>
19
20 namespace boost { namespace accumulators
21 {
22
23 namespace detail
24 {
25 typedef transform_iterator<
26 #ifdef BOOST_NO_CXX98_BINDERS
27 decltype(std::bind(std::multiplies<std::size_t>(), 2, std::placeholders::_1))
28 #else
29 std::binder1st<std::multiplies<std::size_t> >
30 #endif
31 , counting_iterator<std::size_t>
32 > times2_iterator;
33
34 inline times2_iterator make_times2_iterator(std::size_t i)
35 {
36 return make_transform_iterator(
37 make_counting_iterator(i)
38 #ifdef BOOST_NO_CXX98_BINDERS
39 , std::bind(std::multiplies<std::size_t>(), 2, std::placeholders::_1)
40 #else
41 , std::bind1st(std::multiplies<std::size_t>(), 2)
42 #endif
43 );
44 }
45
46 ///////////////////////////////////////////////////////////////////////////////
47 // lvalue_index_iterator
48 template<typename Base>
49 struct lvalue_index_iterator
50 : Base
51 {
52 lvalue_index_iterator()
53 : Base()
54 {}
55
56 lvalue_index_iterator(Base base)
57 : Base(base)
58 {
59 }
60
61 typename Base::reference operator [](typename Base::difference_type n) const
62 {
63 return *(*this + n);
64 }
65 };
66 } // namespace detail
67
68 }}
69
70 #endif