Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-12-16 10:27:53

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_ALGORITHM_FILL_HPP
0014 #define RANGES_V3_ALGORITHM_FILL_HPP
0015 
0016 #include <range/v3/range_fwd.hpp>
0017 
0018 #include <range/v3/iterator/concepts.hpp>
0019 #include <range/v3/range/access.hpp>
0020 #include <range/v3/range/concepts.hpp>
0021 #include <range/v3/range/dangling.hpp>
0022 #include <range/v3/range/traits.hpp>
0023 #include <range/v3/utility/static_const.hpp>
0024 
0025 #include <range/v3/detail/prologue.hpp>
0026 
0027 namespace ranges
0028 {
0029     /// \addtogroup group-algorithms
0030     /// @{
0031     RANGES_FUNC_BEGIN(fill)
0032 
0033         /// \brief function template \c fill
0034         template(typename O, typename S, typename V)(
0035             requires output_iterator<O, V const &> AND sentinel_for<S, O>)
0036         constexpr O RANGES_FUNC(fill)(O first, S last, V const & val) //
0037         {
0038             for(; first != last; ++first)
0039                 *first = val;
0040             return first;
0041         }
0042 
0043         /// \overload
0044         template(typename Rng, typename V)(
0045             requires output_range<Rng, V const &>)
0046         constexpr borrowed_iterator_t<Rng> RANGES_FUNC(fill)(Rng && rng, V const & val)
0047         {
0048             return (*this)(begin(rng), end(rng), val);
0049         }
0050 
0051     RANGES_FUNC_END(fill)
0052 
0053     namespace cpp20
0054     {
0055         using ranges::fill;
0056     }
0057     /// @}
0058 } // namespace ranges
0059 
0060 #include <range/v3/detail/epilogue.hpp>
0061 
0062 #endif