//===----------------------------------------------------------------------===// // // 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 // concept output_range; #include #include #include "test_iterators.h" #include "test_range.h" struct T { }; // Satisfied when it's a range and has the right iterator struct GoodRange { cpp17_output_iterator begin(); sentinel end(); }; static_assert(std::ranges::range); static_assert(std::output_iterator, T>); static_assert(std::ranges::output_range); // Not satisfied when it's not a range struct NotRange { cpp17_output_iterator begin(); }; static_assert(!std::ranges::range); static_assert( std::output_iterator, T>); static_assert(!std::ranges::output_range); // Not satisfied when the iterator is not an output_iterator struct RangeWithBadIterator { cpp17_input_iterator begin(); sentinel end(); }; static_assert( std::ranges::range); static_assert(!std::output_iterator, T>); static_assert(!std::ranges::output_range); // Test ADL-proofing. struct Incomplete; template struct Holder { T t; }; static_assert(!std::ranges::output_range*, Holder*>); static_assert(!std::ranges::output_range*&, Holder*>); static_assert(!std::ranges::output_range*&&, Holder*>); static_assert(!std::ranges::output_range* const, Holder*>); static_assert(!std::ranges::output_range* const&, Holder*>); static_assert(!std::ranges::output_range* const&&, Holder*>); static_assert( std::ranges::output_range*[10], Holder*>); static_assert( std::ranges::output_range*(&)[10], Holder*>); static_assert( std::ranges::output_range*(&&)[10], Holder*>); static_assert(!std::ranges::output_range* const[10], Holder*>); static_assert(!std::ranges::output_range* const(&)[10], Holder*>); static_assert(!std::ranges::output_range* const(&&)[10], Holder*>);