//********************************************************
// The following code example is taken from the book
//  C++23 - The Complete Guide
//  by Nicolai M. Josuttis (www.josuttis.com)
//  https://www.cppstd23.com
//
// The code is licensed under a
//  Creative Commons Attribution 4.0 International License
//  https://creativecommons.org/licenses/by/4.0/
//********************************************************


#include <print>
#include <array>
#include <numeric>

int main()
{
  std::array<int, 10> arr{};

  // assign values from 1 ascending:
  auto res = std::ranges::iota(arr, 1);
  std::println("arr: {}", arr);

  // assign values from 10 ascending:
  auto [end, val] = std::ranges::iota(arr, 10);
  std::println("arr: {}", arr);
  std::println("returns: end() ({})  and  {}", arr.end() == end, val);
}

