* Library support for C++20 coroutines
Implements most of <coroutine>. Usefulness of this header is dependent
on a compatible compiler (e.g. Visual Studio 2019 16.8 Preview 1 or
later) that defines `__cpp_impl_coroutine`. With such a compiler
this header exposes the coroutine library support in the `std` namespace
without the need for an `/await` switch.
This implementation is not yet complete:
- noop coroutines are not yet implemented
- symmetric transfer is not yet implemented
The value of `__cpp_lib_coroutine` is defined to a value less than the
Standard-mandated value to represent the incomplete feature.
Co-authored-by: Daniel Marshall <xandan@gmail.com>
* Rework test_range/test_iterator Ranges test machinery
These were previously compile-only tools intended for instantiation tests, but they can now adapt a contiguous sequence of elements into a range with specified properties for runtime testing. Nest in namespace `test` as `test::range` and `test::iterator`. Add `test::sentinel` to use with `test::iterator` to make non-`common_range`s. `test::iterator` and `test::range` now enforce valid combinations of parameters instead of silently ignoring inconsistencies. `test::iterator`/`test::sentinel` now have "wrapped" and "unwrapped" variations to test use of unwrapping machinery in the Range algorithms. `move_only_range` is now a special case of `test::range`. Adds new test `std/P0896R4_ranges_test_machinery` for this stuff since it's getting complicated.
* Unnest test::proxy_iterator so wrapped and unwrapped proxy iterators can have the same reference type
* More refinement:
* flesh out `proxy_reference`
* make element type configurable in instantiation machinery
* give `test::iterator` proper moves
* tiny bit of test coverage
* Name some bools
Resolves#539.
Co-authored-by: Alex Guteniev <gutenev@gmail.com>
Co-authored-by: Casey Carter <cartec69@gmail.com>
Co-authored-by: Stephan T. Lavavej <stl@nuwen.net>
Per [readable.traits], `indirectly_readable_traits<T>::value_type` is the same type as `remove_cv_t<T::value_type>` if it denotes an object type, or `remove_cv_t<T::element_type>` if it denotes an object type. If both `T::value_type` and `T::element_type` denote types, `indirectly_readable_traits<T>::value_type` is ill-formed. This was perhaps not the best design, given that there are iterators in the wild (Boost's unordered containers) that define both nested types. `indirectly_readable_traits` should tolerate iterators that define both nested types consistently.
Fixes VSO-1121031.
Check cancellation status _before_ getting a chunk of work to process, instead of after. If we check after and a result was found in a later block than the one we were assigned, we won't notice a better result in our block.
Co-authored-by: Stephan T. Lavavej <stl@nuwen.net>
Co-authored-by: Casey Carter <cartec69@gmail.com>
Co-authored-by: Billy Robert O'Neal III <bion@microsoft.com>
Co-authored-by: Curtis Bezault <curtbezault@gmail.com>
* C++20 move_iterator changes and move_sentinel
Changes primarily come from P0896R4 "<ranges>", but the `operator<=>` from P1614R2 "Adding Spaceship <=> To The Library" is here as well.
I've also speculatively implemented the proposed resolutions of LWG-3293, LWG-3391, and LWG-3435.
I had to [patch a pair of libc++ tests](https://reviews.llvm.org/D79343) that fail with these changes; the LLVM reference is updated here to pull in those tests.
Drive-by:
* s/explicit constexpr/constexpr explicit/g (I somehow managed to sneak two occurrences into `subrange`)
* Skip flaky libc++ test (detached threads)