Hidden friends aren't hidden in C1XX's permissive mode, so let's use an alternate mechanism to make these operators truly ADL-only. (We want to avoid checking `weakly_incrementable` for every type that is compared via `==` or `!=` with a type associated with namespace `std`.)
Programs that include such specializations are ill-formed, since the Standard only specifies a partial specialization of `std::function<T>` for non-`noexcept` function types `T`. The current diagnostic:
```
error C2027: use of undefined type 'std::_Get_function_impl<_Fty>'
```
is not great.
Fixes DevCom-825902.
[This is a replay of Microsoft-internal MSVC-PR-215822.]
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`.
* Simplify thread0.cpp and xthrow.cpp.
I verified with `#error` that these files are always compiled with
`_HAS_EXCEPTIONS=1`.
thread0.cpp
Include only necessary headers.
Move the lookup tables within `_STD_BEGIN` to avoid repeated `_STD`
qualification. They're `static`, so this doesn't affect bincompat.
Add trailing commas for readability.
Make `codes` a table of `errc` so we don't need to cast each value.
Mark `_Throw_Cpp_error` as `[[noreturn]]`, matching its declaration
in the header. (No bincompat effect.)
Use `_THROW` for consistency. (Even though exceptions are enabled,
we conventionally use this in `src`.)
`system_error` is a type, so we don't need to `_STD` qualify it.
`static_cast<int>` the `errc`, once.
xthrow.cpp
Coalesce headers. Coalesce `std` regions.
Remove unnecessary comments.
Mark value parameters as const.
* Add constexpr.
This feature-test macro is being extensively queried, so we're updating it with high priority ahead of the other feature-test macro changes in this paper.
* Use unqualified function calls for valarray
The transcend functions require that the function is applied unqualified to each element
* Add comments to unqualified calls.
Fixes#285.
* Update `.clang-format` defaults.
* Enable `AlignConsecutiveMacros`, newly supported by clang-format 9.
We often followed this style before using clang-format, and I believe
that it produces generally positive changes.
* Apply clang-format changes.
* Replace `_FITS` and `_NEXT_ALIGN` macros. clang-format didn't damage
them, it just brought them to my attention. These macros weren't
improving clarity, and the code is more systematic without them.
(For the time being, I have refrained from further overhauling the
metaprogramming here.)
This file is gitignored, so it will provide default settings that can
be further customized without showing up as pending changes.
It enables `editor.formatOnSave` to help with clang-format enforcement.
It sets `files.eol` to CRLF and enables `files.insertFinalNewline`,
`files.trimFinalNewlines`, and `files.trimTrailingWhitespace` to help
with whitespace enforcement.
It uses `files.associations` to mark our extensionless headers as C++.
It excludes the `stl/msbuild` subdirectory (which isn't used by the
GitHub repo, and is doomed soon). It also excludes the `vcpkg`
submodule, to prevent its files from showing up in Quick Open (Ctrl+P).
* Make `enforce-clang-format.cmd` also run `git diff`. This will produce more informative output for clang-format failures.
* Also add timeouts to every task in `run_build.yml`.
* Also remove default `targetPlatform` from `run_build.yml`. This is provided by `azure-pipelines.yml`.
Fixes#187.
Add TRANSITION comments for #248 and #249, blocked by compiler bugs.
Add `_Enabled` names. When we don't have `enable_if_t`, this makes the
template parameter's purpose clearer. When we do have `enable_if_t`
but without `= 0`, this makes it somewhat clearer that we haven't
forgotten the default argument (it's simply elsewhere).
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.
* Remove delay comment in PR template because we've been merging PRs.
* Add readme.md note, and change "CI" to "automated testing" in checklist.
* Also remove statement from readme.md.
WG21-P1614 "The Mothership has Landed" added `==` operators to the comparison category types (`weak_equality`, `strong_equality`, `partial_ordering`, `weak_ordering`, and `strong_ordering`) defined in `<compare>`. This PR implements those operators to bring the comparison category types up to spec once again. It also implements P1614R2's removal of operators that rewrite into calls to `operator==(X, nullptr_t)` for each comparison category type `X`.
Drive-by changes:
* Move the TODO list of tasks for WG21-P0768 "Library Support for the Spaceship (Comparison) Operator" completion out of `<compare>` and into microsoft/STL#64
* Remove the `#if 0 // Not yet implemented` block from `<compare>`
* Update required compiler versions
Update required version of MSVC to VS 2019 16.4p2, and Clang/LLVM to 9.0.0.
* Tell `<yvals_core.h>` that Clang 9 implements `consteval` (WG21 hasn't yet defined a feature-test macro for `consteval`)
* Tell `<atomic>` that Clang 9 implements the `__iso_volatile_load64` intrinsic on x86
* Update mentions of VS version in `README.md`
Resolves#85 / DevCom-706195
Casey applying the new atomic implementation fixed us breaking the
strict aliasing rules, but the memcpy is causing a code size regression
for non-`/Oi` customers. This change should restore code size for the
most common uses of atomic, which are `atomic<integral>` and
`atomic<pointer>`.
* README.md: New Working Draft N4835.
* Simplify pull_request_template.md.
We can remove the N/A guidance by updating
the two checkboxes that are commonly N/A.
Remove the "feature has been voted into the WP" checkbox.
We haven't had issues with people submitting non-Standard PRs,
and the README's Non-Goals section clearly explains
our acceptance criteria.
For the `_Ugly` checkbox, allow people to check it
if there aren't any product code changes at all.
* Properly comment "Tukey's ninther".
* Remove workarounds for VSO-946746.
VSO-946746 "conditional explicit(bool) doesn't work with /clr:pure"
was fixed on 2019-07-23, and should be available in
VS 2019 16.4 Preview 1.
* Remove workarounds for VSO-433486.
VSO-433486 "_Count / 2 inside while (0 < _Count) loop is not
transformed into a simple shift" was fixed on 2019-08-27
and should be available in VS 2019 16.4 Preview 2.
Some shifts are still necessary, and are now commented.
* This mirrors a Microsoft-internal PR:
https://devdiv.visualstudio.com/DevDiv/_git/msvc/pullrequest/207988