Co-authored-by: ArtemSarmini <16746066+ArtemSarmini@users.noreply.github.com>
Co-authored-by: Michael Schellenberger Costa <mschellenbergercosta@gmail.com>
Co-authored-by: Stephan T. Lavavej <stl@nuwen.net>
Co-authored-by: Ahana Mukhopadhyay <t-ahmukh@microsoft.com>
Co-authored-by: Anju Del Moral Gonzalez <judelmor@microsoft.com>
Co-authored-by: Casey Carter <cacarter@microsoft.com>
Co-authored-by: Charlie Barto <chbarto@microsoft.com>
Co-authored-by: Curtis Bezault <cubezaul@microsoft.com>
Co-authored-by: d-winsor <danwin@microsoft.com>
Co-authored-by: Michael Schellenberger Costa <mschellenbergercosta@googlemail.com>
Co-authored-by: statementreply <statementreply@gmail.com>
Co-authored-by: Stephan T. Lavavej <stl@microsoft.com>
Co-authored-by: Adam Bucior <35536269+AdamBucior@users.noreply.github.com>
Co-authored-by: Curtis Jacques Bezault <curtbezault@gmail.com>
Co-authored-by: Michael Schellenberger Costa <mschellenbergercosta@gmail.com>
Co-authored-by: mnatsuhara <46756417+mnatsuhara@users.noreply.github.com>
Co-authored-by: Stephan T. Lavavej <stl@microsoft.com>
MSVC is finally getting around to implementing `[[no_unique_address]]`, which will result in class layout differing with Clang. Let's comment out the uses that are not yet so commented until we reach compiler parity.
* Minimal changes to support constexpr allocation in MSVC
* Define `_CONSTEXPR20_DYNALLOC` macro to `constexpr` when the compiler defines `__cpp_constexpr_dynamic_alloc` and `inline` otherwise.
* Implement and test `ranges::construct_at` and `ranges::destroy_at`, mark them (and `std` flavors) `_CONSTEXPR20_DYNALLOC`.
* Implement `ranges::destroy` and `ranges::destroy_n` which share machinery with `ranges::destroy_at` with minimal test coverage. (More to follow.)
[This is a dual of internal MSVC-PR-275909.]
* `<yvals_core.h>` changes:
* Clang 10 `_HAS_CONDITIONAL_EXPLICIT` in C++14 mode (Only CUDA now requires the `_HAS_CONDITIONAL_EXPLICIT == 0` code paths)
* reject Clang < 10
* reject MSVC < 1926
* Unskip libc++ tests that need Concepts and/or `<=>`
* `std/tests/P0595R2_is_constant_evaluated`: We no longer need suppress the warning Clang 9 emits when it sees the suppression for the warning Clang 10 emits in this test ;)
* `std/tests/VSO_0157762_feature_test_macros`: Remove Clang 9 support
* `std/tests/concepts_matrix.lst`: This is now simply a copy of `usual_latest_matrix.lst` with the `/BE` lines (EDG configs) commented out. (i.e., we now run the Concepts tests with Clang as well as MSVC.)
* Remove workarounds for LLVM-38491 "clang-cl should accept __declspec(allocator)": Replace uses of `_DECLSPEC_ALLOCATOR` with `__declspec(allocator)`, and suppress Clang's warning when the return type isn't a pointer or reference.
* Remove workarounds for LLVM-43531 "clang-format damages 'alternative representations' for operators": Re-enable clang-format in the test which triggered the bug.
* Remove workarounds for LLVM-38478 "clang -fno-ms-compatibility rejects Windows.h": Add -fno-ms-compatibility to the XXX_winsdk_XXX.lst files. (Yes, we still need these because the Windows SDK breaks `/Za`.)
* Drive-by: unskip libc++ new.version now that we implement destroying delete
* Update to Clang 10 and Visual Studio 2019 version 16.6p2
* re-clang-formats the tree to comply with new clang 10 clang-format
* updates our agents to F series VMs which are faster and cheaper for our build workloads
* defaults scale set to 0 VMs and lets the Azure Pipelines service control all resizing
* fix tests to pass with the new compilers
Co-authored by Casey Carter and Curtis Bezault
* Reduce the amount of content included by <array>.
Resolves GH-462.
* Demote `back_inserter` and `iterator` to `<iterator>`.
* Demote `_Yarn` to `<xlocinfo>`.
* Demote `_Tidy_guard`, `_Tidy_deallocate_guard`, and `_Nothrow_compare` to `<xmemory>`.
* Promote `_Swap_ranges_unchecked` to `<xutility>`.
* Change `<array>` to include only `<xutility>`.
* Un-demote iterator.
* Workaround many RWC projects that expected std::min and std::max to come from <array>.
* Remove the `_STL_ASSERT` from `std::min` and `std::max`. We normally guard every `op<` with debug checks, but in this case we aren't using it to enforce something like a container invariant; the number of bad op<s we catch with it are likely microscopic.
* Delete `_Min_value` and `_Max_value` from `<utility>`.
* Move `min` and `max` to `<utility>` (in the exact position as the old `_Min_value` and `_Max_value`)
* Change all existing callers of `_Min_value` and `_Max_value` to call `(_STD min)` and `(_STD max)`, respectively.
* Homogenize vector algorithm guards.
* Implement constexpr algorithms.
Resolves GH-6 ( P0202R3 ), resolves GH-38 ( P0879R0 ), and drive-by fixes GH-414.
Everywhere: Add constexpr, _CONSTEXPR20, and _CONSTEXPR20_ICE to things.
skipped_tests.txt: Turn on all tests previously blocked by missing constexpr algorithms (and exchange and swap). Mark those algorithms that cannot be turned on that we have outstanding PRs for with their associated PRs.
yvals_core.h: Turn on feature test macros.
xutility:
* Move the _Ptr_cat family down to copy, and fix associated SHOUTY comments to indicate that this is really an implementation detail of copy, not something the rest of the standard library intends to use directly. Removed and clarified some of the comments as requested by Casey Carter.
* Extract _Copy_n_core which implements copy_n using only the core language (rather than memcpy-as-an-intrinsic). Note that we cannot use __builtin_memcpy or similar to avoid the is_constant_evaluated check here; builtin_memcpy only works in constexpr contexts when the inputs are of type char.
numeric: Refactor as suggested by GH-414.
* Attempt alternate fix of GH-414 suggested by Stephan.
* Stephan product code PR comments:
* _Swap_ranges_unchecked => _CONSTEXPR20
* _Idl_dist_add => _NODISCARD (and remove comments)
* is_permutation => _NODISCARD
* Add yvals_core.h comments.
* Delete unused _Copy_n_core and TRANSITION, DevCom-889321 comment.
* Put the comments in the right place and remove phantom braces.
Implements iterator primitive operations `std::ranges::advance`, `std::ranges::next`, `std::ranges::prev`, and `std::ranges::distance`; as well as `std::default_sentinel` and `std::unreachable_sentinel`.
This change reworks the STL's iterator unwrapping machinery to enable unwrapping of C++20 move-only single-pass iterators (and `if constepxr`s all the things). Consequently, `_Iter_ref_t`, `_Iter_value_t`, and `_Iter_diff_t` resolve to `iter_reference_t`, `iter_value_t`, and `iter_difference_t` (respectively) in `__cpp_lib_concepts` (soon to be C++20) mode. This change necessitates some fixes to `unique_copy` and `_Fill_memset_is_safe` which both assume that `_Iter_value_t<T>` is well-formed for any iterator `T`. (`iter_value_t<T>` does not have that property: it is only well-formed when `readable<T>`.)
I notably haven't unified `default_sentinel_t` with `_Default_sentinel` out of an abundance of paranoia. Our `move_iterator` is comparable with `_Default_sentinel`, which is not the case for `std::default_sentinel`.
Drive-by:
* This change `if constexpr`-izes `unique_copy`.
Resolves#55.
* Deprecate experimental::erase
* Implement P1209R0
* Update yvals_core.h
* Update deprecations and remove <experimental/xutility>
* move and reorder erase/erase_if
* moved _Erase and remove and friends to <xmemory>
* Consistently place erase_if() definitions.
* Implements a selection of support machinery in `std::ranges` and adds the `<ranges>` header. Primarily consists of the range access customization point objects:
* `ranges::begin`
* `ranges::end`
* `ranges::cbegin`
* `ranges::cend`
* `ranges::rbegin`
* `ranges::rend`
* `ranges::crbegin`
* `ranges::crend`
* `ranges::size`
* `ranges::empty`
* `ranges::data`
* `ranges::cdata`
and range concepts:
* `ranges::range`
* `ranges::output_range`
* `ranges::input_range`
* `ranges::forward_range`
* `ranges::bidirectional_range`
* `ranges::random_access_range`
* `ranges::contiguous_range`
* `ranges::sized_range`
* `ranges::view`
* `ranges::common_range`
and the associated type aliases:
* `ranges::iterator_t`
* `ranges::sentinel_t`
* `ranges::range_value_t`
* `ranges::range_reference_t`
* `ranges::range_difference_t`
* `ranges::range_rvalue_reference_t`
* Adds `<ranges>` - which is mostly empty since the support machinery is defined in `<xutility>` so as to be visible to `<algorithm>`
* Annotates [P0896R4](https://wg21.link/p0896r4) as partially implemented in the "`_HAS_CXX20` directly controls" section of `<yvals_core.h>`.
* Touches `<regex>`, `<set>`, and `<unordered_set>` to add partial specializations of `ranges::enable_view` for `match_results` and `(unordered_)?multi?set` as mandated by the WD to override the heuristic.
* Partially implements [P1474R1 "Helpful pointers for `ContiguousIterator`"](https://wg21.link/p1474r1):
* Push `pointer_traits` from `<xmemory>` and `to_address` from `<memory>` up into `<xutility>`
* Add `to_address` expression requirement to `contiguous_iterator` concept, and update `P0896R4_ranges_iterator_machinery` appropriately
* Implement the changes to `ranges::data` (but not `view_interface` since it isn't yet implemented)
* Drive-by:
* Simplify the definition of `pointer_traits::_Reftype` by eschewing `add_lvalue_reference_t`.
* Strengthen `reverse_iterator`'s constructors and `make_reverse_iterator` so `ranges::rbegin` and `ranges::rend` can be `noexcept` in more cases
* Since we're using `_Rng` as the template parameter name for models of `std::ranges::range`, rename a local variable `_Rng` to `_Generator` in `<random>`