Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:09:51

0001 /// \file
0002 // Range v3 library
0003 //
0004 //  Copyright Eric Niebler 2013-present
0005 //
0006 //  Use, modification and distribution is subject to the
0007 //  Boost Software License, Version 1.0. (See accompanying
0008 //  file LICENSE_1_0.txt or copy at
0009 //  http://www.boost.org/LICENSE_1_0.txt)
0010 //
0011 // Project home: https://github.com/ericniebler/range-v3
0012 //
0013 #ifndef RANGES_V3_NUMERIC_IOTA_HPP
0014 #define RANGES_V3_NUMERIC_IOTA_HPP
0015 
0016 #include <range/v3/iterator/concepts.hpp>
0017 #include <range/v3/range/access.hpp>
0018 #include <range/v3/range/concepts.hpp>
0019 #include <range/v3/range/dangling.hpp>
0020 #include <range/v3/range/traits.hpp>
0021 #include <range/v3/utility/static_const.hpp>
0022 
0023 #include <range/v3/detail/prologue.hpp>
0024 
0025 namespace ranges
0026 {
0027     /// \addtogroup group-numerics
0028     /// @{
0029     struct iota_fn
0030     {
0031         template(typename O, typename S, typename T)(
0032             requires output_iterator<O, T const &> AND sentinel_for<S, O> AND
0033                 weakly_incrementable<T>)
0034         O operator()(O first, S last, T val) const
0035         {
0036             for(; first != last; ++first, ++val)
0037                 *first = detail::as_const(val);
0038             return first;
0039         }
0040 
0041         template(typename Rng, typename T)(
0042             requires output_range<Rng, T const &> AND weakly_incrementable<T>)
0043         borrowed_iterator_t<Rng> operator()(Rng && rng, T val) const //
0044         {
0045             return (*this)(begin(rng), end(rng), detail::move(val));
0046         }
0047     };
0048 
0049     RANGES_INLINE_VARIABLE(iota_fn, iota)
0050     /// @}
0051 } // namespace ranges
0052 
0053 #include <range/v3/detail/epilogue.hpp>
0054 
0055 #endif