/////////////////////////////////////////////////////////////////////////////// // times2_iterator.hpp // // Copyright 2006 Eric Niebler. Distributed under the Boost // Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) #ifndef BOOST_ACCUMULATORS_STATISTICS_TIMES2_ITERATOR_HPP_DE_01_01_2006 #define BOOST_ACCUMULATORS_STATISTICS_TIMES2_ITERATOR_HPP_DE_01_01_2006 #include #include #include #include #include #include #include #include namespace boost { namespace accumulators { namespace detail { typedef transform_iterator< std::binder1st > , counting_iterator > times2_iterator; inline times2_iterator make_times2_iterator(std::size_t i) { return make_transform_iterator( make_counting_iterator(i) , std::bind1st(std::multiplies(), 2) ); } /////////////////////////////////////////////////////////////////////////////// // lvalue_index_iterator template struct lvalue_index_iterator : Base { lvalue_index_iterator() : Base() {} lvalue_index_iterator(Base base) : Base(base) { } typename Base::reference operator [](typename Base::difference_type n) const { return *(*this + n); } }; } // namespace detail }} #endif