選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

57 行
1.4KB

  1. /// \file
  2. // Range v3 library
  3. //
  4. // Copyright Eric Niebler 2013-present
  5. //
  6. // Use, modification and distribution is subject to the
  7. // Boost Software License, Version 1.0. (See accompanying
  8. // file LICENSE_1_0.txt or copy at
  9. // http://www.boost.org/LICENSE_1_0.txt)
  10. //
  11. // Project home: https://github.com/ericniebler/range-v3
  12. //
  13. #ifndef RANGES_V3_ALGORITHM_FILL_N_HPP
  14. #define RANGES_V3_ALGORITHM_FILL_N_HPP
  15. #include <utility>
  16. #include <range/v3/range_fwd.hpp>
  17. #include <range/v3/iterator/concepts.hpp>
  18. #include <range/v3/iterator/operations.hpp>
  19. #include <range/v3/range/access.hpp>
  20. #include <range/v3/range/concepts.hpp>
  21. #include <range/v3/range/traits.hpp>
  22. #include <range/v3/utility/static_const.hpp>
  23. namespace ranges
  24. {
  25. /// \addtogroup group-algorithms
  26. /// @{
  27. RANGES_BEGIN_NIEBLOID(fill_n)
  28. /// \brief function template \c equal
  29. template<typename O, typename V>
  30. auto RANGES_FUN_NIEBLOID(fill_n)(O first, iter_difference_t<O> n, V const & val)
  31. ->CPP_ret(O)( //
  32. requires output_iterator<O, V const &>)
  33. {
  34. RANGES_EXPECT(n >= 0);
  35. auto norig = n;
  36. auto b = uncounted(first);
  37. for(; n != 0; ++b, --n)
  38. *b = val;
  39. return recounted(first, b, norig);
  40. }
  41. RANGES_END_NIEBLOID(fill_n)
  42. namespace cpp20
  43. {
  44. using ranges::fill_n;
  45. }
  46. /// @}
  47. } // namespace ranges
  48. #endif // include guard