//********************************************************
// 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 <vector>
#include <ranges>
#include <algorithm>
#include <functional>

int main()
{
  std::vector<int> coll{6, 8, 44, 9, 8, 2, 7};

  // check whether the range contains a sub-sequence of three elements that are greater than 10:
  std::println("{} has subset of three >10: {}", 
               coll,  
               std::ranges::contains_subrange(coll, std::views::repeat(10, 3), 
                                              std::ranges::greater{}));

  // check whether the range contains a sub-sequence of three elements that are greater than 7:
  std::println("{} has subset of three >7:  {}",
               coll,  
               std::ranges::contains_subrange(coll, std::views::repeat(7, 3), 
                                              std::ranges::greater{}));
}

