//===----------------------------------------------------------------------===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// // UNSUPPORTED: c++03, c++11, c++14, c++17 // template // requires sized_sentinel_for, iterator_t>> // friend constexpr range_difference_t> // operator-(const iterator& x, const sentinel& y); // // template // requires sized_sentinel_for, iterator_t>> // friend constexpr range_difference_t> // operator-(const sentinel& x, const iterator& y); #include #include #include #include #include #include #include "../types.h" template struct Iter { std::tuple* it_; using value_type = std::tuple; using difference_type = std::ptrdiff_t; using iterator_concept = std::input_iterator_tag; constexpr decltype(auto) operator*() const { return *it_; } constexpr Iter& operator++() { ++it_; return *this; } constexpr void operator++(int) { ++it_; } }; template struct Sent { std::tuple* end_; constexpr bool operator==(const Iter& i) const { return i.it_ == end_; } }; template struct SizedSent { std::tuple* end_; constexpr bool operator==(const Iter& i) const { return i.it_ == end_; } friend constexpr auto operator-(const SizedSent& st, const Iter& it) { return st.end_ - it.it_; } friend constexpr auto operator-(const Iter& it, const SizedSent& st) { return it.it_ - st.end_; } }; template struct CrossSizedSent { std::tuple* end_; template constexpr bool operator==(const Iter& i) const { return i.it_ == end_; } template friend constexpr auto operator-(const CrossSizedSent& st, const Iter& it) { return st.end_ - it.it_; } template friend constexpr auto operator-(const Iter& it, const CrossSizedSent& st) { return it.it_ - st.end_; } }; template