repeat.cpp 857 B

123456789101112131415161718192021222324252627282930
  1. // Range v3 library
  2. //
  3. // Copyright Eric Niebler 2014-present
  4. //
  5. // Use, modification and distribution is subject to the
  6. // Boost Software License, Version 1.0. (See accompanying
  7. // file LICENSE_1_0.txt or copy at
  8. // http://www.boost.org/LICENSE_1_0.txt)
  9. //
  10. // Project home: https://github.com/ericniebler/range-v3
  11. #include <vector>
  12. #include <range/v3/core.hpp>
  13. #include <range/v3/view/take.hpp>
  14. #include <range/v3/view/repeat.hpp>
  15. #include <range/v3/utility/copy.hpp>
  16. #include "../simple_test.hpp"
  17. #include "../test_utils.hpp"
  18. int main()
  19. {
  20. using namespace ranges;
  21. auto rng = views::repeat(9) | views::take(10);
  22. CPP_assert(view_<decltype(rng)>);
  23. CPP_assert(sized_range<decltype(rng)>);
  24. CPP_assert(random_access_iterator<decltype(rng.begin())>);
  25. ::check_equal(rng, {9, 9, 9, 9, 9, 9, 9, 9, 9, 9});
  26. return test_result();
  27. }