gcc/libstdc++-v3/testsuite/util
Jonathan Wakely b5b2e3879d libstdc++: Implement ranges::safe_range for C++20 (P1870R1)
This change replaces the __forwarding_range implementation detail with
the ranges::safe_range concept and adds the ranges::enable_safe_range
variable template for opt-in in to the concept.

It also adjusts the begin/end/rbegin/rend customization point objects to
match the new rules for accessing rvalue ranges only when safe to do so.

	* include/bits/range_access.h (ranges::enable_safe_range): Define.
	(ranges::begin, ranges::end, ranges::rbegin, ranges::rend): Constrain
	to only accept types satisfying safe_range and treat argument as an
	lvalue when calling a member of performing ADL.
	(ranges::__detail::__range_impl, ranges::__detail::__forwarding_range):
	Remove.
	(ranges::range): Adjust definition.
	(ranges::safe_range): Define.
	(ranges::iterator_t, ranges::range_difference_t): Reorder definitions
	to match the synopsis in the working draft.
	(ranges::disable_sized_range): Remove duplicate definition.
	* include/experimental/string_view (ranges::enable_safe_range): Add
	partial specialization for std::experimental::basic_string_view.
	* include/std/ranges (ranges::viewable_range, ranges::subrange)
	(ranges::empty_view, ranges::iota_view): Use safe_range. Specialize
	enable_safe_range.
	(ranges::safe_iterator_t, ranges::safe_subrange_t): Define.
	* include/std/span (ranges::enable_safe_range): Add partial
	specialization for std::span.
	* include/std/string_view (ranges::enable_safe_range): Likewise for
	std::basic_string_view.
	* testsuite/std/ranges/access/begin.cc: Adjust expected results.
	* testsuite/std/ranges/access/cbegin.cc: Likewise.
	* testsuite/std/ranges/access/cdata.cc: Likewise.
	* testsuite/std/ranges/access/cend.cc: Likewise.
	* testsuite/std/ranges/access/crbegin.cc: Likewise.
	* testsuite/std/ranges/access/crend.cc: Likewise.
	* testsuite/std/ranges/access/data.cc: Likewise.
	* testsuite/std/ranges/access/end.cc: Likewise.
	* testsuite/std/ranges/access/rbegin.cc: Likewise.
	* testsuite/std/ranges/access/rend.cc: Likewise.
	* testsuite/std/ranges/empty_view.cc: Test ranges::begin and
	ranges::end instead of unqualified calls to begin and end.
	* testsuite/std/ranges/safe_range.cc: New test.
	* testsuite/std/ranges/safe_range_types.cc: New test.
	* testsuite/util/testsuite_iterators.h: Add comment about safe_range.

From-SVN: r279135
2019-12-09 17:35:24 +00:00
..
common_type
debug
exception
hash_fn
io
native_type
performance
pstl Synchronize libstdc++ PSTL with upstream LLVM PSTL 2019-06-07 22:01:16 +00:00
regression
statistic
thread PR libstdc++/81266 fix std:🧵:native_handle_type test 2019-05-10 22:41:23 +01:00
replacement_memory_operators.h Remove redundant std::allocator members for C++20 2019-10-22 22:48:39 +01:00
slow_clock.h libstdc++: Fix copyright date on new test header 2019-12-03 09:51:49 +00:00
specfun_testcase.h
testsuite_abi_check.cc
testsuite_abi.cc PR libstdc++/91067 add more missing exports for directory iterators 2019-08-29 13:16:27 +01:00
testsuite_abi.h Restore use of tr1::unordered_map in testsuite 2019-10-22 22:48:57 +01:00
testsuite_allocator.cc
testsuite_allocator.h Remove redundant std::allocator members for C++20 2019-10-22 22:48:39 +01:00
testsuite_api.h Avoid -Wunused-parameter warnings from testsuite utility 2019-05-29 15:45:50 +01:00
testsuite_character.cc
testsuite_character.h
testsuite_common_types.h
testsuite_container_traits.h
testsuite_containergen.h
testsuite_containers.h
testsuite_counter_type.h
testsuite_error.h
testsuite_fs.h Fix C++14-only code in testsuite utility 2019-05-28 20:39:41 +01:00
testsuite_greedy_ops.h
testsuite_hooks.cc
testsuite_hooks.h PR libstdc++/91871 fix Clang warnings in testsuite 2019-09-24 11:09:18 +01:00
testsuite_io.h
testsuite_iterators.h libstdc++: Implement ranges::safe_range for C++20 (P1870R1) 2019-12-09 17:35:24 +00:00
testsuite_new_operators.h
testsuite_performance.h 2019-09-01 François Dumont <fdumont@gcc.gnu.org> 2019-09-01 20:11:42 +00:00
testsuite_random.h
testsuite_regex.h
testsuite_rng.h
testsuite_rvalref.h
testsuite_shared.cc
testsuite_tr1.h PR libstdc++/71579 assert that type traits are not misused with incomplete types 2019-05-31 11:35:03 +01:00