From 2f8342a3a57fb157d881c6a2d42a917d20e413f8 Mon Sep 17 00:00:00 2001 From: "Stephan T. Lavavej" Date: Fri, 14 Oct 2022 13:00:48 -0700 Subject: [PATCH] Toolset update: VS 2022 17.4 Preview 3, Clang 15 (#3155) Co-authored-by: Casey Carter --- .clang-format | 45 +- README.md | 4 +- azure-devops/create-1es-hosted-pool.ps1 | 6 +- azure-devops/provision-image.ps1 | 2 +- azure-pipelines.yml | 2 +- stl/inc/__msvc_chrono.hpp | 11 +- stl/inc/__msvc_iter_core.hpp | 64 +- stl/inc/algorithm | 176 +-- stl/inc/any | 4 +- stl/inc/array | 2 +- stl/inc/atomic | 2 +- stl/inc/chrono | 24 +- stl/inc/compare | 82 +- stl/inc/cstdint | 2 +- stl/inc/execution | 11 +- stl/inc/expected | 118 +- stl/inc/format | 25 +- stl/inc/functional | 61 +- stl/inc/iso646.h | 14 +- stl/inc/iterator | 119 +- stl/inc/memory | 76 +- stl/inc/memory_resource | 4 +- stl/inc/new | 4 +- stl/inc/optional | 24 +- stl/inc/random | 11 +- stl/inc/ranges | 1105 ++++++++++------- stl/inc/regex | 2 +- stl/inc/stop_token | 4 +- stl/inc/tuple | 10 +- stl/inc/type_traits | 23 +- stl/inc/unordered_map | 2 +- stl/inc/unordered_set | 2 +- stl/inc/utility | 25 +- stl/inc/valarray | 4 +- stl/inc/variant | 13 +- stl/inc/xcharconv_tables.h | 14 +- stl/inc/xhash | 6 +- stl/inc/xkeycheck.h | 8 +- stl/inc/xlocinfo | 8 +- stl/inc/xmemory | 55 +- stl/inc/xstring | 10 +- stl/inc/xutility | 380 +++--- stl/inc/yvals_core.h | 10 +- stl/src/mutex.cpp | 1 + stl/src/ppltasks.cpp | 2 +- stl/src/tzdb.cpp | 10 +- stl/src/winapisupp.cpp | 2 +- stl/src/xfdscale.cpp | 1 + stl/src/xstopfx.cpp | 1 + stl/src/xstoxflt.cpp | 2 +- stl/src/xstrxfrm.cpp | 2 +- stl/src/xtime.cpp | 1 + stl/src/xwcsxfrm.cpp | 2 +- stl/src/xwstoxfl.cpp | 2 +- tests/libcxx/expected_results.txt | 9 +- tests/libcxx/skipped_tests.txt | 9 +- tests/libcxx/usual_matrix.lst | 2 +- tests/std/include/range_algorithm_support.hpp | 327 ++--- .../GH_002030_asan_annotate_string/env.lst | 8 +- .../GH_002030_asan_annotate_vector/env.lst | 8 +- .../GH_002030_asan_annotate_vector/test.cpp | 4 +- .../GH_002558_format_presetPadding/env.lst | 4 +- .../test.compile.pass.cpp | 4 +- .../test.compile.pass.cpp | 4 +- tests/std/tests/P0088R3_variant/env.lst | 8 +- tests/std/tests/P0218R1_filesystem/test.cpp | 6 +- .../test.cpp | 20 +- .../tests/P0288R9_move_only_function/test.cpp | 12 +- tests/std/tests/P0323R12_expected/test.cpp | 12 +- .../env.lst | 4 +- .../tests/P0718R2_atomic_smart_ptrs/test.cpp | 4 + .../std/tests/P0768R1_spaceship_cpos/test.cpp | 2 - .../test.cpp | 21 +- .../P0896R4_P1614R2_comparisons/test.cpp | 15 +- .../tests/P0896R4_common_iterator/test.cpp | 10 +- .../tests/P0896R4_counted_iterator/test.cpp | 3 +- .../tests/P0896R4_ranges_alg_merge/test.cpp | 2 +- .../tests/P0896R4_ranges_alg_minmax/test.cpp | 4 +- .../test.cpp | 189 ++- .../P0896R4_ranges_range_machinery/test.cpp | 21 +- .../tests/P0896R4_ranges_ref_view/test.cpp | 12 +- .../test.compile.pass.cpp | 34 +- .../test.compile.pass.cpp | 8 +- tests/std/tests/P0896R4_views_all/test.cpp | 4 +- tests/std/tests/P0896R4_views_common/test.cpp | 8 +- tests/std/tests/P0896R4_views_drop/test.cpp | 7 +- .../tests/P0896R4_views_drop_while/test.cpp | 4 +- .../std/tests/P0896R4_views_elements/test.cpp | 4 +- tests/std/tests/P0896R4_views_filter/test.cpp | 4 +- tests/std/tests/P0896R4_views_iota/test.cpp | 8 +- tests/std/tests/P0896R4_views_join/test.cpp | 4 +- .../tests/P0896R4_views_lazy_split/test.cpp | 13 +- .../std/tests/P0896R4_views_reverse/test.cpp | 4 +- tests/std/tests/P0896R4_views_split/test.cpp | 12 +- tests/std/tests/P0896R4_views_take/test.cpp | 7 +- .../tests/P0896R4_views_take_while/test.cpp | 4 +- .../tests/P0896R4_views_transform/test.cpp | 6 +- tests/std/tests/P0898R3_concepts/test.cpp | 12 +- tests/std/tests/P0912R5_coroutine/env.lst | 4 +- .../P1206R7_from_range/test.compile.pass.cpp | 4 +- .../tests/P1208R6_source_location/test.cpp | 8 - .../tests/P1522R1_difference_type/test.cpp | 4 +- tests/std/tests/P1614R2_spaceship/test.cpp | 4 +- .../P1659R3_ranges_alg_ends_with/test.cpp | 2 +- tests/std/tests/P1899R3_views_stride/test.cpp | 10 +- .../test.cpp | 20 +- .../test.cpp | 4 +- tests/std/tests/P2415R2_owning_view/test.cpp | 5 +- .../tests/P2441R2_views_join_with/test.cpp | 11 +- tests/std/tests/P2442R1_views_chunk/test.cpp | 8 +- tests/std/tests/P2442R1_views_slide/test.cpp | 4 +- .../std/tests/P2443R1_views_chunk_by/test.cpp | 4 +- .../tests/P2446R2_views_as_rvalue/test.cpp | 4 +- .../P2494R2_move_only_range_adaptors/test.cpp | 22 +- .../test.cpp | 2 +- .../VSO_0157762_feature_test_macros/env.lst | 8 +- .../test.cpp | 1 + .../tests/VSO_0938757_attribute_order/env.lst | 2 +- tests/std/tests/char8_t_17_matrix.lst | 8 +- tests/std/tests/char8_t_impure_matrix.lst | 8 +- tests/std/tests/char8_t_matrix.lst | 8 +- tests/std/tests/concepts_20_matrix.lst | 4 +- tests/std/tests/concepts_latest_matrix.lst | 4 +- .../std/tests/floating_point_model_matrix.lst | 6 +- tests/std/tests/impure_matrix.lst | 8 +- tests/std/tests/locale0_implib_cpp_matrix.lst | 8 +- tests/std/tests/native_17_matrix.lst | 6 +- tests/std/tests/native_matrix.lst | 8 +- tests/std/tests/strict_concepts_20_matrix.lst | 4 +- .../tests/strict_concepts_latest_matrix.lst | 4 +- tests/std/tests/usual_17_matrix.lst | 8 +- tests/std/tests/usual_20_matrix.lst | 4 +- tests/std/tests/usual_latest_matrix.lst | 4 +- tests/std/tests/usual_matrix.lst | 8 +- tests/tr1/env.lst | 8 +- tests/tr1/env_minus_md_idl.lst | 6 +- tests/tr1/env_minus_pure.lst | 6 +- tests/tr1/env_threads.lst | 6 +- tests/tr1/include/tcvt.h | 17 +- tests/tr1/include/tdefs.h | 113 +- tests/tr1/include/tspec_random.h | 31 +- tests/tr1/tests/algorithm/test.cpp | 3 +- tests/tr1/tests/chrono/test.cpp | 9 +- tests/tr1/tests/codecvt/test.cpp | 6 +- tests/tr1/tests/cstdio/test.cpp | 3 +- tests/tr1/tests/cvt/wstring/test.cpp | 2 +- tests/tr1/tests/exception/test.cpp | 3 +- tests/tr1/tests/filesystem1/test.cpp | 35 +- tests/tr1/tests/forward_list/test.cpp | 6 +- tests/tr1/tests/future1/test.cpp | 17 +- tests/tr1/tests/istream1/test.cpp | 6 +- tests/tr1/tests/istream2/test.cpp | 6 +- tests/tr1/tests/iterator/test.cpp | 6 +- tests/tr1/tests/limits/test.cpp | 6 +- tests/tr1/tests/locale1/test.cpp | 24 +- tests/tr1/tests/locale2/test.cpp | 12 +- tests/tr1/tests/locale3/test.cpp | 24 +- tests/tr1/tests/locale4/test.cpp | 24 +- tests/tr1/tests/locale8/test.cpp | 2 +- tests/tr1/tests/memory2/test.cpp | 17 +- tests/tr1/tests/ostream1/test.cpp | 5 +- tests/tr1/tests/ostream2/test.cpp | 5 +- tests/tr1/tests/random1/test.cpp | 24 +- tests/tr1/tests/random2/test.cpp | 3 +- tests/tr1/tests/random4/test.cpp | 21 +- tests/tr1/tests/random5/test.cpp | 3 +- tests/tr1/tests/regex1/test.cpp | 24 +- tests/tr1/tests/regex2/test.cpp | 32 +- tests/tr1/tests/regex3/test.cpp | 3 +- tests/tr1/tests/stdexcept/test.cpp | 3 +- 170 files changed, 2140 insertions(+), 2079 deletions(-) diff --git a/.clang-format b/.clang-format index 2af6dd9df7..76504cac07 100644 --- a/.clang-format +++ b/.clang-format @@ -1,7 +1,7 @@ # Copyright (c) Microsoft Corporation. # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -# https://releases.llvm.org/14.0.0/tools/clang/docs/ClangFormatStyleOptions.html +# https://releases.llvm.org/15.0.0/tools/clang/docs/ClangFormatStyleOptions.html --- # Language: Cpp @@ -12,12 +12,32 @@ AccessModifierOffset: -4 AlignAfterOpenBracket: DontAlign # AlignArrayOfStructures: None # TRANSITION, LLVM-51935 (try using AlignArrayOfStructures after this crash is fixed) -# AlignConsecutiveMacros: None -AlignConsecutiveMacros: Consecutive -# AlignConsecutiveAssignments: None +# AlignConsecutiveAssignments: +# Enabled: false +# AcrossEmptyLines: false +# AcrossComments: false +# AlignCompound: false +# PadOperators: true AlignConsecutiveAssignments: Consecutive -# AlignConsecutiveBitFields: None -# AlignConsecutiveDeclarations: None +# AlignConsecutiveBitFields: +# Enabled: false +# AcrossEmptyLines: false +# AcrossComments: false +# AlignCompound: false +# PadOperators: false +# AlignConsecutiveDeclarations: +# Enabled: false +# AcrossEmptyLines: false +# AcrossComments: false +# AlignCompound: false +# PadOperators: false +# AlignConsecutiveMacros: +# Enabled: false +# AcrossEmptyLines: false +# AcrossComments: false +# AlignCompound: false +# PadOperators: false +AlignConsecutiveMacros: Consecutive # AlignEscapedNewlines: Right AlignEscapedNewlines: Left # AlignOperands: Align @@ -64,7 +84,7 @@ AlwaysBreakTemplateDeclarations: Yes # SplitEmptyNamespace: true # BreakBeforeBinaryOperators: None BreakBeforeBinaryOperators: NonAssignment -# BreakBeforeConceptDeclarations: true +# BreakBeforeConceptDeclarations: Always # BreakBeforeBraces: Attach # BreakBeforeInheritanceComma: false # BreakInheritanceList: BeforeColon @@ -138,12 +158,13 @@ IndentCaseBlocks: true # IndentGotoLabels: true # IndentPPDirectives: None # IndentExternBlock: AfterExternBlock -# IndentRequires: false -IndentRequires: true +# IndentRequiresClause: true # IndentWidth: 2 IndentWidth: 4 # IndentWrappedFunctionNames: false IndentWrappedFunctionNames: true +# InsertBraces: false +InsertBraces: true # InsertTrailingCommas: None # JavaScriptQuotes: Leave # JavaScriptWrapImports: true @@ -177,6 +198,7 @@ PointerAlignment: Left # ReferenceAlignment: Pointer # ReflowComments: true # RemoveBracesLLVM: false +# RequiresClausePosition: OwnLine # SeparateDefinitionBlocks: Leave # ShortNamespaceLines: 1 # SortIncludes: CaseSensitive @@ -199,7 +221,12 @@ SpaceAfterCStyleCast: true # AfterFunctionDeclarationName: false # AfterIfMacros: true # AfterOverloadedOperator: false +# AfterRequiresInClause: false +# AfterRequiresInExpression: false # BeforeNonEmptyParentheses: false +SpaceBeforeParens: Custom +SpaceBeforeParensOptions: + AfterRequiresInClause: true # SpaceAroundPointerQualifiers: Default # SpaceBeforeRangeBasedForLoopColon: true # SpaceInEmptyBlock: false diff --git a/README.md b/README.md index 80692c646f..5e2e91cb55 100644 --- a/README.md +++ b/README.md @@ -141,7 +141,7 @@ Just try to follow these rules, so we can spend more time fixing bugs and implem # How To Build With The Visual Studio IDE -1. Install Visual Studio 2022 17.4 Preview 2 or later. +1. Install Visual Studio 2022 17.4 Preview 3 or later. * Select "Windows 11 SDK (10.0.22000.0)" in the VS Installer. * We recommend selecting "C++ CMake tools for Windows" in the VS Installer. This will ensure that you're using supported versions of CMake and Ninja. @@ -157,7 +157,7 @@ Just try to follow these rules, so we can spend more time fixing bugs and implem # How To Build With A Native Tools Command Prompt -1. Install Visual Studio 2022 17.4 Preview 2 or later. +1. Install Visual Studio 2022 17.4 Preview 3 or later. * Select "Windows 11 SDK (10.0.22000.0)" in the VS Installer. * We recommend selecting "C++ CMake tools for Windows" in the VS Installer. This will ensure that you're using supported versions of CMake and Ninja. diff --git a/azure-devops/create-1es-hosted-pool.ps1 b/azure-devops/create-1es-hosted-pool.ps1 index 39a2b4f320..3205770494 100644 --- a/azure-devops/create-1es-hosted-pool.ps1 +++ b/azure-devops/create-1es-hosted-pool.ps1 @@ -132,13 +132,9 @@ Display-ProgressBar -Status 'Creating resource group' $ResourceGroupName = 'StlBuild-' + $CurrentDate.ToString('yyyy-MM-ddTHHmm') -# TRANSITION, this opt-in tag should be unnecessary after 2022-09-30. -$SimplySecureV2OptInTag = @{ 'NRMSV2OptIn' = $CurrentDate.ToString('yyyyMMdd'); } - New-AzResourceGroup ` -Name $ResourceGroupName ` - -Location $Location ` - -Tag $SimplySecureV2OptInTag | Out-Null + -Location $Location | Out-Null #################################################################################################### Display-ProgressBar -Status 'Creating credentials' diff --git a/azure-devops/provision-image.ps1 b/azure-devops/provision-image.ps1 index b2ab606c8e..a186aec297 100644 --- a/azure-devops/provision-image.ps1 +++ b/azure-devops/provision-image.ps1 @@ -141,7 +141,7 @@ $Workloads = @( $ReleaseInPath = 'Preview' $Sku = 'Enterprise' $VisualStudioBootstrapperUrl = 'https://aka.ms/vs/17/pre/vs_enterprise.exe' -$PythonUrl = 'https://www.python.org/ftp/python/3.10.7/python-3.10.7-amd64.exe' +$PythonUrl = 'https://www.python.org/ftp/python/3.10.8/python-3.10.8-amd64.exe' $CudaUrl = 'https://developer.download.nvidia.com/compute/cuda/11.6.0/local_installers/cuda_11.6.0_511.23_windows.exe' diff --git a/azure-pipelines.yml b/azure-pipelines.yml index ee5374a2e5..d50839bb06 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -8,7 +8,7 @@ variables: buildOutputLocation: 'D:\build' pool: - name: 'StlBuild-2022-09-14T1332-Pool' + name: 'StlBuild-2022-10-11T1916-Pool' demands: EnableSpotVM -equals true pr: diff --git a/stl/inc/__msvc_chrono.hpp b/stl/inc/__msvc_chrono.hpp index e7051c28d4..4930179b62 100644 --- a/stl/inc/__msvc_chrono.hpp +++ b/stl/inc/__msvc_chrono.hpp @@ -91,17 +91,16 @@ namespace chrono { constexpr duration() = default; template && (treat_as_floating_point_v<_Rep> || !treat_as_floating_point_v<_Rep2>), + enable_if_t + && (treat_as_floating_point_v<_Rep> || !treat_as_floating_point_v<_Rep2>), int> = 0> constexpr explicit duration(const _Rep2& _Val) noexcept( is_arithmetic_v<_Rep>&& is_arithmetic_v<_Rep2>) // strengthened : _MyRep(static_cast<_Rep>(_Val)) {} template || (_Ratio_divide_sfinae<_Period2, _Period>::den == 1 && !treat_as_floating_point_v<_Rep2>), + enable_if_t + || (_Ratio_divide_sfinae<_Period2, _Period>::den == 1 && !treat_as_floating_point_v<_Rep2>), int> = 0> constexpr duration(const duration<_Rep2, _Period2>& _Dur) noexcept( is_arithmetic_v<_Rep>&& is_arithmetic_v<_Rep2>) // strengthened @@ -408,13 +407,11 @@ namespace chrono { } #ifdef __cpp_lib_concepts - // clang-format off _EXPORT_STD template requires three_way_comparable, duration<_Rep2, _Period2>>::rep> _NODISCARD constexpr auto operator<=>(const duration<_Rep1, _Period1>& _Left, const duration<_Rep2, _Period2>& _Right) noexcept( is_arithmetic_v<_Rep1>&& is_arithmetic_v<_Rep2>) /* strengthened */ { - // clang-format on using _CT = common_type_t, duration<_Rep2, _Period2>>; return _CT(_Left).count() <=> _CT(_Right).count(); } diff --git a/stl/inc/__msvc_iter_core.hpp b/stl/inc/__msvc_iter_core.hpp index 502c024eb8..5917ed1fb5 100644 --- a/stl/inc/__msvc_iter_core.hpp +++ b/stl/inc/__msvc_iter_core.hpp @@ -34,43 +34,29 @@ _EXPORT_STD struct contiguous_iterator_tag : random_access_iterator_tag {}; template concept _Dereferenceable = requires(_Ty& __t) { - { *__t } -> _Can_reference; -}; + { *__t } -> _Can_reference; + }; template -concept _Has_member_iterator_concept = requires { - typename _Ty::iterator_concept; -}; +concept _Has_member_iterator_concept = requires { typename _Ty::iterator_concept; }; template -concept _Has_member_iterator_category = requires { - typename _Ty::iterator_category; -}; +concept _Has_member_iterator_category = requires { typename _Ty::iterator_category; }; template -concept _Has_member_value_type = requires { - typename _Ty::value_type; -}; +concept _Has_member_value_type = requires { typename _Ty::value_type; }; template -concept _Has_member_element_type = requires { - typename _Ty::element_type; -}; +concept _Has_member_element_type = requires { typename _Ty::element_type; }; template -concept _Has_member_difference_type = requires { - typename _Ty::difference_type; -}; +concept _Has_member_difference_type = requires { typename _Ty::difference_type; }; template -concept _Has_member_pointer = requires { - typename _Ty::pointer; -}; +concept _Has_member_pointer = requires { typename _Ty::pointer; }; template -concept _Has_member_reference = requires { - typename _Ty::reference; -}; +concept _Has_member_reference = requires { typename _Ty::reference; }; _EXPORT_STD template struct incrementable_traits {}; @@ -91,16 +77,14 @@ struct incrementable_traits<_Ty> { template concept _Can_difference = requires(const _Ty& __a, const _Ty& __b) { - { __a - __b } -> integral; -}; + { __a - __b } -> integral; + }; -// clang-format off template requires (!_Has_member_difference_type<_Ty> && _Can_difference<_Ty>) struct incrementable_traits<_Ty> { using difference_type = make_signed_t() - _STD declval<_Ty>())>; }; -// clang-format on template concept _Is_from_primary = _Same_impl; @@ -142,16 +126,14 @@ struct indirectly_readable_traits<_Ty> : _Cond_value_type struct indirectly_readable_traits<_Ty> : _Cond_value_type {}; -// clang-format off template <_Has_member_value_type _Ty> requires _Has_member_element_type<_Ty> struct indirectly_readable_traits<_Ty> {}; template <_Has_member_value_type _Ty> requires _Has_member_element_type<_Ty> - && same_as, remove_cv_t> + && same_as, remove_cv_t> struct indirectly_readable_traits<_Ty> : _Cond_value_type {}; -// clang-format on _EXPORT_STD template using iter_value_t = typename conditional_t<_Is_from_primary>>, @@ -165,7 +147,7 @@ struct _Iterator_traits_base {}; template concept _Has_iter_types = _Has_member_difference_type<_It> && _Has_member_value_type<_It> // - && _Has_member_reference<_It> && _Has_member_iterator_category<_It>; + && _Has_member_reference<_It> && _Has_member_iterator_category<_It>; template struct _Old_iter_traits_pointer { @@ -257,9 +239,7 @@ struct _Iter_traits_pointer<_Itraits_pointer_strategy::_Use_decltype> { }; template -concept _Has_member_arrow = requires(_Ty&& __t) { - static_cast<_Ty&&>(__t).operator->(); -}; +concept _Has_member_arrow = requires(_Ty&& __t) { static_cast<_Ty&&>(__t).operator->(); }; template struct _Iter_traits_reference { @@ -311,10 +291,10 @@ struct _Iter_traits_category3 { template concept _Cpp17_bidi_delta = requires(_It __i) { - { --__i } -> same_as<_It&>; - { __i-- } -> convertible_to; - requires same_as>; -}; + { --__i } -> same_as<_It&>; + { __i-- } -> convertible_to; + requires same_as>; + }; template struct _Iter_traits_category2 { @@ -383,9 +363,9 @@ struct iterator_traits<_Ty*> { template inline constexpr bool _Integer_class = requires { - typename _Ty::_Signed_type; - typename _Ty::_Unsigned_type; -}; + typename _Ty::_Signed_type; + typename _Ty::_Unsigned_type; + }; template concept _Integer_like = _Is_nonbool_integral> || _Integer_class<_Ty>; @@ -431,7 +411,6 @@ concept sized_sentinel_for = sentinel_for<_Se, _It> // clang-format on namespace ranges { - // clang-format off _EXPORT_STD enum class subrange_kind : bool { unsized, sized }; _EXPORT_STD template _Se = _It, @@ -446,7 +425,6 @@ namespace ranges { _EXPORT_STD template requires (_Idx < 2) _NODISCARD constexpr auto get(subrange<_It, _Se, _Ki>&& _Val); - // clang-format on } // namespace ranges _EXPORT_STD using ranges::get; diff --git a/stl/inc/algorithm b/stl/inc/algorithm index a732813622..7b06dc31be 100644 --- a/stl/inc/algorithm +++ b/stl/inc/algorithm @@ -443,7 +443,6 @@ namespace ranges { public: using _Not_quite_object::_Not_quite_object; - // clang-format off template _Se, class _Ty, class _Pj = identity> requires indirect_binary_predicate, const _Ty*> _NODISCARD constexpr iter_difference_t<_It> operator()( @@ -458,7 +457,7 @@ namespace ranges { _NODISCARD constexpr range_difference_t<_Rng> operator()(_Rng&& _Range, const _Ty& _Val, _Pj _Proj = {}) const { return _Count_unchecked(_Ubegin(_Range), _Uend(_Range), _Val, _Pass_fn(_Proj)); } - // clang-format on + private: template _NODISCARD static constexpr iter_difference_t<_It> _Count_unchecked( @@ -468,7 +467,7 @@ namespace ranges { _STL_INTERNAL_STATIC_ASSERT(indirect_binary_predicate, const _Ty*>); #if _USE_STD_VECTOR_ALGORITHMS - if constexpr (is_same_v<_Pj, identity> && _Vector_alg_in_find_is_safe<_It, _Ty> // + if constexpr (is_same_v<_Pj, identity> && _Vector_alg_in_find_is_safe<_It, _Ty> && sized_sentinel_for<_Se, _It>) { if (!_STD is_constant_evaluated()) { if (!_Within_limits(_First, _Val)) { @@ -660,12 +659,10 @@ _NODISCARD pair<_FwdIt1, _FwdIt2> mismatch( #ifdef __cpp_lib_concepts namespace ranges { - // clang-format off template requires indirectly_comparable<_It1, _It2, _Pr, _Pj1, _Pj2> _NODISCARD constexpr bool _Equal_count( _It1 _First1, _It2 _First2, _Size _Count, _Pr _Pred, _Pj1 _Proj1, _Pj2 _Proj2) { - // clang-format on _STL_INTERNAL_CHECK(_Count >= 0); if constexpr (_Equal_memcmp_is_safe<_It1, _It2, _Pr> && same_as<_Pj1, identity> && same_as<_Pj2, identity>) { if (!_STD is_constant_evaluated()) { @@ -710,7 +707,6 @@ namespace ranges { public: using _Not_quite_object::_Not_quite_object; - // clang-format off template _Se1, input_iterator _It2, sentinel_for<_It2> _Se2, class _Pr = ranges::equal_to, class _Pj1 = identity, class _Pj2 = identity> requires indirectly_comparable<_It1, _It2, _Pr, _Pj1, _Pj2> @@ -729,8 +725,8 @@ namespace ranges { return false; } - return _Equal_count(_STD move(_UFirst1), _STD move(_UFirst2), _Count, - _Pass_fn(_Pred), _Pass_fn(_Proj1), _Pass_fn(_Proj2)); + return _Equal_count(_STD move(_UFirst1), _STD move(_UFirst2), _Count, _Pass_fn(_Pred), _Pass_fn(_Proj1), + _Pass_fn(_Proj2)); } else { return _Equal_4(_STD move(_UFirst1), _STD move(_ULast1), _STD move(_UFirst2), _STD move(_ULast2), _Pass_fn(_Pred), _Pass_fn(_Proj1), _Pass_fn(_Proj2)); @@ -743,20 +739,19 @@ namespace ranges { _NODISCARD constexpr bool operator()( _Rng1&& _Range1, _Rng2&& _Range2, _Pr _Pred = {}, _Pj1 _Proj1 = {}, _Pj2 _Proj2 = {}) const { if constexpr (sized_range<_Rng1> && sized_range<_Rng2>) { - using _Size1 = _Make_unsigned_like_t>; + using _Size1 = _Make_unsigned_like_t>; const auto _Count = static_cast<_Size1>(_RANGES size(_Range1)); - using _Size2 = _Make_unsigned_like_t>; + using _Size2 = _Make_unsigned_like_t>; if (_Count != static_cast<_Size2>(_RANGES size(_Range2))) { return false; } - return _Equal_count(_Ubegin(_Range1), _Ubegin(_Range2), _Count, - _Pass_fn(_Pred), _Pass_fn(_Proj1), _Pass_fn(_Proj2)); + return _Equal_count( + _Ubegin(_Range1), _Ubegin(_Range2), _Count, _Pass_fn(_Pred), _Pass_fn(_Proj1), _Pass_fn(_Proj2)); } else { - return _Equal_4(_Ubegin(_Range1), _Uend(_Range1), _Ubegin(_Range2), _Uend(_Range2), - _Pass_fn(_Pred), _Pass_fn(_Proj1), _Pass_fn(_Proj2)); + return _Equal_4(_Ubegin(_Range1), _Uend(_Range1), _Ubegin(_Range2), _Uend(_Range2), _Pass_fn(_Pred), + _Pass_fn(_Proj1), _Pass_fn(_Proj2)); } } - // clang-format on }; _EXPORT_STD inline constexpr _Equal_fn equal{_Not_quite_object::_Construct_tag{}}; @@ -1319,11 +1314,9 @@ namespace ranges { public: using _Not_quite_object::_Not_quite_object; - // clang-format off template _Se, class _Ty, class _Pj = identity> requires indirect_binary_predicate, const _Ty*> _NODISCARD constexpr bool operator()(_It _First, _Se _Last, const _Ty& _Val, _Pj _Proj = {}) const { - // clang-format on _Adl_verify_range(_First, _Last); const auto _ULast = _Unwrap_sent<_It>(_STD move(_Last)); const auto _UResult = @@ -1331,11 +1324,9 @@ namespace ranges { return _UResult != _ULast; } - // clang-format off template requires indirect_binary_predicate, _Pj>, const _Ty*> _NODISCARD constexpr bool operator()(_Rng&& _Range, const _Ty& _Val, _Pj _Proj = {}) const { - // clang-format on const auto _UResult = _RANGES _Find_unchecked(_Ubegin(_Range), _Uend(_Range), _Val, _Pass_fn(_Proj)); return _UResult != _Uend(_Range); } @@ -1347,13 +1338,11 @@ namespace ranges { public: using _Not_quite_object::_Not_quite_object; - // clang-format off template _Se1, forward_iterator _It2, sentinel_for<_It2> _Se2, class _Pr = ranges::equal_to, class _Pj1 = identity, class _Pj2 = identity> requires indirectly_comparable<_It1, _It2, _Pr, _Pj1, _Pj2> - _NODISCARD constexpr bool operator()(_It1 _First1, - _Se1 _Last1, _It2 _First2, _Se2 _Last2, _Pr _Pred = {}, _Pj1 _Proj1 = {}, _Pj2 _Proj2 = {}) const { - // clang-format on + _NODISCARD constexpr bool operator()(_It1 _First1, _Se1 _Last1, _It2 _First2, _Se2 _Last2, _Pr _Pred = {}, + _Pj1 _Proj1 = {}, _Pj2 _Proj2 = {}) const { _Adl_verify_range(_First2, _Last2); auto _UFirst2 = _Unwrap_iter<_Se2>(_STD move(_First2)); auto _ULast2 = _Unwrap_sent<_It2>(_STD move(_Last2)); @@ -1367,13 +1356,11 @@ namespace ranges { return !_Match.empty(); } - // clang-format off template requires indirectly_comparable, iterator_t<_Rng2>, _Pr, _Pj1, _Pj2> _NODISCARD constexpr bool operator()( _Rng1&& _Range1, _Rng2&& _Range2, _Pr _Pred = {}, _Pj1 _Proj1 = {}, _Pj2 _Proj2 = {}) const { - // clang-format on if (_RANGES empty(_Range2)) { return true; } @@ -2133,7 +2120,6 @@ namespace ranges { public: using _Not_quite_object::_Not_quite_object; - // clang-format off template _Se, class _Ty, class _Pr = ranges::equal_to, class _Pj = identity> requires indirectly_comparable<_It, const _Ty*, _Pr, _Pj> @@ -2182,7 +2168,6 @@ namespace ranges { return _Rewrap_subrange>(_First, _STD move(_UResult)); } } - // clang-format on private: template @@ -2293,13 +2278,11 @@ namespace ranges { public: using _Not_quite_object::_Not_quite_object; - // clang-format off template _Se1, input_iterator _It2, sentinel_for<_It2> _Se2, class _Pr = ranges::equal_to, class _Pj1 = identity, class _Pj2 = identity> requires indirectly_comparable<_It1, _It2, _Pr, _Pj1, _Pj2> _NODISCARD constexpr bool operator()(_It1 _First1, _Se1 _Last1, _It2 _First2, _Se2 _Last2, _Pr _Pred = {}, _Pj1 _Proj1 = {}, _Pj2 _Proj2 = {}) const { - // clang-format on _Adl_verify_range(_First1, _Last1); _Adl_verify_range(_First2, _Last2); @@ -2324,13 +2307,11 @@ namespace ranges { } } - // clang-format off template requires indirectly_comparable, iterator_t<_Rng2>, _Pr, _Pj1, _Pj2> _NODISCARD constexpr bool operator()( - _Rng1&& _Range1, _Rng2&& _Range2, _Pr _Pred = {}, _Pj1 _Proj1 = {}, _Pj2 _Proj2 = {}) const { - // clang-format on + _Rng1&& _Range1, _Rng2&& _Range2, _Pr _Pred = {}, _Pj1 _Proj1 = {}, _Pj2 _Proj2 = {}) const { if constexpr (_Sized_or_infinite_range<_Rng1> && sized_range<_Rng2>) { const range_difference_t<_Rng2> _Count2 = _RANGES distance(_Range2); if constexpr (sized_range<_Rng1>) { @@ -2357,7 +2338,6 @@ namespace ranges { public: using _Not_quite_object::_Not_quite_object; - // clang-format off template _Se1, input_iterator _It2, sentinel_for<_It2> _Se2, class _Pr = ranges::equal_to, class _Pj1 = identity, class _Pj2 = identity> requires (forward_iterator<_It1> || sized_sentinel_for<_Se1, _It1>) @@ -2365,7 +2345,6 @@ namespace ranges { && indirectly_comparable<_It1, _It2, _Pr, _Pj1, _Pj2> _NODISCARD constexpr bool operator()(_It1 _First1, _Se1 _Last1, _It2 _First2, _Se2 _Last2, _Pr _Pred = {}, _Pj1 _Proj1 = {}, _Pj2 _Proj2 = {}) const { - // clang-format on _Adl_verify_range(_First1, _Last1); _Adl_verify_range(_First2, _Last2); auto _UFirst1 = _Unwrap_iter<_Se1>(_STD move(_First1)); @@ -2380,15 +2359,12 @@ namespace ranges { _STD move(_ULast2), _Count2, _Pass_fn(_Pred), _Pass_fn(_Proj1), _Pass_fn(_Proj2)); } - // clang-format off template - requires (forward_range<_Rng1> || sized_range<_Rng1>) - && (forward_range<_Rng2> || sized_range<_Rng2>) + requires (forward_range<_Rng1> || sized_range<_Rng1>) && (forward_range<_Rng2> || sized_range<_Rng2>) && indirectly_comparable, iterator_t<_Rng2>, _Pr, _Pj1, _Pj2> _NODISCARD constexpr bool operator()( - _Rng1&& _Range1, _Rng2&& _Range2, _Pr _Pred = {}, _Pj1 _Proj1 = {}, _Pj2 _Proj2 = {}) const { - // clang-format on + _Rng1&& _Range1, _Rng2&& _Range2, _Pr _Pred = {}, _Pj1 _Proj1 = {}, _Pj2 _Proj2 = {}) const { const auto _Count1 = _Distance_helper(_Range1); const auto _Count2 = _Distance_helper(_Range2); @@ -2791,7 +2767,6 @@ namespace ranges { public: using _Not_quite_object::_Not_quite_object; - // clang-format off template _Se1, forward_iterator _It2, sentinel_for<_It2> _Se2, class _Pr = ranges::equal_to, class _Pj1 = identity, class _Pj2 = identity> requires indirectly_comparable<_It1, _It2, _Pr, _Pj1, _Pj2> @@ -2804,8 +2779,8 @@ namespace ranges { auto _UFirst2 = _Unwrap_iter<_Se2>(_First2); auto _ULast2 = _Unwrap_sent<_It2>(_Last2); - if constexpr (random_access_iterator<_It1> && sized_sentinel_for<_Se1, _It1> - && random_access_iterator<_It2> && sized_sentinel_for<_Se2, _It2>) { + if constexpr (random_access_iterator<_It1> && sized_sentinel_for<_Se1, _It1> && random_access_iterator<_It2> + && sized_sentinel_for<_Se2, _It2>) { const auto _Count1 = _ULast1 - _UFirst1; const auto _Count2 = _ULast2 - _UFirst2; auto _UResult = _Random_access_sized_ranges(_STD move(_UFirst1), _Count1, _STD move(_UFirst2), _Count2, @@ -2827,22 +2802,21 @@ namespace ranges { requires indirectly_comparable, iterator_t<_Rng2>, _Pr, _Pj1, _Pj2> _NODISCARD constexpr borrowed_subrange_t<_Rng1> operator()( _Rng1&& _Range1, _Rng2&& _Range2, _Pr _Pred = {}, _Pj1 _Proj1 = {}, _Pj2 _Proj2 = {}) const { - if constexpr (random_access_range<_Rng1> && sized_range<_Rng1> - && random_access_range<_Rng2> && sized_range<_Rng2>) { + if constexpr (random_access_range<_Rng1> && sized_range<_Rng1> && random_access_range<_Rng2> + && sized_range<_Rng2>) { auto _UResult = _Random_access_sized_ranges(_Ubegin(_Range1), _RANGES distance(_Range1), _Ubegin(_Range2), _RANGES distance(_Range2), _Pass_fn(_Pred), _Pass_fn(_Proj1), _Pass_fn(_Proj2)); return _Rewrap_subrange>(_Range1, _STD move(_UResult)); } else if constexpr (_Bidi_common_range<_Rng1> && _Bidi_common_range<_Rng2>) { - auto _UResult = _Bidi_common_ranges(_Ubegin(_Range1), _Uend(_Range1), - _Ubegin(_Range2), _Uend(_Range2), _Pass_fn(_Pred), _Pass_fn(_Proj1), _Pass_fn(_Proj2)); + auto _UResult = _Bidi_common_ranges(_Ubegin(_Range1), _Uend(_Range1), _Ubegin(_Range2), _Uend(_Range2), + _Pass_fn(_Pred), _Pass_fn(_Proj1), _Pass_fn(_Proj2)); return _Rewrap_subrange>(_Range1, _STD move(_UResult)); } else { - auto _UResult = _Forward_ranges(_Ubegin(_Range1), _Uend(_Range1), - _Ubegin(_Range2), _Uend(_Range2), _Pass_fn(_Pred), _Pass_fn(_Proj1), _Pass_fn(_Proj2)); + auto _UResult = _Forward_ranges(_Ubegin(_Range1), _Uend(_Range1), _Ubegin(_Range2), _Uend(_Range2), + _Pass_fn(_Pred), _Pass_fn(_Proj1), _Pass_fn(_Proj2)); return _Rewrap_subrange>(_Range1, _STD move(_UResult)); } } - // clang-format on }; _EXPORT_STD inline constexpr _Find_end_fn find_end{_Not_quite_object::_Construct_tag{}}; @@ -2896,7 +2870,6 @@ namespace ranges { public: using _Not_quite_object::_Not_quite_object; - // clang-format off template _Se1, forward_iterator _It2, sentinel_for<_It2> _Se2, class _Pr = ranges::equal_to, class _Pj1 = identity, class _Pj2 = identity> requires indirectly_comparable<_It1, _It2, _Pr, _Pj1, _Pj2> @@ -2926,7 +2899,7 @@ namespace ranges { _Seek_wrapped(_First1, _STD move(_UResult)); return _First1; } - // clang-format on + private: template _NODISCARD static constexpr _It1 _Find_first_of_unchecked(_It1 _First1, const _Se1 _Last1, const _It2 _First2, @@ -3246,13 +3219,11 @@ namespace ranges { public: using _Not_quite_object::_Not_quite_object; - // clang-format off template _Se, class _Ty1, class _Ty2, class _Pj = identity> requires indirectly_writable<_It, const _Ty2&> && indirect_binary_predicate, const _Ty1*> constexpr _It operator()( _It _First, _Se _Last, const _Ty1& _Oldval, const _Ty2& _Newval, _Pj _Proj = {}) const { - // clang-format on _Adl_verify_range(_First, _Last); auto _UResult = _Replace_unchecked(_Unwrap_iter<_Se>(_STD move(_First)), _Unwrap_sent<_It>(_STD move(_Last)), _Oldval, _Newval, _Pass_fn(_Proj)); @@ -3261,13 +3232,11 @@ namespace ranges { return _First; } - // clang-format off template requires indirectly_writable, const _Ty2&> && indirect_binary_predicate, _Pj>, const _Ty1*> constexpr borrowed_iterator_t<_Rng> operator()( _Rng&& _Range, const _Ty1& _Oldval, const _Ty2& _Newval, _Pj _Proj = {}) const { - // clang-format on auto _First = _RANGES begin(_Range); auto _UResult = _Replace_unchecked( _Unwrap_range_iter<_Rng>(_STD move(_First)), _Uend(_Range), _Oldval, _Newval, _Pass_fn(_Proj)); @@ -3324,12 +3293,10 @@ namespace ranges { public: using _Not_quite_object::_Not_quite_object; - // clang-format off template _Se, class _Ty, class _Pj = identity, indirect_unary_predicate> _Pr> requires indirectly_writable<_It, const _Ty&> constexpr _It operator()(_It _First, _Se _Last, _Pr _Pred, const _Ty& _Newval, _Pj _Proj = {}) const { - // clang-format on _Adl_verify_range(_First, _Last); auto _UResult = _Replace_if_unchecked(_Unwrap_iter<_Se>(_STD move(_First)), _Unwrap_sent<_It>(_STD move(_Last)), _Pass_fn(_Pred), _Newval, _Pass_fn(_Proj)); @@ -3338,13 +3305,11 @@ namespace ranges { return _First; } - // clang-format off template , _Pj>> _Pr> requires indirectly_writable, const _Ty&> constexpr borrowed_iterator_t<_Rng> operator()( _Rng&& _Range, _Pr _Pred, const _Ty& _Newval, _Pj _Proj = {}) const { - // clang-format on auto _First = _RANGES begin(_Range); auto _UResult = _Replace_if_unchecked( _Unwrap_range_iter<_Rng>(_STD move(_First)), _Uend(_Range), _Pass_fn(_Pred), _Newval, _Pass_fn(_Proj)); @@ -3417,14 +3382,12 @@ namespace ranges { public: using _Not_quite_object::_Not_quite_object; - // clang-format off template _Se, class _Ty1, class _Ty2, output_iterator _Out, class _Pj = identity> requires indirectly_copyable<_It, _Out> && indirect_binary_predicate, const _Ty1*> constexpr replace_copy_result<_It, _Out> operator()( _It _First, _Se _Last, _Out _Result, const _Ty1& _Oldval, const _Ty2& _Newval, _Pj _Proj = {}) const { - // clang-format on _Adl_verify_range(_First, _Last); auto _UResult = _Replace_copy_unchecked(_Unwrap_iter<_Se>(_STD move(_First)), _Unwrap_sent<_It>(_STD move(_Last)), _STD move(_Result), _Oldval, _Newval, _Pass_fn(_Proj)); @@ -3433,13 +3396,11 @@ namespace ranges { return {_STD move(_First), _STD move(_UResult.out)}; } - // clang-format off template _Out, class _Pj = identity> requires indirectly_copyable, _Out> && indirect_binary_predicate, _Pj>, const _Ty1*> constexpr replace_copy_result, _Out> operator()( _Rng&& _Range, _Out _Result, const _Ty1& _Oldval, const _Ty2& _Newval, _Pj _Proj = {}) const { - // clang-format on auto _First = _RANGES begin(_Range); auto _UResult = _Replace_copy_unchecked(_Unwrap_range_iter<_Rng>(_STD move(_First)), _Uend(_Range), _STD move(_Result), _Oldval, _Newval, _Pass_fn(_Proj)); @@ -3799,7 +3760,6 @@ namespace ranges { public: using _Not_quite_object::_Not_quite_object; - // clang-format off template _Se, class _Ty, class _Pj = identity> requires indirect_binary_predicate, const _Ty*> _NODISCARD_REMOVE_ALG constexpr subrange<_It> operator()( @@ -3820,7 +3780,7 @@ namespace ranges { return _Rewrap_subrange>(_Range, _STD move(_UResult)); } - // clang-format on + private: template _NODISCARD static constexpr subrange<_It> _Remove_unchecked( @@ -3864,7 +3824,6 @@ namespace ranges { return _Rewrap_subrange>(_First, _STD move(_UResult)); } - // clang-format off template , _Pj>> _Pr> requires permutable> @@ -3874,7 +3833,7 @@ namespace ranges { return _Rewrap_subrange>(_Range, _STD move(_UResult)); } - // clang-format on + private: template _NODISCARD static constexpr subrange<_It> _Remove_if_unchecked( @@ -3910,12 +3869,10 @@ namespace ranges { public: using _Not_quite_object::_Not_quite_object; - // clang-format off template _Se, weakly_incrementable _Out, class _Ty, class _Pj = identity> requires indirectly_copyable<_It, _Out> && indirect_binary_predicate, const _Ty*> constexpr remove_copy_result<_It, _Out> operator()( - // clang-format on _It _First, _Se _Last, _Out _Result, const _Ty& _Val, _Pj _Proj = {}) const { _Adl_verify_range(_First, _Last); auto _UResult = @@ -3927,13 +3884,11 @@ namespace ranges { return {_STD move(_First), _STD move(_Result)}; } - // clang-format off template requires indirectly_copyable, _Out> && indirect_binary_predicate, _Pj>, const _Ty*> constexpr remove_copy_result, _Out> operator()( _Rng&& _Range, _Out _Result, const _Ty& _Val, _Pj _Proj = {}) const { - // clang-format on auto _First = _RANGES begin(_Range); auto _UResult = _Remove_copy_unchecked(_Unwrap_range_iter<_Rng>(_STD move(_First)), _Uend(_Range), _Get_unwrapped_unverified(_STD move(_Result)), _Val, _Pass_fn(_Proj)); @@ -4092,7 +4047,6 @@ namespace ranges { return _Rewrap_subrange>(_First, _STD move(_UResult)); } - // clang-format off template , _Pj>> _Pr = ranges::equal_to> requires permutable> @@ -4102,7 +4056,7 @@ namespace ranges { return _Rewrap_subrange>(_Range, _STD move(_UResult)); } - // clang-format on + private: template _NODISCARD static constexpr subrange<_It> _Unique_unchecked(_It _First, const _Se _Last, _Pr _Pred, _Pj _Proj) { @@ -4242,8 +4196,8 @@ namespace ranges { template concept _Can_reread_or_store = forward_iterator<_It> // - || _Is_input_with_value_type<_Out, iter_value_t<_It>> // - || indirectly_copyable_storable<_It, _Out>; + || _Is_input_with_value_type<_Out, iter_value_t<_It>> // + || indirectly_copyable_storable<_It, _Out>; class _Unique_copy_fn : private _Not_quite_object { public: @@ -4822,12 +4776,10 @@ namespace ranges { public: using _Not_quite_object::_Not_quite_object; - // clang-format off template _Se, weakly_incrementable _Out, class _Urng> requires (forward_iterator<_It> || random_access_iterator<_Out>) && indirectly_copyable<_It, _Out> && uniform_random_bit_generator> _Out operator()(_It _First, _Se _Last, _Out _Result, iter_difference_t<_It> _Count, _Urng&& _Func) const { - // clang-format on _Adl_verify_range(_First, _Last); if (_Count <= 0) { return _Result; @@ -4844,13 +4796,11 @@ namespace ranges { } } - // clang-format off template - requires (forward_range<_Rng> || random_access_iterator<_Out>) + requires (forward_range<_Rng> || random_access_iterator<_Out>) && indirectly_copyable, _Out> && uniform_random_bit_generator> _Out operator()(_Rng&& _Range, _Out _Result, range_difference_t<_Rng> _Count, _Urng&& _Func) const { - // clang-format on if (_Count <= 0) { return _Result; } @@ -4960,7 +4910,6 @@ namespace ranges { public: using _Not_quite_object::_Not_quite_object; - // clang-format off template _Se, class _Urng> requires permutable<_It> && uniform_random_bit_generator> _It operator()(_It _First, _Se _Last, _Urng&& _Func) const { @@ -4981,7 +4930,7 @@ namespace ranges { return _Rewrap_iterator(_Range, _Shuffle_unchecked(_Ubegin(_Range), _Uend(_Range), _RngFunc)); } - // clang-format on + private: template _NODISCARD static _It _Shuffle_unchecked(_It _First, const _Se _Last, _Rng& _Func) { @@ -5282,11 +5231,9 @@ namespace ranges { } } - // clang-format off template requires indirectly_movable<_It, _Out> _NODISCARD static constexpr _Out _Move_n_helper(_It _First, iter_difference_t<_It> _Count, _Out _Result) { - // clang-format on for (; _Count > 0; ++_First, (void) --_Count, ++_Result) { *_Result = _RANGES iter_move(_First); } @@ -5751,12 +5698,10 @@ namespace ranges { public: using _Not_quite_object::_Not_quite_object; - // clang-format off template _Se, class _Pj = identity, indirect_unary_predicate> _Pr> requires permutable<_It> subrange<_It> operator()(_It _First, _Se _Last, _Pr _Pred, _Pj _Proj = {}) const { - // clang-format on _Adl_verify_range(_First, _Last); auto _UFirst = _Unwrap_iter<_Se>(_STD move(_First)); auto _ULast = _Get_final_iterator_unwrapped<_It>(_UFirst, _STD move(_Last)); @@ -5766,12 +5711,10 @@ namespace ranges { return _Rewrap_subrange>(_First, _STD move(_UResult)); } - // clang-format off template , _Pj>> _Pr> requires permutable> borrowed_subrange_t<_Rng> operator()(_Rng&& _Range, _Pr _Pred, _Pj _Proj = {}) const { - // clang-format on auto _ULast = _Get_final_iterator_unwrapped(_Range); auto _UResult = _Stable_partition_common(_Ubegin(_Range), _STD move(_ULast), _Pass_fn(_Pred), _Pass_fn(_Proj)); @@ -5892,7 +5835,7 @@ namespace ranges { const auto _Right_count = static_cast<_Diff>(_Count - _Mid_offset); const auto _Remaining = static_cast<_Diff>(_Right_count - _Right_true_count); const auto _High = _Stable_partition_common_buffered( - _STD move(_Right), _Last, _Pred, _Proj, _Remaining, _Temp_ptr, _Capacity); + _STD move(_Right), _Last, _Pred, _Proj, _Remaining, _Temp_ptr, _Capacity); _Right = _STD move(_High.first); _Right_true_count += _High.second; break; @@ -5952,13 +5895,11 @@ _CONSTEXPR20 void push_heap(_RanIt _First, _RanIt _Last) { #ifdef __cpp_lib_concepts namespace ranges { - // clang-format off template requires sortable<_It, _Pr, _Pj1> && indirectly_writable<_It, _Ty> - && indirect_strict_weak_order<_Pr, projected<_It, _Pj1>, projected*, _Pj2>> + && indirect_strict_weak_order<_Pr, projected<_It, _Pj1>, projected*, _Pj2>> constexpr void _Push_heap_by_index(const _It _First, iter_difference_t<_It> _Hole, const iter_difference_t<_It> _Top, _Ty&& _Val, _Pr _Pred, _Pj1 _Proj1, _Pj2 _Proj2) { - // clang-format on // percolate _Hole to _Top or where _Val belongs while (_Top < _Hole) { const auto _Idx = static_cast>((_Hole - 1) >> 1); // shift for codegen @@ -6090,13 +6031,11 @@ _CONSTEXPR20 void pop_heap(_RanIt _First, _RanIt _Last) { #ifdef __cpp_lib_concepts namespace ranges { - // clang-format off template requires sortable<_It, _Pr, _Pj1> && indirectly_writable<_It, _Ty> - && indirect_strict_weak_order<_Pr, projected<_It, _Pj1>, projected*, _Pj2>> + && indirect_strict_weak_order<_Pr, projected<_It, _Pj1>, projected*, _Pj2>> constexpr void _Pop_heap_hole_by_index(_It _First, iter_difference_t<_It> _Hole, const iter_difference_t<_It> _Bottom, _Ty&& _Val, _Pr _Pred, _Pj1 _Proj1, _Pj2 _Proj2) { - // clang-format on // percolate _Hole to _Bottom, then push _Val _STL_INTERNAL_CHECK(_Hole >= 0); _STL_INTERNAL_CHECK(_Bottom > 0); @@ -6127,13 +6066,11 @@ namespace ranges { _RANGES _Push_heap_by_index(_STD move(_First), _Hole, _Top, _STD forward<_Ty>(_Val), _Pred, _Proj1, _Proj2); } - // clang-format off template requires sortable<_It, _Pr, _Pj1> && indirectly_writable<_It, _Ty> - && indirect_strict_weak_order<_Pr, projected<_It, _Pj1>, projected*, _Pj2>> + && indirect_strict_weak_order<_Pr, projected<_It, _Pj1>, projected*, _Pj2>> constexpr void _Pop_heap_hole_unchecked( _It _First, const _It _Last, const _It _Dest, _Ty&& _Val, _Pr _Pred, _Pj1 _Proj1, _Pj2 _Proj2) { - // clang-format on // pop *_First to *_Dest and reheap _STL_INTERNAL_CHECK(_First != _Last); _STL_INTERNAL_CHECK(_First != _Dest); @@ -7182,11 +7119,9 @@ void inplace_merge(_ExPo&&, _BidIt _First, _BidIt _Mid, _BidIt _Last) noexcept / #ifdef __cpp_lib_concepts namespace ranges { - // clang-format off template _Se, class _Pr, class _Pj> requires indirect_strict_weak_order<_Pr, projected<_It, _Pj>> _NODISCARD constexpr _It _Is_sorted_until_unchecked(_It _First, const _Se _Last, _Pr _Pred, _Pj _Proj) { - // clang-format on if (_First == _Last) { return _First; } @@ -7404,11 +7339,9 @@ namespace ranges { public: using _Not_quite_object::_Not_quite_object; - // clang-format off template _Se, class _Pr = ranges::less, class _Pj = identity> requires sortable<_It, _Pr, _Pj> _It operator()(_It _First, _It _Mid, _Se _Last, _Pr _Pred = {}, _Pj _Proj = {}) const { - // clang-format on _Adl_verify_range(_First, _Mid); _Adl_verify_range(_Mid, _Last); @@ -7421,12 +7354,10 @@ namespace ranges { return _First; } - // clang-format off template requires sortable, _Pr, _Pj> borrowed_iterator_t<_Rng> operator()( _Rng&& _Range, iterator_t<_Rng> _Mid, _Pr _Pred = {}, _Pj _Proj = {}) const { - // clang-format on auto _First = _RANGES begin(_Range); auto _Last = _RANGES end(_Range); @@ -7758,12 +7689,9 @@ namespace ranges { } } - // clang-format off template requires sortable<_It, _Pr, _Pj> - _NODISCARD constexpr subrange<_It> _Partition_by_median_guess_common( - _It _First, _It _Last, _Pr _Pred, _Pj _Proj) { - // clang-format on + _NODISCARD constexpr subrange<_It> _Partition_by_median_guess_common(_It _First, _It _Last, _Pr _Pred, _Pj _Proj) { // Choose a pivot, partition [_First, _Last) into elements less than pivot, elements equal to pivot, and // elements greater than pivot; return the equal partition as a subrange. @@ -8107,11 +8035,9 @@ namespace ranges { public: using _Not_quite_object::_Not_quite_object; - // clang-format off template _Se, class _Pr = ranges::less, class _Pj = identity> requires sortable<_It, _Pr, _Pj> _It operator()(_It _First, _Se _Last, _Pr _Pred = {}, _Pj _Proj = {}) const { - // clang-format on _Adl_verify_range(_First, _Last); auto _UFirst = _Unwrap_iter<_Se>(_STD move(_First)); auto _ULast = _Get_final_iterator_unwrapped<_It>(_UFirst, _STD move(_Last)); @@ -8122,11 +8048,9 @@ namespace ranges { return _First; } - // clang-format off template requires sortable, _Pr, _Pj> borrowed_iterator_t<_Rng> operator()(_Rng&& _Range, _Pr _Pred = {}, _Pj _Proj = {}) const { - // clang-format on auto _UFirst = _Ubegin(_Range); auto _ULast = _Get_final_iterator_unwrapped(_Range); @@ -8546,15 +8470,12 @@ namespace ranges { public: using _Not_quite_object::_Not_quite_object; - // clang-format off template _Se1, random_access_iterator _It2, sentinel_for<_It2> _Se2, class _Pr = ranges::less, class _Pj1 = identity, class _Pj2 = identity> - requires indirectly_copyable<_It1, _It2> - && sortable<_It2, _Pr, _Pj2> - && indirect_strict_weak_order<_Pr, projected<_It1, _Pj1>, projected<_It2, _Pj2>> + requires indirectly_copyable<_It1, _It2> && sortable<_It2, _Pr, _Pj2> + && indirect_strict_weak_order<_Pr, projected<_It1, _Pj1>, projected<_It2, _Pj2>> constexpr partial_sort_copy_result<_It1, _It2> operator()(_It1 _First1, _Se1 _Last1, _It2 _First2, _Se2 _Last2, _Pr _Pred = {}, _Pj1 _Proj1 = {}, _Pj2 _Proj2 = {}) const { - // clang-format on _Adl_verify_range(_First1, _Last1); _Adl_verify_range(_First2, _Last2); @@ -8567,16 +8488,13 @@ namespace ranges { return {_STD move(_First1), _STD move(_First2)}; } - // clang-format off template - requires indirectly_copyable, iterator_t<_Rng2>> - && sortable, _Pr, _Pj2> - && indirect_strict_weak_order<_Pr, projected, _Pj1>, - projected, _Pj2>> + requires indirectly_copyable, iterator_t<_Rng2>> && sortable, _Pr, _Pj2> + && indirect_strict_weak_order<_Pr, projected, _Pj1>, + projected, _Pj2>> constexpr partial_sort_copy_result, borrowed_iterator_t<_Rng2>> operator()( _Rng1&& _Range1, _Rng2&& _Range2, _Pr _Pred = {}, _Pj1 _Proj1 = {}, _Pj2 _Proj2 = {}) const { - // clang-format on auto _First = _RANGES begin(_Range1); auto _UResult = _Partial_sort_copy_unchecked(_Unwrap_range_iter<_Rng1>(_STD move(_First)), _Uend(_Range1), _Ubegin(_Range2), _Uend(_Range2), _Pass_fn(_Pred), _Pass_fn(_Proj1), _Pass_fn(_Proj2)); @@ -9508,7 +9426,7 @@ namespace ranges { _STL_INTERNAL_STATIC_ASSERT(indirect_strict_weak_order<_Pr, projected<_It, _Pj>>); #if _USE_STD_VECTOR_ALGORITHMS - if constexpr (is_same_v<_Pj, identity> && _Is_min_max_optimization_safe<_It, _Pr> // + if constexpr (is_same_v<_Pj, identity> && _Is_min_max_optimization_safe<_It, _Pr> && sized_sentinel_for<_Se, _It>) { if (!_STD is_constant_evaluated()) { const auto _First_ptr = _STD to_address(_First); @@ -9629,7 +9547,7 @@ namespace ranges { _STL_INTERNAL_STATIC_ASSERT(indirect_strict_weak_order<_Pr, projected<_It, _Pj>>); #if _USE_STD_VECTOR_ALGORITHMS - if constexpr (is_same_v<_Pj, identity> && _Is_min_max_optimization_safe<_It, _Pr> // + if constexpr (is_same_v<_Pj, identity> && _Is_min_max_optimization_safe<_It, _Pr> && sized_sentinel_for<_Se, _It>) { if (!_STD is_constant_evaluated()) { const auto _First_ptr = _STD to_address(_First); @@ -9784,7 +9702,7 @@ namespace ranges { _STL_INTERNAL_STATIC_ASSERT(indirect_strict_weak_order<_Pr, projected<_It, _Pj>>); #if _USE_STD_VECTOR_ALGORITHMS - if constexpr (is_same_v<_Pj, identity> && _Is_min_max_optimization_safe<_It, _Pr> // + if constexpr (is_same_v<_Pj, identity> && _Is_min_max_optimization_safe<_It, _Pr> && sized_sentinel_for<_Se, _It>) { if (!_STD is_constant_evaluated()) { const auto _First_ptr = _STD to_address(_First); @@ -9923,7 +9841,6 @@ namespace ranges { return *_RANGES _Max_element_unchecked(_First, _Last, _Pass_fn(_Pred), _Pass_fn(_Proj)); } - // clang-format off template , _Pj>> _Pr = ranges::less> requires indirectly_copyable_storable, range_value_t<_Rng>*> @@ -9946,7 +9863,6 @@ namespace ranges { return _Found; } } - // clang-format on }; _EXPORT_STD inline constexpr _Max_fn max{_Not_quite_object::_Construct_tag{}}; @@ -9993,7 +9909,6 @@ namespace ranges { return *_RANGES _Min_element_unchecked(_First, _Last, _Pass_fn(_Pred), _Pass_fn(_Proj)); } - // clang-format off template , _Pj>> _Pr = ranges::less> requires indirectly_copyable_storable, range_value_t<_Rng>*> @@ -10016,7 +9931,6 @@ namespace ranges { return _Found; } } - // clang-format on }; _EXPORT_STD inline constexpr _Min_fn min{_Not_quite_object::_Construct_tag{}}; @@ -10091,13 +10005,11 @@ namespace ranges { return {static_cast<_Ty>(*_Found.min), static_cast<_Ty>(*_Found.max)}; } - // clang-format off template , _Pj>> _Pr = ranges::less> requires indirectly_copyable_storable, range_value_t<_Rng>*> _NODISCARD constexpr minmax_result> operator()( _Rng&& _Range, _Pr _Pred = {}, _Pj _Proj = {}) const { - // clang-format on auto _UFirst = _Ubegin(_Range); auto _ULast = _Uend(_Range); _STL_ASSERT( diff --git a/stl/inc/any b/stl/inc/any index e7dd43d43d..88c751330a 100644 --- a/stl/inc/any +++ b/stl/inc/any @@ -43,8 +43,8 @@ public: inline constexpr size_t _Any_trivial_space_size = (_Small_object_num_ptrs - 1) * sizeof(void*); template -inline constexpr bool _Any_is_trivial = alignof(_Ty) <= alignof(max_align_t) - && is_trivially_copyable_v<_Ty> && sizeof(_Ty) <= _Any_trivial_space_size; +inline constexpr bool _Any_is_trivial = + alignof(_Ty) <= alignof(max_align_t) && is_trivially_copyable_v<_Ty> && sizeof(_Ty) <= _Any_trivial_space_size; inline constexpr size_t _Any_small_space_size = (_Small_object_num_ptrs - 2) * sizeof(void*); diff --git a/stl/inc/array b/stl/inc/array index 4c384d1efc..6605cd87b6 100644 --- a/stl/inc/array +++ b/stl/inc/array @@ -882,7 +882,7 @@ _NODISCARD constexpr const _Ty&& get(const array<_Ty, _Size>&& _Arr) noexcept { namespace _DEPRECATE_TR1_NAMESPACE tr1 { using _STD array; using _STD get; -} // namespace tr1 +} // namespace _DEPRECATE_TR1_NAMESPACE tr1 #endif // _HAS_TR1_NAMESPACE _STD_END diff --git a/stl/inc/atomic b/stl/inc/atomic index b58fe10ae1..c9c6026771 100644 --- a/stl/inc/atomic +++ b/stl/inc/atomic @@ -2090,7 +2090,7 @@ private: using _Base = _Choose_atomic_base_t<_Ty>; public: - static_assert(is_trivially_copyable_v<_Ty> && is_copy_constructible_v<_Ty> && is_move_constructible_v<_Ty> // + static_assert(is_trivially_copyable_v<_Ty> && is_copy_constructible_v<_Ty> && is_move_constructible_v<_Ty> && is_copy_assignable_v<_Ty> && is_move_assignable_v<_Ty>, "atomic requires T to be trivially copyable, copy constructible, move constructible, copy assignable, " "and move assignable."); diff --git a/stl/inc/chrono b/stl/inc/chrono index cfe8898968..d7b489e672 100644 --- a/stl/inc/chrono +++ b/stl/inc/chrono @@ -190,7 +190,9 @@ namespace chrono { _EXPORT_STD using local_seconds = local_time; _EXPORT_STD using local_days = local_time; - _EXPORT_STD struct last_spec { explicit last_spec() = default; }; + _EXPORT_STD struct last_spec { + explicit last_spec() = default; + }; _EXPORT_STD inline constexpr last_spec last{}; _EXPORT_STD class day { @@ -1562,7 +1564,7 @@ namespace chrono { template inline constexpr bool - _Duration_underflows_with = !treat_as_floating_point_v // + _Duration_underflows_with = !treat_as_floating_point_v && _From::period::den / _Gcd(_From::period::den, _To::period::den) > INTMAX_MAX / (_To::period::num / _Gcd(_From::period::num, _To::period::num)); @@ -1992,12 +1994,9 @@ namespace chrono { } #ifdef __cpp_lib_concepts - // clang-format off _EXPORT_STD template requires three_way_comparable_with> - _NODISCARD constexpr auto operator<=>( - const leap_second& _Left, const sys_time<_Duration>& _Right) noexcept { - // clang-format on + _NODISCARD constexpr auto operator<=>(const leap_second& _Left, const sys_time<_Duration>& _Right) noexcept { return _Left.date() <=> _Right; } _EXPORT_STD _NODISCARD constexpr strong_ordering operator<=>( @@ -3465,7 +3464,7 @@ namespace chrono { // std::days can't represent std::seconds, and duration::max() is ~9.2 seconds. constexpr auto _Max_tick = static_cast((numeric_limits>::max)()); - return ratio_less_equal_v<_Period1, _Period2> // + return ratio_less_equal_v<_Period1, _Period2> && ratio_greater_equal_v, ratio_divide, _Period1>>; } else if (is_floating_point_v<_Rep1>) { // With the smallest possible _Period1, ratio<1,INTMAX_MAX>, one day has a tick count of @@ -4710,8 +4709,8 @@ concept _Chrono_parse_spec_callbacks = _Parse_align_callbacks<_Ty, _CharT> template concept _Has_ok = requires(_Ty _At) { - { _At.ok() } -> same_as; -}; + { _At.ok() } -> same_as; + }; // A chrono spec is either a type (with an optional modifier), OR a literal character, never both. template @@ -5227,10 +5226,8 @@ namespace chrono { } _EXPORT_STD template - // clang-format off requires (!treat_as_floating_point_v && _Duration{1} < days{1}) basic_ostream<_CharT, _Traits>& operator<<(basic_ostream<_CharT, _Traits>& _Os, const sys_time<_Duration>& _Val) { - // clang-format on return _Os << _STD format(_Os.getloc(), _STATICALLY_WIDEN(_CharT, "{:L%F %T}"), _Val); } @@ -5670,7 +5667,7 @@ namespace chrono { template static void _Validate_specifiers(const _Chrono_spec<_CharT>& _Spec, const _Ty& _Val) { - if constexpr (_Is_specialization_v<_Ty, duration> || is_same_v<_Ty, sys_info> // + if constexpr (_Is_specialization_v<_Ty, duration> || is_same_v<_Ty, sys_info> || _Is_specialization_v<_Ty, time_point> || _Is_specialization_v<_Ty, _Local_time_format_t>) { return; } @@ -5712,7 +5709,8 @@ namespace chrono { if constexpr (is_same_v<_Ty, month>) { return _Val.ok(); } else if constexpr (_Is_any_of_v<_Ty, month_day, month_day_last, month_weekday, month_weekday_last, - year_month> || _Is_ymd) { + year_month> + || _Is_ymd) { return _Val.month().ok(); } break; diff --git a/stl/inc/compare b/stl/inc/compare index feb5aafe97..9d605211d8 100644 --- a/stl/inc/compare +++ b/stl/inc/compare @@ -287,10 +287,10 @@ struct common_comparison_category { }; #ifdef __cpp_lib_concepts -// clang-format off template concept _Compares_as = same_as, _Cat>; +// clang-format off _EXPORT_STD template concept three_way_comparable = _Half_equality_comparable<_Ty, _Ty> && _Half_ordered<_Ty, _Ty> && requires(const remove_reference_t<_Ty>& __a, const remove_reference_t<_Ty>& __b) { @@ -306,6 +306,7 @@ concept three_way_comparable_with = three_way_comparable<_Ty1, _Cat> && three_wa { __t <=> __u } -> _Compares_as<_Cat>; { __u <=> __t } -> _Compares_as<_Cat>; }; +// clang-format on _EXPORT_STD template using compare_three_way_result_t = @@ -330,17 +331,14 @@ _EXPORT_STD struct compare_three_way { using is_transparent = int; }; -// clang-format on struct _Synth_three_way { - // clang-format off template _NODISCARD constexpr auto operator()(const _Ty1& _Left, const _Ty2& _Right) const - requires requires { - { _Left < _Right } -> _Boolean_testable; - { _Right < _Left } -> _Boolean_testable; - } - // clang-format on + requires requires { + { _Left < _Right } -> _Boolean_testable; + { _Right < _Left } -> _Boolean_testable; + } { if constexpr (three_way_comparable_with<_Ty1, _Ty2>) { return _Left <=> _Right; @@ -365,14 +363,12 @@ namespace _Strong_order { void strong_order(); // Block unqualified name lookup; see GH-1374. template - concept _Has_ADL = requires(_Ty1& _Left, _Ty2& _Right) { - static_cast(/* ADL */ strong_order(_Left, _Right)); - }; + concept _Has_ADL = + requires(_Ty1& _Left, _Ty2& _Right) { static_cast(/* ADL */ strong_order(_Left, _Right)); }; template - concept _Can_compare_three_way = requires(_Ty1& _Left, _Ty2& _Right) { - static_cast(compare_three_way{}(_Left, _Right)); - }; + concept _Can_compare_three_way = + requires(_Ty1& _Left, _Ty2& _Right) { static_cast(compare_three_way{}(_Left, _Right)); }; class _Cpo { private: @@ -399,12 +395,10 @@ namespace _Strong_order { static constexpr _Choice_t<_St> _Choice = _Choose<_Ty1, _Ty2>(); public: - // clang-format off template requires (_Choice<_Ty1&, _Ty2&>._Strategy != _St::_None) _NODISCARD constexpr strong_ordering operator()(_Ty1&& _Left, _Ty2&& _Right) const noexcept(_Choice<_Ty1&, _Ty2&>._No_throw) { - // clang-format on constexpr _St _Strat = _Choice<_Ty1&, _Ty2&>._Strategy; if constexpr (_Strat == _St::_Adl) { return static_cast(/* ADL */ strong_order(_Left, _Right)); @@ -460,14 +454,12 @@ namespace _Weak_order { void weak_order(); // Block unqualified name lookup; see GH-1374. template - concept _Has_ADL = requires(_Ty1& _Left, _Ty2& _Right) { - static_cast(/* ADL */ weak_order(_Left, _Right)); - }; + concept _Has_ADL = + requires(_Ty1& _Left, _Ty2& _Right) { static_cast(/* ADL */ weak_order(_Left, _Right)); }; template - concept _Can_compare_three_way = requires(_Ty1& _Left, _Ty2& _Right) { - static_cast(compare_three_way{}(_Left, _Right)); - }; + concept _Can_compare_three_way = + requires(_Ty1& _Left, _Ty2& _Right) { static_cast(compare_three_way{}(_Left, _Right)); }; // Throughput optimization: attempting to use _STD strong_order will always select ADL strong_order here. void strong_order(); // Block unqualified name lookup; see GH-1374. @@ -501,12 +493,10 @@ namespace _Weak_order { static constexpr _Choice_t<_St> _Choice = _Choose<_Ty1, _Ty2>(); public: - // clang-format off template requires (_Choice<_Ty1&, _Ty2&>._Strategy != _St::_None) _NODISCARD constexpr weak_ordering operator()(_Ty1&& _Left, _Ty2&& _Right) const noexcept(_Choice<_Ty1&, _Ty2&>._No_throw) { - // clang-format on constexpr _St _Strat = _Choice<_Ty1&, _Ty2&>._Strategy; if constexpr (_Strat == _St::_Adl) { return static_cast(/* ADL */ weak_order(_Left, _Right)); @@ -580,14 +570,12 @@ namespace _Partial_order { void partial_order(); // Block unqualified name lookup; see GH-1374. template - concept _Has_ADL = requires(_Ty1& _Left, _Ty2& _Right) { - static_cast(/* ADL */ partial_order(_Left, _Right)); - }; + concept _Has_ADL = + requires(_Ty1& _Left, _Ty2& _Right) { static_cast(/* ADL */ partial_order(_Left, _Right)); }; template - concept _Can_compare_three_way = requires(_Ty1& _Left, _Ty2& _Right) { - static_cast(compare_three_way{}(_Left, _Right)); - }; + concept _Can_compare_three_way = + requires(_Ty1& _Left, _Ty2& _Right) { static_cast(compare_three_way{}(_Left, _Right)); }; // Throughput optimization: attempting to use _STD weak_order // will attempt to select ADL weak_order, followed by ADL strong_order, here. @@ -625,12 +613,10 @@ namespace _Partial_order { static constexpr _Choice_t<_St> _Choice = _Choose<_Ty1, _Ty2>(); public: - // clang-format off template requires (_Choice<_Ty1&, _Ty2&>._Strategy != _St::_None) _NODISCARD constexpr partial_ordering operator()(_Ty1&& _Left, _Ty2&& _Right) const noexcept(_Choice<_Ty1&, _Ty2&>._No_throw) { - // clang-format on constexpr _St _Strat = _Choice<_Ty1&, _Ty2&>._Strategy; if constexpr (_Strat == _St::_Adl) { return static_cast(/* ADL */ partial_order(_Left, _Right)); @@ -655,14 +641,12 @@ inline namespace _Cpos { template concept _Can_fallback_eq_lt = requires(_Ty1& _Left, _Ty2& _Right) { - { _Left == _Right } -> _Implicitly_convertible_to; - { _Left < _Right } -> _Implicitly_convertible_to; -}; + { _Left == _Right } -> _Implicitly_convertible_to; + { _Left < _Right } -> _Implicitly_convertible_to; + }; template -concept _Can_strong_order = requires(_Ty1& _Left, _Ty2& _Right) { - _STD strong_order(_Left, _Right); -}; +concept _Can_strong_order = requires(_Ty1& _Left, _Ty2& _Right) { _STD strong_order(_Left, _Right); }; namespace _Compare_strong_order_fallback { class _Cpo { @@ -689,12 +673,10 @@ namespace _Compare_strong_order_fallback { static constexpr _Choice_t<_St> _Choice = _Choose<_Ty1, _Ty2>(); public: - // clang-format off template requires (_Choice<_Ty1&, _Ty2&>._Strategy != _St::_None) _NODISCARD constexpr strong_ordering operator()(_Ty1&& _Left, _Ty2&& _Right) const noexcept(_Choice<_Ty1&, _Ty2&>._No_throw) { - // clang-format on constexpr _St _Strat = _Choice<_Ty1&, _Ty2&>._Strategy; if constexpr (_Strat == _St::_Strong) { return _STD strong_order(_Left, _Right); @@ -714,9 +696,7 @@ inline namespace _Cpos { } template -concept _Can_weak_order = requires(_Ty1& _Left, _Ty2& _Right) { - _STD weak_order(_Left, _Right); -}; +concept _Can_weak_order = requires(_Ty1& _Left, _Ty2& _Right) { _STD weak_order(_Left, _Right); }; namespace _Compare_weak_order_fallback { class _Cpo { @@ -743,12 +723,10 @@ namespace _Compare_weak_order_fallback { static constexpr _Choice_t<_St> _Choice = _Choose<_Ty1, _Ty2>(); public: - // clang-format off template requires (_Choice<_Ty1&, _Ty2&>._Strategy != _St::_None) _NODISCARD constexpr weak_ordering operator()(_Ty1&& _Left, _Ty2&& _Right) const noexcept(_Choice<_Ty1&, _Ty2&>._No_throw) { - // clang-format on constexpr _St _Strat = _Choice<_Ty1&, _Ty2&>._Strategy; if constexpr (_Strat == _St::_Weak) { return _STD weak_order(_Left, _Right); @@ -768,17 +746,15 @@ inline namespace _Cpos { } template -concept _Can_partial_order = requires(_Ty1& _Left, _Ty2& _Right) { - _STD partial_order(_Left, _Right); -}; +concept _Can_partial_order = requires(_Ty1& _Left, _Ty2& _Right) { _STD partial_order(_Left, _Right); }; namespace _Compare_partial_order_fallback { template concept _Can_fallback_eq_lt_twice = requires(_Ty1& _Left, _Ty2& _Right) { - { _Left == _Right } -> _Implicitly_convertible_to; - { _Left < _Right } -> _Implicitly_convertible_to; - { _Right < _Left } -> _Implicitly_convertible_to; - }; + { _Left == _Right } -> _Implicitly_convertible_to; + { _Left < _Right } -> _Implicitly_convertible_to; + { _Right < _Left } -> _Implicitly_convertible_to; + }; class _Cpo { private: @@ -805,12 +781,10 @@ namespace _Compare_partial_order_fallback { static constexpr _Choice_t<_St> _Choice = _Choose<_Ty1, _Ty2>(); public: - // clang-format off template requires (_Choice<_Ty1&, _Ty2&>._Strategy != _St::_None) _NODISCARD constexpr partial_ordering operator()(_Ty1&& _Left, _Ty2&& _Right) const noexcept(_Choice<_Ty1&, _Ty2&>._No_throw) { - // clang-format on constexpr _St _Strat = _Choice<_Ty1&, _Ty2&>._Strategy; if constexpr (_Strat == _St::_Partial) { return _STD partial_order(_Left, _Right); diff --git a/stl/inc/cstdint b/stl/inc/cstdint index e581d104da..63ad4c4bfb 100644 --- a/stl/inc/cstdint +++ b/stl/inc/cstdint @@ -84,7 +84,7 @@ namespace _DEPRECATE_TR1_NAMESPACE tr1 { using _CSTD intptr_t; using _CSTD uintmax_t; using _CSTD uintptr_t; -} // namespace tr1 +} // namespace _DEPRECATE_TR1_NAMESPACE tr1 #endif // _HAS_TR1_NAMESPACE _STD_END diff --git a/stl/inc/execution b/stl/inc/execution index e465e848f4..576e6a0a09 100644 --- a/stl/inc/execution +++ b/stl/inc/execution @@ -269,7 +269,7 @@ struct _Parallelism_allocate_traits { #ifdef __cpp_aligned_new __declspec(allocator) static void* _Allocate_aligned(const size_t _Bytes, const size_t _Align) { - void* _Result = ::operator new (_Bytes, align_val_t{_Align}, nothrow); + void* _Result = ::operator new(_Bytes, align_val_t{_Align}, nothrow); if (!_Result) { _Throw_parallelism_resources_exhausted(); } @@ -4187,10 +4187,11 @@ _NODISCARD _Ty transform_reduce(_ExPo&&, _FwdIt1 _First1, _FwdIt1 _Last1, _FwdIt while (const auto _Stolen_key = _Operation._Team._Get_next_key()) { const auto _Chunk_number = _Stolen_key._Chunk_number; const auto _Chunk1 = _Operation._Basis1._Get_chunk(_Stolen_key); - _Val = _STD transform_reduce(_Chunk1._First, _Chunk1._Last, - _Operation._Basis2._Get_first( - _Chunk_number, _Operation._Team._Get_chunk_offset(_Chunk_number)), - _STD move(_Val), _Pass_fn(_Reduce_op), _Pass_fn(_Transform_op)); + + _Val = _STD transform_reduce(_Chunk1._First, _Chunk1._Last, + _Operation._Basis2._Get_first( + _Chunk_number, _Operation._Team._Get_chunk_offset(_Chunk_number)), + _STD move(_Val), _Pass_fn(_Reduce_op), _Pass_fn(_Transform_op)); } } // join with _Work_ptr threads diff --git a/stl/inc/expected b/stl/inc/expected index 3f25d69314..3ee976b062 100644 --- a/stl/inc/expected +++ b/stl/inc/expected @@ -49,13 +49,11 @@ class unexpected { public: // [expected.un.ctor] - // clang-format off template requires (!is_same_v, unexpected> && !is_same_v, in_place_t> - && is_constructible_v<_Err, _UError>) + && is_constructible_v<_Err, _UError>) constexpr explicit unexpected(_UError&& _Unex) noexcept(is_nothrow_constructible_v<_Err, _UError>) // strengthened : _Unexpected(_STD forward<_UError>(_Unex)) {} - // clang-format on template requires is_constructible_v<_Err, _Args...> @@ -63,13 +61,11 @@ public: is_nothrow_constructible_v<_Err, _Args...>) // strengthened : _Unexpected(_STD forward<_Args>(_Vals)...) {} - // clang-format off template requires is_constructible_v<_Err, initializer_list<_Uty>&, _Args...> constexpr explicit unexpected(in_place_t, initializer_list<_Uty> _Ilist, _Args&&... _Vals) noexcept( - is_nothrow_constructible_v<_Err, initializer_list<_Uty>&, _Args...>) // strengthened + is_nothrow_constructible_v<_Err, initializer_list<_Uty>&, _Args...>) // strengthened : _Unexpected(_Ilist, _STD forward<_Args>(_Vals)...) {} - // clang-format on // [expected.un.obs] _NODISCARD constexpr const _Err& error() const& noexcept { @@ -91,14 +87,15 @@ public: _Swap_adl(_Unexpected, _Other._Unexpected); } - friend constexpr void swap(unexpected& _Left, unexpected& _Right) noexcept(is_nothrow_swappable_v<_Err>) // - requires is_swappable_v<_Err> { + friend constexpr void swap(unexpected& _Left, unexpected& _Right) noexcept(is_nothrow_swappable_v<_Err>) + requires is_swappable_v<_Err> + { _Left.swap(_Right); } // [expected.un.eq] template - _NODISCARD_FRIEND constexpr bool operator==(const unexpected& _Left, const unexpected<_UErr>& _Right) noexcept( // + _NODISCARD_FRIEND constexpr bool operator==(const unexpected& _Left, const unexpected<_UErr>& _Right) noexcept( noexcept(_Fake_copy_init(_Left._Unexpected == _Right.error()))) { // strengthened return _Left._Unexpected == _Right.error(); } @@ -157,7 +154,9 @@ private: _Err _Unexpected; }; -_EXPORT_STD struct unexpect_t { explicit unexpect_t() = default; }; +_EXPORT_STD struct unexpect_t { + explicit unexpect_t() = default; +}; _EXPORT_STD inline constexpr unexpect_t unexpect{}; @@ -187,16 +186,14 @@ public: // [expected.object.ctor] constexpr expected() noexcept(is_nothrow_default_constructible_v<_Ty>) // strengthened - requires is_default_constructible_v<_Ty> // + requires is_default_constructible_v<_Ty> : _Value(), _Has_value(true) {} - // clang-format off constexpr expected(const expected& _Other) noexcept( is_nothrow_copy_constructible_v<_Ty>&& is_nothrow_copy_constructible_v<_Err>) // strengthened requires (!(is_trivially_copy_constructible_v<_Ty> && is_trivially_copy_constructible_v<_Err>) - && is_copy_constructible_v<_Ty> && is_copy_constructible_v<_Err>) + && is_copy_constructible_v<_Ty> && is_copy_constructible_v<_Err>) : _Has_value(_Other._Has_value) { - // clang-format on if (_Has_value) { _STD construct_at(_STD addressof(_Value), _Other._Value); } else { @@ -207,13 +204,13 @@ public: // clang-format off expected(const expected&) requires is_trivially_copy_constructible_v<_Ty> && is_trivially_copy_constructible_v<_Err> = default; + // clang-format on constexpr expected(expected&& _Other) noexcept( is_nothrow_move_constructible_v<_Ty>&& is_nothrow_move_constructible_v<_Err>) requires (!(is_trivially_move_constructible_v<_Ty> && is_trivially_move_constructible_v<_Err>) - && is_move_constructible_v<_Ty> && is_move_constructible_v<_Err>) + && is_move_constructible_v<_Ty> && is_move_constructible_v<_Err>) : _Has_value(_Other._Has_value) { - // clang-format on if (_Has_value) { _STD construct_at(_STD addressof(_Value), _STD move(_Other._Value)); } else { @@ -241,8 +238,8 @@ public: && !is_constructible_v, const expected<_Uty, _UErr>>; template - requires is_constructible_v<_Ty, const _Uty&> && is_constructible_v<_Err, const _UErr&> // - && _Allow_unwrapping<_Uty, _UErr> + requires is_constructible_v<_Ty, const _Uty&> && is_constructible_v<_Err, const _UErr&> + && _Allow_unwrapping<_Uty, _UErr> constexpr explicit(!is_convertible_v || !is_convertible_v) expected(const expected<_Uty, _UErr>& _Other) noexcept(is_nothrow_constructible_v<_Ty, const _Uty&> // && is_nothrow_constructible_v<_Err, const _UErr&>) // strengthened @@ -267,14 +264,12 @@ public: } } - // clang-format off template requires (!is_same_v, in_place_t> && !is_same_v, expected> - && !_Is_specialization_v, unexpected> && is_constructible_v<_Ty, _Uty>) + && !_Is_specialization_v, unexpected> && is_constructible_v<_Ty, _Uty>) constexpr explicit(!is_convertible_v<_Uty, _Ty>) expected(_Uty&& _Other) noexcept(is_nothrow_constructible_v<_Ty, _Uty>) // strengthened : _Value(_STD forward<_Uty>(_Other)), _Has_value(true) {} - // clang-format on template requires is_constructible_v<_Err, const _UErr&> @@ -294,13 +289,11 @@ public: is_nothrow_constructible_v<_Ty, _Args...>) // strengthened : _Value(_STD forward<_Args>(_Vals)...), _Has_value(true) {} - // clang-format off template requires is_constructible_v<_Ty, initializer_list<_Uty>&, _Args...> constexpr explicit expected(in_place_t, initializer_list<_Uty> _Ilist, _Args&&... _Vals) noexcept( is_nothrow_constructible_v<_Ty, initializer_list<_Uty>&, _Args...>) // strengthened : _Value(_Ilist, _STD forward<_Args>(_Vals)...), _Has_value(true) {} - // clang-format on template requires is_constructible_v<_Err, _Args...> @@ -308,13 +301,11 @@ public: is_nothrow_constructible_v<_Err, _Args...>) // strengthened : _Unexpected(_STD forward<_Args>(_Vals)...), _Has_value(false) {} - // clang-format off template requires is_constructible_v<_Err, initializer_list<_Uty>&, _Args...> constexpr explicit expected(unexpect_t, initializer_list<_Uty> _Ilist, _Args&&... _Vals) noexcept( is_nothrow_constructible_v<_Err, initializer_list<_Uty>&, _Args...>) // strengthened : _Unexpected(_Ilist, _STD forward<_Args>(_Vals)...), _Has_value(false) {} - // clang-format on // [expected.object.dtor] constexpr ~expected() noexcept { @@ -379,8 +370,9 @@ public: is_nothrow_copy_constructible_v<_Ty>&& is_nothrow_copy_constructible_v<_Err> // && is_nothrow_copy_assignable_v<_Ty>&& is_nothrow_copy_assignable_v<_Err>) // strengthened requires is_copy_assignable_v<_Ty> && is_copy_constructible_v<_Ty> // - && is_copy_assignable_v<_Err> && is_copy_constructible_v<_Err> // - &&(is_nothrow_move_constructible_v<_Ty> || is_nothrow_move_constructible_v<_Err>) { + && is_copy_assignable_v<_Err> && is_copy_constructible_v<_Err> // + && (is_nothrow_move_constructible_v<_Ty> || is_nothrow_move_constructible_v<_Err>) + { if (_Has_value && _Other._Has_value) { _Value = _Other._Value; } else if (_Has_value) { @@ -399,8 +391,9 @@ public: is_nothrow_move_constructible_v<_Ty>&& is_nothrow_move_constructible_v<_Err> // && is_nothrow_move_assignable_v<_Ty>&& is_nothrow_move_assignable_v<_Err>) // requires is_move_assignable_v<_Ty> && is_move_constructible_v<_Ty> // - && is_move_assignable_v<_Err> && is_move_constructible_v<_Err> // - &&(is_nothrow_move_constructible_v<_Ty> || is_nothrow_move_constructible_v<_Err>) { + && is_move_assignable_v<_Err> && is_move_constructible_v<_Err> // + && (is_nothrow_move_constructible_v<_Ty> || is_nothrow_move_constructible_v<_Err>) + { if (_Has_value && _Other._Has_value) { _Value = _STD move(_Other._Value); } else if (_Has_value) { @@ -415,14 +408,13 @@ public: return *this; } - // clang-format off template requires (!is_same_v, expected> && !_Is_specialization_v, unexpected> - && is_constructible_v<_Ty, _Uty> && is_assignable_v<_Ty&, _Uty> && (is_nothrow_constructible_v<_Ty, _Uty> - || is_nothrow_move_constructible_v<_Ty> || is_nothrow_move_constructible_v<_Err>)) + && is_constructible_v<_Ty, _Uty> && is_assignable_v<_Ty&, _Uty> + && (is_nothrow_constructible_v<_Ty, _Uty> || is_nothrow_move_constructible_v<_Ty> + || is_nothrow_move_constructible_v<_Err>) ) constexpr expected& operator=(_Uty&& _Other) noexcept( is_nothrow_constructible_v<_Ty, _Uty>&& is_nothrow_assignable_v<_Ty&, _Uty>) { // strengthened - // clang-format on if (_Has_value) { _Value = _STD forward<_Uty>(_Other); } else { @@ -433,14 +425,12 @@ public: return *this; } - // clang-format off template - requires (is_constructible_v<_Err, const _UErr&>&& is_assignable_v<_Err&, const _UErr&> - && (is_nothrow_constructible_v<_Err, const _UErr&> || is_nothrow_move_constructible_v<_Ty> - || is_nothrow_move_constructible_v<_Err>) ) + requires (is_constructible_v<_Err, const _UErr&> && is_assignable_v<_Err&, const _UErr&> + && (is_nothrow_constructible_v<_Err, const _UErr&> || is_nothrow_move_constructible_v<_Ty> + || is_nothrow_move_constructible_v<_Err>) ) constexpr expected& operator=(const unexpected<_UErr>& _Other) noexcept( is_nothrow_constructible_v<_Err, const _UErr&>&& is_nothrow_assignable_v<_Err&, const _UErr&>) { // strengthened - // clang-format on if (_Has_value) { _Reinit_expected(_Unexpected, _Value, _Other._Unexpected); _Has_value = false; @@ -451,14 +441,12 @@ public: return *this; } - // clang-format off template - requires (is_constructible_v<_Err, _UErr>&& is_assignable_v<_Err&, _UErr> - && (is_nothrow_constructible_v<_Err, _UErr> || is_nothrow_move_constructible_v<_Ty> - || is_nothrow_move_constructible_v<_Err>) ) + requires (is_constructible_v<_Err, _UErr> && is_assignable_v<_Err&, _UErr> + && (is_nothrow_constructible_v<_Err, _UErr> || is_nothrow_move_constructible_v<_Ty> + || is_nothrow_move_constructible_v<_Err>) ) constexpr expected& operator=(unexpected<_UErr>&& _Other) noexcept( is_nothrow_constructible_v<_Err, _UErr>&& is_nothrow_assignable_v<_Err&, _UErr>) { // strengthened - // clang-format on if (_Has_value) { _Reinit_expected(_Unexpected, _Value, _STD move(_Other._Unexpected)); _Has_value = false; @@ -486,11 +474,9 @@ public: return *_STD construct_at(_STD addressof(_Value), _STD forward<_Args>(_Vals)...); } - // clang-format off template requires is_nothrow_constructible_v<_Ty, initializer_list<_Uty>&, _Args...> constexpr _Ty& emplace(initializer_list<_Uty> _Ilist, _Args&&... _Vals) noexcept { - // clang-format on if (_Has_value) { if constexpr (!is_trivially_destructible_v<_Ty>) { _Value.~_Ty(); @@ -509,8 +495,9 @@ public: constexpr void swap(expected& _Other) noexcept(is_nothrow_move_constructible_v<_Ty>&& is_nothrow_swappable_v<_Ty>&& is_nothrow_move_constructible_v<_Err>&& is_nothrow_swappable_v<_Err>) // requires is_swappable_v<_Ty> && is_swappable_v<_Err> // - && is_move_constructible_v<_Ty> && is_move_constructible_v<_Err> // - &&(is_nothrow_move_constructible_v<_Ty> || is_nothrow_move_constructible_v<_Err>) { + && is_move_constructible_v<_Ty> && is_move_constructible_v<_Err> // + && (is_nothrow_move_constructible_v<_Ty> || is_nothrow_move_constructible_v<_Err>) + { if (_Has_value && _Other._Has_value) { _Swap_adl(_Value, _Other._Value); } else if (_Has_value) { @@ -560,8 +547,9 @@ public: friend constexpr void swap(expected& _Lhs, expected& _Rhs) noexcept(is_nothrow_move_constructible_v<_Ty>&& is_nothrow_swappable_v<_Ty>&& is_nothrow_move_constructible_v<_Err>&& is_nothrow_swappable_v<_Err>) // requires is_swappable_v<_Ty> && is_swappable_v<_Err> // - && is_move_constructible_v<_Ty> && is_move_constructible_v<_Err> // - &&(is_nothrow_move_constructible_v<_Ty> || is_nothrow_move_constructible_v<_Err>) { + && is_move_constructible_v<_Ty> && is_move_constructible_v<_Err> // + && (is_nothrow_move_constructible_v<_Ty> || is_nothrow_move_constructible_v<_Err>) + { _Lhs.swap(_Rhs); } @@ -696,13 +684,11 @@ public: // [expected.object.eq] - // clang-format off template requires (!is_void_v<_Uty>) _NODISCARD_FRIEND constexpr bool operator==(const expected& _Left, const expected<_Uty, _UErr>& _Right) noexcept( noexcept(_Fake_copy_init(_Left._Value == *_Right)) && noexcept( _Fake_copy_init(_Left._Unexpected == _Right.error()))) { // strengthened - // clang-format on if (_Left._Has_value != _Right.has_value()) { return false; } else if (_Left._Has_value) { @@ -772,7 +758,6 @@ public: // [expected.void.ctor] constexpr expected() noexcept : _Has_value(true) {} - // clang-format off constexpr expected(const expected& _Other) noexcept(is_nothrow_copy_constructible_v<_Err>) // strengthened requires (!is_trivially_copy_constructible_v<_Err> && is_copy_constructible_v<_Err>) : _Has_value(_Other._Has_value) { @@ -781,7 +766,9 @@ public: } } + // clang-format off expected(const expected&) requires is_trivially_copy_constructible_v<_Err> = default; + // clang-format on constexpr expected(expected&& _Other) noexcept(is_nothrow_move_constructible_v<_Err>) requires (!is_trivially_move_constructible_v<_Err> && is_move_constructible_v<_Err>) @@ -791,13 +778,14 @@ public: } } + // clang-format off expected(expected&&) requires is_trivially_move_constructible_v<_Err> = default; // clang-format on template - static constexpr bool _Allow_unwrapping = !is_constructible_v, expected<_Uty, _UErr>&> // - && !is_constructible_v, expected<_Uty, _UErr>> // - && !is_constructible_v, const expected<_Uty, _UErr>&> // + static constexpr bool _Allow_unwrapping = !is_constructible_v, expected<_Uty, _UErr>&> + && !is_constructible_v, expected<_Uty, _UErr>> + && !is_constructible_v, const expected<_Uty, _UErr>&> && !is_constructible_v, const expected<_Uty, _UErr>>; template @@ -840,13 +828,11 @@ public: is_nothrow_constructible_v<_Err, _Args...>) // strengthened : _Unexpected(_STD forward<_Args>(_Vals)...), _Has_value(false) {} - // clang-format off template requires is_constructible_v<_Err, initializer_list<_Uty>&, _Args...> constexpr explicit expected(unexpect_t, initializer_list<_Uty> _Ilist, _Args&&... _Vals) noexcept( is_nothrow_constructible_v<_Err, initializer_list<_Uty>&, _Args...>) // strengthened : _Unexpected(_Ilist, _STD forward<_Args>(_Vals)...), _Has_value(false) {} - // clang-format on // [expected.void.dtor] constexpr ~expected() noexcept { @@ -863,7 +849,8 @@ public: // [expected.void.assign] constexpr expected& operator=(const expected& _Other) noexcept( is_nothrow_copy_constructible_v<_Err>&& is_nothrow_copy_assignable_v<_Err>) // strengthened - requires is_copy_assignable_v<_Err> && is_copy_constructible_v<_Err> { + requires is_copy_assignable_v<_Err> && is_copy_constructible_v<_Err> + { if (_Has_value && _Other._Has_value) { // nothing to do } else if (_Has_value) { @@ -882,8 +869,9 @@ public: } constexpr expected& operator=(expected&& _Other) noexcept( - is_nothrow_move_constructible_v<_Err>&& is_nothrow_move_assignable_v<_Err>) // - requires is_move_assignable_v<_Err> && is_move_constructible_v<_Err> { + is_nothrow_move_constructible_v<_Err>&& is_nothrow_move_assignable_v<_Err>) + requires is_move_assignable_v<_Err> && is_move_constructible_v<_Err> + { if (_Has_value && _Other._Has_value) { // nothing to do } else if (_Has_value) { @@ -941,7 +929,8 @@ public: // [expected.void.swap] constexpr void swap(expected& _Other) noexcept( is_nothrow_move_constructible_v<_Err>&& is_nothrow_swappable_v<_Err>) // - requires is_swappable_v<_Err> && is_move_constructible_v<_Err> { + requires is_swappable_v<_Err> && is_move_constructible_v<_Err> + { if (_Has_value && _Other._Has_value) { // nothing } else if (_Has_value) { @@ -964,8 +953,9 @@ public: } friend constexpr void swap(expected& _Left, expected& _Right) noexcept( - is_nothrow_move_constructible_v<_Err>&& is_nothrow_swappable_v<_Err>) // - requires is_swappable_v<_Err> && is_move_constructible_v<_Err> { + is_nothrow_move_constructible_v<_Err>&& is_nothrow_swappable_v<_Err>) + requires is_swappable_v<_Err> && is_move_constructible_v<_Err> + { if (_Left._Has_value && _Right._Has_value) { // nothing } else if (_Left._Has_value) { @@ -1038,12 +1028,10 @@ public: } // [expected.void.eq] - // clang-format off template requires is_void_v<_Uty> _NODISCARD_FRIEND constexpr bool operator==(const expected& _Left, const expected<_Uty, _UErr>& _Right) noexcept( noexcept(static_cast(_Left._Unexpected == _Right.error()))) { // strengthened - // clang-format on if (_Left._Has_value != _Right.has_value()) { return false; } else { diff --git a/stl/inc/format b/stl/inc/format index 2407e5c984..9804a08d9f 100644 --- a/stl/inc/format +++ b/stl/inc/format @@ -70,7 +70,9 @@ _STD_BEGIN _EXPORT_STD template class vector; -_EXPORT_STD class format_error : public runtime_error { using runtime_error::runtime_error; }; +_EXPORT_STD class format_error : public runtime_error { + using runtime_error::runtime_error; +}; [[noreturn]] inline void _Throw_format_error(const char* const _Message) { _THROW(format_error{_Message}); @@ -532,9 +534,10 @@ template concept _Format_supported_charT = _Is_any_of_v<_CharT, char, wchar_t>; template -concept _Has_formatter = requires(_Ty& _Val, _Context& _Ctx) { - _STD declval>>().format(_Val, _Ctx); -}; +concept _Has_formatter = + requires(_Ty& _Val, _Context& _Ctx) { + _STD declval>>().format(_Val, _Ctx); + }; template concept _Has_const_formatter = _Has_formatter, _Context>; @@ -990,11 +993,9 @@ _NODISCARD constexpr _Fmt_codec<_CharT> _Get_fmt_codec() { return {}; } -// clang-format off template requires (is_same_v<_CharT, char> && !_Is_execution_charset_self_synchronizing()) _NODISCARD const _Fmt_codec<_CharT>& _Get_fmt_codec() { - // clang-format on using _CodecType = _Fmt_codec<_CharT>; static once_flag _Flag; @@ -2267,11 +2268,9 @@ _NODISCARD _OutputIt _Fmt_write(_OutputIt _Out, monostate) { // plus 3 characters for the max exponent. inline constexpr size_t _Format_min_buffer_length = 24; -// clang-format off template requires (is_arithmetic_v<_Arithmetic> && !_CharT_or_bool<_Arithmetic, _CharT>) _NODISCARD _OutputIt _Fmt_write(_OutputIt _Out, _Arithmetic _Value); -// clang-format on template _NODISCARD _OutputIt _Fmt_write(_OutputIt _Out, bool _Value); @@ -2297,11 +2296,9 @@ _NODISCARD _OutputIt _Widen_and_copy(const char* _First, const char* const _Last return _Out; } -// clang-format off template requires (is_arithmetic_v<_Arithmetic> && !_CharT_or_bool<_Arithmetic, _CharT>) _NODISCARD _OutputIt _Fmt_write(_OutputIt _Out, const _Arithmetic _Value) { - // clang-format on // TRANSITION, Reusable buffer char _Buffer[_Format_min_buffer_length]; char* _End = _Buffer; @@ -2530,12 +2527,10 @@ template _NODISCARD _OutputIt _Write_integral( _OutputIt _Out, _Integral _Value, _Basic_format_specs<_CharT> _Specs, _Lazy_locale _Locale); -// clang-format off template requires (!_CharT_or_bool<_Integral, _CharT>) -_NODISCARD _OutputIt _Fmt_write( - _OutputIt _Out, _Integral _Value, const _Basic_format_specs<_CharT>& _Specs, _Lazy_locale _Locale); -// clang-format on +_NODISCARD _OutputIt + _Fmt_write(_OutputIt _Out, _Integral _Value, const _Basic_format_specs<_CharT>& _Specs, _Lazy_locale _Locale); template _NODISCARD _OutputIt _Fmt_write(_OutputIt _Out, bool _Value, _Basic_format_specs<_CharT> _Specs, _Lazy_locale _Locale); @@ -2665,12 +2660,10 @@ _NODISCARD _OutputIt _Write_integral( } #pragma warning(pop) -// clang-format off template requires (!_CharT_or_bool<_Integral, _CharT>) _NODISCARD _OutputIt _Fmt_write( _OutputIt _Out, const _Integral _Value, const _Basic_format_specs<_CharT>& _Specs, _Lazy_locale _Locale) { - // clang-format on return _Write_integral(_STD move(_Out), _Value, _Specs, _Locale); } diff --git a/stl/inc/functional b/stl/inc/functional index 780d324a99..e68769a91f 100644 --- a/stl/inc/functional +++ b/stl/inc/functional @@ -1200,9 +1200,9 @@ union alignas(max_align_t) _Move_only_function_data { char _Data; // For aliasing template - static constexpr size_t _Buf_offset = alignof(_Fn) <= sizeof(_Impl) - ? sizeof(_Impl) // Store _Fn immediately after _Impl - : alignof(_Fn); // Pad _Fn to next alignment + static constexpr size_t _Buf_offset = + alignof(_Fn) <= sizeof(_Impl) ? sizeof(_Impl) // Store _Fn immediately after _Impl + : alignof(_Fn); // Pad _Fn to next alignment template static constexpr size_t _Buf_size = sizeof(_Pointers) - _Buf_offset<_Fn>; @@ -1285,7 +1285,7 @@ template void __stdcall _Function_deallocate_large_overaligned(_Move_only_function_data& _Self) noexcept { _STL_INTERNAL_STATIC_ASSERT(_Align > __STDCPP_DEFAULT_NEW_ALIGNMENT__); #ifdef __cpp_aligned_new - ::operator delete (_Self._Large_fn_ptr(), align_val_t{_Align}); + ::operator delete(_Self._Large_fn_ptr(), align_val_t{_Align}); #else // ^^^ __cpp_aligned_new / !__cpp_aligned_new vvv ::operator delete(_Self._Large_fn_ptr()); #endif // __cpp_aligned_new @@ -1297,7 +1297,7 @@ void __stdcall _Function_destroy_large(_Move_only_function_data& _Self) noexcept _Pfn->~_Vt(); #ifdef __cpp_aligned_new if constexpr (alignof(_Vt) > __STDCPP_DEFAULT_NEW_ALIGNMENT__) { - ::operator delete (static_cast(_Pfn), align_val_t{alignof(_Vt)}); + ::operator delete(static_cast(_Pfn), align_val_t{alignof(_Vt)}); } else #endif // __cpp_aligned_new { @@ -1307,8 +1307,8 @@ void __stdcall _Function_destroy_large(_Move_only_function_data& _Self) noexcept template inline constexpr size_t _Function_small_copy_size = // We copy Impl* and the functor data at once - _Move_only_function_data::_Buf_offset<_Vt> + // Impl* plus possible alignment - (size_t{sizeof(_Vt) + sizeof(void*) - 1} & ~size_t{sizeof(void*) - 1}); // size in whole pointers + _Move_only_function_data::_Buf_offset<_Vt> // Impl* plus possible alignment + + (size_t{sizeof(_Vt) + sizeof(void*) - 1} & ~size_t{sizeof(void*) - 1}); // size in whole pointers template _NODISCARD void* _Function_new_large(_CTypes&&... _Args) { @@ -1321,7 +1321,7 @@ _NODISCARD void* _Function_new_large(_CTypes&&... _Args) { if (_Ptr) { #ifdef __cpp_aligned_new if constexpr (alignof(_Vt) > __STDCPP_DEFAULT_NEW_ALIGNMENT__) { - ::operator delete (_Ptr, align_val_t{alignof(_Vt)}); + ::operator delete(_Ptr, align_val_t{alignof(_Vt)}); } else #endif // __cpp_aligned_new { @@ -1334,7 +1334,7 @@ _NODISCARD void* _Function_new_large(_CTypes&&... _Args) { void* _Ptr; #ifdef __cpp_aligned_new if constexpr (alignof(_Vt) > __STDCPP_DEFAULT_NEW_ALIGNMENT__) { - _Ptr = ::operator new (sizeof(_Vt), align_val_t{alignof(_Vt)}); + _Ptr = ::operator new(sizeof(_Vt), align_val_t{alignof(_Vt)}); } else #endif // __cpp_aligned_new { @@ -1470,9 +1470,9 @@ public: } template - static constexpr bool _Large_function_engaged = - alignof(_Vt) > alignof(max_align_t) - || sizeof(_Vt) > _Move_only_function_data::_Buf_size<_Vt> || !is_nothrow_move_constructible_v<_Vt>; + static constexpr bool _Large_function_engaged = alignof(_Vt) > alignof(max_align_t) + || sizeof(_Vt) > _Move_only_function_data::_Buf_size<_Vt> + || !is_nothrow_move_constructible_v<_Vt>; _NODISCARD auto _Get_invoke() const noexcept { return _Get_impl(_Data)->_Invoke; @@ -1558,7 +1558,7 @@ public: template static constexpr bool _Is_callable_from = - is_invocable_r_v<_Rx, _Vt, _Types...>&& is_invocable_r_v<_Rx, _Vt&, _Types...>; + is_invocable_r_v<_Rx, _Vt, _Types...> && is_invocable_r_v<_Rx, _Vt&, _Types...>; _Rx operator()(_Types... _Args) { return this->_Get_invoke()(this->_Data, _STD forward<_Types>(_Args)...); @@ -1607,7 +1607,7 @@ public: template static constexpr bool _Is_callable_from = - is_invocable_r_v<_Rx, const _Vt, _Types...>&& is_invocable_r_v<_Rx, const _Vt&, _Types...>; + is_invocable_r_v<_Rx, const _Vt, _Types...> && is_invocable_r_v<_Rx, const _Vt&, _Types...>; _Rx operator()(_Types... _Args) const { return this->_Get_invoke()(this->_Data, _STD forward<_Types>(_Args)...); @@ -1657,7 +1657,7 @@ public: template static constexpr bool _Is_callable_from = - is_nothrow_invocable_r_v<_Rx, _Vt, _Types...>&& is_nothrow_invocable_r_v<_Rx, _Vt&, _Types...>; + is_nothrow_invocable_r_v<_Rx, _Vt, _Types...> && is_nothrow_invocable_r_v<_Rx, _Vt&, _Types...>; _Rx operator()(_Types... _Args) noexcept { return this->_Get_invoke()(this->_Data, _STD forward<_Types>(_Args)...); @@ -1665,7 +1665,7 @@ public: }; template -class _Move_only_function_call<_Rx(_Types...)& noexcept> : public _Move_only_function_base<_Rx, true, _Types...> { +class _Move_only_function_call<_Rx(_Types...) & noexcept> : public _Move_only_function_base<_Rx, true, _Types...> { public: using result_type = _Rx; @@ -1681,7 +1681,7 @@ public: }; template -class _Move_only_function_call<_Rx(_Types...)&& noexcept> : public _Move_only_function_base<_Rx, true, _Types...> { +class _Move_only_function_call<_Rx(_Types...) && noexcept> : public _Move_only_function_base<_Rx, true, _Types...> { public: using result_type = _Rx; @@ -1706,7 +1706,7 @@ public: template static constexpr bool _Is_callable_from = - is_nothrow_invocable_r_v<_Rx, const _Vt, _Types...>&& is_nothrow_invocable_r_v<_Rx, const _Vt&, _Types...>; + is_nothrow_invocable_r_v<_Rx, const _Vt, _Types...> && is_nothrow_invocable_r_v<_Rx, const _Vt&, _Types...>; _Rx operator()(_Types... _Args) const noexcept { return this->_Get_invoke()(this->_Data, _STD forward<_Types>(_Args)...); @@ -1714,7 +1714,8 @@ public: }; template -class _Move_only_function_call<_Rx(_Types...) const& noexcept> : public _Move_only_function_base<_Rx, true, _Types...> { +class _Move_only_function_call<_Rx(_Types...) const & noexcept> + : public _Move_only_function_base<_Rx, true, _Types...> { public: using result_type = _Rx; @@ -1730,7 +1731,7 @@ public: }; template -class _Move_only_function_call<_Rx(_Types...) const&& noexcept> +class _Move_only_function_call<_Rx(_Types...) const && noexcept> : public _Move_only_function_base<_Rx, true, _Types...> { public: using result_type = _Rx; @@ -2862,40 +2863,34 @@ private: #ifdef __cpp_lib_concepts namespace ranges { _EXPORT_STD struct not_equal_to { - // clang-format off template requires equality_comparable_with<_Ty1, _Ty2> - _NODISCARD constexpr bool operator()(_Ty1&& _Left, _Ty2&& _Right) const noexcept(noexcept( - static_cast(static_cast<_Ty1&&>(_Left) == static_cast<_Ty2&&>(_Right)))) /* strengthened */ { + _NODISCARD constexpr bool operator()(_Ty1&& _Left, _Ty2&& _Right) const noexcept( + noexcept(static_cast(static_cast<_Ty1&&>(_Left) == static_cast<_Ty2&&>(_Right)))) /* strengthened */ { return !static_cast(static_cast<_Ty1&&>(_Left) == static_cast<_Ty2&&>(_Right)); } - // clang-format on using is_transparent = int; }; _EXPORT_STD struct greater_equal { - // clang-format off template requires totally_ordered_with<_Ty1, _Ty2> - _NODISCARD constexpr bool operator()(_Ty1&& _Left, _Ty2&& _Right) const noexcept(noexcept( - static_cast(static_cast<_Ty1&&>(_Left) < static_cast<_Ty2&&>(_Right)))) /* strengthened */ { + _NODISCARD constexpr bool operator()(_Ty1&& _Left, _Ty2&& _Right) const noexcept( + noexcept(static_cast(static_cast<_Ty1&&>(_Left) < static_cast<_Ty2&&>(_Right)))) /* strengthened */ { return !static_cast(static_cast<_Ty1&&>(_Left) < static_cast<_Ty2&&>(_Right)); } - // clang-format on using is_transparent = int; }; _EXPORT_STD struct less_equal { - // clang-format off template requires totally_ordered_with<_Ty1, _Ty2> - _NODISCARD constexpr bool operator()(_Ty1&& _Left, _Ty2&& _Right) const noexcept(noexcept( - static_cast(static_cast<_Ty2&&>(_Right) < static_cast<_Ty1&&>(_Left)))) /* strengthened */ { + _NODISCARD constexpr bool operator()(_Ty1&& _Left, _Ty2&& _Right) const noexcept( + noexcept(static_cast(static_cast<_Ty2&&>(_Right) < static_cast<_Ty1&&>(_Left)))) /* strengthened */ { return !static_cast(static_cast<_Ty2&&>(_Right) < static_cast<_Ty1&&>(_Left)); } - // clang-format on using is_transparent = int; }; @@ -2914,7 +2909,7 @@ namespace _DEPRECATE_TR1_NAMESPACE tr1 { namespace placeholders { using namespace _STD placeholders; } -} // namespace tr1 +} // namespace _DEPRECATE_TR1_NAMESPACE tr1 #endif // _HAS_TR1_NAMESPACE _STD_END diff --git a/stl/inc/iso646.h b/stl/inc/iso646.h index 3622c17ffd..4a010c4a83 100644 --- a/stl/inc/iso646.h +++ b/stl/inc/iso646.h @@ -12,16 +12,16 @@ #else // ^^^ non-compiler tools / C and C++ compilers vvv #if !defined(__cplusplus) || defined(_MSC_EXTENSIONS) -#define and && +#define and && #define and_eq &= #define bitand & -#define bitor | -#define compl ~ -#define not ! +#define bitor | +#define compl ~ +#define not ! #define not_eq != -#define or || -#define or_eq |= -#define xor ^ +#define or || +#define or_eq |= +#define xor ^ #define xor_eq ^= #endif // !defined(__cplusplus) || defined(_MSC_EXTENSIONS) diff --git a/stl/inc/iterator b/stl/inc/iterator index 5b2e5ec211..aa6b02001e 100644 --- a/stl/inc/iterator +++ b/stl/inc/iterator @@ -189,21 +189,19 @@ public: constexpr explicit move_sentinel(_Se _Val) noexcept(is_nothrow_move_constructible_v<_Se>) // strengthened : _Last{_STD move(_Val)} {} - // clang-format off template requires convertible_to - constexpr move_sentinel(const move_sentinel<_Se2>& _Val) - noexcept(is_nothrow_constructible_v<_Se, const _Se2&>) // strengthened + constexpr move_sentinel(const move_sentinel<_Se2>& _Val) noexcept( + is_nothrow_constructible_v<_Se, const _Se2&>) // strengthened : _Last{_Val._Get_last()} {} template requires assignable_from<_Se&, const _Se2&> - constexpr move_sentinel& operator=(const move_sentinel<_Se2>& _Val) - noexcept(is_nothrow_assignable_v<_Se&, const _Se2&>) /* strengthened */ { + constexpr move_sentinel& operator=(const move_sentinel<_Se2>& _Val) noexcept( + is_nothrow_assignable_v<_Se&, const _Se2&>) /* strengthened */ { _Last = _Val._Get_last(); return *this; } - // clang-format on _NODISCARD constexpr _Se base() const noexcept(is_nothrow_copy_constructible_v<_Se>) /* strengthened */ { return _Last; @@ -563,7 +561,8 @@ class _Variantish { public: constexpr explicit _Variantish(_Variantish_empty_tag) noexcept : _Contains{_Variantish_state::_Nothing} {} - constexpr _Variantish() noexcept(is_nothrow_default_constructible_v<_Ty1>) requires default_initializable<_Ty1> + constexpr _Variantish() noexcept(is_nothrow_default_constructible_v<_Ty1>) + requires default_initializable<_Ty1> : _First{}, _Contains{_Variantish_state::_Holds_first} {} template @@ -847,11 +846,11 @@ concept _Use_postfix_proxy = !requires(_Iter& __it) { { *__it++ } -> _Can_refere && indirectly_readable<_Iter> && constructible_from, iter_reference_t<_Iter>> && move_constructible>; +// clang-format on _EXPORT_STD template _Se> requires (!same_as<_Iter, _Se> && copyable<_Iter>) class common_iterator { - // clang-format on private: struct _Proxy_base { iter_value_t<_Iter> _Keep; @@ -874,13 +873,13 @@ public: constexpr explicit common_iterator(_Variantish_empty_tag _Tag) noexcept : _Val{_Tag} {} - // clang-format off template requires convertible_to && convertible_to constexpr common_iterator(const common_iterator<_OIter, _OSe>& _Right) noexcept( is_nothrow_constructible_v<_Iter, const _OIter&>&& is_nothrow_constructible_v<_Se, const _OSe&>) // strengthened : _Val{_Right._Get_val()} {} + // clang-format off template requires convertible_to && convertible_to && assignable_from<_Iter&, const _OIter&> && assignable_from<_Se&, const _OSe&> @@ -901,7 +900,9 @@ public: return *_Val._First; } - _NODISCARD constexpr decltype(auto) operator*() const requires _Dereferenceable { + _NODISCARD constexpr decltype(auto) operator*() const + requires _Dereferenceable + { #if _ITERATOR_DEBUG_LEVEL != 0 _STL_VERIFY(_Val._Contains == _Variantish_state::_Holds_first, "common_iterator can only be dereferenced if it holds an iterator"); @@ -978,12 +979,10 @@ public: } } - // clang-format off template _OSe> requires sentinel_for<_Se, _OIter> - _NODISCARD_FRIEND constexpr - bool operator==(const common_iterator& _Left, const common_iterator<_OIter, _OSe>& _Right) { - // clang-format on + _NODISCARD_FRIEND constexpr bool operator==( + const common_iterator& _Left, const common_iterator<_OIter, _OSe>& _Right) { auto& _Right_val = _Right._Get_val(); #if _ITERATOR_DEBUG_LEVEL != 0 _STL_VERIFY( @@ -1010,12 +1009,10 @@ public: } } - // clang-format off template _OIter, sized_sentinel_for<_Iter> _OSe> requires sized_sentinel_for<_Se, _OIter> _NODISCARD_FRIEND constexpr iter_difference_t<_OIter> operator-( const common_iterator& _Left, const common_iterator<_OIter, _OSe>& _Right) { - // clang-format on auto& _Right_val = _Right._Get_val(); #if _ITERATOR_DEBUG_LEVEL != 0 _STL_VERIFY( @@ -1039,7 +1036,9 @@ public: } _NODISCARD_FRIEND constexpr iter_rvalue_reference_t<_Iter> iter_move(const common_iterator& _Right) noexcept( - noexcept(_RANGES iter_move(_Right._Val._First))) requires input_iterator<_Iter> { + noexcept(_RANGES iter_move(_Right._Val._First))) + requires input_iterator<_Iter> + { #if _ITERATOR_DEBUG_LEVEL != 0 _STL_VERIFY(_Right._Val._Contains == _Variantish_state::_Holds_first, "can only iter_move from common_iterator if it holds an iterator"); @@ -1080,19 +1079,17 @@ struct _Common_iterator_pointer_type { using pointer = void; }; -// clang-format off template requires _Has_member_arrow&> struct _Common_iterator_pointer_type<_Iter, _Se> { - // clang-format on using pointer = decltype(_STD declval&>().operator->()); }; template concept _Has_forward_category = requires { - typename _Iter_cat_t<_Iter>; - requires derived_from<_Iter_cat_t<_Iter>, forward_iterator_tag>; -}; + typename _Iter_cat_t<_Iter>; + requires derived_from<_Iter_cat_t<_Iter>, forward_iterator_tag>; + }; template struct iterator_traits> { @@ -1147,7 +1144,6 @@ public: #endif // _ITERATOR_DEBUG_LEVEL != 0 } - // clang-format off template requires convertible_to constexpr counted_iterator(const counted_iterator<_Other>& _Right) noexcept( @@ -1158,7 +1154,6 @@ public: requires assignable_from<_Iter&, const _Other&> constexpr counted_iterator& operator=(const counted_iterator<_Other>& _Right) noexcept( is_nothrow_assignable_v<_Iter&, const _Other&>) /* strengthened */ { - // clang-format on _Current = _Right.base(); _Length = _Right.count(); return *this; @@ -1186,19 +1181,23 @@ public: } _NODISCARD constexpr decltype(auto) operator*() const noexcept(noexcept(*_Current)) /* strengthened */ - requires _Dereferenceable { + requires _Dereferenceable + { #if _ITERATOR_DEBUG_LEVEL != 0 _STL_VERIFY(_Length > 0, "counted_iterator dereference beyond end of range"); #endif // _ITERATOR_DEBUG_LEVEL != 0 return *_Current; } - _NODISCARD constexpr auto operator->() const noexcept requires contiguous_iterator<_Iter> { + _NODISCARD constexpr auto operator->() const noexcept + requires contiguous_iterator<_Iter> + { return _STD to_address(_Current); } - _NODISCARD constexpr decltype(auto) operator[]( - const iter_difference_t<_Iter> _Diff) const requires random_access_iterator<_Iter> { + _NODISCARD constexpr decltype(auto) operator[](const iter_difference_t<_Iter> _Diff) const + requires random_access_iterator<_Iter> + { #if _ITERATOR_DEBUG_LEVEL != 0 _STL_VERIFY(_Diff < _Length, "counted_iterator index out of range"); #endif // _ITERATOR_DEBUG_LEVEL != 0 @@ -1230,7 +1229,9 @@ public: _CATCH_END } - constexpr counted_iterator operator++(int) requires forward_iterator<_Iter> { + constexpr counted_iterator operator++(int) + requires forward_iterator<_Iter> + { #if _ITERATOR_DEBUG_LEVEL != 0 _STL_VERIFY(_Length > 0, "counted_iterator increment beyond end of range"); #endif // _ITERATOR_DEBUG_LEVEL != 0 @@ -1240,31 +1241,39 @@ public: return _Tmp; } - constexpr counted_iterator& operator--() requires bidirectional_iterator<_Iter> { + constexpr counted_iterator& operator--() + requires bidirectional_iterator<_Iter> + { --_Current; ++_Length; return *this; } - constexpr counted_iterator operator--(int) requires bidirectional_iterator<_Iter> { + constexpr counted_iterator operator--(int) + requires bidirectional_iterator<_Iter> + { counted_iterator _Tmp = *this; --_Current; ++_Length; return _Tmp; } - _NODISCARD constexpr counted_iterator operator+( - const iter_difference_t<_Iter> _Diff) const requires random_access_iterator<_Iter> { + _NODISCARD constexpr counted_iterator operator+(const iter_difference_t<_Iter> _Diff) const + requires random_access_iterator<_Iter> + { return counted_iterator{_Current + _Diff, static_cast>(_Length - _Diff)}; } _NODISCARD_FRIEND constexpr counted_iterator operator+( - const iter_difference_t<_Iter> _Diff, const counted_iterator& _Right) requires random_access_iterator<_Iter> { + const iter_difference_t<_Iter> _Diff, const counted_iterator& _Right) + requires random_access_iterator<_Iter> + { return counted_iterator{_Right._Current + _Diff, static_cast>(_Right._Length - _Diff)}; } - constexpr counted_iterator& operator+=( - const iter_difference_t<_Iter> _Diff) requires random_access_iterator<_Iter> { + constexpr counted_iterator& operator+=(const iter_difference_t<_Iter> _Diff) + requires random_access_iterator<_Iter> + { #if _ITERATOR_DEBUG_LEVEL != 0 _STL_VERIFY(_Diff <= _Length, "counted_iterator seek beyond end of range"); #endif // _ITERATOR_DEBUG_LEVEL != 0 @@ -1273,8 +1282,9 @@ public: return *this; } - _NODISCARD constexpr counted_iterator operator-( - const iter_difference_t<_Iter> _Diff) const requires random_access_iterator<_Iter> { + _NODISCARD constexpr counted_iterator operator-(const iter_difference_t<_Iter> _Diff) const + requires random_access_iterator<_Iter> + { return counted_iterator{_Current - _Diff, static_cast>(_Length + _Diff)}; } @@ -1297,8 +1307,9 @@ public: return _Right._Length; } - constexpr counted_iterator& operator-=( - const iter_difference_t<_Iter> _Diff) requires random_access_iterator<_Iter> { + constexpr counted_iterator& operator-=(const iter_difference_t<_Iter> _Diff) + requires random_access_iterator<_Iter> + { #if _ITERATOR_DEBUG_LEVEL != 0 _STL_VERIFY(-_Diff <= _Length, "counted_iterator decrement beyond end of range"); #endif // _ITERATOR_DEBUG_LEVEL != 0 @@ -1333,7 +1344,9 @@ public: // [counted.iter.cust] _NODISCARD_FRIEND constexpr iter_rvalue_reference_t<_Iter> iter_move(const counted_iterator& _Right) noexcept( - noexcept(_RANGES iter_move(_Right._Current))) requires input_iterator<_Iter> { + noexcept(_RANGES iter_move(_Right._Current))) + requires input_iterator<_Iter> + { return _RANGES iter_move(_Right._Current); } @@ -1388,38 +1401,32 @@ public: using _Prevent_inheriting_unwrap = counted_iterator; - // clang-format off - _NODISCARD constexpr counted_iterator<_Unwrapped_t> _Unwrapped() const& - noexcept(noexcept(counted_iterator<_Unwrapped_t>{_Current._Unwrapped(), _Length})) - requires _Unwrappable_v { - // clang-format on + _NODISCARD constexpr counted_iterator<_Unwrapped_t> _Unwrapped() const& noexcept( + noexcept(counted_iterator<_Unwrapped_t>{_Current._Unwrapped(), _Length})) + requires _Unwrappable_v + { return counted_iterator<_Unwrapped_t>{_Current._Unwrapped(), _Length}; } - // clang-format off - _NODISCARD constexpr counted_iterator<_Unwrapped_t<_Iter>> _Unwrapped() && - noexcept(noexcept(counted_iterator<_Unwrapped_t<_Iter>>{_STD move(_Current)._Unwrapped(), _Length})) - requires _Unwrappable_v<_Iter> { - // clang-format on + _NODISCARD constexpr counted_iterator<_Unwrapped_t<_Iter>> _Unwrapped() && noexcept( + noexcept(counted_iterator<_Unwrapped_t<_Iter>>{_STD move(_Current)._Unwrapped(), _Length})) + requires _Unwrappable_v<_Iter> + { return counted_iterator<_Unwrapped_t<_Iter>>{_STD move(_Current)._Unwrapped(), _Length}; } static constexpr bool _Unwrap_when_unverified = _Do_unwrap_when_unverified_v<_Iter>; - // clang-format off template requires _Wrapped_seekable_v<_Iter, const _Other&> constexpr void _Seek_to(const counted_iterator<_Other>& _It) { - // clang-format on _Current._Seek_to(_It.base()); _Length = _It.count(); } - // clang-format off template requires _Wrapped_seekable_v<_Iter, _Other> constexpr void _Seek_to(counted_iterator<_Other>&& _It) { - // clang-format on _Current._Seek_to(_STD move(_It).base()); _Length = _It.count(); } @@ -1429,11 +1436,9 @@ private: iter_difference_t<_Iter> _Length = 0; }; -// clang-format off template requires (!_Is_from_primary>) struct iterator_traits> : iterator_traits<_Iter> { - // clang-format on using pointer = conditional_t, add_pointer_t>, void>; }; #endif // __cpp_lib_concepts diff --git a/stl/inc/memory b/stl/inc/memory index 94ac50ab41..14dd1130dc 100644 --- a/stl/inc/memory +++ b/stl/inc/memory @@ -35,12 +35,10 @@ namespace ranges { public: using _Not_quite_object::_Not_quite_object; - // clang-format off template _Se, _No_throw_forward_iterator _Out, _No_throw_sentinel_for<_Out> _OSe> requires constructible_from, iter_reference_t<_It>> uninitialized_copy_result<_It, _Out> operator()(_It _First1, _Se _Last1, _Out _First2, _OSe _Last2) const { - // clang-format on _Adl_verify_range(_First1, _Last1); _Adl_verify_range(_First2, _Last2); auto _UResult = _Uninitialized_copy_unchecked(_Unwrap_iter<_Se>(_STD move(_First1)), @@ -52,12 +50,10 @@ namespace ranges { return {_STD move(_First1), _STD move(_First2)}; } - // clang-format off template requires constructible_from, range_reference_t<_Rng1>> uninitialized_copy_result, borrowed_iterator_t<_Rng2>> operator()( _Rng1&& _Range1, _Rng2&& _Range2) const { - // clang-format on auto _First1 = _RANGES begin(_Range1); auto _UResult = _Uninitialized_copy_unchecked( _Unwrap_range_iter<_Rng1>(_STD move(_First1)), _Uend(_Range1), _Ubegin(_Range2), _Uend(_Range2)); @@ -142,12 +138,10 @@ namespace ranges { public: using _Not_quite_object::_Not_quite_object; - // clang-format off template _OSe> requires constructible_from, iter_reference_t<_It>> uninitialized_copy_n_result<_It, _Out> operator()( _It _First1, iter_difference_t<_It> _Count, _Out _First2, _OSe _Last2) const { - // clang-format on if (_Count <= 0) { return {_STD move(_First1), _STD move(_First2)}; } @@ -206,12 +200,10 @@ namespace ranges { public: using _Not_quite_object::_Not_quite_object; - // clang-format off template _Se, _No_throw_forward_iterator _Out, _No_throw_sentinel_for<_Out> _OSe> requires constructible_from, iter_rvalue_reference_t<_It>> uninitialized_move_result<_It, _Out> operator()(_It _First1, _Se _Last1, _Out _First2, _OSe _Last2) const { - // clang-format on _Adl_verify_range(_First1, _Last1); _Adl_verify_range(_First2, _Last2); auto _UResult = _RANGES _Uninitialized_move_unchecked(_Unwrap_iter<_Se>(_STD move(_First1)), @@ -223,12 +215,10 @@ namespace ranges { return {_STD move(_First1), _STD move(_First2)}; } - // clang-format off template requires constructible_from, range_rvalue_reference_t<_Rng1>> uninitialized_move_result, borrowed_iterator_t<_Rng2>> operator()( _Rng1&& _Range1, _Rng2&& _Range2) const { - // clang-format on auto _First1 = _RANGES begin(_Range1); auto _UResult = _RANGES _Uninitialized_move_unchecked( _Unwrap_range_iter<_Rng1>(_STD move(_First1)), _Uend(_Range1), _Ubegin(_Range2), _Uend(_Range2)); @@ -281,12 +271,10 @@ namespace ranges { public: using _Not_quite_object::_Not_quite_object; - // clang-format off template _OSe> requires constructible_from, iter_rvalue_reference_t<_It>> uninitialized_move_n_result<_It, _Out> operator()( _It _First1, iter_difference_t<_It> _Count, _Out _First2, _OSe _Last2) const { - // clang-format on if (_Count <= 0) { return {_STD move(_First1), _STD move(_First2)}; } @@ -329,11 +317,9 @@ namespace ranges { public: using _Not_quite_object::_Not_quite_object; - // clang-format off template <_No_throw_forward_iterator _It, _No_throw_sentinel_for<_It> _Se, class _Ty> requires constructible_from, const _Ty&> _It operator()(_It _First, _Se _Last, const _Ty& _Val) const { - // clang-format on _Adl_verify_range(_First, _Last); auto _UResult = _Uninitialized_fill_unchecked( _Unwrap_iter<_Se>(_STD move(_First)), _Unwrap_sent<_It>(_STD move(_Last)), _Val); @@ -342,11 +328,9 @@ namespace ranges { return _First; } - // clang-format off template <_No_throw_forward_range _Rng, class _Ty> requires constructible_from, const _Ty&> borrowed_iterator_t<_Rng> operator()(_Rng&& _Range, const _Ty& _Val) const { - // clang-format on return _Rewrap_iterator(_Range, _Uninitialized_fill_unchecked(_Ubegin(_Range), _Uend(_Range), _Val)); } @@ -425,11 +409,9 @@ namespace ranges { public: using _Not_quite_object::_Not_quite_object; - // clang-format off template <_No_throw_forward_iterator _It, class _Ty> requires constructible_from, const _Ty&> _It operator()(_It _First, iter_difference_t<_It> _Count, const _Ty& _Val) const { - // clang-format on if (_Count <= 0) { return _First; } @@ -481,11 +463,9 @@ namespace ranges { _EXPORT_STD inline constexpr _Construct_at_fn construct_at{_Not_quite_object::_Construct_tag{}}; - // clang-format off template <_No_throw_input_iterator _It, _No_throw_sentinel_for<_It> _Se> requires destructible> _NODISCARD constexpr _It _Destroy_unchecked(_It _First, _Se _Last) noexcept; - // clang-format on class _Destroy_at_fn : private _Not_quite_object { public: @@ -515,11 +495,9 @@ _CONSTEXPR20 void destroy(const _NoThrowFwdIt _First, const _NoThrowFwdIt _Last) #ifdef __cpp_lib_concepts namespace ranges { - // clang-format off template <_No_throw_input_iterator _It, _No_throw_sentinel_for<_It> _Se> requires destructible> _NODISCARD constexpr _It _Destroy_unchecked(_It _First, _Se _Last) noexcept { - // clang-format on if constexpr (is_trivially_destructible_v>) { _RANGES advance(_First, _STD move(_Last)); } else { @@ -535,22 +513,18 @@ namespace ranges { public: using _Not_quite_object::_Not_quite_object; - // clang-format off template <_No_throw_input_iterator _It, _No_throw_sentinel_for<_It> _Se> requires destructible> constexpr _It operator()(_It _First, _Se _Last) const noexcept { - // clang-format on _Adl_verify_range(_First, _Last); _Seek_wrapped(_First, _RANGES _Destroy_unchecked(_Unwrap_iter<_Se>(_STD move(_First)), _Unwrap_sent<_It>(_STD move(_Last)))); return _First; } - // clang-format off template <_No_throw_input_range _Rng> requires destructible> constexpr borrowed_iterator_t<_Rng> operator()(_Rng&& _Range) const noexcept { - // clang-format on auto _First = _RANGES begin(_Range); _Seek_wrapped( _First, _RANGES _Destroy_unchecked(_Unwrap_range_iter<_Rng>(_STD move(_First)), _Uend(_Range))); @@ -589,11 +563,9 @@ namespace ranges { public: using _Not_quite_object::_Not_quite_object; - // clang-format off template <_No_throw_input_iterator _It> requires destructible> constexpr _It operator()(_It _First, const iter_difference_t<_It> _Count_raw) const noexcept { - // clang-format on _Algorithm_int_t> _Count = _Count_raw; if (_Count <= 0) { return _First; @@ -641,11 +613,9 @@ namespace ranges { public: using _Not_quite_object::_Not_quite_object; - // clang-format off template <_No_throw_forward_iterator _It, _No_throw_sentinel_for<_It> _Se> requires default_initializable> _It operator()(_It _First, _Se _Last) const { - // clang-format on _Adl_verify_range(_First, _Last); auto _UResult = _Uninitialized_default_construct_unchecked( _Unwrap_iter<_Se>(_STD move(_First)), _Unwrap_sent<_It>(_STD move(_Last))); @@ -654,11 +624,9 @@ namespace ranges { return _First; } - // clang-format off template <_No_throw_forward_range _Rng> requires default_initializable> borrowed_iterator_t<_Rng> operator()(_Rng&& _Range) const { - // clang-format on auto _UResult = _Uninitialized_default_construct_unchecked(_Ubegin(_Range), _Uend(_Range)); return _Rewrap_iterator(_Range, _STD move(_UResult)); @@ -721,11 +689,9 @@ namespace ranges { public: using _Not_quite_object::_Not_quite_object; - // clang-format off template <_No_throw_forward_iterator _It> requires default_initializable> _It operator()(_It _First, iter_difference_t<_It> _Count) const { - // clang-format on if (_Count <= 0) { return _First; } @@ -776,11 +742,9 @@ namespace ranges { public: using _Not_quite_object::_Not_quite_object; - // clang-format off template <_No_throw_forward_iterator _It, _No_throw_sentinel_for<_It> _Se> requires default_initializable> _It operator()(_It _First, _Se _Last) const { - // clang-format on _Adl_verify_range(_First, _Last); auto _UResult = _Uninitialized_value_construct_unchecked( _Unwrap_iter<_Se>(_STD move(_First)), _Unwrap_sent<_It>(_STD move(_Last))); @@ -789,11 +753,9 @@ namespace ranges { return _First; } - // clang-format off template <_No_throw_forward_range _Rng> requires default_initializable> borrowed_iterator_t<_Rng> operator()(_Rng&& _Range) const { - // clang-format on auto _UResult = _Uninitialized_value_construct_unchecked(_Ubegin(_Range), _Uend(_Range)); return _Rewrap_iterator(_Range, _STD move(_UResult)); @@ -843,11 +805,9 @@ namespace ranges { public: using _Not_quite_object::_Not_quite_object; - // clang-format off template <_No_throw_forward_iterator _It> requires default_initializable> _It operator()(_It _First, iter_difference_t<_It> _Count) const { - // clang-format on if (_Count <= 0) { return _First; } @@ -2102,7 +2062,7 @@ _NODISCARD _Refc* _Allocate_flexible_array(const size_t _Count) { #ifdef __cpp_aligned_new constexpr size_t _Align = alignof(_Refc); if constexpr (_Align > __STDCPP_DEFAULT_NEW_ALIGNMENT__) { - return static_cast<_Refc*>(::operator new (_Bytes, align_val_t{_Align})); + return static_cast<_Refc*>(::operator new(_Bytes, align_val_t{_Align})); } else #endif // __cpp_aligned_new { @@ -2115,7 +2075,7 @@ void _Deallocate_flexible_array(_Refc* const _Ptr) noexcept { #ifdef __cpp_aligned_new constexpr size_t _Align = alignof(_Refc); if constexpr (_Align > __STDCPP_DEFAULT_NEW_ALIGNMENT__) { - ::operator delete (static_cast(_Ptr), align_val_t{_Align}); + ::operator delete(static_cast(_Ptr), align_val_t{_Align}); } else #endif // __cpp_aligned_new { @@ -2558,8 +2518,8 @@ void _Uninitialized_fill_multidimensional_n_al(_Ty* const _Out, const size_t _Si } else if constexpr (_Fill_memset_is_safe<_Ty*, _Ty> && _Uses_default_construct<_Alloc, _Ty*, const _Ty&>::value) { _Fill_memset(_Out, _Val, _Size); } else { - if constexpr (_Fill_zero_memset_is_safe<_Ty*, - _Ty> && _Uses_default_construct<_Alloc, _Ty*, const _Ty&>::value) { + if constexpr (_Fill_zero_memset_is_safe<_Ty*, _Ty> + && _Uses_default_construct<_Alloc, _Ty*, const _Ty&>::value) { if (_Is_all_bits_zero(_Val)) { _Fill_zero_memset(_Out, _Size); return; @@ -3578,12 +3538,10 @@ _NODISCARD _CONSTEXPR23 bool operator<=(nullptr_t _Left, const unique_ptr<_Ty, _ } #ifdef __cpp_lib_concepts -// clang-format off _EXPORT_STD template requires three_way_comparable::pointer> _NODISCARD _CONSTEXPR23 compare_three_way_result_t::pointer> operator<=>( const unique_ptr<_Ty, _Dx>& _Left, nullptr_t) { - // clang-format on return _Left.get() <=> static_cast::pointer>(nullptr); } #endif // __cpp_lib_concepts @@ -4102,13 +4060,13 @@ struct _Pointer_of_helper<_Ty> { using type = typename _Ty::pointer; }; -// clang-format off template <_Has_member_element_type _Ty> requires (!_Has_member_pointer<_Ty>) struct _Pointer_of_helper<_Ty> { using type = typename _Ty::element_type*; }; +// clang-format off template requires (!_Has_member_element_type<_Ty> && !_Has_member_pointer<_Ty> && _Has_member_element_type>) @@ -4125,13 +4083,11 @@ struct _Pointer_of_or_helper { using type = _Uty; }; -// clang-format off template requires requires { typename _Pointer_of<_Ty>; } struct _Pointer_of_or_helper<_Ty, _Uty> { using type = _Pointer_of<_Ty>; }; -// clang-format on template using _Pointer_of_or = typename _Pointer_of_or_helper<_Ty, _Uty>::type; @@ -4139,8 +4095,8 @@ using _Pointer_of_or = typename _Pointer_of_or_helper<_Ty, _Uty>::type; // TRANSITION, requires expression support template concept _Resettable_pointer = requires(_SmartPtr& _Smart_ptr, _Pointer _Ptr, _ArgsT&&... _Args) { - _Smart_ptr.reset(static_cast<_Sp>(_Ptr), _STD forward<_ArgsT>(_Args)...); -}; + _Smart_ptr.reset(static_cast<_Sp>(_Ptr), _STD forward<_ArgsT>(_Args)...); + }; _EXPORT_STD template class out_ptr_t { @@ -4177,18 +4133,18 @@ public: return _STD addressof(_Get_ptr()); } - operator void**() const noexcept requires(!is_same_v<_Pointer, void*>) { + operator void**() const noexcept + requires (!is_same_v<_Pointer, void*>) + { static_assert(is_pointer_v<_Pointer>, "conversion of out_ptr_t to void** requires " "Pointer to be a raw pointer (N4892 [out.ptr.t]/13)"); return reinterpret_cast(_STD addressof(_Get_ptr())); } - // clang-format off private: _NODISCARD _Pointer& _Get_ptr() const noexcept { return const_cast<_Pointer&>(_Mypair._Myval2); } - // clang-format on _NODISCARD tuple<_ArgsT...>& _Get_args() noexcept { return _Mypair._Get_first(); @@ -4213,7 +4169,9 @@ class inout_ptr_t { "inout_ptr_t doesn't work with shared_ptr (N4892 [inout.ptr.t]/3)"); private: - _NODISCARD static auto _Get_ptr_from_smart(_SmartPtr& _Smart_ptr) noexcept requires is_pointer_v<_SmartPtr> { + _NODISCARD static auto _Get_ptr_from_smart(_SmartPtr& _Smart_ptr) noexcept + requires is_pointer_v<_SmartPtr> + { return _Smart_ptr; } @@ -4257,18 +4215,18 @@ public: return _STD addressof(_Get_ptr()); } - operator void**() const noexcept requires(!is_same_v<_Pointer, void*>) { + operator void**() const noexcept + requires (!is_same_v<_Pointer, void*>) + { static_assert(is_pointer_v<_Pointer>, "conversion of inout_ptr_t to void** requires " "Pointer to be a raw pointer (N4892 [inout.ptr.t]/15)"); return reinterpret_cast(_STD addressof(_Get_ptr())); } - // clang-format off private: _NODISCARD _Pointer& _Get_ptr() const noexcept { return const_cast<_Pointer&>(_Mypair._Myval2); } - // clang-format on _NODISCARD tuple<_ArgsT...>& _Get_args() noexcept { return _Mypair._Get_first(); @@ -4301,7 +4259,7 @@ namespace _DEPRECATE_TR1_NAMESPACE tr1 { using _STD static_pointer_cast; using _STD swap; using _STD weak_ptr; -} // namespace tr1 +} // namespace _DEPRECATE_TR1_NAMESPACE tr1 #endif // _HAS_TR1_NAMESPACE _STD_END diff --git a/stl/inc/memory_resource b/stl/inc/memory_resource index 90a6214ada..154063e539 100644 --- a/stl/inc/memory_resource +++ b/stl/inc/memory_resource @@ -74,7 +74,7 @@ namespace pmr { : public _Identity_equal_resource { // implementation for new_delete_resource with aligned new support void* do_allocate(const size_t _Bytes, const size_t _Align) override { if (_Align > __STDCPP_DEFAULT_NEW_ALIGNMENT__) { - return ::operator new (_Bytes, align_val_t{_Align}); + return ::operator new(_Bytes, align_val_t{_Align}); } return ::operator new(_Bytes); @@ -83,7 +83,7 @@ namespace pmr { void do_deallocate(void* const _Ptr, const size_t _Bytes, const size_t _Align) noexcept override /* strengthened */ { if (_Align > __STDCPP_DEFAULT_NEW_ALIGNMENT__) { - return ::operator delete (_Ptr, _Bytes, align_val_t{_Align}); + return ::operator delete(_Ptr, _Bytes, align_val_t{_Align}); } ::operator delete(_Ptr, _Bytes); diff --git a/stl/inc/new b/stl/inc/new index d697a4e9f1..fc9357adc4 100644 --- a/stl/inc/new +++ b/stl/inc/new @@ -84,7 +84,9 @@ _EXPORT_STD class bad_array_new_length; #endif // ^^^ !_HAS_EXCEPTIONS ^^^ #if _HAS_CXX20 -_EXPORT_STD struct destroying_delete_t { explicit destroying_delete_t() = default; }; +_EXPORT_STD struct destroying_delete_t { + explicit destroying_delete_t() = default; +}; _EXPORT_STD inline constexpr destroying_delete_t destroying_delete{}; #endif // _HAS_CXX20 diff --git a/stl/inc/optional b/stl/inc/optional index 49173c22cd..6b88502722 100644 --- a/stl/inc/optional +++ b/stl/inc/optional @@ -620,8 +620,8 @@ _NODISCARD constexpr bool operator==(const optional<_Ty1>& _Left, const optional noexcept(_Fake_copy_init(*_Left == *_Right))) /* strengthened */ #ifdef __cpp_lib_concepts requires requires { - { *_Left == *_Right } -> _Implicitly_convertible_to; -} + { *_Left == *_Right } -> _Implicitly_convertible_to; + } #endif // __cpp_lib_concepts { const bool _Left_has_value = _Left.has_value(); @@ -637,8 +637,8 @@ _NODISCARD constexpr bool operator!=(const optional<_Ty1>& _Left, const optional noexcept(_Fake_copy_init(*_Left != *_Right))) /* strengthened */ #ifdef __cpp_lib_concepts requires requires { - { *_Left != *_Right } -> _Implicitly_convertible_to; -} + { *_Left != *_Right } -> _Implicitly_convertible_to; + } #endif // __cpp_lib_concepts { const bool _Left_has_value = _Left.has_value(); @@ -654,8 +654,8 @@ _NODISCARD constexpr bool operator<(const optional<_Ty1>& _Left, const optional< noexcept(_Fake_copy_init(*_Left < *_Right))) /* strengthened */ #ifdef __cpp_lib_concepts requires requires { - { *_Left < *_Right } -> _Implicitly_convertible_to; -} + { *_Left < *_Right } -> _Implicitly_convertible_to; + } #endif // __cpp_lib_concepts { const bool _Left_has_value = _Left.has_value(); @@ -671,8 +671,8 @@ _NODISCARD constexpr bool operator>(const optional<_Ty1>& _Left, const optional< noexcept(_Fake_copy_init(*_Left > *_Right))) /* strengthened */ #ifdef __cpp_lib_concepts requires requires { - { *_Left > *_Right } -> _Implicitly_convertible_to; -} + { *_Left > *_Right } -> _Implicitly_convertible_to; + } #endif // __cpp_lib_concepts { const bool _Left_has_value = _Left.has_value(); @@ -688,8 +688,8 @@ _NODISCARD constexpr bool operator<=(const optional<_Ty1>& _Left, const optional noexcept(_Fake_copy_init(*_Left <= *_Right))) /* strengthened */ #ifdef __cpp_lib_concepts requires requires(const _Ty1& _Elem1, const _Ty2& _Elem2) { - { *_Left <= *_Right } -> _Implicitly_convertible_to; -} + { *_Left <= *_Right } -> _Implicitly_convertible_to; + } #endif // __cpp_lib_concepts { const bool _Left_has_value = _Left.has_value(); @@ -705,8 +705,8 @@ _NODISCARD constexpr bool operator>=(const optional<_Ty1>& _Left, const optional noexcept(_Fake_copy_init(*_Left >= *_Right))) /* strengthened */ #ifdef __cpp_lib_concepts requires requires { - { *_Left >= *_Right } -> _Implicitly_convertible_to; -} + { *_Left >= *_Right } -> _Implicitly_convertible_to; + } #endif // __cpp_lib_concepts { const bool _Left_has_value = _Left.has_value(); diff --git a/stl/inc/random b/stl/inc/random index 7e933b23a0..b3242c798b 100644 --- a/stl/inc/random +++ b/stl/inc/random @@ -54,11 +54,10 @@ _STD_BEGIN _RNG_PROHIBIT_CHAR(_CheckedType) template -using _Enable_if_seed_seq_t = enable_if_t< - !is_convertible_v, - typename _Self:: - result_type> && !is_same_v, _Self> && !is_same_v, _Engine>, - int>; +using _Enable_if_seed_seq_t = + enable_if_t, typename _Self::result_type> + && !is_same_v, _Self> && !is_same_v, _Engine>, + int>; _INLINE_VAR constexpr long double _Pi = 3.14159265358979323846264338327950288L; _INLINE_VAR constexpr long double _Exp1 = 2.71828182845904523536028747135266250L; @@ -5028,7 +5027,7 @@ namespace _DEPRECATE_TR1_NAMESPACE tr1 { using _STD uniform_int_distribution; using _STD uniform_real_distribution; using _STD weibull_distribution; -} // namespace tr1 +} // namespace _DEPRECATE_TR1_NAMESPACE tr1 _STL_RESTORE_DEPRECATED_WARNING #endif // _HAS_TR1_NAMESPACE _STD_END diff --git a/stl/inc/ranges b/stl/inc/ranges index d922bbae01..c6889745c0 100644 --- a/stl/inc/ranges +++ b/stl/inc/ranges @@ -73,10 +73,12 @@ namespace ranges { template _Ty* _Derived_from_range_adaptor_closure(_Base<_Ty>&); // not defined + // clang-format off template - concept _Range_adaptor_closure_object = !range> && requires(remove_cvref_t<_Ty> & __t) { + concept _Range_adaptor_closure_object = !range> && requires(remove_cvref_t<_Ty>& __t) { { _Pipe::_Derived_from_range_adaptor_closure(__t) } -> same_as*>; }; + // clang-format on template struct _Pipeline : _Base<_Pipeline<_ClosureLeft, _ClosureRight>> { @@ -93,54 +95,58 @@ namespace ranges { template _NODISCARD constexpr auto operator()(_Ty&& _Val) & noexcept( - noexcept(_Right(_Left(_STD forward<_Ty>(_Val))))) requires requires { - _Right(_Left(_STD forward<_Ty>(_Val))); + noexcept(_Right(_Left(_STD forward<_Ty>(_Val))))) + requires requires { _Right(_Left(_STD forward<_Ty>(_Val))); } + { + return _Right(_Left(_STD forward<_Ty>(_Val))); } - { return _Right(_Left(_STD forward<_Ty>(_Val))); } template _NODISCARD constexpr auto operator()(_Ty&& _Val) const& noexcept( - noexcept(_Right(_Left(_STD forward<_Ty>(_Val))))) requires requires { - _Right(_Left(_STD forward<_Ty>(_Val))); + noexcept(_Right(_Left(_STD forward<_Ty>(_Val))))) + requires requires { _Right(_Left(_STD forward<_Ty>(_Val))); } + { + return _Right(_Left(_STD forward<_Ty>(_Val))); } - { return _Right(_Left(_STD forward<_Ty>(_Val))); } template _NODISCARD constexpr auto operator()(_Ty&& _Val) && noexcept( - noexcept(_STD move(_Right)(_STD move(_Left)(_STD forward<_Ty>(_Val))))) requires requires { - _STD move(_Right)(_STD move(_Left)(_STD forward<_Ty>(_Val))); + noexcept(_STD move(_Right)(_STD move(_Left)(_STD forward<_Ty>(_Val))))) + requires requires { _STD move(_Right)(_STD move(_Left)(_STD forward<_Ty>(_Val))); } + { + return _STD move(_Right)(_STD move(_Left)(_STD forward<_Ty>(_Val))); } - { return _STD move(_Right)(_STD move(_Left)(_STD forward<_Ty>(_Val))); } template _NODISCARD constexpr auto operator()(_Ty&& _Val) const&& noexcept( - noexcept(_STD move(_Right)(_STD move(_Left)(_STD forward<_Ty>(_Val))))) requires requires { - _STD move(_Right)(_STD move(_Left)(_STD forward<_Ty>(_Val))); + noexcept(_STD move(_Right)(_STD move(_Left)(_STD forward<_Ty>(_Val))))) + requires requires { _STD move(_Right)(_STD move(_Left)(_STD forward<_Ty>(_Val))); } + { + return _STD move(_Right)(_STD move(_Left)(_STD forward<_Ty>(_Val))); } - { return _STD move(_Right)(_STD move(_Left)(_STD forward<_Ty>(_Val))); } }; template _Pipeline(_Ty1, _Ty2) -> _Pipeline<_Ty1, _Ty2>; _EXPORT_STD template - requires _Range_adaptor_closure_object<_Left> // - && _Range_adaptor_closure_object<_Right> // - && constructible_from, _Left> // - && constructible_from, _Right> // - _NODISCARD constexpr auto operator|(_Left&& __l, _Right&& __r) noexcept( - noexcept(_Pipeline{static_cast<_Left&&>(__l), static_cast<_Right&&>(__r)})) { + requires _Range_adaptor_closure_object<_Left> // + && _Range_adaptor_closure_object<_Right> // + && constructible_from, _Left> // + && constructible_from, _Right> // + _NODISCARD constexpr auto operator|(_Left&& __l, _Right&& __r) noexcept( + noexcept(_Pipeline{static_cast<_Left&&>(__l), static_cast<_Right&&>(__r)})) { return _Pipeline{static_cast<_Left&&>(__l), static_cast<_Right&&>(__r)}; } _EXPORT_STD template - requires _Range_adaptor_closure_object<_Right> && range<_Left> // - _NODISCARD constexpr auto operator|(_Left&& __l, _Right&& __r) noexcept( - noexcept(_STD forward<_Right>(__r)(_STD forward<_Left>(__l)))) // - requires requires { - static_cast<_Right&&>(__r)(static_cast<_Left&&>(__l)); + requires (_Range_adaptor_closure_object<_Right> && range<_Left>) + _NODISCARD constexpr auto operator|(_Left&& __l, _Right&& __r) noexcept( + noexcept(_STD forward<_Right>(__r)(_STD forward<_Left>(__l)))) + requires requires { static_cast<_Right&&>(__r)(static_cast<_Left&&>(__l)); } + { + return _STD forward<_Right>(__r)(_STD forward<_Left>(__l)); } - { return _STD forward<_Right>(__r)(_STD forward<_Left>(__l)); } } // namespace _Pipe template @@ -244,7 +250,8 @@ namespace ranges { template <_Valid_movable_box_object _Ty> class _Movable_box { public: - constexpr _Movable_box() noexcept(is_nothrow_default_constructible_v<_Ty>) requires default_initializable<_Ty> + constexpr _Movable_box() noexcept(is_nothrow_default_constructible_v<_Ty>) + requires default_initializable<_Ty> : _Val(), _Engaged{true} {} template @@ -288,7 +295,8 @@ namespace ranges { constexpr _Movable_box& operator=(const _Movable_box& _That) noexcept( is_nothrow_copy_constructible_v<_Ty>&& is_nothrow_copy_assignable_v<_Ty>) // strengthened - requires copyable<_Ty> { + requires copyable<_Ty> + { if (_Engaged) { if (_That._Engaged) { _Val = _That._Val; @@ -308,8 +316,9 @@ namespace ranges { return *this; } - constexpr _Movable_box& operator=(const _Movable_box& _That) noexcept( - is_nothrow_copy_constructible_v<_Ty>) requires copy_constructible<_Ty> { + constexpr _Movable_box& operator=(const _Movable_box& _That) noexcept(is_nothrow_copy_constructible_v<_Ty>) + requires copy_constructible<_Ty> + { if (_STD addressof(_That) == this) { return *this; } @@ -334,7 +343,8 @@ namespace ranges { constexpr _Movable_box& operator=(_Movable_box&& _That) noexcept( is_nothrow_move_constructible_v<_Ty>&& is_nothrow_move_assignable_v<_Ty>) // strengthened - requires movable<_Ty> { + requires movable<_Ty> + { if (_Engaged) { if (_That._Engaged) { _Val = _STD move(_That._Val); @@ -424,7 +434,9 @@ namespace ranges { _Movable_box& operator=(_Movable_box&&) requires movable<_Ty> = default; // clang-format on - constexpr _Movable_box& operator=(const _Movable_box& _That) noexcept requires copy_constructible<_Ty> { + constexpr _Movable_box& operator=(const _Movable_box& _That) noexcept + requires copy_constructible<_Ty> + { if (_STD addressof(_That) != this) { _Val.~_Ty(); _Construct_in_place(_Val, _That._Val); @@ -476,7 +488,9 @@ namespace ranges { requires copy_constructible<_Ty> && is_trivially_copy_constructible_v<_Ty> = default; // clang-format on - constexpr _Defaultabox(const _Defaultabox& _That) requires copy_constructible<_Ty> : _Engaged{_That._Engaged} { + constexpr _Defaultabox(const _Defaultabox& _That) + requires copy_constructible<_Ty> + : _Engaged{_That._Engaged} { if (_That._Engaged) { _Construct_in_place(_Val, _That._Val); } @@ -515,7 +529,8 @@ namespace ranges { constexpr _Defaultabox& operator=(const _Defaultabox& _That) noexcept( is_nothrow_copy_constructible_v<_Ty>&& is_nothrow_copy_assignable_v<_Ty>) // strengthened - requires copyable<_Ty> { + requires copyable<_Ty> + { if (_Engaged) { if (_That._Engaged) { _Val = _That._Val; @@ -573,7 +588,9 @@ namespace ranges { } constexpr _Defaultabox& operator=(const _Ty& _That) noexcept( - is_nothrow_copy_constructible_v<_Ty>&& is_nothrow_copy_assignable_v<_Ty>) requires copyable<_Ty> { + is_nothrow_copy_constructible_v<_Ty>&& is_nothrow_copy_assignable_v<_Ty>) + requires copyable<_Ty> + { if (_Engaged) { _Val = _That; } else { @@ -638,8 +655,9 @@ namespace ranges { } } - constexpr _Defaultabox& operator=(const _Ty& _Right) noexcept( - is_nothrow_copy_assignable_v<_Ty>) requires copyable<_Ty> { + constexpr _Defaultabox& operator=(const _Ty& _Right) noexcept(is_nothrow_copy_assignable_v<_Ty>) + requires copyable<_Ty> + { _Value = _Right; return *this; } @@ -721,7 +739,9 @@ namespace ranges { return *this; } - _NODISCARD constexpr explicit operator bool() const noexcept requires _Needs_operator_bool { + _NODISCARD constexpr explicit operator bool() const noexcept + requires _Needs_operator_bool + { return _Engaged; } @@ -797,8 +817,7 @@ namespace ranges { #if _HAS_CXX23 _EXPORT_STD template requires is_class_v<_Derived> && same_as<_Derived, remove_cv_t<_Derived>> - class range_adaptor_closure : public _Pipe::_Base<_Derived> { - }; + class range_adaptor_closure : public _Pipe::_Base<_Derived> {}; #endif // _HAS_CXX23 template @@ -813,13 +832,11 @@ namespace ranges { _STL_INTERNAL_STATIC_ASSERT((same_as, _Types> && ...)); _STL_INTERNAL_STATIC_ASSERT(is_empty_v<_Fn>&& is_default_constructible_v<_Fn>); - // clang-format off template requires (same_as, _Types> && ...) constexpr explicit _Range_closure(_UTypes&&... _Args) noexcept( conjunction_v...>) : _Captures(_STD forward<_UTypes>(_Args)...) {} - // clang-format on void operator()(auto&&) & = delete; void operator()(auto&&) const& = delete; @@ -908,7 +925,8 @@ namespace ranges { // clang-format on constexpr explicit single_view(const _Ty& _Val_) noexcept(is_nothrow_copy_constructible_v<_Ty>) // strengthened - requires copy_constructible<_Ty> : _Val{in_place, _Val_} {} + requires copy_constructible<_Ty> + : _Val{in_place, _Val_} {} constexpr explicit single_view(_Ty&& _Val_) noexcept(is_nothrow_move_constructible_v<_Ty>) // strengthened : _Val{in_place, _STD move(_Val_)} {} @@ -1039,27 +1057,28 @@ namespace ranges { } } - constexpr _Ioterator& operator--() noexcept( - noexcept(--_Current)) /* strengthened */ requires _Decrementable<_Wi> { + constexpr _Ioterator& operator--() noexcept(noexcept(--_Current)) /* strengthened */ + requires _Decrementable<_Wi> + { --_Current; return *this; } - constexpr _Ioterator operator--(int) noexcept(is_nothrow_copy_constructible_v<_Wi>&& noexcept( - --_Current)) /* strengthened */ requires _Decrementable<_Wi> { + constexpr _Ioterator operator--(int) noexcept( + is_nothrow_copy_constructible_v<_Wi>&& noexcept(--_Current)) /* strengthened */ + requires _Decrementable<_Wi> + { auto _Tmp = *this; --_Current; return _Tmp; } #if !defined(__clang__) && !defined(__EDG__) // TRANSITION, DevCom-1347136 - // clang-format off private: template static constexpr bool _Nothrow_plus_equal = noexcept(_STD declval<_Left&>() += _STD declval()); template <_Integer_like _Left, class _Right> static constexpr bool _Nothrow_plus_equal<_Left, _Right> = true; - // clang-format on template static constexpr bool _Nothrow_minus_equal = noexcept(_STD declval<_Left&>() -= _STD declval()); @@ -1075,7 +1094,8 @@ namespace ranges { #else // ^^^ no workaround / workaround vvv noexcept(_Nothrow_plus_equal<_Wi, difference_type>) /* strengthened */ #endif // TRANSITION, DevCom-1347136 - requires _Advanceable<_Wi> { + requires _Advanceable<_Wi> + { if constexpr (_Integer_like<_Wi>) { if constexpr (_Signed_integer_like<_Wi>) { _Current = static_cast<_Wi>(_Current + _Off); @@ -1098,7 +1118,8 @@ namespace ranges { #else // ^^^ no workaround / workaround vvv noexcept(_Nothrow_minus_equal<_Wi, difference_type>) /* strengthened */ #endif // TRANSITION, DevCom-1347136 - requires _Advanceable<_Wi> { + requires _Advanceable<_Wi> + { if constexpr (_Integer_like<_Wi>) { if constexpr (_Signed_integer_like<_Wi>) { _Current = static_cast<_Wi>(_Current - _Off); @@ -1116,7 +1137,9 @@ namespace ranges { } _NODISCARD constexpr _Wi operator[](const difference_type _Idx) const - noexcept(noexcept(static_cast<_Wi>(_Current + _Idx))) /* strengthened */ requires _Advanceable<_Wi> { + noexcept(noexcept(static_cast<_Wi>(_Current + _Idx))) /* strengthened */ + requires _Advanceable<_Wi> + { if constexpr (_Integer_like<_Wi>) { return static_cast<_Wi>(_Current + static_cast<_Wi>(_Idx)); } else { @@ -1125,54 +1148,70 @@ namespace ranges { } _NODISCARD_FRIEND constexpr bool operator==(const _Ioterator& _Left, const _Ioterator& _Right) noexcept( - noexcept(_Left._Current == _Right._Current)) requires equality_comparable<_Wi> { + noexcept(_Left._Current == _Right._Current)) + requires equality_comparable<_Wi> + { return _Left._Current == _Right._Current; } _NODISCARD_FRIEND constexpr bool operator<(const _Ioterator& _Left, const _Ioterator& _Right) noexcept( - noexcept(_Left._Current < _Right._Current)) /* strengthened */ requires totally_ordered<_Wi> { + noexcept(_Left._Current < _Right._Current)) /* strengthened */ + requires totally_ordered<_Wi> + { return _Left._Current < _Right._Current; } _NODISCARD_FRIEND constexpr bool operator>(const _Ioterator& _Left, const _Ioterator& _Right) noexcept( - noexcept(_Right._Current < _Left._Current)) /* strengthened */ requires totally_ordered<_Wi> { + noexcept(_Right._Current < _Left._Current)) /* strengthened */ + requires totally_ordered<_Wi> + { return _Right._Current < _Left._Current; } _NODISCARD_FRIEND constexpr bool operator<=(const _Ioterator& _Left, const _Ioterator& _Right) noexcept( - noexcept(!(_Right._Current < _Left._Current))) /* strengthened */ requires totally_ordered<_Wi> { + noexcept(!(_Right._Current < _Left._Current))) /* strengthened */ + requires totally_ordered<_Wi> + { return !(_Right._Current < _Left._Current); } _NODISCARD_FRIEND constexpr bool operator>=(const _Ioterator& _Left, const _Ioterator& _Right) noexcept( - noexcept(!(_Left._Current < _Right._Current))) /* strengthened */ requires totally_ordered<_Wi> { + noexcept(!(_Left._Current < _Right._Current))) /* strengthened */ + requires totally_ordered<_Wi> + { return !(_Left._Current < _Right._Current); } _NODISCARD_FRIEND constexpr auto operator<=>(const _Ioterator& _Left, const _Ioterator& _Right) noexcept( - noexcept(_Left._Current <=> _Right._Current)) requires totally_ordered<_Wi> && three_way_comparable<_Wi> { + noexcept(_Left._Current <=> _Right._Current)) + requires totally_ordered<_Wi> && three_way_comparable<_Wi> + { return _Left._Current <=> _Right._Current; } _NODISCARD_FRIEND constexpr _Ioterator operator+(_Ioterator _It, const difference_type _Off) noexcept( - is_nothrow_move_constructible_v<_Ioterator>&& noexcept( - _It += _Off)) /* strengthened */ requires _Advanceable<_Wi> { + is_nothrow_move_constructible_v<_Ioterator>&& noexcept(_It += _Off)) /* strengthened */ + requires _Advanceable<_Wi> + { _It += _Off; return _It; } _NODISCARD_FRIEND constexpr _Ioterator operator+(const difference_type _Off, _Ioterator _It) noexcept( - is_nothrow_move_constructible_v<_Wi>&& noexcept( - static_cast<_Wi>(_It._Current + _Off))) /* strengthened */ requires _Advanceable<_Wi> { + is_nothrow_move_constructible_v<_Wi>&& noexcept(static_cast<_Wi>(_It._Current + _Off))) /* strengthened */ + requires _Advanceable<_Wi> + { return _Ioterator{static_cast<_Wi>(_It._Current + _Off)}; } _NODISCARD_FRIEND constexpr _Ioterator operator-(_Ioterator _It, const difference_type _Off) noexcept( - is_nothrow_move_constructible_v<_Ioterator>&& noexcept( - _It -= _Off)) /* strengthened */ requires _Advanceable<_Wi> { + is_nothrow_move_constructible_v<_Ioterator>&& noexcept(_It -= _Off)) /* strengthened */ + requires _Advanceable<_Wi> + { _It -= _Off; return _It; } - _NODISCARD_FRIEND constexpr difference_type - operator-(const _Ioterator& _Left, const _Ioterator& _Right) noexcept( - noexcept(_Left._Current - _Right._Current)) /* strengthened */ requires _Advanceable<_Wi> { + _NODISCARD_FRIEND constexpr difference_type operator-(const _Ioterator& _Left, + const _Ioterator& _Right) noexcept(noexcept(_Left._Current - _Right._Current)) /* strengthened */ + requires _Advanceable<_Wi> + { if constexpr (_Integer_like<_Wi>) { if constexpr (_Signed_integer_like<_Wi>) { return static_cast( @@ -1214,12 +1253,16 @@ namespace ranges { } _NODISCARD_FRIEND constexpr iter_difference_t<_Wi> operator-(const _It& _Left, const _Iotinel& _Right) noexcept( - noexcept(_Right._Delta(_Left))) /* strengthened */ requires sized_sentinel_for<_Bo, _Wi> { + noexcept(_Right._Delta(_Left))) /* strengthened */ + requires sized_sentinel_for<_Bo, _Wi> + { return -_Right._Delta(_Left); } _NODISCARD_FRIEND constexpr iter_difference_t<_Wi> operator-(const _Iotinel& _Left, const _It& _Right) noexcept( - noexcept(_Left._Delta(_Right))) /* strengthened */ requires sized_sentinel_for<_Bo, _Wi> { + noexcept(_Left._Delta(_Right))) /* strengthened */ + requires sized_sentinel_for<_Bo, _Wi> + { return _Left._Delta(_Right); } }; @@ -1314,26 +1357,26 @@ namespace ranges { struct _Iota_fn { template _NODISCARD constexpr auto operator()(_Ty&& _Val) const - noexcept(noexcept(iota_view(static_cast<_Ty&&>(_Val)))) requires requires { - iota_view(static_cast<_Ty&&>(_Val)); + noexcept(noexcept(iota_view(static_cast<_Ty&&>(_Val)))) + requires requires { iota_view(static_cast<_Ty&&>(_Val)); } + { + return iota_view(static_cast<_Ty&&>(_Val)); } - { return iota_view(static_cast<_Ty&&>(_Val)); } template - _NODISCARD constexpr auto operator()(_Ty1&& _Val1, _Ty2&& _Val2) const noexcept( - noexcept(iota_view(static_cast<_Ty1&&>(_Val1), static_cast<_Ty2&&>(_Val2)))) requires requires { - iota_view(static_cast<_Ty1&&>(_Val1), static_cast<_Ty2&&>(_Val2)); + _NODISCARD constexpr auto operator()(_Ty1&& _Val1, _Ty2&& _Val2) const + noexcept(noexcept(iota_view(static_cast<_Ty1&&>(_Val1), static_cast<_Ty2&&>(_Val2)))) + requires requires { iota_view(static_cast<_Ty1&&>(_Val1), static_cast<_Ty2&&>(_Val2)); } + { + return iota_view(static_cast<_Ty1&&>(_Val1), static_cast<_Ty2&&>(_Val2)); } - { return iota_view(static_cast<_Ty1&&>(_Val1), static_cast<_Ty2&&>(_Val2)); } }; _EXPORT_STD inline constexpr _Iota_fn iota; } // namespace views template - concept _Stream_extractable = requires(basic_istream<_Elem, _Traits>& __is, _Ty& __t) { - __is >> __t; - }; + concept _Stream_extractable = requires(basic_istream<_Elem, _Traits>& __is, _Ty& __t) { __is >> __t; }; _EXPORT_STD template > requires default_initializable<_Ty> && _Stream_extractable<_Ty, _Elem, _Traits> @@ -1414,13 +1457,11 @@ namespace ranges { namespace views { template struct _Istream_fn { - // clang-format off template requires derived_from<_StreamTy, basic_istream> _NODISCARD constexpr auto operator()(_StreamTy& _Stream) const noexcept(is_nothrow_default_constructible_v<_Ty>) /* strengthened */ { - // clang-format on return basic_istream_view<_Ty, typename _StreamTy::char_type, typename _StreamTy::traits_type>(_Stream); } }; @@ -1462,17 +1503,20 @@ namespace ranges { } _NODISCARD constexpr bool empty() const noexcept(noexcept(_RANGES empty(*_Range))) /* strengthened */ - requires _Can_empty<_Rng> { + requires _Can_empty<_Rng> + { return _RANGES empty(*_Range); } _NODISCARD constexpr auto size() const noexcept(noexcept(_RANGES size(*_Range))) /* strengthened */ - requires sized_range<_Rng> { + requires sized_range<_Rng> + { return _RANGES size(*_Range); } _NODISCARD constexpr auto data() const noexcept(noexcept(_RANGES data(*_Range))) /* strengthened */ - requires contiguous_range<_Rng> { + requires contiguous_range<_Rng> + { return _RANGES data(*_Range); } }; @@ -1483,11 +1527,9 @@ namespace ranges { template inline constexpr bool enable_borrowed_range> = true; - // clang-format off _EXPORT_STD template requires (movable<_Rng> && !_Is_initializer_list<_Rng>) class owning_view : public view_interface> { - // clang-format on private: _Rng _Range{}; @@ -1523,40 +1565,48 @@ namespace ranges { return _RANGES end(_Range); } - _NODISCARD constexpr auto begin() const - noexcept(noexcept(_RANGES begin(_Range))) /* strengthened */ requires range { + _NODISCARD constexpr auto begin() const noexcept(noexcept(_RANGES begin(_Range))) /* strengthened */ + requires range + { return _RANGES begin(_Range); } - _NODISCARD constexpr auto end() const - noexcept(noexcept(_RANGES end(_Range))) /* strengthened */ requires range { + _NODISCARD constexpr auto end() const noexcept(noexcept(_RANGES end(_Range))) /* strengthened */ + requires range + { return _RANGES end(_Range); } _NODISCARD constexpr bool empty() noexcept(noexcept(_RANGES empty(_Range))) /* strengthened */ - requires _Can_empty<_Rng> { + requires _Can_empty<_Rng> + { return _RANGES empty(_Range); } _NODISCARD constexpr bool empty() const noexcept(noexcept(_RANGES empty(_Range))) /* strengthened */ - requires _Can_empty { + requires _Can_empty + { return _RANGES empty(_Range); } _NODISCARD constexpr auto size() noexcept(noexcept(_RANGES size(_Range))) /* strengthened */ - requires sized_range<_Rng> { + requires sized_range<_Rng> + { return _RANGES size(_Range); } _NODISCARD constexpr auto size() const noexcept(noexcept(_RANGES size(_Range))) /* strengthened */ - requires sized_range { + requires sized_range + { return _RANGES size(_Range); } _NODISCARD constexpr auto data() noexcept(noexcept(_RANGES data(_Range))) /* strengthened */ - requires contiguous_range<_Rng> { + requires contiguous_range<_Rng> + { return _RANGES data(_Range); } _NODISCARD constexpr auto data() const noexcept(noexcept(_RANGES data(_Range))) /* strengthened */ - requires contiguous_range { + requires contiguous_range + { return _RANGES data(_Range); } }; @@ -1566,14 +1616,10 @@ namespace ranges { namespace views { template - concept _Can_ref_view = requires(_Rng&& __r) { - ref_view{static_cast<_Rng&&>(__r)}; - }; + concept _Can_ref_view = requires(_Rng&& __r) { ref_view{static_cast<_Rng&&>(__r)}; }; template - concept _Ownable = requires(_Rng&& __r) { - owning_view{static_cast<_Rng&&>(__r)}; - }; + concept _Ownable = requires(_Rng&& __r) { owning_view{static_cast<_Rng&&>(__r)}; }; class _All_fn : public _Pipe::_Base<_All_fn> { private: @@ -1598,11 +1644,9 @@ namespace ranges { static constexpr _Choice_t<_St> _Choice = _Choose<_Rng>(); public: - // clang-format off template requires (_Choice<_Rng>._Strategy != _St::_None) _NODISCARD constexpr auto operator()(_Rng&& _Range) const noexcept(_Choice<_Rng>._No_throw) { - // clang-format on constexpr _St _Strat = _Choice<_Rng>._Strategy; if constexpr (_Strat == _St::_View) { @@ -1645,7 +1689,8 @@ namespace ranges { : _Range(_STD move(_Range_)) {} _NODISCARD constexpr _Vw base() const& noexcept(is_nothrow_copy_constructible_v<_Vw>) // strengthened - requires copy_constructible<_Vw> { + requires copy_constructible<_Vw> + { return _Range; } @@ -1654,17 +1699,20 @@ namespace ranges { } _NODISCARD constexpr auto begin() noexcept(noexcept(move_iterator{_RANGES begin(_Range)})) // strengthened - requires(!_Simple_view<_Vw>) { + requires (!_Simple_view<_Vw>) + { return move_iterator{_RANGES begin(_Range)}; } _NODISCARD constexpr auto begin() const noexcept(noexcept(move_iterator{_RANGES begin(_Range)})) // strengthened - requires range { + requires range + { return move_iterator{_RANGES begin(_Range)}; } _NODISCARD constexpr auto end() noexcept(_Is_end_nothrow_v<_Vw>) // strengthened - requires(!_Simple_view<_Vw>) { + requires (!_Simple_view<_Vw>) + { if constexpr (common_range<_Vw>) { return move_iterator{_RANGES end(_Range)}; } else { @@ -1673,7 +1721,8 @@ namespace ranges { } _NODISCARD constexpr auto end() const noexcept(_Is_end_nothrow_v) // strengthened - requires range { + requires range + { if constexpr (common_range) { return move_iterator{_RANGES end(_Range)}; } else { @@ -1682,12 +1731,14 @@ namespace ranges { } _NODISCARD constexpr auto size() noexcept(noexcept(_RANGES size(_Range))) // strengthened - requires sized_range<_Vw> { + requires sized_range<_Vw> + { return _RANGES size(_Range); } _NODISCARD constexpr auto size() const noexcept(noexcept(_RANGES size(_Range))) // strengthened - requires sized_range { + requires sized_range + { return _RANGES size(_Range); } }; @@ -1700,9 +1751,7 @@ namespace ranges { namespace views { template - concept _Can_as_rvalue = requires(_Rng&& __r) { - as_rvalue_view{static_cast<_Rng&&>(__r)}; - }; + concept _Can_as_rvalue = requires(_Rng&& __r) { as_rvalue_view{static_cast<_Rng&&>(__r)}; }; class _As_rvalue_fn : public _Pipe::_Base<_As_rvalue_fn> { private: @@ -1724,7 +1773,7 @@ namespace ranges { public: template - requires(_Choice<_Rng>._Strategy != _St::_None) + requires (_Choice<_Rng>._Strategy != _St::_None) _NODISCARD constexpr auto operator()(_Rng&& _Range) const noexcept(_Choice<_Rng>._No_throw) { constexpr _St _Strat = _Choice<_Rng>._Strategy; if constexpr (_Strat == _St::_All) { @@ -1840,7 +1889,9 @@ namespace ranges { } } - constexpr _Iterator& operator--() requires bidirectional_range<_Vw> { + constexpr _Iterator& operator--() + requires bidirectional_range<_Vw> + { #if _ITERATOR_DEBUG_LEVEL != 0 _STL_VERIFY(_Parent != nullptr, "cannot decrement value-initialized filter_view iterator"); #endif // _ITERATOR_DEBUG_LEVEL != 0 @@ -1854,14 +1905,17 @@ namespace ranges { return *this; } - constexpr _Iterator operator--(int) requires bidirectional_range<_Vw> { + constexpr _Iterator operator--(int) + requires bidirectional_range<_Vw> + { auto _Tmp = *this; --*this; return _Tmp; } - _NODISCARD_FRIEND constexpr bool operator==( - const _Iterator& _Left, const _Iterator& _Right) requires equality_comparable> { + _NODISCARD_FRIEND constexpr bool operator==(const _Iterator& _Left, const _Iterator& _Right) + requires equality_comparable> + { #if _ITERATOR_DEBUG_LEVEL != 0 _STL_VERIFY( _Left._Parent == _Right._Parent, "cannot compare incompatible filter_view iterators for equality"); @@ -1877,8 +1931,10 @@ namespace ranges { return _RANGES iter_move(_It._Current); } - friend constexpr void iter_swap(const _Iterator& _Left, const _Iterator& _Right) noexcept(noexcept( - _RANGES iter_swap(_Left._Current, _Right._Current))) requires indirectly_swappable> { + friend constexpr void iter_swap(const _Iterator& _Left, const _Iterator& _Right) noexcept( + noexcept(_RANGES iter_swap(_Left._Current, _Right._Current))) + requires indirectly_swappable> + { #if _ITERATOR_DEBUG_LEVEL != 0 _Left._Check_dereference(); _Right._Check_dereference(); @@ -1923,8 +1979,9 @@ namespace ranges { is_nothrow_move_constructible_v<_Vw>&& is_nothrow_move_constructible_v<_Pr>) // strengthened : _Range(_STD move(_Range_)), _Pred{in_place, _STD move(_Pred_)} {} - _NODISCARD constexpr _Vw base() const& noexcept( - is_nothrow_copy_constructible_v<_Vw>) /* strengthened */ requires copy_constructible<_Vw> { + _NODISCARD constexpr _Vw base() const& noexcept(is_nothrow_copy_constructible_v<_Vw>) /* strengthened */ + requires copy_constructible<_Vw> + { return _Range; } _NODISCARD constexpr _Vw base() && noexcept(is_nothrow_move_constructible_v<_Vw>) /* strengthened */ { @@ -1981,12 +2038,10 @@ namespace ranges { return filter_view(_STD forward<_Rng>(_Range), _STD forward<_Pr>(_Pred)); } - // clang-format off template requires constructible_from, _Pr> _NODISCARD constexpr auto operator()(_Pr&& _Pred) const noexcept(is_nothrow_constructible_v, _Pr>) { - // clang-format on return _Range_closure<_Filter_fn, decay_t<_Pr>>{_STD forward<_Pr>(_Pred)}; } }; @@ -2127,8 +2182,9 @@ namespace ranges { } } - constexpr _Iterator& operator--() noexcept( - noexcept(--_Current)) /* strengthened */ requires bidirectional_range<_Base> { + constexpr _Iterator& operator--() noexcept(noexcept(--_Current)) /* strengthened */ + requires bidirectional_range<_Base> + { #if _ITERATOR_DEBUG_LEVEL != 0 _STL_VERIFY(_Parent != nullptr, "Cannot decrement value-initialized transform_view iterator"); if constexpr (forward_range<_Vw>) { @@ -2141,13 +2197,16 @@ namespace ranges { } constexpr _Iterator operator--(int) noexcept( noexcept(--_Current) && is_nothrow_copy_constructible_v>) /* strengthened */ - requires bidirectional_range<_Base> { + requires bidirectional_range<_Base> + { auto _Tmp = *this; --*this; return _Tmp; } - constexpr void _Verify_offset(const difference_type _Off) const requires random_access_range<_Base> { + constexpr void _Verify_offset(const difference_type _Off) const + requires random_access_range<_Base> + { #if _ITERATOR_DEBUG_LEVEL == 0 (void) _Off; #else // ^^^ _ITERATOR_DEBUG_LEVEL == 0 / _ITERATOR_DEBUG_LEVEL != 0 vvv @@ -2165,8 +2224,8 @@ namespace ranges { if constexpr (sized_sentinel_for, iterator_t<_Base>>) { _STL_VERIFY(_Off <= _RANGES end(_Parent->_Range) - _Current, "cannot seek transform_view iterator after end"); - } else if constexpr (sized_sentinel_for, - iterator_t<_Base>> && sized_range<_Base>) { + } else if constexpr (sized_sentinel_for, iterator_t<_Base>> + && sized_range<_Base>) { const auto _Size = _RANGES distance(_Parent->_Range); _STL_VERIFY(_Off <= _Size - (_Current - _RANGES begin(_Parent->_Range)), "cannot seek transform_view iterator after end"); @@ -2177,7 +2236,9 @@ namespace ranges { } constexpr _Iterator& operator+=(const difference_type _Off) - _NOEXCEPT_IDL0(noexcept(_Current += _Off)) /* strengthened */ requires random_access_range<_Base> { + _NOEXCEPT_IDL0(noexcept(_Current += _Off)) /* strengthened */ + requires random_access_range<_Base> + { #if _ITERATOR_DEBUG_LEVEL != 0 _Verify_offset(_Off); #endif // _ITERATOR_DEBUG_LEVEL != 0 @@ -2185,7 +2246,9 @@ namespace ranges { return *this; } constexpr _Iterator& operator-=(const difference_type _Off) - _NOEXCEPT_IDL0(noexcept(_Current -= _Off)) /* strengthened */ requires random_access_range<_Base> { + _NOEXCEPT_IDL0(noexcept(_Current -= _Off)) /* strengthened */ + requires random_access_range<_Base> + { #if _ITERATOR_DEBUG_LEVEL != 0 _Verify_offset(-_Off); #endif // _ITERATOR_DEBUG_LEVEL != 0 @@ -2195,7 +2258,8 @@ namespace ranges { _NODISCARD constexpr decltype(auto) operator[](const difference_type _Idx) const _NOEXCEPT_IDL0(noexcept(_STD invoke(*_Parent->_Fun, _Current[_Idx]))) /* strengthened */ - requires random_access_range<_Base> { + requires random_access_range<_Base> + { #if _ITERATOR_DEBUG_LEVEL != 0 _Verify_offset(_Idx); _STL_VERIFY( @@ -2205,8 +2269,9 @@ namespace ranges { } _NODISCARD_FRIEND constexpr bool operator==(const _Iterator& _Left, const _Iterator& _Right) noexcept( - noexcept(_Left._Current - == _Right._Current)) /* strengthened */ requires equality_comparable> { + noexcept(_Left._Current == _Right._Current)) /* strengthened */ + requires equality_comparable> + { #if _ITERATOR_DEBUG_LEVEL != 0 _Left._Same_range(_Right); #endif // _ITERATOR_DEBUG_LEVEL != 0 @@ -2214,22 +2279,30 @@ namespace ranges { } _NODISCARD_FRIEND constexpr bool operator<(const _Iterator& _Left, const _Iterator& _Right) noexcept( - noexcept(_Left._Current < _Right._Current)) /* strengthened */ requires random_access_range<_Base> { + noexcept(_Left._Current < _Right._Current)) /* strengthened */ + requires random_access_range<_Base> + { #if _ITERATOR_DEBUG_LEVEL != 0 _Left._Same_range(_Right); #endif // _ITERATOR_DEBUG_LEVEL != 0 return _Left._Current < _Right._Current; } _NODISCARD_FRIEND constexpr bool operator>(const _Iterator& _Left, const _Iterator& _Right) noexcept( - noexcept(_Left._Current < _Right._Current)) /* strengthened */ requires random_access_range<_Base> { + noexcept(_Left._Current < _Right._Current)) /* strengthened */ + requires random_access_range<_Base> + { return _Right < _Left; } _NODISCARD_FRIEND constexpr bool operator<=(const _Iterator& _Left, const _Iterator& _Right) noexcept( - noexcept(_Left._Current < _Right._Current)) /* strengthened */ requires random_access_range<_Base> { + noexcept(_Left._Current < _Right._Current)) /* strengthened */ + requires random_access_range<_Base> + { return !(_Right < _Left); } _NODISCARD_FRIEND constexpr bool operator>=(const _Iterator& _Left, const _Iterator& _Right) noexcept( - noexcept(_Left._Current < _Right._Current)) /* strengthened */ requires random_access_range<_Base> { + noexcept(_Left._Current < _Right._Current)) /* strengthened */ + requires random_access_range<_Base> + { return !(_Left < _Right); } // clang-format off @@ -2244,7 +2317,9 @@ namespace ranges { } _NODISCARD_FRIEND constexpr _Iterator operator+(_Iterator _It, difference_type _Off) - _NOEXCEPT_IDL0(noexcept(_It._Current += _Off)) /* strengthened */ requires random_access_range<_Base> { + _NOEXCEPT_IDL0(noexcept(_It._Current += _Off)) /* strengthened */ + requires random_access_range<_Base> + { #if _ITERATOR_DEBUG_LEVEL != 0 _It._Verify_offset(_Off); #endif // _ITERATOR_DEBUG_LEVEL != 0 @@ -2252,7 +2327,9 @@ namespace ranges { return _It; } _NODISCARD_FRIEND constexpr _Iterator operator+(difference_type _Off, _Iterator _It) - _NOEXCEPT_IDL0(noexcept(_It._Current += _Off)) /* strengthened */ requires random_access_range<_Base> { + _NOEXCEPT_IDL0(noexcept(_It._Current += _Off)) /* strengthened */ + requires random_access_range<_Base> + { #if _ITERATOR_DEBUG_LEVEL != 0 _It._Verify_offset(_Off); #endif // _ITERATOR_DEBUG_LEVEL != 0 @@ -2261,7 +2338,9 @@ namespace ranges { } _NODISCARD_FRIEND constexpr _Iterator operator-(_Iterator _It, difference_type _Off) - _NOEXCEPT_IDL0(noexcept(_It._Current -= _Off)) /* strengthened */ requires random_access_range<_Base> { + _NOEXCEPT_IDL0(noexcept(_It._Current -= _Off)) /* strengthened */ + requires random_access_range<_Base> + { #if _ITERATOR_DEBUG_LEVEL != 0 _It._Verify_offset(-_Off); #endif // _ITERATOR_DEBUG_LEVEL != 0 @@ -2271,7 +2350,8 @@ namespace ranges { _NODISCARD_FRIEND constexpr difference_type operator-(const _Iterator& _Left, const _Iterator& _Right) noexcept(noexcept(_Left._Current - _Right._Current)) /* strengthened */ - requires sized_sentinel_for, iterator_t<_Base>> { + requires sized_sentinel_for, iterator_t<_Base>> + { #if _ITERATOR_DEBUG_LEVEL != 0 _Left._Same_range(_Right); #endif // _ITERATOR_DEBUG_LEVEL != 0 @@ -2320,7 +2400,6 @@ namespace ranges { return _Last; } - // clang-format off template requires sentinel_for, _Maybe_const_iter<_OtherConst>> _NODISCARD_FRIEND constexpr bool operator==(const _Iterator<_OtherConst>& _Left, @@ -2328,6 +2407,7 @@ namespace ranges { return _Get_current(_Left) == _Right._Last; } + // clang-format off template requires sized_sentinel_for, _Maybe_const_iter<_OtherConst>> _NODISCARD_FRIEND constexpr range_difference_t<_Maybe_const<_OtherConst, _Vw>> @@ -2335,6 +2415,7 @@ namespace ranges { noexcept(_Get_current(_Left) - _Right._Last)) /* strengthened */ { return _Get_current(_Left) - _Right._Last; } + // clang-format on template requires sized_sentinel_for, _Maybe_const_iter<_OtherConst>> @@ -2346,6 +2427,7 @@ namespace ranges { }; public: + // clang-format off transform_view() requires default_initializable<_Vw> && default_initializable<_Fn> = default; // clang-format on @@ -2353,8 +2435,9 @@ namespace ranges { is_nothrow_move_constructible_v<_Vw>&& is_nothrow_move_constructible_v<_Fn>) // strengthened : _Range(_STD move(_Range_)), _Fun{in_place, _STD move(_Fun_)} {} - _NODISCARD constexpr _Vw base() const& noexcept( - is_nothrow_copy_constructible_v<_Vw>) /* strengthened */ requires copy_constructible<_Vw> { + _NODISCARD constexpr _Vw base() const& noexcept(is_nothrow_copy_constructible_v<_Vw>) /* strengthened */ + requires copy_constructible<_Vw> + { return _Range; } _NODISCARD constexpr _Vw base() && noexcept(is_nothrow_move_constructible_v<_Vw>) /* strengthened */ { @@ -2407,12 +2490,14 @@ namespace ranges { } } - _NODISCARD constexpr auto size() noexcept( - noexcept(_RANGES size(_Range))) /* strengthened */ requires sized_range<_Vw> { + _NODISCARD constexpr auto size() noexcept(noexcept(_RANGES size(_Range))) /* strengthened */ + requires sized_range<_Vw> + { return _RANGES size(_Range); } - _NODISCARD constexpr auto size() const - noexcept(noexcept(_RANGES size(_Range))) /* strengthened */ requires sized_range { + _NODISCARD constexpr auto size() const noexcept(noexcept(_RANGES size(_Range))) /* strengthened */ + requires sized_range + { return _RANGES size(_Range); } }; @@ -2434,12 +2519,10 @@ namespace ranges { return transform_view(_STD forward<_Rng>(_Range), _STD move(_Fun)); } - // clang-format off template requires constructible_from, _Fn> _NODISCARD constexpr auto operator()(_Fn&& _Fun) const noexcept(is_nothrow_constructible_v, _Fn>) { - // clang-format on return _Range_closure<_Transform_fn, decay_t<_Fn>>{_STD forward<_Fn>(_Fun)}; } }; @@ -2491,12 +2574,10 @@ namespace ranges { return _Left.count() == 0 || _Left.base() == _Right._Last; } - // clang-format off template requires sentinel_for<_Base_sentinel, _Base_iterator<_OtherConst>> _NODISCARD_FRIEND constexpr bool operator==( const _Counted_iter<_OtherConst>& _Left, const _Sentinel& _Right) { - // clang-format on return _Left.count() == 0 || _Left.base() == _Right._Last; } @@ -2519,10 +2600,14 @@ namespace ranges { static constexpr bool _Unwrap_when_unverified = _Do_unwrap_when_unverified_v>; - constexpr void _Seek_to(const _Sentinel<_Const, false>& _That) requires _Wrapped { + constexpr void _Seek_to(const _Sentinel<_Const, false>& _That) + requires _Wrapped + { _Seek_wrapped(_Last, _That._Last); } - constexpr void _Seek_to(_Sentinel<_Const, false>&& _That) requires _Wrapped { + constexpr void _Seek_to(_Sentinel<_Const, false>&& _That) + requires _Wrapped + { _Seek_wrapped(_Last, _STD move(_That._Last)); } }; @@ -2536,8 +2621,9 @@ namespace ranges { is_nothrow_move_constructible_v<_Vw>) // strengthened : _Range(_STD move(_Range_)), _Count{_Count_} {} - _NODISCARD constexpr _Vw base() const& noexcept( - is_nothrow_copy_constructible_v<_Vw>) /* strengthened */ requires copy_constructible<_Vw> { + _NODISCARD constexpr _Vw base() const& noexcept(is_nothrow_copy_constructible_v<_Vw>) /* strengthened */ + requires copy_constructible<_Vw> + { return _Range; } _NODISCARD constexpr _Vw base() && noexcept(is_nothrow_move_constructible_v<_Vw>) /* strengthened */ { @@ -2559,7 +2645,9 @@ namespace ranges { } } - _NODISCARD constexpr auto begin() const requires range { + _NODISCARD constexpr auto begin() const + requires range + { if constexpr (sized_range) { if constexpr (random_access_range) { return _RANGES begin(_Range); @@ -2586,7 +2674,9 @@ namespace ranges { } } - _NODISCARD constexpr auto end() const requires range { + _NODISCARD constexpr auto end() const + requires range + { if constexpr (sized_range) { if constexpr (random_access_range) { return _RANGES begin(_Range) + static_cast>(size()); @@ -2598,12 +2688,16 @@ namespace ranges { } } - _NODISCARD constexpr auto size() requires sized_range<_Vw> { + _NODISCARD constexpr auto size() + requires sized_range<_Vw> + { const auto _Length = _RANGES size(_Range); return (_STD min)(_Length, static_cast(_Count)); } - _NODISCARD constexpr auto size() const requires sized_range { + _NODISCARD constexpr auto size() const + requires sized_range + { const auto _Length = _RANGES size(_Range); return (_STD min)(_Length, static_cast(_Count)); } @@ -2691,12 +2785,10 @@ namespace ranges { } } - // clang-format off template requires constructible_from, _Ty> _NODISCARD constexpr auto operator()(_Ty&& _Length) const - noexcept(is_nothrow_constructible_v, _Ty>) { - // clang-format on + noexcept(is_nothrow_constructible_v, _Ty>) { return _Range_closure<_Take_fn, decay_t<_Ty>>{_STD forward<_Ty>(_Length)}; } }; @@ -2750,12 +2842,10 @@ namespace ranges { return _Right._Last == _Left || !_STD invoke(*_Right._Pred, *_Left); } - // clang-format off template requires sentinel_for<_Base_sentinel, _Maybe_const_iter<_OtherConst>> _NODISCARD_FRIEND constexpr bool operator==( const _Maybe_const_iter<_OtherConst>& _Left, const _Sentinel& _Right) { - // clang-format on return _Right._Last == _Left || !_STD invoke(*_Right._Pred, *_Left); } @@ -2778,10 +2868,14 @@ namespace ranges { static constexpr bool _Unwrap_when_unverified = _Do_unwrap_when_unverified_v>; - constexpr void _Seek_to(const _Sentinel<_Const, false>& _That) requires _Wrapped { + constexpr void _Seek_to(const _Sentinel<_Const, false>& _That) + requires _Wrapped + { _Seek_wrapped(_Last, _That._Last); } - constexpr void _Seek_to(_Sentinel<_Const, false>&& _That) requires _Wrapped { + constexpr void _Seek_to(_Sentinel<_Const, false>&& _That) + requires _Wrapped + { _Seek_wrapped(_Last, _STD move(_That._Last)); } }; @@ -2795,8 +2889,9 @@ namespace ranges { is_nothrow_move_constructible_v<_Vw>&& is_nothrow_move_constructible_v<_Pr>) // strengthened : _Range(_STD move(_Range_)), _Pred{in_place, _STD move(_Pred_)} {} - _NODISCARD constexpr _Vw base() const& noexcept( - is_nothrow_copy_constructible_v<_Vw>) /* strengthened */ requires copy_constructible<_Vw> { + _NODISCARD constexpr _Vw base() const& noexcept(is_nothrow_copy_constructible_v<_Vw>) /* strengthened */ + requires copy_constructible<_Vw> + { return _Range; } _NODISCARD constexpr _Vw base() && noexcept(is_nothrow_move_constructible_v<_Vw>) /* strengthened */ { @@ -2855,17 +2950,16 @@ namespace ranges { struct _Take_while_fn { template _NODISCARD constexpr auto operator()(_Rng&& _Range, _Pr _Pred) const - noexcept(noexcept(take_while_view(_STD forward<_Rng>(_Range), _STD move(_Pred)))) requires requires { - take_while_view(static_cast<_Rng&&>(_Range), _STD move(_Pred)); + noexcept(noexcept(take_while_view(_STD forward<_Rng>(_Range), _STD move(_Pred)))) + requires requires { take_while_view(static_cast<_Rng&&>(_Range), _STD move(_Pred)); } + { + return take_while_view(_STD forward<_Rng>(_Range), _STD move(_Pred)); } - { return take_while_view(_STD forward<_Rng>(_Range), _STD move(_Pred)); } - // clang-format off template requires constructible_from, _Pr> _NODISCARD constexpr auto operator()(_Pr&& _Pred) const noexcept(is_nothrow_constructible_v, _Pr>) { - // clang-format on return _Range_closure<_Take_while_fn, decay_t<_Pr>>{_STD forward<_Pr>(_Pred)}; } }; @@ -2919,8 +3013,9 @@ namespace ranges { #endif // _CONTAINER_DEBUG_LEVEL > 0 } - _NODISCARD constexpr _Vw base() const& noexcept( - is_nothrow_copy_constructible_v<_Vw>) /* strengthened */ requires copy_constructible<_Vw> { + _NODISCARD constexpr _Vw base() const& noexcept(is_nothrow_copy_constructible_v<_Vw>) /* strengthened */ + requires copy_constructible<_Vw> + { return _Range; } _NODISCARD constexpr _Vw base() && noexcept(is_nothrow_move_constructible_v<_Vw>) /* strengthened */ { @@ -2963,11 +3058,15 @@ namespace ranges { return _RANGES end(_Range); } - _NODISCARD constexpr auto end() const requires range { + _NODISCARD constexpr auto end() const + requires range + { return _RANGES end(_Range); } - _NODISCARD constexpr auto size() requires sized_range<_Vw> { + _NODISCARD constexpr auto size() + requires sized_range<_Vw> + { const auto _Size = _RANGES size(_Range); const auto _Count_as_size = static_cast>(_Count); if (_Size < _Count_as_size) { @@ -2977,7 +3076,9 @@ namespace ranges { } } - _NODISCARD constexpr auto size() const requires sized_range { + _NODISCARD constexpr auto size() const + requires sized_range + { const auto _Size = _RANGES size(_Range); const auto _Count_as_size = static_cast>(_Count); if (_Size < _Count_as_size) { @@ -3063,12 +3164,10 @@ namespace ranges { } } - // clang-format off template requires constructible_from, _Ty> _NODISCARD constexpr auto operator()(_Ty&& _Length) const noexcept(is_nothrow_constructible_v, _Ty>) { - // clang-format on return _Range_closure<_Drop_fn, decay_t<_Ty>>{_STD forward<_Ty>(_Length)}; } }; @@ -3092,8 +3191,9 @@ namespace ranges { is_nothrow_move_constructible_v<_Vw>&& is_nothrow_move_constructible_v<_Pr>) // strengthened : _Range(_STD move(_Range_)), _Pred{in_place, _STD move(_Pred_)} {} - _NODISCARD constexpr _Vw base() const& noexcept( - is_nothrow_copy_constructible_v<_Vw>) /* strengthened */ requires copy_constructible<_Vw> { + _NODISCARD constexpr _Vw base() const& noexcept(is_nothrow_copy_constructible_v<_Vw>) /* strengthened */ + requires copy_constructible<_Vw> + { return _Range; } _NODISCARD constexpr _Vw base() && noexcept(is_nothrow_move_constructible_v<_Vw>) /* strengthened */ { @@ -3141,17 +3241,16 @@ namespace ranges { struct _Drop_while_fn { template _NODISCARD constexpr auto operator()(_Rng&& _Range, _Pr _Pred) const - noexcept(noexcept(drop_while_view(_STD forward<_Rng>(_Range), _STD move(_Pred)))) requires requires { - drop_while_view(static_cast<_Rng&&>(_Range), _STD move(_Pred)); + noexcept(noexcept(drop_while_view(_STD forward<_Rng>(_Range), _STD move(_Pred)))) + requires requires { drop_while_view(static_cast<_Rng&&>(_Range), _STD move(_Pred)); } + { + return drop_while_view(_STD forward<_Rng>(_Range), _STD move(_Pred)); } - { return drop_while_view(_STD forward<_Rng>(_Range), _STD move(_Pred)); } - // clang-format off template requires constructible_from, _Pr> _NODISCARD constexpr auto operator()(_Pr&& _Pred) const noexcept(is_nothrow_constructible_v, _Pr>) { - // clang-format on return _Range_closure<_Drop_while_fn, decay_t<_Pr>>{_STD forward<_Pr>(_Pred)}; } }; @@ -3218,11 +3317,11 @@ namespace ranges { template struct _Category_base<_Outer, _Inner, true> { using iterator_category = - conditional_t // - && derived_from<_Iter_cat_t>, bidirectional_iterator_tag> // + conditional_t + && derived_from<_Iter_cat_t>, bidirectional_iterator_tag> && derived_from<_Iter_cat_t>, bidirectional_iterator_tag>, bidirectional_iterator_tag, - conditional_t>, forward_iterator_tag> // + conditional_t>, forward_iterator_tag> && derived_from<_Iter_cat_t>, forward_iterator_tag>, forward_iterator_tag, input_iterator_tag>>; }; @@ -3314,12 +3413,10 @@ namespace ranges { _Satisfy(); } - // clang-format off constexpr _Iterator(_Iterator _It) requires _Const && convertible_to, _OuterIter> - && convertible_to>, _InnerIter> + && convertible_to>, _InnerIter> : _Outer{_STD move(_It._Outer)}, _Inner{_STD move(_It._Inner)}, _Parent{_It._Parent} {} - // clang-format on _NODISCARD constexpr decltype(auto) operator*() const noexcept(noexcept(**_Inner)) /* strengthened */ { #if _ITERATOR_DEBUG_LEVEL != 0 @@ -3460,12 +3557,12 @@ namespace ranges { noexcept(is_nothrow_constructible_v, sentinel_t<_Vw>>) // strengthened requires _Const && convertible_to, sentinel_t<_Base>> : _Last(_STD move(_Se._Last)) {} + // clang-format on template requires sentinel_for, _Maybe_const_iter<_OtherConst>> _NODISCARD_FRIEND constexpr bool operator==(const _Iterator<_OtherConst>& _Left, const _Sentinel& _Right) noexcept(noexcept(_Right._Equal(_Left))) /* strengthened */ { - // clang-format on return _Right._Equal(_Left); } }; @@ -3478,8 +3575,9 @@ namespace ranges { constexpr explicit join_view(_Vw _Range_) noexcept(is_nothrow_move_constructible_v<_Vw>) // strengthened : _Range(_STD move(_Range_)) {} - _NODISCARD constexpr _Vw base() const& noexcept( - is_nothrow_copy_constructible_v<_Vw>) /* strengthened */ requires copy_constructible<_Vw> { + _NODISCARD constexpr _Vw base() const& noexcept(is_nothrow_copy_constructible_v<_Vw>) /* strengthened */ + requires copy_constructible<_Vw> + { return _Range; } _NODISCARD constexpr _Vw base() && noexcept(is_nothrow_move_constructible_v<_Vw>) /* strengthened */ { @@ -3491,15 +3589,13 @@ namespace ranges { return _Iterator<_Use_const>{*this, _RANGES begin(_Range)}; } - // clang-format off _NODISCARD constexpr _Iterator begin() const - #ifdef __clang__ // TRANSITION, LLVM-47414 +#ifdef __clang__ // TRANSITION, LLVM-47414 requires _Can_const_join<_Vw> - #else // ^^^ workaround / no workaround vvv +#else // ^^^ workaround / no workaround vvv requires input_range && is_reference_v<_InnerRng> - #endif // TRANSITION, LLVM-47414 +#endif // TRANSITION, LLVM-47414 { - // clang-format on return _Iterator{*this, _RANGES begin(_Range)}; } @@ -3552,8 +3648,9 @@ namespace ranges { #if _HAS_CXX23 template - concept _Compatible_joinable_ranges = common_with, range_value_t<_Pat>> // - && common_reference_with, range_reference_t<_Pat>> // + concept _Compatible_joinable_ranges = + common_with, range_value_t<_Pat>> + && common_reference_with, range_reference_t<_Pat>> && common_reference_with, range_rvalue_reference_t<_Pat>>; template // TRANSITION, LLVM-47414 @@ -3561,8 +3658,8 @@ namespace ranges { input_range && forward_range && is_reference_v>; _EXPORT_STD template - requires view<_Vw> && input_range> && view<_Pat> // - && _Compatible_joinable_ranges, _Pat> + requires view<_Vw> && input_range> && view<_Pat> + && _Compatible_joinable_ranges, _Pat> class join_with_view; template @@ -3583,12 +3680,11 @@ namespace ranges { template requires is_reference_v> - class _Join_with_view_base<_Vw, _Pat> : public view_interface> { - }; + class _Join_with_view_base<_Vw, _Pat> : public view_interface> {}; _EXPORT_STD template - requires view<_Vw> && input_range> && view<_Pat> // - && _Compatible_joinable_ranges, _Pat> + requires view<_Vw> && input_range> && view<_Pat> + && _Compatible_joinable_ranges, _Pat> class join_with_view : public _Join_with_view_base<_Vw, _Pat> { private: template @@ -3604,8 +3700,8 @@ namespace ranges { struct _Category_base {}; template - requires forward_range<_Maybe_const<_Const, _Vw>> && forward_range<_InnerRng<_Const>> // - && is_reference_v<_InnerRng<_Const>> + requires forward_range<_Maybe_const<_Const, _Vw>> && forward_range<_InnerRng<_Const>> + && is_reference_v<_InnerRng<_Const>> struct _Category_base<_Const> { using _Outer = _Maybe_const<_Const, _Vw>; using _Inner = _InnerRng<_Const>; @@ -3614,13 +3710,13 @@ namespace ranges { using iterator_category = conditional_t< !is_lvalue_reference_v, range_reference_t<_PatternBase>>>, input_iterator_tag, - conditional_t && common_range<_PatternBase> // - && derived_from<_Iter_cat_t>, bidirectional_iterator_tag> // - && derived_from<_Iter_cat_t>, bidirectional_iterator_tag> // + conditional_t && common_range<_PatternBase> + && derived_from<_Iter_cat_t>, bidirectional_iterator_tag> + && derived_from<_Iter_cat_t>, bidirectional_iterator_tag> && derived_from<_Iter_cat_t>, bidirectional_iterator_tag>, bidirectional_iterator_tag, - conditional_t>, forward_iterator_tag> // - && derived_from<_Iter_cat_t>, forward_iterator_tag> // + conditional_t>, forward_iterator_tag> + && derived_from<_Iter_cat_t>, forward_iterator_tag> && derived_from<_Iter_cat_t>, forward_iterator_tag>, forward_iterator_tag, input_iterator_tag>>>; }; @@ -3725,10 +3821,11 @@ namespace ranges { _Iterator() requires default_initializable<_OuterIter> = default; // clang-format on - constexpr _Iterator(_Iterator _It) requires _Const // - && convertible_to, _OuterIter> // - && convertible_to>, _InnerIter> // - && convertible_to, _PatternIter> // + constexpr _Iterator(_Iterator _It) + requires _Const // + && convertible_to, _OuterIter> // + && convertible_to>, _InnerIter> // + && convertible_to, _PatternIter> // : _Outer_it{_STD move(_It._Outer_it)}, _Parent{_It._Parent} { switch (_It._Inner_it._Contains) { case _Variantish_state::_Holds_first: @@ -3766,15 +3863,18 @@ namespace ranges { ++*this; } - constexpr _Iterator operator++(int) requires _Deref_is_glvalue - && forward_iterator<_OuterIter> && forward_iterator<_InnerIter> { + constexpr _Iterator operator++(int) + requires _Deref_is_glvalue && forward_iterator<_OuterIter> && forward_iterator<_InnerIter> + { auto _Tmp = *this; ++*this; return _Tmp; } - constexpr _Iterator& operator--() requires _Deref_is_glvalue && bidirectional_range<_Base> // - && _Bidi_common_range<_InnerRng<_Const>> && _Bidi_common_range<_PatternBase> { + constexpr _Iterator& operator--() + requires _Deref_is_glvalue && bidirectional_range<_Base> // + && _Bidi_common_range<_InnerRng<_Const>> && _Bidi_common_range<_PatternBase> + { if (_Outer_it == _RANGES end(_Parent->_Range)) { --_Outer_it; auto&& _Inner = *_Outer_it; @@ -3817,16 +3917,18 @@ namespace ranges { return *this; } - constexpr _Iterator operator--(int) requires _Deref_is_glvalue && bidirectional_range<_Base> // - && _Bidi_common_range<_InnerRng<_Const>> && _Bidi_common_range<_PatternBase> { + constexpr _Iterator operator--(int) + requires _Deref_is_glvalue && bidirectional_range<_Base> // + && _Bidi_common_range<_InnerRng<_Const>> && _Bidi_common_range<_PatternBase> + { auto _Tmp = *this; --*this; return _Tmp; } - _NODISCARD_FRIEND constexpr bool operator==( - const _Iterator& _Left, const _Iterator& _Right) requires _Deref_is_glvalue - && equality_comparable<_OuterIter> && equality_comparable<_InnerIter> { + _NODISCARD_FRIEND constexpr bool operator==(const _Iterator& _Left, const _Iterator& _Right) + requires _Deref_is_glvalue && equality_comparable<_OuterIter> && equality_comparable<_InnerIter> + { if (_Left._Outer_it != _Right._Outer_it) { return false; } @@ -3853,8 +3955,9 @@ namespace ranges { return _It._Visit_inner_it<_Rvalue_ref>(_RANGES iter_move); } - friend constexpr void iter_swap(const _Iterator& _Left, - const _Iterator& _Right) requires indirectly_swappable<_InnerIter, _PatternIter> { + friend constexpr void iter_swap(const _Iterator& _Left, const _Iterator& _Right) + requires indirectly_swappable<_InnerIter, _PatternIter> + { switch (_Left._Inner_it._Contains) { case _Variantish_state::_Holds_first: switch (_Right._Inner_it._Contains) { @@ -3912,13 +4015,13 @@ namespace ranges { constexpr _Sentinel(_Sentinel _Se) noexcept( is_nothrow_constructible_v, sentinel_t<_Vw>>) // strengthened - requires _Const && convertible_to, sentinel_t<_Base>> // + requires _Const && convertible_to, sentinel_t<_Base>> : _Last{_STD move(_Se._Last)} {} template - requires sentinel_for, iterator_t<_Maybe_const<_OtherConst, _Vw>>> - _NODISCARD_FRIEND constexpr bool operator==(const _Iterator<_OtherConst>& _Left, - const _Sentinel& _Right) noexcept(noexcept(_Right._Equal(_Left))) /* strengthened */ { + requires sentinel_for, iterator_t<_Maybe_const<_OtherConst, _Vw>>> + _NODISCARD_FRIEND constexpr bool operator==(const _Iterator<_OtherConst>& _Left, + const _Sentinel& _Right) noexcept(noexcept(_Right._Equal(_Left))) /* strengthened */ { return _Right._Equal(_Left); } }; @@ -3933,15 +4036,16 @@ namespace ranges { : _Range{_STD move(_Range_)}, _Pattern{_STD move(_Pattern_)} {} template - requires constructible_from<_Vw, views::all_t<_Rng>> && constructible_from<_Pat, - single_view>>> + requires constructible_from<_Vw, views::all_t<_Rng>> + && constructible_from<_Pat, single_view>>> constexpr join_with_view(_Rng&& _Range_, range_value_t<_InnerRng> _Elem) noexcept( noexcept(_Vw(views::all(_STD forward<_Rng>(_Range_)))) && noexcept( _Pat(views::single(_STD move(_Elem))))) // strengthened : _Range(views::all(_STD forward<_Rng>(_Range_))), _Pattern(views::single(_STD move(_Elem))) {} _NODISCARD constexpr _Vw base() const& noexcept(is_nothrow_copy_constructible_v<_Vw>) /* strengthened */ - requires copy_constructible<_Vw> { + requires copy_constructible<_Vw> + { return _Range; } _NODISCARD constexpr _Vw base() && noexcept(is_nothrow_move_constructible_v<_Vw>) /* strengthened */ { @@ -4009,12 +4113,10 @@ namespace ranges { return join_with_view(_STD forward<_Rng>(_Range), _STD forward<_Pat>(_Pattern)); } - // clang-format off template requires constructible_from, _Delim> _NODISCARD constexpr auto operator()(_Delim&& _Delimiter) const noexcept(is_nothrow_constructible_v, _Delim>) { - // clang-format on return _Range_closure<_Join_with_fn, decay_t<_Delim>>{_STD forward<_Delim>(_Delimiter)}; } }; @@ -4148,11 +4250,9 @@ namespace ranges { requires forward_range<_BaseTy> : _Mybase{_STD move(_Current_)}, _Parent{_STD addressof(_Parent_)} {} - // clang-format off constexpr _Outer_iter(_Outer_iter _It) requires _Const && convertible_to, iterator_t<_BaseTy>> : _Mybase{_STD move(_It._Current)}, _Parent{_It._Parent} {} - // clang-format on _NODISCARD constexpr auto operator*() const noexcept(noexcept(value_type{*this})) /* strengthened */ { return value_type{*this}; @@ -4204,7 +4304,9 @@ namespace ranges { } _NODISCARD_FRIEND constexpr bool operator==(const _Outer_iter& _Left, const _Outer_iter& _Right) noexcept( - noexcept(_Left._Current == _Right._Current)) /* strengthened */ requires forward_range<_BaseTy> { + noexcept(_Left._Current == _Right._Current)) /* strengthened */ + requires forward_range<_BaseTy> + { return _Left._Current == _Right._Current && _Left._Trailing_empty == _Right._Trailing_empty; } _NODISCARD_FRIEND constexpr bool operator==(const _Outer_iter& _Left, default_sentinel_t) noexcept( @@ -4301,7 +4403,8 @@ namespace ranges { _NODISCARD constexpr iterator_t<_BaseTy> base() && noexcept( is_nothrow_move_constructible_v>) /* strengthened */ - requires forward_range<_Vw> { + requires forward_range<_Vw> + { return _STD move(_It._Get_current()); } @@ -4330,8 +4433,9 @@ namespace ranges { } } - _NODISCARD_FRIEND constexpr bool operator==( - const _Inner_iter& _Left, const _Inner_iter& _Right) requires forward_range<_BaseTy> { + _NODISCARD_FRIEND constexpr bool operator==(const _Inner_iter& _Left, const _Inner_iter& _Right) + requires forward_range<_BaseTy> + { return _Left._Equal(_Right); } @@ -4373,7 +4477,8 @@ namespace ranges { // clang-format on _NODISCARD constexpr _Vw base() const& noexcept(is_nothrow_copy_constructible_v<_Vw>) /* strengthened */ - requires copy_constructible<_Vw> { + requires copy_constructible<_Vw> + { return _Range; } _NODISCARD constexpr _Vw base() && noexcept(is_nothrow_move_constructible_v<_Vw>) /* strengthened */ { @@ -4390,11 +4495,15 @@ namespace ranges { } } - _NODISCARD constexpr auto begin() const requires forward_range<_Vw> && forward_range { + _NODISCARD constexpr auto begin() const + requires forward_range<_Vw> && forward_range + { return _Outer_iter{*this, _RANGES begin(_Range)}; } - _NODISCARD constexpr auto end() requires forward_range<_Vw> && common_range<_Vw> { + _NODISCARD constexpr auto end() + requires forward_range<_Vw> && common_range<_Vw> + { constexpr bool _Both_simple = _Simple_view<_Vw> && _Simple_view<_Pat>; return _Outer_iter<_Both_simple>{*this, _RANGES end(_Range)}; } @@ -4427,12 +4536,10 @@ namespace ranges { return lazy_split_view(_STD forward<_Rng>(_Range), _STD forward<_Pat>(_Pattern)); } - // clang-format off template requires constructible_from, _Delim> _NODISCARD constexpr auto operator()(_Delim&& _Delimiter) const noexcept(is_nothrow_constructible_v, _Delim>) { - // clang-format on return _Range_closure<_Lazy_split_fn, decay_t<_Delim>>{_STD forward<_Delim>(_Delimiter)}; } }; @@ -4584,7 +4691,8 @@ namespace ranges { // clang-format on _NODISCARD constexpr _Vw base() const& noexcept(is_nothrow_copy_constructible_v<_Vw>) /* strengthened */ - requires copy_constructible<_Vw> { + requires copy_constructible<_Vw> + { return _Range; } _NODISCARD constexpr _Vw base() && noexcept(is_nothrow_move_constructible_v<_Vw>) /* strengthened */ { @@ -4626,12 +4734,10 @@ namespace ranges { return split_view(_STD forward<_Rng>(_Range), _STD forward<_Pat>(_Pattern)); } - // clang-format off template requires constructible_from, _Delim> _NODISCARD constexpr auto operator()(_Delim&& _Delimiter) const noexcept(is_nothrow_constructible_v, _Delim>) { - // clang-format on return _Range_closure<_Split_fn, decay_t<_Delim>>{_STD forward<_Delim>(_Delimiter)}; } }; @@ -4687,11 +4793,9 @@ namespace ranges { _EXPORT_STD inline constexpr _Counted_fn counted; } // namespace views - // clang-format off _EXPORT_STD template requires (!common_range<_Vw> && copyable>) class common_view : public view_interface> { - // clang-format on private: /* [[no_unique_address]] */ _Vw _Base{}; @@ -4703,8 +4807,9 @@ namespace ranges { constexpr explicit common_view(_Vw _Base_) noexcept(is_nothrow_move_constructible_v<_Vw>) // strengthened : _Base(_STD move(_Base_)) {} - _NODISCARD constexpr _Vw base() const& noexcept( - is_nothrow_copy_constructible_v<_Vw>) /* strengthened */ requires copy_constructible<_Vw> { + _NODISCARD constexpr _Vw base() const& noexcept(is_nothrow_copy_constructible_v<_Vw>) /* strengthened */ + requires copy_constructible<_Vw> + { return _Base; } _NODISCARD constexpr _Vw base() && noexcept(is_nothrow_move_constructible_v<_Vw>) /* strengthened */ { @@ -4721,8 +4826,9 @@ namespace ranges { } _NODISCARD constexpr auto begin() const noexcept( - noexcept(_RANGES begin(_Base)) - && is_nothrow_move_constructible_v>) /* strengthened */ requires range { + noexcept(_RANGES begin(_Base)) && is_nothrow_move_constructible_v>) /* strengthened */ + requires range + { if constexpr (random_access_range && sized_range) { return _RANGES begin(_Base); } else { @@ -4738,7 +4844,9 @@ namespace ranges { } } - _NODISCARD constexpr auto end() const requires range { + _NODISCARD constexpr auto end() const + requires range + { if constexpr (random_access_range && sized_range) { return _RANGES begin(_Base) + _RANGES size(_Base); } else { @@ -4746,12 +4854,14 @@ namespace ranges { } } - _NODISCARD constexpr auto size() noexcept( - noexcept(_RANGES size(_Base))) /* strengthened */ requires sized_range<_Vw> { + _NODISCARD constexpr auto size() noexcept(noexcept(_RANGES size(_Base))) /* strengthened */ + requires sized_range<_Vw> + { return _RANGES size(_Base); } - _NODISCARD constexpr auto size() const - noexcept(noexcept(_RANGES size(_Base))) /* strengthened */ requires sized_range { + _NODISCARD constexpr auto size() const noexcept(noexcept(_RANGES size(_Base))) /* strengthened */ + requires sized_range + { return _RANGES size(_Base); } }; @@ -4782,11 +4892,9 @@ namespace ranges { static constexpr _Choice_t<_St> _Choice = _Choose<_Rng>(); public: - // clang-format off template requires (_Choice<_Rng>._Strategy != _St::_None) _NODISCARD constexpr auto operator()(_Rng&& _Range) const noexcept(_Choice<_Rng>._No_throw) { - // clang-format on constexpr _St _Strat = _Choice<_Rng>._Strategy; if constexpr (_Strat == _St::_All) { @@ -4819,8 +4927,9 @@ namespace ranges { constexpr explicit reverse_view(_Vw _Range_) noexcept(is_nothrow_move_constructible_v<_Vw>) // strengthened : _Range(_STD move(_Range_)) {} - _NODISCARD constexpr _Vw base() const& noexcept( - is_nothrow_copy_constructible_v<_Vw>) /* strengthened */ requires copy_constructible<_Vw> { + _NODISCARD constexpr _Vw base() const& noexcept(is_nothrow_copy_constructible_v<_Vw>) /* strengthened */ + requires copy_constructible<_Vw> + { return _Range; } _NODISCARD constexpr _Vw base() && noexcept(is_nothrow_move_constructible_v<_Vw>) /* strengthened */ { @@ -4846,8 +4955,10 @@ namespace ranges { } } - _NODISCARD constexpr auto begin() const noexcept( - noexcept(_Rev_iter{_RANGES end(_Range)})) /* strengthened */ requires common_range { + _NODISCARD constexpr auto begin() const + noexcept(noexcept(_Rev_iter{_RANGES end(_Range)})) /* strengthened */ + requires common_range + { return _Rev_iter{_RANGES end(_Range)}; } @@ -4855,17 +4966,21 @@ namespace ranges { noexcept(_Rev_iter<_Vw>{_RANGES begin(_Range)})) /* strengthened */ { return _Rev_iter<_Vw>{_RANGES begin(_Range)}; } - _NODISCARD constexpr auto end() const noexcept( - noexcept(_Rev_iter{_RANGES begin(_Range)})) /* strengthened */ requires common_range { + _NODISCARD constexpr auto end() const + noexcept(noexcept(_Rev_iter{_RANGES begin(_Range)})) /* strengthened */ + requires common_range + { return _Rev_iter{_RANGES begin(_Range)}; } - _NODISCARD constexpr auto size() noexcept( - noexcept(_RANGES size(_Range))) /* strengthened */ requires sized_range<_Vw> { + _NODISCARD constexpr auto size() noexcept(noexcept(_RANGES size(_Range))) /* strengthened */ + requires sized_range<_Vw> + { return _RANGES size(_Range); } - _NODISCARD constexpr auto size() const - noexcept(noexcept(_RANGES size(_Range))) /* strengthened */ requires sized_range { + _NODISCARD constexpr auto size() const noexcept(noexcept(_RANGES size(_Range))) /* strengthened */ + requires sized_range + { return _RANGES size(_Range); } }; @@ -4878,14 +4993,10 @@ namespace ranges { namespace views { template - concept _Can_extract_base = requires(_Rng&& __r) { - static_cast<_Rng&&>(__r).base(); - }; + concept _Can_extract_base = requires(_Rng&& __r) { static_cast<_Rng&&>(__r).base(); }; template - concept _Can_reverse = requires(_Rng&& __r) { - reverse_view{static_cast<_Rng&&>(__r)}; - }; + concept _Can_reverse = requires(_Rng&& __r) { reverse_view{static_cast<_Rng&&>(__r)}; }; class _Reverse_fn : public _Pipe::_Base<_Reverse_fn> { private: @@ -4895,8 +5006,8 @@ namespace ranges { static constexpr auto _Reversed_subrange = -1; template - static constexpr auto - _Reversed_subrange, reverse_iterator<_It>, _Ki>> = static_cast(_Ki); + static constexpr auto _Reversed_subrange, reverse_iterator<_It>, _Ki>> = + static_cast(_Ki); template _NODISCARD static _CONSTEVAL _Choice_t<_St> _Choose() noexcept { @@ -4927,11 +5038,9 @@ namespace ranges { static constexpr _Choice_t<_St> _Choice = _Choose<_Rng>(); public: - // clang-format off template requires (_Choice<_Rng>._Strategy != _St::_None) _NODISCARD constexpr auto operator()(_Rng&& _Range) const noexcept(_Choice<_Rng>._No_throw) { - // clang-format on constexpr _St _Strat = _Choice<_Rng>._Strategy; if constexpr (_Strat == _St::_Base) { @@ -4952,14 +5061,13 @@ namespace ranges { } // namespace views template - concept _Has_tuple_element = requires(_Tuple __t) { - typename tuple_size<_Tuple>::type; - requires _Index < tuple_size_v<_Tuple>; - typename tuple_element_t<_Index, _Tuple>; - // clang-format off - { _STD get<_Index>(__t) } -> convertible_to&>; - // clang-format on - }; + concept _Has_tuple_element = // + requires(_Tuple __t) { + typename tuple_size<_Tuple>::type; + requires _Index < tuple_size_v<_Tuple>; + typename tuple_element_t<_Index, _Tuple>; + { _STD get<_Index>(__t) } -> convertible_to&>; + }; template concept _Returnable_element = is_reference_v<_Tuple> || move_constructible>; @@ -5016,12 +5124,10 @@ namespace ranges { is_nothrow_move_constructible_v>) // strengthened : _Current{_STD move(_Current_)} {} - // clang-format off constexpr _Iterator(_Iterator _It) noexcept( is_nothrow_constructible_v, iterator_t<_Vw>>) // strengthened requires _Const && convertible_to, iterator_t<_Base>> : _Current{_STD move(_It._Current)} {} - // clang-format on _NODISCARD constexpr const iterator_t<_Base>& base() const& noexcept { return _Current; @@ -5034,7 +5140,8 @@ namespace ranges { _NODISCARD constexpr decltype(auto) operator*() const noexcept(noexcept(_STD get<_Index>(*_Current))) /* strengthened */ - requires is_reference_v> { + requires is_reference_v> + { return _STD get<_Index>(*_Current); } @@ -5056,38 +5163,45 @@ namespace ranges { constexpr _Iterator operator++(int) noexcept( noexcept(++_Current) && is_nothrow_copy_constructible_v>) /* strengthened */ - requires forward_range<_Base> { + requires forward_range<_Base> + { auto _Tmp = *this; ++_Current; return _Tmp; } constexpr _Iterator& operator--() noexcept(noexcept(--_Current)) /* strengthened */ - requires bidirectional_range<_Base> { + requires bidirectional_range<_Base> + { --_Current; return *this; } constexpr _Iterator operator--(int) noexcept( noexcept(--_Current) && is_nothrow_copy_constructible_v>) /* strengthened */ - requires bidirectional_range<_Base> { + requires bidirectional_range<_Base> + { auto _Tmp = *this; --_Current; return _Tmp; } - constexpr void _Verify_offset(const difference_type _Off) const requires random_access_range<_Base> { + constexpr void _Verify_offset(const difference_type _Off) const + requires random_access_range<_Base> + { #if _ITERATOR_DEBUG_LEVEL != 0 (void) _Off; #else // ^^^ _ITERATOR_DEBUG_LEVEL == 0 / _ITERATOR_DEBUG_LEVEL != 0 vvv if constexpr (_Offset_verifiable_v>) { - _Current._Verify_offset(_Off); + _Current._Verify_offset(_Off); } #endif // _ITERATOR_DEBUG_LEVEL == 0 } constexpr _Iterator& operator+=(const difference_type _Off) noexcept( - noexcept(_Current += _Off)) /* strengthened */ requires random_access_range<_Base> { + noexcept(_Current += _Off)) /* strengthened */ + requires random_access_range<_Base> + { #if _ITERATOR_DEBUG_LEVEL != 0 _Verify_offset(_Off); #endif // _ITERATOR_DEBUG_LEVEL != 0 @@ -5095,7 +5209,9 @@ namespace ranges { return *this; } constexpr _Iterator& operator-=(const difference_type _Off) noexcept( - noexcept(_Current -= _Off)) /* strengthened */ requires random_access_range<_Base> { + noexcept(_Current -= _Off)) /* strengthened */ + requires random_access_range<_Base> + { #if _ITERATOR_DEBUG_LEVEL != 0 _Verify_offset(-_Off); #endif // _ITERATOR_DEBUG_LEVEL != 0 @@ -5105,7 +5221,8 @@ namespace ranges { _NODISCARD constexpr decltype(auto) operator[](const difference_type _Idx) const noexcept(noexcept(_STD get<_Index>(*(_Current + _Idx)))) /* strengthened */ - requires random_access_range<_Base> && is_reference_v> { + requires random_access_range<_Base> && is_reference_v> + { #if _ITERATOR_DEBUG_LEVEL != 0 _Verify_offset(_Idx); #endif // _ITERATOR_DEBUG_LEVEL != 0 @@ -5115,7 +5232,8 @@ namespace ranges { _NODISCARD constexpr decltype(auto) operator[](const difference_type _Idx) const noexcept(is_nothrow_move_constructible_v>> // && noexcept(_STD get<_Index>(*(_Current + _Idx)))) /* strengthened */ - requires random_access_range<_Base> { + requires random_access_range<_Base> + { #if _ITERATOR_DEBUG_LEVEL != 0 _Verify_offset(_Idx); #endif // _ITERATOR_DEBUG_LEVEL != 0 @@ -5125,24 +5243,33 @@ namespace ranges { _NODISCARD_FRIEND constexpr bool operator==(const _Iterator& _Left, const _Iterator& _Right) noexcept( noexcept(_Left._Current == _Right._Current)) /* strengthened */ - requires equality_comparable> { + requires equality_comparable> + { return _Left._Current == _Right._Current; } _NODISCARD_FRIEND constexpr bool operator<(const _Iterator& _Left, const _Iterator& _Right) noexcept( - noexcept(_Left._Current < _Right._Current)) /* strengthened */ requires random_access_range<_Base> { + noexcept(_Left._Current < _Right._Current)) /* strengthened */ + requires random_access_range<_Base> + { return _Left._Current < _Right._Current; } _NODISCARD_FRIEND constexpr bool operator>(const _Iterator& _Left, const _Iterator& _Right) noexcept( - noexcept(_Left._Current < _Right._Current)) /* strengthened */ requires random_access_range<_Base> { + noexcept(_Left._Current < _Right._Current)) /* strengthened */ + requires random_access_range<_Base> + { return _Right < _Left; } _NODISCARD_FRIEND constexpr bool operator<=(const _Iterator& _Left, const _Iterator& _Right) noexcept( - noexcept(_Left._Current < _Right._Current)) /* strengthened */ requires random_access_range<_Base> { + noexcept(_Left._Current < _Right._Current)) /* strengthened */ + requires random_access_range<_Base> + { return !(_Right < _Left); } _NODISCARD_FRIEND constexpr bool operator>=(const _Iterator& _Left, const _Iterator& _Right) noexcept( - noexcept(_Left._Current < _Right._Current)) /* strengthened */ requires random_access_range<_Base> { + noexcept(_Left._Current < _Right._Current)) /* strengthened */ + requires random_access_range<_Base> + { return !(_Left < _Right); } @@ -5157,7 +5284,8 @@ namespace ranges { _NODISCARD_FRIEND constexpr _Iterator operator+(const _Iterator& _It, const difference_type _Off) noexcept( noexcept(_STD declval&>() += _Off) && is_nothrow_copy_constructible_v>) /* strengthened */ - requires random_access_range<_Base> { + requires random_access_range<_Base> + { #if _ITERATOR_DEBUG_LEVEL != 0 _It._Verify_offset(_Off); #endif // _ITERATOR_DEBUG_LEVEL != 0 @@ -5169,7 +5297,8 @@ namespace ranges { _NODISCARD_FRIEND constexpr _Iterator operator+(const difference_type _Off, const _Iterator& _It) noexcept( noexcept(_STD declval&>() += _Off) && is_nothrow_copy_constructible_v>) /* strengthened */ - requires random_access_range<_Base> { + requires random_access_range<_Base> + { #if _ITERATOR_DEBUG_LEVEL != 0 _It._Verify_offset(_Off); #endif // _ITERATOR_DEBUG_LEVEL != 0 @@ -5181,7 +5310,8 @@ namespace ranges { _NODISCARD_FRIEND constexpr _Iterator operator-(const _Iterator& _It, const difference_type _Off) noexcept( noexcept(_STD declval&>() -= _Off) && is_nothrow_copy_constructible_v>) /* strengthened */ - requires random_access_range<_Base> { + requires random_access_range<_Base> + { #if _ITERATOR_DEBUG_LEVEL != 0 _It._Verify_offset(-_Off); #endif // _ITERATOR_DEBUG_LEVEL != 0 @@ -5192,7 +5322,8 @@ namespace ranges { _NODISCARD_FRIEND constexpr difference_type operator-(const _Iterator& _Left, const _Iterator& _Right) noexcept(noexcept(_Left._Current - _Right._Current)) /* strengthened */ - requires sized_sentinel_for, iterator_t<_Base>> { + requires sized_sentinel_for, iterator_t<_Base>> + { return _Left._Current - _Right._Current; } }; @@ -5233,12 +5364,10 @@ namespace ranges { return _Last; } - // clang-format off template requires sentinel_for, _Maybe_const_iter<_OtherConst>> _NODISCARD_FRIEND constexpr bool operator==(const _Iterator<_OtherConst>& _Left, const _Sentinel& _Right) noexcept(noexcept(_Get_current(_Left) == _Right._Last)) /* strengthened */ { - // clang-format on return _Get_current(_Left) == _Right._Last; } @@ -5272,7 +5401,8 @@ namespace ranges { : _Range(_STD move(_Range_)) {} _NODISCARD constexpr _Vw base() const& noexcept(is_nothrow_copy_constructible_v<_Vw>) /* strengthened */ - requires copy_constructible<_Vw> { + requires copy_constructible<_Vw> + { return _Range; } @@ -5291,7 +5421,8 @@ namespace ranges { _NODISCARD constexpr _Iterator begin() const noexcept(noexcept(_RANGES begin(_Range)) && is_nothrow_move_constructible_v>) /* strengthened */ - requires range { + requires range + { return _Iterator{_RANGES begin(_Range)}; } @@ -5320,11 +5451,13 @@ namespace ranges { } _NODISCARD constexpr auto size() noexcept(noexcept(_RANGES size(_Range))) /* strengthened */ - requires sized_range<_Vw> { + requires sized_range<_Vw> + { return _RANGES size(_Range); } _NODISCARD constexpr auto size() const noexcept(noexcept(_RANGES size(_Range))) /* strengthened */ - requires sized_range { + requires sized_range + { return _RANGES size(_Range); } }; @@ -5342,11 +5475,12 @@ namespace ranges { class _Elements_fn : public _Pipe::_Base<_Elements_fn<_Index>> { public: template - _NODISCARD constexpr auto operator()(_Rng&& _Range) const noexcept( - noexcept(elements_view, _Index>{_STD forward<_Rng>(_Range)})) requires requires { - elements_view, _Index>{static_cast<_Rng&&>(_Range)}; + _NODISCARD constexpr auto operator()(_Rng&& _Range) const + noexcept(noexcept(elements_view, _Index>{_STD forward<_Rng>(_Range)})) + requires requires { elements_view, _Index>{static_cast<_Rng&&>(_Range)}; } + { + return elements_view, _Index>{_STD forward<_Rng>(_Range)}; } - { return elements_view, _Index>{_STD forward<_Rng>(_Range)}; } }; _EXPORT_STD template @@ -5446,13 +5580,15 @@ namespace ranges { _NODISCARD_FRIEND constexpr difference_type operator-(default_sentinel_t, const _Inner_iterator& _Right) noexcept(noexcept(_Right._Get_size())) /* strengthened */ - requires sized_sentinel_for, iterator_t<_Vw>> { + requires sized_sentinel_for, iterator_t<_Vw>> + { return _Right._Get_size(); } _NODISCARD_FRIEND constexpr difference_type operator-(const _Inner_iterator& _Left, default_sentinel_t) noexcept(noexcept(_Left._Get_size())) /* strengthened */ - requires sized_sentinel_for, iterator_t<_Vw>> { + requires sized_sentinel_for, iterator_t<_Vw>> + { return -_Left._Get_size(); } }; @@ -5500,7 +5636,8 @@ namespace ranges { _NODISCARD constexpr auto size() const noexcept(noexcept(_RANGES end(_Parent->_Range) - *_Parent->_Current)) /* strengthened */ - requires sized_sentinel_for, iterator_t<_Vw>> { + requires sized_sentinel_for, iterator_t<_Vw>> + { return _To_unsigned_like( (_STD min)(_Parent->_Remainder, _RANGES end(_Parent->_Range) - *_Parent->_Current)); } @@ -5540,13 +5677,15 @@ namespace ranges { _NODISCARD_FRIEND constexpr difference_type operator-(default_sentinel_t, const _Outer_iterator& _Right) noexcept(noexcept(_Right._Get_size())) /* strengthened */ - requires sized_sentinel_for, iterator_t<_Vw>> { + requires sized_sentinel_for, iterator_t<_Vw>> + { return _Right._Get_size(); } _NODISCARD_FRIEND constexpr difference_type operator-(const _Outer_iterator& _Left, default_sentinel_t) noexcept(noexcept(_Left._Get_size())) /* strengthened */ - requires sized_sentinel_for, iterator_t<_Vw>> { + requires sized_sentinel_for, iterator_t<_Vw>> + { return -_Left._Get_size(); } }; @@ -5561,7 +5700,8 @@ namespace ranges { } _NODISCARD constexpr _Vw base() const& noexcept(is_nothrow_copy_constructible_v<_Vw>) /* strengthened */ - requires copy_constructible<_Vw> { + requires copy_constructible<_Vw> + { return _Range; } @@ -5581,12 +5721,14 @@ namespace ranges { } _NODISCARD constexpr auto size() noexcept(noexcept(_RANGES distance(_Range))) /* strengthened */ - requires sized_range<_Vw> { + requires sized_range<_Vw> + { return _To_unsigned_like(_Div_ceil(_RANGES distance(_Range), _Count)); } _NODISCARD constexpr auto size() const noexcept(noexcept(_RANGES distance(_Range))) /* strengthened */ - requires sized_range { + requires sized_range + { return _To_unsigned_like(_Div_ceil(_RANGES distance(_Range), _Count)); } }; @@ -5633,11 +5775,9 @@ namespace ranges { is_nothrow_constructible_v<_Base_iterator, typename _Iterator::_Base_iterator> // && is_nothrow_constructible_v<_Base_sentinel, typename _Iterator::_Base_sentinel> // ) /* strengthened */ - requires _Const && convertible_to, _Base_iterator> // - && convertible_to, _Base_sentinel> // - : _Current(_STD move(_Other._Current)), - _End(_STD move(_Other._End)), - _Count(_Other._Count), + requires _Const && convertible_to, _Base_iterator> + && convertible_to, _Base_sentinel> + : _Current(_STD move(_Other._Current)), _End(_STD move(_Other._End)), _Count(_Other._Count), _Missing(_Other._Missing) {} _NODISCARD constexpr _Base_iterator base() const @@ -5668,21 +5808,24 @@ namespace ranges { } constexpr _Iterator& operator--() /* not strengthened, see _RANGES advance */ - requires bidirectional_range<_Base> { + requires bidirectional_range<_Base> + { _RANGES advance(_Current, _Missing - _Count); _Missing = 0; return *this; } constexpr _Iterator operator--(int) /* not strengthened, see _RANGES advance */ - requires bidirectional_range<_Base> { + requires bidirectional_range<_Base> + { auto _Tmp = *this; --*this; return _Tmp; } constexpr _Iterator& operator+=(const difference_type _Off) /* not strengthened, see _RANGES advance */ - requires random_access_range<_Base> { + requires random_access_range<_Base> + { if (_Off > 0) { #if _ITERATOR_DEBUG_LEVEL != 0 _STL_VERIFY(_Count <= (numeric_limits::max)() / _Off, @@ -5708,7 +5851,8 @@ namespace ranges { } constexpr _Iterator& operator-=(const difference_type _Off) /* not strengthened, see _RANGES advance */ - requires random_access_range<_Base> { + requires random_access_range<_Base> + { #if _ITERATOR_DEBUG_LEVEL != 0 _STL_VERIFY(_Off != (numeric_limits::min)(), "cannot advance chunk_view iterator past end (integer overflow)"); @@ -5717,7 +5861,9 @@ namespace ranges { } _NODISCARD constexpr value_type operator[](const difference_type _Off) const - noexcept(noexcept(*(*this + _Off))) /* strengthened */ requires random_access_range<_Base> { + noexcept(noexcept(*(*this + _Off))) /* strengthened */ + requires random_access_range<_Base> + { return *(*this + _Off); } @@ -5733,38 +5879,44 @@ namespace ranges { _NODISCARD_FRIEND constexpr bool operator<(const _Iterator& _Left, const _Iterator& _Right) noexcept( noexcept(_Fake_copy_init(_Left._Current < _Right._Current))) /* strengthened */ - requires random_access_range<_Base> { + requires random_access_range<_Base> + { return _Left._Current < _Right._Current; } _NODISCARD_FRIEND constexpr bool operator>(const _Iterator& _Left, const _Iterator& _Right) noexcept( noexcept(_Fake_copy_init(_Right._Current < _Left._Current))) /* strengthened */ - requires random_access_range<_Base> { + requires random_access_range<_Base> + { return _Right._Current < _Left._Current; } _NODISCARD_FRIEND constexpr bool operator<=(const _Iterator& _Left, const _Iterator& _Right) noexcept( noexcept(_Fake_copy_init(!(_Right._Current < _Left._Current)))) /* strengthened */ - requires random_access_range<_Base> { + requires random_access_range<_Base> + { return !(_Right._Current < _Left._Current); } _NODISCARD_FRIEND constexpr bool operator>=(const _Iterator& _Left, const _Iterator& _Right) noexcept( noexcept(_Fake_copy_init(!(_Left._Current < _Right._Current)))) /* strengthened */ - requires random_access_range<_Base> { + requires random_access_range<_Base> + { return !(_Left._Current < _Right._Current); } _NODISCARD_FRIEND constexpr auto operator<=>(const _Iterator& _Left, const _Iterator& _Right) noexcept( noexcept(_Left._Current <=> _Right._Current)) /* strengthened */ - requires random_access_range<_Base> && three_way_comparable<_Base_iterator> { + requires random_access_range<_Base> && three_way_comparable<_Base_iterator> + { return _Left._Current <=> _Right._Current; } _NODISCARD_FRIEND constexpr _Iterator operator+(const _Iterator& _It, const difference_type _Off) noexcept( is_nothrow_copy_constructible_v<_Iterator>&& noexcept( _STD declval<_Iterator&>() += _Off)) /* strengthened */ - requires random_access_range<_Base> { + requires random_access_range<_Base> + { auto _Copy = _It; _Copy += _Off; return _Copy; @@ -5773,7 +5925,8 @@ namespace ranges { _NODISCARD_FRIEND constexpr _Iterator operator+(const difference_type _Off, const _Iterator& _It) noexcept( is_nothrow_copy_constructible_v<_Iterator>&& noexcept( _STD declval<_Iterator&>() += _Off)) /* strengthened */ - requires random_access_range<_Base> { + requires random_access_range<_Base> + { auto _Copy = _It; _Copy += _Off; return _Copy; @@ -5782,7 +5935,8 @@ namespace ranges { _NODISCARD_FRIEND constexpr _Iterator operator-(const _Iterator& _It, const difference_type _Off) noexcept( is_nothrow_copy_constructible_v<_Iterator>&& noexcept( _STD declval<_Iterator&>() -= _Off)) /* strengthened */ - requires random_access_range<_Base> { + requires random_access_range<_Base> + { auto _Copy = _It; _Copy -= _Off; return _Copy; @@ -5790,19 +5944,22 @@ namespace ranges { _NODISCARD_FRIEND constexpr difference_type operator-(const _Iterator& _Left, const _Iterator& _Right) noexcept(noexcept(_Left._Current - _Right._Current)) /* strengthened */ - requires sized_sentinel_for<_Base_iterator, _Base_iterator> { + requires sized_sentinel_for<_Base_iterator, _Base_iterator> + { return (_Left._Current - _Right._Current + _Left._Missing - _Right._Missing) / _Left._Count; } _NODISCARD_FRIEND constexpr difference_type operator-(default_sentinel_t, const _Iterator& _Right) noexcept( noexcept(_Right._End - _Right._Current)) /* strengthened */ - requires sized_sentinel_for<_Base_sentinel, _Base_iterator> { + requires sized_sentinel_for<_Base_sentinel, _Base_iterator> + { return _Div_ceil(_Right._End - _Right._Current, _Right._Count); } _NODISCARD_FRIEND constexpr difference_type operator-(const _Iterator& _Left, default_sentinel_t) noexcept( noexcept(_Left._End - _Left._Current)) /* strengthened */ - requires sized_sentinel_for<_Base_sentinel, _Base_iterator> { + requires sized_sentinel_for<_Base_sentinel, _Base_iterator> + { return -_Div_ceil(_Left._End - _Left._Current, _Left._Count); } }; @@ -5817,7 +5974,8 @@ namespace ranges { } _NODISCARD constexpr _Vw base() const& noexcept(is_nothrow_copy_constructible_v<_Vw>) /* strengthened */ - requires copy_constructible<_Vw> { + requires copy_constructible<_Vw> + { return _Range; } @@ -5836,7 +5994,8 @@ namespace ranges { _NODISCARD constexpr auto begin() const noexcept(noexcept(_RANGES begin(_Range)) && is_nothrow_move_constructible_v>) /* strengthened */ - requires forward_range { + requires forward_range + { return _Iterator{this, _RANGES begin(_Range)}; } @@ -5878,12 +6037,14 @@ namespace ranges { } _NODISCARD constexpr auto size() noexcept(noexcept(_RANGES distance(_Range))) /* strengthened */ - requires sized_range<_Vw> { + requires sized_range<_Vw> + { return _To_unsigned_like(_Div_ceil(_RANGES distance(_Range), _Count)); } _NODISCARD constexpr auto size() const noexcept(noexcept(_RANGES distance(_Range))) /* strengthened */ - requires sized_range { + requires sized_range + { return _To_unsigned_like(_Div_ceil(_RANGES distance(_Range), _Count)); } }; @@ -5892,7 +6053,7 @@ namespace ranges { chunk_view(_Rng&&, range_difference_t<_Rng>) -> chunk_view>; template - inline constexpr bool enable_borrowed_range> = enable_borrowed_range<_Vw>&& forward_range<_Vw>; + inline constexpr bool enable_borrowed_range> = enable_borrowed_range<_Vw> && forward_range<_Vw>; namespace views { struct _Chunk_fn { @@ -5906,12 +6067,10 @@ namespace ranges { return chunk_view(_STD forward<_Rng>(_Range), _Count); } - // clang-format off template requires constructible_from, _Ty> _NODISCARD constexpr auto operator()(_Ty&& _Count) const noexcept(is_nothrow_constructible_v, _Ty>) { - // clang-format on return _Range_closure<_Chunk_fn, decay_t<_Ty>>{_STD forward<_Ty>(_Count)}; } }; @@ -5923,10 +6082,10 @@ namespace ranges { concept _Slide_caches_nothing = random_access_range<_Vw> && sized_range<_Vw>; template - concept _Slide_caches_last = !_Slide_caches_nothing<_Vw> && bidirectional_range<_Vw> && common_range<_Vw>; + concept _Slide_caches_last = (!_Slide_caches_nothing<_Vw>) && bidirectional_range<_Vw> && common_range<_Vw>; template - concept _Slide_caches_first = !_Slide_caches_nothing<_Vw> && !_Slide_caches_last<_Vw>; + concept _Slide_caches_first = (!_Slide_caches_nothing<_Vw>) && (!_Slide_caches_last<_Vw>); _EXPORT_STD template requires view<_Vw> @@ -5966,12 +6125,10 @@ namespace ranges { /* [[no_unique_address]] */ _Base_iterator _Current{}; range_difference_t<_Base> _Count = 0; - // clang-format off constexpr _Iterator(_Base_iterator _Current_, range_difference_t<_Base> _Count_) noexcept( is_nothrow_move_constructible_v<_Base_iterator>) /* strengthened */ requires (!_Slide_caches_first<_Base>) : _Current(_STD move(_Current_)), _Count(_Count_) {} - // clang-format on constexpr _Iterator(_Base_iterator _Current_, _Base_iterator _Last_, range_difference_t<_Base> _Count_) // noexcept(is_nothrow_move_constructible_v<_Base_iterator>) /* strengthened */ @@ -5989,7 +6146,7 @@ namespace ranges { constexpr _Iterator(_Iterator _Other) noexcept(is_nothrow_constructible_v<_Base_iterator, typename _Iterator::_Base_iterator>) /* strengthened */ - requires _Const && convertible_to, _Base_iterator> // + requires _Const && convertible_to, _Base_iterator> : _Current(_STD move(_Other._Current)), _Count(_Other._Count) {} _NODISCARD constexpr value_type operator*() const @@ -6014,7 +6171,8 @@ namespace ranges { } constexpr _Iterator& operator--() noexcept(noexcept(--_Current)) /* strengthened */ - requires bidirectional_range<_Base> { + requires bidirectional_range<_Base> + { --_Current; if constexpr (_Slide_caches_first<_Base>) { @@ -6025,7 +6183,8 @@ namespace ranges { constexpr _Iterator operator--(int) noexcept( is_nothrow_copy_constructible_v<_Base_iterator>&& noexcept(--_Current)) /* strengthened */ - requires bidirectional_range<_Base> { + requires bidirectional_range<_Base> + { auto _Tmp = *this; --*this; return _Tmp; @@ -6033,7 +6192,8 @@ namespace ranges { constexpr _Iterator& operator+=(const difference_type _Off) noexcept( noexcept(_Current += _Off)) /* strengthened */ - requires random_access_range<_Base> { + requires random_access_range<_Base> + { _Current += _Off; if constexpr (_Slide_caches_first<_Base>) { @@ -6044,7 +6204,8 @@ namespace ranges { constexpr _Iterator& operator-=(const difference_type _Off) noexcept( noexcept(_Current -= _Off)) /* strengthened */ - requires random_access_range<_Base> { + requires random_access_range<_Base> + { _Current -= _Off; if constexpr (_Slide_caches_first<_Base>) { @@ -6055,7 +6216,8 @@ namespace ranges { _NODISCARD constexpr value_type operator[](const difference_type _Off) const noexcept(noexcept(views::counted(_Current + _Off, _Count))) /* strengthened */ - requires random_access_range<_Base> { + requires random_access_range<_Base> + { return views::counted(_Current + _Off, _Count); } @@ -6070,37 +6232,43 @@ namespace ranges { _NODISCARD_FRIEND constexpr bool operator<(const _Iterator& _Left, const _Iterator& _Right) noexcept( noexcept(_Fake_copy_init(_Left._Current < _Right._Current))) /* strengthened */ - requires random_access_range<_Base> { + requires random_access_range<_Base> + { return _Left._Current < _Right._Current; } _NODISCARD_FRIEND constexpr bool operator>(const _Iterator& _Left, const _Iterator& _Right) noexcept( noexcept(_Fake_copy_init(_Right._Current < _Left._Current))) /* strengthened */ - requires random_access_range<_Base> { + requires random_access_range<_Base> + { return _Right._Current < _Left._Current; } _NODISCARD_FRIEND constexpr bool operator<=(const _Iterator& _Left, const _Iterator& _Right) noexcept( noexcept(_Fake_copy_init(!(_Right._Current < _Left._Current)))) /* strengthened */ - requires random_access_range<_Base> { + requires random_access_range<_Base> + { return !(_Right._Current < _Left._Current); } _NODISCARD_FRIEND constexpr bool operator>=(const _Iterator& _Left, const _Iterator& _Right) noexcept( noexcept(_Fake_copy_init(!(_Left._Current < _Right._Current)))) /* strengthened */ - requires random_access_range<_Base> { + requires random_access_range<_Base> + { return !(_Left._Current < _Right._Current); } _NODISCARD_FRIEND constexpr auto operator<=>(const _Iterator& _Left, const _Iterator& _Right) noexcept( noexcept(_Left._Current <=> _Right._Current)) /* strengthened */ - requires random_access_range<_Base> && three_way_comparable<_Base_iterator> { + requires random_access_range<_Base> && three_way_comparable<_Base_iterator> + { return _Left._Current <=> _Right._Current; } _NODISCARD_FRIEND constexpr _Iterator operator+(const _Iterator& _It, const difference_type _Off) noexcept( noexcept(_STD declval<_Iterator&>() += _Off)) /* strengthened */ - requires random_access_range<_Base> { + requires random_access_range<_Base> + { auto _Copy = _It; _Copy += _Off; return _Copy; @@ -6108,7 +6276,8 @@ namespace ranges { _NODISCARD_FRIEND constexpr _Iterator operator+(const difference_type _Off, const _Iterator& _It) noexcept( noexcept(_STD declval<_Iterator&>() += _Off)) /* strengthened */ - requires random_access_range<_Base> { + requires random_access_range<_Base> + { auto _Copy = _It; _Copy += _Off; return _Copy; @@ -6116,7 +6285,8 @@ namespace ranges { _NODISCARD_FRIEND constexpr _Iterator operator-(const _Iterator& _It, const difference_type _Off) noexcept( noexcept(_STD declval<_Iterator&>() -= _Off)) /* strengthened */ - requires random_access_range<_Base> { + requires random_access_range<_Base> + { auto _Copy = _It; _Copy -= _Off; return _Copy; @@ -6124,7 +6294,8 @@ namespace ranges { _NODISCARD_FRIEND constexpr difference_type operator-(const _Iterator& _Left, const _Iterator& _Right) noexcept(noexcept(_Left._Current - _Right._Current)) /* strengthened */ - requires sized_sentinel_for<_Base_iterator, _Base_iterator> { + requires sized_sentinel_for<_Base_iterator, _Base_iterator> + { if constexpr (_Slide_caches_first<_Base>) { return _Left._Last_element - _Right._Last_element; } else { @@ -6153,14 +6324,16 @@ namespace ranges { _NODISCARD_FRIEND constexpr range_difference_t<_Vw> operator-(const _Iterator& _Left, const _Sentinel& _Right) noexcept(noexcept(_Left._Get_last_element() - _Right._Last)) /* strengthened */ - requires sized_sentinel_for, iterator_t<_Vw>> { + requires sized_sentinel_for, iterator_t<_Vw>> + { return _Left._Get_last_element() - _Right._Last; } _NODISCARD_FRIEND constexpr range_difference_t<_Vw> operator-(const _Sentinel& _Left, const _Iterator& _Right) noexcept( noexcept(_Left._Last - _Right._Get_last_element())) /* strengthened */ - requires sized_sentinel_for, iterator_t<_Vw>> { + requires sized_sentinel_for, iterator_t<_Vw>> + { return _Left._Last - _Right._Get_last_element(); } }; @@ -6193,7 +6366,8 @@ namespace ranges { _NODISCARD constexpr auto begin() const noexcept( noexcept(_RANGES begin(_Range)) && is_nothrow_move_constructible_v>) /* strengthened */ - requires _Slide_caches_nothing { + requires _Slide_caches_nothing + { return _Iterator{_RANGES begin(_Range), _Count}; } @@ -6225,7 +6399,8 @@ namespace ranges { _NODISCARD constexpr auto end() const noexcept(is_nothrow_move_constructible_v> // && noexcept(_RANGES distance(_Range)) && noexcept(_RANGES begin(_Range) + _Count)) /* strengthened */ - requires _Slide_caches_nothing { + requires _Slide_caches_nothing + { const auto _Size = _RANGES distance(_Range) - (_Count - 1); if (_Size < 0) { return _Iterator{_RANGES begin(_Range), _Count}; @@ -6235,7 +6410,8 @@ namespace ranges { } _NODISCARD constexpr auto size() noexcept(noexcept(_RANGES distance(_Range))) /* strengthened */ - requires sized_range<_Vw> { + requires sized_range<_Vw> + { auto _Size = _RANGES distance(_Range) - (_Count - 1); if (_Size < 0) { _Size = 0; @@ -6245,7 +6421,8 @@ namespace ranges { } _NODISCARD constexpr auto size() const noexcept(noexcept(_RANGES distance(_Range))) /* strengthened */ - requires sized_range { + requires sized_range + { auto _Size = _RANGES distance(_Range) - (_Count - 1); if (_Size < 0) { _Size = 0; @@ -6272,12 +6449,10 @@ namespace ranges { return slide_view(_STD forward<_Rng>(_Range), _Count); } - // clang-format off template requires constructible_from, _Ty> _NODISCARD constexpr auto operator()(_Ty&& _Count) const noexcept(is_nothrow_constructible_v, _Ty>) { - // clang-format on return _Range_closure<_Slide_fn, decay_t<_Ty>>{_STD forward<_Ty>(_Count)}; } }; @@ -6356,7 +6531,9 @@ namespace ranges { return _Tmp; } - constexpr _Iterator& operator--() requires bidirectional_range<_Vw> { + constexpr _Iterator& operator--() + requires bidirectional_range<_Vw> + { #if _ITERATOR_DEBUG_LEVEL != 0 _STL_VERIFY(_Parent != nullptr, "cannot decrement value-initialized chunk_by_view iterator"); _STL_VERIFY( @@ -6367,7 +6544,9 @@ namespace ranges { return *this; } - constexpr _Iterator operator--(int) requires bidirectional_range<_Vw> { + constexpr _Iterator operator--(int) + requires bidirectional_range<_Vw> + { auto _Tmp = *this; --*this; return _Tmp; @@ -6413,8 +6592,9 @@ namespace ranges { is_nothrow_move_constructible_v<_Vw>&& is_nothrow_move_constructible_v<_Pr>) // strengthened : _Range(_STD move(_Range_)), _Pred{in_place, _STD move(_Pred_)} {} - _NODISCARD constexpr _Vw base() const& noexcept( - is_nothrow_copy_constructible_v<_Vw>) /* strengthened */ requires copy_constructible<_Vw> { + _NODISCARD constexpr _Vw base() const& noexcept(is_nothrow_copy_constructible_v<_Vw>) /* strengthened */ + requires copy_constructible<_Vw> + { return _Range; } _NODISCARD constexpr _Vw base() && noexcept(is_nothrow_move_constructible_v<_Vw>) /* strengthened */ { @@ -6468,12 +6648,10 @@ namespace ranges { return chunk_by_view(_STD forward<_Rng>(_Range), _STD forward<_Pr>(_Pred)); } - // clang-format off template requires constructible_from, _Pr> _NODISCARD constexpr auto operator()(_Pr&& _Pred) const noexcept(is_nothrow_constructible_v, _Pr>) { - // clang-format on return _Range_closure<_Chunk_by_fn, decay_t<_Pr>>{_STD forward<_Pr>(_Pred)}; } }; @@ -6537,11 +6715,10 @@ namespace ranges { constexpr _Iterator(_Iterator _Other) noexcept( is_nothrow_constructible_v<_Base_iterator, iterator_t<_Vw>> // && is_nothrow_constructible_v<_Base_sentinel, sentinel_t<_Vw>> // - ) /* strengthened */ requires _Const - && convertible_to, _Base_iterator> && convertible_to, _Base_sentinel> - : _Current(_STD move(_Other._Current)), - _End(_STD move(_Other._End)), - _Stride(_Other._Stride), + ) /* strengthened */ + requires _Const && convertible_to, _Base_iterator> + && convertible_to, _Base_sentinel> + : _Current(_STD move(_Other._Current)), _End(_STD move(_Other._End)), _Stride(_Other._Stride), _Missing(_Other._Missing) {} _NODISCARD constexpr _Base_iterator base() && noexcept( @@ -6572,25 +6749,33 @@ namespace ranges { ++*this; } - constexpr _Iterator operator++(int) requires forward_range<_Base> { + constexpr _Iterator operator++(int) + requires forward_range<_Base> + { auto _Tmp = *this; ++*this; return _Tmp; } - constexpr _Iterator& operator--() requires bidirectional_range<_Base> { + constexpr _Iterator& operator--() + requires bidirectional_range<_Base> + { _RANGES advance(_Current, _Missing - _Stride); _Missing = 0; return *this; } - constexpr _Iterator operator--(int) requires bidirectional_range<_Base> { + constexpr _Iterator operator--(int) + requires bidirectional_range<_Base> + { auto _Tmp = *this; --*this; return _Tmp; } - constexpr _Iterator& operator+=(const difference_type _Off) requires random_access_range<_Base> { + constexpr _Iterator& operator+=(const difference_type _Off) + requires random_access_range<_Base> + { if (_Off > 0) { #if _ITERATOR_DEBUG_LEVEL != 0 _STL_VERIFY(_Stride <= (numeric_limits::max)() / _Off, @@ -6615,7 +6800,9 @@ namespace ranges { return *this; } - constexpr _Iterator& operator-=(const difference_type _Off) requires random_access_range<_Base> { + constexpr _Iterator& operator-=(const difference_type _Off) + requires random_access_range<_Base> + { #if _ITERATOR_DEBUG_LEVEL != 0 _STL_VERIFY(_Off != (numeric_limits::min)(), "cannot advance stride_view iterator past end (integer overflow)"); @@ -6624,7 +6811,9 @@ namespace ranges { } _NODISCARD constexpr decltype(auto) operator[](const difference_type _Off) const - noexcept(noexcept(*(*this + _Off))) /* strengthened */ requires random_access_range<_Base> { + noexcept(noexcept(*(*this + _Off))) /* strengthened */ + requires random_access_range<_Base> + { return *(*this + _Off); } @@ -6635,56 +6824,65 @@ namespace ranges { _NODISCARD_FRIEND constexpr bool operator==(const _Iterator& _Left, const _Iterator& _Right) noexcept( noexcept(_Fake_copy_init(_Left._Current == _Right._Current))) // strengthened - requires equality_comparable<_Base_iterator> { + requires equality_comparable<_Base_iterator> + { return _Left._Current == _Right._Current; } _NODISCARD_FRIEND constexpr bool operator<(const _Iterator& _Left, const _Iterator& _Right) noexcept( noexcept(_Fake_copy_init(_Left._Current < _Right._Current))) // strengthened - requires random_access_range<_Base> { + requires random_access_range<_Base> + { return _Left._Current < _Right._Current; } _NODISCARD_FRIEND constexpr bool operator>(const _Iterator& _Left, const _Iterator& _Right) noexcept( noexcept(_Fake_copy_init(_Right._Current < _Left._Current))) // strengthened - requires random_access_range<_Base> { + requires random_access_range<_Base> + { return _Right._Current < _Left._Current; } _NODISCARD_FRIEND constexpr bool operator<=(const _Iterator& _Left, const _Iterator& _Right) noexcept( noexcept(_Fake_copy_init(!(_Right._Current < _Left._Current)))) // strengthened - requires random_access_range<_Base> { + requires random_access_range<_Base> + { return !(_Right._Current < _Left._Current); } _NODISCARD_FRIEND constexpr bool operator>=(const _Iterator& _Left, const _Iterator& _Right) noexcept( noexcept(_Fake_copy_init(!(_Left._Current < _Right._Current)))) // strengthened - requires random_access_range<_Base> { + requires random_access_range<_Base> + { return !(_Left._Current < _Right._Current); } _NODISCARD_FRIEND constexpr auto operator<=>(const _Iterator& _Left, const _Iterator& _Right) noexcept( noexcept(_Left._Current <=> _Right._Current)) // strengthened - requires random_access_range<_Base> && three_way_comparable<_Base_iterator> { + requires random_access_range<_Base> && three_way_comparable<_Base_iterator> + { return _Left._Current <=> _Right._Current; } - _NODISCARD_FRIEND constexpr _Iterator operator+(const _Iterator& _It, const difference_type _Off) // - requires random_access_range<_Base> { + _NODISCARD_FRIEND constexpr _Iterator operator+(const _Iterator& _It, const difference_type _Off) + requires random_access_range<_Base> + { auto _Copy = _It; _Copy += _Off; return _Copy; } - _NODISCARD_FRIEND constexpr _Iterator operator+(const difference_type _Off, const _Iterator& _It) // - requires random_access_range<_Base> { + _NODISCARD_FRIEND constexpr _Iterator operator+(const difference_type _Off, const _Iterator& _It) + requires random_access_range<_Base> + { auto _Copy = _It; _Copy += _Off; return _Copy; } - _NODISCARD_FRIEND constexpr _Iterator operator-(const _Iterator& _It, const difference_type _Off) // - requires random_access_range<_Base> { + _NODISCARD_FRIEND constexpr _Iterator operator-(const _Iterator& _It, const difference_type _Off) + requires random_access_range<_Base> + { auto _Copy = _It; _Copy -= _Off; return _Copy; @@ -6692,7 +6890,8 @@ namespace ranges { _NODISCARD_FRIEND constexpr difference_type operator-(const _Iterator& _Left, const _Iterator& _Right) // noexcept(noexcept(_Left._Current - _Right._Current)) // strengthened - requires sized_sentinel_for<_Base_iterator, _Base_iterator> { + requires sized_sentinel_for<_Base_iterator, _Base_iterator> + { const auto _Diff = _Left._Current - _Right._Current; if constexpr (forward_range<_Base>) { return (_Diff + _Left._Missing - _Right._Missing) / _Left._Stride; @@ -6707,13 +6906,15 @@ namespace ranges { _NODISCARD_FRIEND constexpr difference_type operator-(default_sentinel_t, const _Iterator& _It) noexcept( noexcept(_It._End - _It._Current)) // strengthened - requires sized_sentinel_for<_Base_sentinel, _Base_iterator> { + requires sized_sentinel_for<_Base_sentinel, _Base_iterator> + { return _Div_ceil(_It._End - _It._Current, _It._Stride); } _NODISCARD_FRIEND constexpr difference_type operator-(const _Iterator& _It, default_sentinel_t) noexcept( noexcept(_It._End - _It._Current)) // strengthened - requires sized_sentinel_for<_Base_sentinel, _Base_iterator> { + requires sized_sentinel_for<_Base_sentinel, _Base_iterator> + { return -_Div_ceil(_It._End - _It._Current, _It._Stride); } @@ -6723,8 +6924,9 @@ namespace ranges { } friend constexpr void iter_swap(const _Iterator& _Left, const _Iterator& _Right) noexcept( - noexcept(_RANGES iter_swap(_Left._Current, _Right._Current))) // - requires indirectly_swappable<_Base_iterator> { + noexcept(_RANGES iter_swap(_Left._Current, _Right._Current))) + requires indirectly_swappable<_Base_iterator> + { return _RANGES iter_swap(_Left._Current, _Right._Current); } }; @@ -6739,7 +6941,8 @@ namespace ranges { } _NODISCARD constexpr _Vw base() const& noexcept(is_nothrow_copy_constructible_v<_Vw>) // strengthened - requires copy_constructible<_Vw> { + requires copy_constructible<_Vw> + { return _Range; } @@ -6753,19 +6956,22 @@ namespace ranges { _NODISCARD constexpr auto begin() noexcept( noexcept(_RANGES begin(_Range)) && is_nothrow_move_constructible_v>) // strengthened - requires(!_Simple_view<_Vw>) { + requires (!_Simple_view<_Vw>) + { return _Iterator{this, _RANGES begin(_Range)}; } _NODISCARD constexpr auto begin() const noexcept( noexcept(_RANGES begin(_Range)) && is_nothrow_move_constructible_v>) // strengthened - requires range { + requires range + { return _Iterator{this, _RANGES begin(_Range)}; } _NODISCARD constexpr auto end() noexcept(noexcept(_RANGES distance(_Range)) && noexcept(_RANGES end(_Range)) && is_nothrow_move_constructible_v>) // strengthened - requires(!_Simple_view<_Vw>) { + requires (!_Simple_view<_Vw>) + { if constexpr (common_range<_Vw> && sized_range<_Vw> && forward_range<_Vw>) { const auto _Missing = static_cast>(_Stride - _RANGES distance(_Range) % _Stride); @@ -6784,7 +6990,8 @@ namespace ranges { _NODISCARD constexpr auto end() const noexcept(noexcept(_RANGES distance(_Range)) && noexcept(_RANGES end(_Range)) && is_nothrow_move_constructible_v>) // strengthened - requires range { + requires range + { if constexpr (common_range && sized_range && forward_range) { const auto _Missing = static_cast>(_Stride - _RANGES distance(_Range) % _Stride); @@ -6801,12 +7008,14 @@ namespace ranges { } _NODISCARD constexpr auto size() noexcept(noexcept(_RANGES distance(_Range))) // strengthened - requires sized_range<_Vw> { + requires sized_range<_Vw> + { return _To_unsigned_like(_Div_ceil(_RANGES distance(_Range), _Stride)); } _NODISCARD constexpr auto size() const noexcept(noexcept(_RANGES distance(_Range))) // strengthened - requires sized_range { + requires sized_range + { return _To_unsigned_like(_Div_ceil(_RANGES distance(_Range), _Stride)); } }; @@ -6829,12 +7038,10 @@ namespace ranges { return stride_view(_STD forward<_Rng>(_Range), _Stride); } - // clang-format off template requires constructible_from, _Ty> _NODISCARD constexpr auto operator()(_Ty&& _Stride) const noexcept(is_nothrow_constructible_v, _Ty>) { - // clang-format on return _Range_closure<_Stride_fn, decay_t<_Ty>>{_STD forward<_Ty>(_Stride)}; } }; @@ -6858,27 +7065,24 @@ namespace ranges { template concept _Converts_direct_constructible = _Ref_converts<_Rng, _Container> // - && constructible_from<_Container, _Rng, _Types...>; + && constructible_from<_Container, _Rng, _Types...>; template concept _Converts_tag_constructible = _Ref_converts<_Rng, _Container> - // per LWG issue unnumbered as of 2022-08-08 - && constructible_from<_Container, const from_range_t&, _Rng, _Types...>; + // per LWG issue unnumbered as of 2022-08-08 + && constructible_from<_Container, const from_range_t&, _Rng, _Types...>; template - concept _Converts_and_common_constructible = _Ref_converts<_Rng, _Container> && common_range<_Rng> // + concept _Converts_and_common_constructible = + _Ref_converts<_Rng, _Container> && common_range<_Rng> // && _Cpp17_input_iterator> // && constructible_from<_Container, iterator_t<_Rng>, iterator_t<_Rng>, _Types...>; template - concept _Can_push_back = requires(_Container& _Cont) { - _Cont.push_back(_STD declval<_Reference>()); - }; + concept _Can_push_back = requires(_Container& _Cont) { _Cont.push_back(_STD declval<_Reference>()); }; template - concept _Can_insert_end = requires(_Container& _Cont) { - _Cont.insert(_Cont.end(), _STD declval<_Reference>()); - }; + concept _Can_insert_end = requires(_Container& _Cont) { _Cont.insert(_Cont.end(), _STD declval<_Reference>()); }; // clang-format off template @@ -6897,11 +7101,9 @@ namespace ranges { } } - // clang-format off _EXPORT_STD template requires (!view<_Container>) _NODISCARD constexpr _Container to(_Rng&& _Range, _Types&&... _Args) { - // clang-format on if constexpr (_Converts_direct_constructible<_Rng, _Container, _Types...>) { return _Container(_STD forward<_Rng>(_Range), _STD forward<_Types>(_Args)...); } else if constexpr (_Converts_tag_constructible<_Rng, _Container, _Types...>) { @@ -6930,19 +7132,18 @@ namespace ranges { _STL_INTERNAL_STATIC_ASSERT(!view<_Container>); template - _NODISCARD constexpr auto operator()(_Rng&& _Range, _Types&&... _Args) const requires requires { - _RANGES to<_Container>(_STD forward<_Rng>(_Range), _STD forward<_Types>(_Args)...); + _NODISCARD constexpr auto operator()(_Rng&& _Range, _Types&&... _Args) const + requires requires { _RANGES to<_Container>(_STD forward<_Rng>(_Range), _STD forward<_Types>(_Args)...); } + { + return _RANGES to<_Container>(_STD forward<_Rng>(_Range), _STD forward<_Types>(_Args)...); } - { return _RANGES to<_Container>(_STD forward<_Rng>(_Range), _STD forward<_Types>(_Args)...); } }; - // clang-format off _EXPORT_STD template requires (!view<_Container>) _NODISCARD constexpr auto to(_Types&&... _Args) { return _Range_closure<_To_class_fn<_Container>, decay_t<_Types>...>{_STD forward<_Types>(_Args)...}; } - // clang-format on template struct _Phony_input_iterator { diff --git a/stl/inc/regex b/stl/inc/regex index f5fb0c2ee4..56a12fe53e 100644 --- a/stl/inc/regex +++ b/stl/inc/regex @@ -4606,7 +4606,7 @@ namespace _DEPRECATE_TR1_NAMESPACE tr1 { namespace regex_constants { using namespace _STD regex_constants; } -} // namespace tr1 +} // namespace _DEPRECATE_TR1_NAMESPACE tr1 #endif // _HAS_TR1_NAMESPACE #if _HAS_CXX17 diff --git a/stl/inc/stop_token b/stl/inc/stop_token index 3f02d984e4..ee14cc886a 100644 --- a/stl/inc/stop_token +++ b/stl/inc/stop_token @@ -25,7 +25,9 @@ _STL_DISABLE_CLANG_WARNINGS #undef new _STD_BEGIN -_EXPORT_STD struct nostopstate_t { explicit nostopstate_t() = default; }; +_EXPORT_STD struct nostopstate_t { + explicit nostopstate_t() = default; +}; _EXPORT_STD inline constexpr nostopstate_t nostopstate{}; diff --git a/stl/inc/tuple b/stl/inc/tuple index ef3d4a653f..4af9b88b44 100644 --- a/stl/inc/tuple +++ b/stl/inc/tuple @@ -908,17 +908,13 @@ struct uses_allocator, _Alloc> : true_type {}; // true_type if #ifdef __cpp_lib_concepts template class _TQual, template class _UQual> - requires requires { - typename tuple, _UQual<_UTypes>>...>; - } + requires requires { typename tuple, _UQual<_UTypes>>...>; } struct basic_common_reference, tuple<_UTypes...>, _TQual, _UQual> { using type = tuple, _UQual<_UTypes>>...>; }; template - requires requires { - typename tuple...>; - } + requires requires { typename tuple...>; } struct common_type, tuple<_UTypes...>> { using type = tuple...>; }; @@ -932,7 +928,7 @@ namespace _DEPRECATE_TR1_NAMESPACE tr1 { using _STD ref; using _STD tie; using _STD tuple; -} // namespace tr1 +} // namespace _DEPRECATE_TR1_NAMESPACE tr1 #endif // _HAS_TR1_NAMESPACE _STD_END diff --git a/stl/inc/type_traits b/stl/inc/type_traits index 9218c5d44e..d7179bc9d9 100644 --- a/stl/inc/type_traits +++ b/stl/inc/type_traits @@ -697,8 +697,8 @@ struct _Is_copy_assignable_no_precondition_check add_lvalue_reference_t<_Ty>, add_lvalue_reference_t)> {}; template -_INLINE_VAR constexpr bool _Is_copy_assignable_unchecked_v = __is_assignable_no_precondition_check( - add_lvalue_reference_t<_Ty>, add_lvalue_reference_t); +_INLINE_VAR constexpr bool _Is_copy_assignable_unchecked_v = + __is_assignable_no_precondition_check(add_lvalue_reference_t<_Ty>, add_lvalue_reference_t); #else // ^^^ Use intrinsic / intrinsic not supported vvv template using _Is_copy_assignable_no_precondition_check = is_copy_assignable<_Ty>; @@ -721,8 +721,8 @@ struct _Is_move_assignable_no_precondition_check : bool_constant<__is_assignable_no_precondition_check(add_lvalue_reference_t<_Ty>, _Ty)> {}; template -_INLINE_VAR constexpr bool _Is_move_assignable_unchecked_v = __is_assignable_no_precondition_check( - add_lvalue_reference_t<_Ty>, _Ty); +_INLINE_VAR constexpr bool _Is_move_assignable_unchecked_v = + __is_assignable_no_precondition_check(add_lvalue_reference_t<_Ty>, _Ty); #else // ^^^ Use intrinsic / intrinsic not supported vvv template using _Is_move_assignable_no_precondition_check = is_move_assignable<_Ty>; @@ -1386,8 +1386,8 @@ using _RR_common_ref = remove_reference_t<_LL_common_ref<_Ty1, _Ty2>>&&; template struct _Common_reference2A<_Ty1&&, _Ty2&&, - enable_if_t< - is_convertible_v<_Ty1&&, _RR_common_ref<_Ty1, _Ty2>> && is_convertible_v<_Ty2&&, _RR_common_ref<_Ty1, _Ty2>>>> { + enable_if_t> + && is_convertible_v<_Ty2&&, _RR_common_ref<_Ty1, _Ty2>>>> { using type = _RR_common_ref<_Ty1, _Ty2>; // "both rvalues" case from N4917 21.3.8.7 [meta.trans.other]/2.6 }; @@ -1987,8 +1987,8 @@ struct _Is_swappable : _Is_swappable_with, add_lvalu }; template -struct _Swap_cannot_throw : bool_constant(), _STD declval<_Ty2>())) // - && noexcept(swap(_STD declval<_Ty2>(), _STD declval<_Ty1>()))> { +struct _Swap_cannot_throw : bool_constant(), _STD declval<_Ty2>())) + && noexcept(swap(_STD declval<_Ty2>(), _STD declval<_Ty1>()))> { // Determine if expressions with type and value category _Ty1 and _Ty2 // (presumed to satisfy is_swappable_with) can be swapped without emitting exceptions }; @@ -2181,9 +2181,8 @@ struct _Conditionally_enabled_hash<_Kty, false> { // conditionally disabled hash }; _EXPORT_STD template -struct hash - : _Conditionally_enabled_hash<_Kty, - !is_const_v<_Kty> && !is_volatile_v<_Kty> && (is_enum_v<_Kty> || is_integral_v<_Kty> || is_pointer_v<_Kty>)> { +struct hash : _Conditionally_enabled_hash<_Kty, !is_const_v<_Kty> && !is_volatile_v<_Kty> + && (is_enum_v<_Kty> || is_integral_v<_Kty> || is_pointer_v<_Kty>)> { // hash functor primary template (handles enums, integrals, and pointers) static size_t _Do_hash(const _Kty& _Keyval) noexcept { return _Hash_representation(_Keyval); @@ -2347,7 +2346,7 @@ namespace _DEPRECATE_TR1_NAMESPACE tr1 { using _STD result_of; #endif // _HAS_DEPRECATED_RESULT_OF using _STD hash; -} // namespace tr1 +} // namespace _DEPRECATE_TR1_NAMESPACE tr1 _STL_RESTORE_DEPRECATED_WARNING #endif // _HAS_TR1_NAMESPACE diff --git a/stl/inc/unordered_map b/stl/inc/unordered_map index 00883e77a8..dfc37c0068 100644 --- a/stl/inc/unordered_map +++ b/stl/inc/unordered_map @@ -922,7 +922,7 @@ _NODISCARD bool operator!=(const unordered_multimap<_Kty, _Ty, _Hasher, _Keyeq, namespace _DEPRECATE_TR1_NAMESPACE tr1 { using _STD unordered_map; using _STD unordered_multimap; -} // namespace tr1 +} // namespace _DEPRECATE_TR1_NAMESPACE tr1 #endif // _HAS_TR1_NAMESPACE #if _HAS_CXX17 diff --git a/stl/inc/unordered_set b/stl/inc/unordered_set index 63e51c9fbb..02ffe73f50 100644 --- a/stl/inc/unordered_set +++ b/stl/inc/unordered_set @@ -749,7 +749,7 @@ _NODISCARD bool operator!=(const unordered_multiset<_Kty, _Hasher, _Keyeq, _Allo namespace _DEPRECATE_TR1_NAMESPACE tr1 { using _STD unordered_multiset; using _STD unordered_set; -} // namespace tr1 +} // namespace _DEPRECATE_TR1_NAMESPACE tr1 #endif // _HAS_TR1_NAMESPACE #if _HAS_CXX17 diff --git a/stl/inc/utility b/stl/inc/utility index df5b488214..3e79e1d44b 100644 --- a/stl/inc/utility +++ b/stl/inc/utility @@ -410,16 +410,15 @@ _NODISCARD constexpr bool operator>=(const pair<_Ty1, _Ty2>& _Left, const pair<_ template class _TQual, template class _UQual> requires requires { - typename pair, _UQual<_Uty1>>, common_reference_t<_TQual<_Ty2>, _UQual<_Uty2>>>; - } + typename pair, _UQual<_Uty1>>, + common_reference_t<_TQual<_Ty2>, _UQual<_Uty2>>>; + } struct basic_common_reference, pair<_Uty1, _Uty2>, _TQual, _UQual> { using type = pair, _UQual<_Uty1>>, common_reference_t<_TQual<_Ty2>, _UQual<_Uty2>>>; }; template - requires requires { - typename pair, common_type_t<_Ty2, _Uty2>>; - } + requires requires { typename pair, common_type_t<_Ty2, _Uty2>>; } struct common_type, pair<_Uty1, _Uty2>> { using type = pair, common_type_t<_Ty2, _Uty2>>; }; @@ -468,7 +467,7 @@ namespace _CXX20_DEPRECATE_REL_OPS rel_ops { _CXX20_DEPRECATE_REL_OPS _NODISCARD bool operator>=(const _Ty& _Left, const _Ty& _Right) { return !(_Left < _Right); } -} // namespace rel_ops +} // namespace _CXX20_DEPRECATE_REL_OPS rel_ops _EXPORT_STD template struct tuple_size; @@ -689,14 +688,14 @@ inline constexpr in_place_index_t<_Idx> in_place_index{}; #if _HAS_CXX20 template inline constexpr bool _Is_standard_integer = is_integral_v<_Ty> - && !_Is_any_of_v, bool, char, + && !_Is_any_of_v, bool, char, #ifdef _NATIVE_WCHAR_T_DEFINED - wchar_t, + wchar_t, #endif // _NATIVE_WCHAR_T_DEFINED #ifdef __cpp_char8_t - char8_t, + char8_t, #endif // __cpp_char8_t - char16_t, char32_t>; + char16_t, char32_t>; _EXPORT_STD template _NODISCARD constexpr bool cmp_equal(const _Ty1 _Left, const _Ty2 _Right) noexcept { @@ -797,9 +796,7 @@ template using _With_reference = _Ty&; template -concept _Can_reference = requires { - typename _With_reference<_Ty>; -}; +concept _Can_reference = requires { typename _With_reference<_Ty>; }; #else // __cpp_lib_concepts template inline constexpr bool _Can_reference = false; @@ -849,7 +846,7 @@ namespace _DEPRECATE_TR1_NAMESPACE tr1 { using _STD get; using _STD tuple_element; using _STD tuple_size; -} // namespace tr1 +} // namespace _DEPRECATE_TR1_NAMESPACE tr1 #endif // _HAS_TR1_NAMESPACE _STD_END diff --git a/stl/inc/valarray b/stl/inc/valarray index b0d978daf1..273aa90988 100644 --- a/stl/inc/valarray +++ b/stl/inc/valarray @@ -44,7 +44,7 @@ _Ty* _Allocate_for_op_delete(size_t _Count) { #ifdef __cpp_aligned_new constexpr bool _Extended_alignment = alignof(_Ty) > __STDCPP_DEFAULT_NEW_ALIGNMENT__; if constexpr (_Extended_alignment) { - return static_cast<_Ty*>(::operator new (_Bytes, align_val_t{alignof(_Ty)})); + return static_cast<_Ty*>(::operator new(_Bytes, align_val_t{alignof(_Ty)})); } else #endif // __cpp_aligned_new { @@ -563,7 +563,7 @@ private: #ifdef __cpp_aligned_new constexpr bool _Extended_alignment = alignof(_Ty) > __STDCPP_DEFAULT_NEW_ALIGNMENT__; if constexpr (_Extended_alignment) { - ::operator delete (static_cast(_Myptr), align_val_t{alignof(_Ty)}); + ::operator delete(static_cast(_Myptr), align_val_t{alignof(_Ty)}); } else #endif // __cpp_aligned_new { diff --git a/stl/inc/variant b/stl/inc/variant index 222365dcfd..1aae6561ec 100644 --- a/stl/inc/variant +++ b/stl/inc/variant @@ -1027,9 +1027,9 @@ public: // initialize alternative _Idx from _Ilist and _Args... } - template , variant> // - && is_constructible_v<_Variant_init_type<_Ty, _Types...>, _Ty> // - && is_assignable_v<_Variant_init_type<_Ty, _Types...>&, _Ty>, // + template , variant> + && is_constructible_v<_Variant_init_type<_Ty, _Types...>, _Ty> + && is_assignable_v<_Variant_init_type<_Ty, _Types...>&, _Ty>, int> = 0> _CONSTEXPR20 variant& operator=(_Ty&& _Obj) noexcept( is_nothrow_assignable_v<_Variant_init_type<_Ty, _Types...>&, _Ty>&& @@ -1397,14 +1397,12 @@ _NODISCARD constexpr bool operator>=(const variant<_Types...>& _Left, const vari } #ifdef __cpp_lib_concepts -// clang-format off _EXPORT_STD template requires (three_way_comparable<_Types> && ...) _NODISCARD constexpr common_comparison_category_t...> operator<=>(const variant<_Types...>& _Left, const variant<_Types...>& _Right) noexcept( conjunction_v...>, compare_three_way, const _Types&, const _Types&>...>) /* strengthened */ { - // clang-format on // determine the three-way comparison of _Left's and _Right's index, if equal // return the three-way comparison of the contained values of _Left and _Right using _Visitor = _Variant_relop_visitor2 inline constexpr bool _Variant_all_visit_results_convertible<_Expected, _Callable, _Meta_list<_Args...>, - const variant<_Types...>&, _Rest...> = (_Variant_all_visit_results_convertible<_Expected, _Callable, - _Meta_list<_Args..., const _Types&>, _Rest...> && ...); + const variant<_Types...>&, _Rest...> = + (_Variant_all_visit_results_convertible<_Expected, _Callable, _Meta_list<_Args..., const _Types&>, _Rest...> + && ...); template inline constexpr bool diff --git a/stl/inc/xcharconv_tables.h b/stl/inc/xcharconv_tables.h index 77a6f040e9..7e43ab8b83 100644 --- a/stl/inc/xcharconv_tables.h +++ b/stl/inc/xcharconv_tables.h @@ -83,32 +83,26 @@ struct _General_precision_tables_2; template <> struct _General_precision_tables_2 { - static const int _Max_special_P; + static constexpr int _Max_special_P = 7; static const uint32_t _Special_X_table[63]; - static const int _Max_P; + static constexpr int _Max_P = 39; static const uint32_t _Ordinary_X_table[44]; }; -inline constexpr int _General_precision_tables_2::_Max_special_P = 7; // TRANSITION, VSO-1579484 -inline constexpr int _General_precision_tables_2::_Max_P = 39; // TRANSITION, VSO-1579484 - template <> struct _General_precision_tables_2 { - static const int _Max_special_P; + static constexpr int _Max_special_P = 15; static const uint64_t _Special_X_table[195]; - static const int _Max_P; + static constexpr int _Max_P = 309; static const uint64_t _Ordinary_X_table[314]; }; -inline constexpr int _General_precision_tables_2::_Max_special_P = 15; // TRANSITION, VSO-1579484 -inline constexpr int _General_precision_tables_2::_Max_P = 309; // TRANSITION, VSO-1579484 - _STD_END #pragma pop_macro("new") diff --git a/stl/inc/xhash b/stl/inc/xhash index 4b9587a5b9..6ae4dd102d 100644 --- a/stl/inc/xhash +++ b/stl/inc/xhash @@ -118,8 +118,8 @@ struct _Uhash_choose_transparency<_Kty, _Hasher, _Keyeq, #endif // _HAS_CXX20 template -_INLINE_VAR constexpr bool _Nothrow_hash = noexcept( - static_cast(_STD declval()(_STD declval()))); +_INLINE_VAR constexpr bool _Nothrow_hash = + noexcept(static_cast(_STD declval()(_STD declval()))); template class _Uhash_compare @@ -1096,7 +1096,7 @@ private: template static constexpr bool _Noexcept_heterogeneous_erasure() { - return _Nothrow_hash<_Traits, _Kx> // + return _Nothrow_hash<_Traits, _Kx> && (!_Multi || (_Nothrow_compare<_Traits, key_type, _Kx> && _Nothrow_compare<_Traits, _Kx, key_type>) ); } diff --git a/stl/inc/xkeycheck.h b/stl/inc/xkeycheck.h index b419247fc4..4e7aecd2cd 100644 --- a/stl/inc/xkeycheck.h +++ b/stl/inc/xkeycheck.h @@ -145,19 +145,19 @@ Enable warning C4005 to find the forbidden define. Enable warning C4005 to find the forbidden define. #endif // continue -#if defined(co_await ) && _HAS_CXX20 +#if defined(co_await) && _HAS_CXX20 #define co_await EMIT WARNING C4005 #error The C++ Standard Library forbids macroizing the keyword "co_await". \ Enable warning C4005 to find the forbidden define. #endif // co_await -#if defined(co_return ) && _HAS_CXX20 +#if defined(co_return) && _HAS_CXX20 #define co_return EMIT WARNING C4005 #error The C++ Standard Library forbids macroizing the keyword "co_return". \ Enable warning C4005 to find the forbidden define. #endif // co_return -#if defined(co_yield ) && _HAS_CXX20 +#if defined(co_yield) && _HAS_CXX20 #define co_yield EMIT WARNING C4005 #error The C++ Standard Library forbids macroizing the keyword "co_yield". \ Enable warning C4005 to find the forbidden define. @@ -356,7 +356,7 @@ Enable warning C4005 to find the forbidden define. Enable warning C4005 to find the forbidden define. #endif // requires -#if defined(return ) +#if defined(return) #define return EMIT WARNING C4005 #error The C++ Standard Library forbids macroizing the keyword "return". \ Enable warning C4005 to find the forbidden define. diff --git a/stl/inc/xlocinfo b/stl/inc/xlocinfo index 27f63566a2..702cf430c0 100644 --- a/stl/inc/xlocinfo +++ b/stl/inc/xlocinfo @@ -66,7 +66,7 @@ _CRTIMP2_PURE long double __CLRCALL_PURE_OR_CDECL _Stold(const char*, _Out_opt_ _CRTIMP2_PURE int __CLRCALL_PURE_OR_CDECL _Strcoll(const char*, const char*, const char*, const char*, const _Collvec*); _CRTIMP2_PURE size_t __CLRCALL_PURE_OR_CDECL _Strxfrm(_Out_writes_(_End1 - _String1) - _Post_readable_size_(return ) char* _String1, + _Post_readable_size_(return) char* _String1, _In_z_ char* _End1, const char*, const char*, const _Collvec*); _CRTIMP2_PURE int __CLRCALL_PURE_OR_CDECL _Tolower(int, const _Ctypevec*); _CRTIMP2_PURE int __CLRCALL_PURE_OR_CDECL _Toupper(int, const _Ctypevec*); @@ -74,7 +74,7 @@ _CRTIMP2_PURE _Success_(return != -1) int __CLRCALL_PURE_OR_CDECL _Wcrtomb(_Out_ char*, wchar_t, mbstate_t*, const _Cvtvec*); _CRTIMP2_PURE int __CLRCALL_PURE_OR_CDECL _Wcscoll( const wchar_t*, const wchar_t*, const wchar_t*, const wchar_t*, const _Collvec*); -_CRTIMP2_PURE size_t __CLRCALL_PURE_OR_CDECL _Wcsxfrm(_Out_writes_(_End1 - _String1) _Post_readable_size_(return ) +_CRTIMP2_PURE size_t __CLRCALL_PURE_OR_CDECL _Wcsxfrm(_Out_writes_(_End1 - _String1) _Post_readable_size_(return) wchar_t* _String1, _In_z_ wchar_t* _End1, const wchar_t*, const wchar_t*, const _Collvec*); @@ -439,14 +439,14 @@ size_t __CRTDECL _LStrxfrm(_Elem* _First1, _Elem* _Last1, const _Elem* _First2, } template <> -inline size_t __CRTDECL _LStrxfrm(_Out_writes_(_Last1 - _First1) _Post_readable_size_(return ) char* _First1, +inline size_t __CRTDECL _LStrxfrm(_Out_writes_(_Last1 - _First1) _Post_readable_size_(return) char* _First1, _In_z_ char* _Last1, const char* _First2, const char* _Last2, const _Locinfo::_Collvec* _Vector) { // perform locale-specific transform of chars [_First1, _Last1) return _Strxfrm(_First1, _Last1, _First2, _Last2, _Vector); } template <> -inline size_t __CRTDECL _LStrxfrm(_Out_writes_(_Last1 - _First1) _Post_readable_size_(return ) wchar_t* _First1, +inline size_t __CRTDECL _LStrxfrm(_Out_writes_(_Last1 - _First1) _Post_readable_size_(return) wchar_t* _First1, _In_z_ wchar_t* _Last1, const wchar_t* _First2, const wchar_t* _Last2, const _Locinfo::_Collvec* _Vector) { // perform locale-specific transform of wchar_ts [_First1, _Last1) return _Wcsxfrm(_First1, _Last1, _First2, _Last2, _Vector); diff --git a/stl/inc/xmemory b/stl/inc/xmemory index cdd4d07c3c..bc54938885 100644 --- a/stl/inc/xmemory +++ b/stl/inc/xmemory @@ -91,7 +91,7 @@ struct _Default_allocate_traits { #endif // _HAS_CXX20 #endif // __clang__ { - return ::operator new (_Bytes, align_val_t{_Align}); + return ::operator new(_Bytes, align_val_t{_Align}); } } #endif // __cpp_aligned_new @@ -207,7 +207,7 @@ _CONSTEXPR20 void _Deallocate(void* _Ptr, const size_t _Bytes) noexcept { _Passed_align = (_STD max)(_Align, _Big_allocation_alignment); } #endif // defined(_M_IX86) || defined(_M_X64) - ::operator delete (_Ptr, _Bytes, align_val_t{_Passed_align}); + ::operator delete(_Ptr, _Bytes, align_val_t{_Passed_align}); } } @@ -716,12 +716,12 @@ enum class _Pocma_values { }; template -_INLINE_VAR constexpr _Pocma_values - _Choose_pocma_v = allocator_traits<_Alloc>::is_always_equal::value - ? _Pocma_values::_Equal_allocators - : (allocator_traits<_Alloc>::propagate_on_container_move_assignment::value - ? _Pocma_values::_Propagate_allocators - : _Pocma_values::_No_propagate_allocators); +_INLINE_VAR constexpr _Pocma_values _Choose_pocma_v = + allocator_traits<_Alloc>::is_always_equal::value + ? _Pocma_values::_Equal_allocators + : (allocator_traits<_Alloc>::propagate_on_container_move_assignment::value + ? _Pocma_values::_Propagate_allocators + : _Pocma_values::_No_propagate_allocators); template using _Rebind_alloc_t = typename allocator_traits<_Alloc>::template rebind_alloc<_Value_type>; @@ -734,10 +734,11 @@ using _Maybe_rebind_alloc_t = _Rebind_alloc_t<_Alloc, _Value_type>>; template // tests if allocator has simple addressing -_INLINE_VAR constexpr bool _Is_simple_alloc_v = is_same_v::size_type, size_t>&& - is_same_v::difference_type, ptrdiff_t>&& - is_same_v::pointer, typename _Alloc::value_type*>&& - is_same_v::const_pointer, const typename _Alloc::value_type*>; +_INLINE_VAR constexpr bool _Is_simple_alloc_v = + is_same_v::size_type, size_t> + && is_same_v::difference_type, ptrdiff_t> + && is_same_v::pointer, typename _Alloc::value_type*> + && is_same_v::const_pointer, const typename _Alloc::value_type*>; template struct _Simple_types { // wraps types from allocators with simple addressing for use in iterators @@ -758,9 +759,7 @@ struct allocation_result { #ifdef __cpp_lib_concepts template -concept _Has_member_allocate_at_least = requires(_Alloc _Al, size_t _Count) { - _Al.allocate_at_least(_Count); -}; +concept _Has_member_allocate_at_least = requires(_Alloc _Al, size_t _Count) { _Al.allocate_at_least(_Count); }; _EXPORT_STD template _NODISCARD constexpr allocation_result::pointer> allocate_at_least( @@ -1426,7 +1425,7 @@ pair<_Ty*, ptrdiff_t> _Get_temporary_buffer(ptrdiff_t _Count) noexcept { void* _Pbuf; #ifdef __cpp_aligned_new if constexpr (alignof(_Ty) > __STDCPP_DEFAULT_NEW_ALIGNMENT__) { - _Pbuf = ::operator new (_Size, align_val_t{alignof(_Ty)}, nothrow); + _Pbuf = ::operator new(_Size, align_val_t{alignof(_Ty)}, nothrow); } else #endif // __cpp_aligned_new { @@ -1446,7 +1445,7 @@ template void _Return_temporary_buffer(_Ty* const _Pbuf) noexcept { #ifdef __cpp_aligned_new if constexpr (alignof(_Ty) > __STDCPP_DEFAULT_NEW_ALIGNMENT__) { - ::operator delete (_Pbuf, align_val_t{alignof(_Ty)}); + ::operator delete(_Pbuf, align_val_t{alignof(_Ty)}); } else #endif // __cpp_aligned_new { @@ -1507,25 +1506,25 @@ _CONSTEXPR20 _NoThrowFwdIt _Uninitialized_move_unchecked(_InIt _First, const _In namespace ranges { template concept _No_throw_input_iterator = input_iterator<_It> // - && is_lvalue_reference_v> // - && same_as>, iter_value_t<_It>>; + && is_lvalue_reference_v> // + && same_as>, iter_value_t<_It>>; template concept _No_throw_sentinel_for = sentinel_for<_Se, _It>; template concept _No_throw_forward_iterator = _No_throw_input_iterator<_It> // - && forward_iterator<_It> // - && _No_throw_sentinel_for<_It, _It>; + && forward_iterator<_It> // + && _No_throw_sentinel_for<_It, _It>; template concept _No_throw_input_range = range<_Rng> // - && _No_throw_input_iterator> // - && _No_throw_sentinel_for, iterator_t<_Rng>>; + && _No_throw_input_iterator> // + && _No_throw_sentinel_for, iterator_t<_Rng>>; template concept _No_throw_forward_range = _No_throw_input_range<_Rng> // - && _No_throw_forward_iterator>; + && _No_throw_forward_iterator>; template in_out_result<_InIt, _OutIt> _Copy_memcpy_count(_InIt _IFirst, _OutIt _OFirst, const size_t _Count) noexcept { @@ -1607,13 +1606,11 @@ namespace ranges { _EXPORT_STD template using uninitialized_move_result = in_out_result<_In, _Out>; - // clang-format off template _Se, _No_throw_forward_iterator _Out, _No_throw_sentinel_for<_Out> _OSe> requires (constructible_from, iter_rvalue_reference_t<_It>>) uninitialized_move_result<_It, _Out> _Uninitialized_move_unchecked( _It _IFirst, _Se _ILast, _Out _OFirst, _OSe _OLast) { - // clang-format on constexpr bool _Is_sized1 = sized_sentinel_for<_Se, _It>; constexpr bool _Is_sized2 = sized_sentinel_for<_OSe, _Out>; if constexpr (_Iter_move_cat<_It, _Out>::_Bitcopy_constructible @@ -2337,12 +2334,14 @@ constexpr _Ty* uninitialized_construct_using_allocator(_Ty* _Ptr, const _Alloc& #endif // _HAS_CXX20 #if _HAS_CXX23 && defined(__cpp_lib_concepts) // TRANSITION, GH-395 -_EXPORT_STD struct from_range_t { explicit from_range_t() = default; }; +_EXPORT_STD struct from_range_t { + explicit from_range_t() = default; +}; _EXPORT_STD inline constexpr from_range_t from_range; template concept _Container_compatible_range = - _RANGES input_range<_Rng> && convertible_to<_RANGES range_reference_t<_Rng>, _Elem>; + (_RANGES input_range<_Rng>) && convertible_to<_RANGES range_reference_t<_Rng>, _Elem>; template <_RANGES input_range _Rng> using _Range_key_type = remove_const_t::first_type>; diff --git a/stl/inc/xstring b/stl/inc/xstring index bc0332d6c4..f3d77c4cda 100644 --- a/stl/inc/xstring +++ b/stl/inc/xstring @@ -376,7 +376,7 @@ public: _In_reads_(_Count) const _Elem* const _First2, const size_t _Count) noexcept /* strengthened */ { // compare [_First1, _First1 + _Count) with [_First2, ...) #if _HAS_CXX17 -#if _HAS_CXX20 && defined(__EDG__) // TRANSITION, VSO-1601168 +#if _HAS_CXX20 && defined(__EDG__) // TRANSITION, VSO-1641993 if (_STD is_constant_evaluated()) { for (size_t _Idx = 0; _Idx != _Count; ++_Idx) { if (static_cast(_First1[_Idx]) < static_cast(_First2[_Idx])) { @@ -1260,12 +1260,10 @@ public: } #ifdef __cpp_lib_concepts - // clang-format off template _Sent> requires (is_same_v, _Elem> && !is_convertible_v<_Sent, size_type>) constexpr basic_string_view(_Iter _First, _Sent _Last) noexcept(noexcept(_Last - _First)) // strengthened : _Mydata(_STD to_address(_First)), _Mysize(static_cast(_Last - _First)) {} - // clang-format on #if _HAS_CXX23 // clang-format off @@ -2424,8 +2422,8 @@ extern const bool _Asan_string_should_annotate; #endif // ^^^ unknown architecture ^^^ template -_INLINE_VAR constexpr bool _Has_minimum_allocation_alignment_string = alignof(typename _String::value_type) - >= _Asan_granularity; +_INLINE_VAR constexpr bool _Has_minimum_allocation_alignment_string = + alignof(typename _String::value_type) >= _Asan_granularity; template _INLINE_VAR constexpr bool _Has_minimum_allocation_alignment_string<_String, @@ -2438,7 +2436,7 @@ _INLINE_VAR constexpr bool _Has_minimum_allocation_alignment_string<_String, #if _HAS_CXX23 && defined(__cpp_lib_concepts) // TRANSITION, GH-395 template concept _Contiguous_range_of = - _RANGES contiguous_range<_Rng> && same_as>, _Ty>; + (_RANGES contiguous_range<_Rng>) && same_as>, _Ty>; #endif // _HAS_CXX23 && defined(__cpp_lib_concepts) _EXPORT_STD template , class _Alloc = allocator<_Elem>> diff --git a/stl/inc/xutility b/stl/inc/xutility index 2a308dcbaf..ba8ed1e070 100644 --- a/stl/inc/xutility +++ b/stl/inc/xutility @@ -209,13 +209,13 @@ _NODISCARD constexpr void* _Voidify_iter(_Iter _It) noexcept { #if _HAS_CXX20 #ifdef __EDG__ // TRANSITION, DevCom-1691516 _EXPORT_STD template ()) _Ty(_STD declval<_Types>()...))>> + class = void_t()) _Ty(_STD declval<_Types>()...))>> #else // ^^^ no workaround // workaround vvv _EXPORT_STD template ()) _Ty(_STD declval<_Types>()...))>* = nullptr> + void_t()) _Ty(_STD declval<_Types>()...))>* = nullptr> #endif // TRANSITION, DevCom-1691516 constexpr _Ty* construct_at(_Ty* const _Location, _Types&&... _Args) noexcept( - noexcept(::new (_Voidify_iter(_Location)) _Ty(_STD forward<_Types>(_Args)...))) /* strengthened */ { + noexcept(::new(_Voidify_iter(_Location)) _Ty(_STD forward<_Types>(_Args)...))) /* strengthened */ { _MSVC_CONSTEXPR return ::new (_Voidify_iter(_Location)) _Ty(_STD forward<_Types>(_Args)...); } #endif // _HAS_CXX20 @@ -275,9 +275,9 @@ struct pointer_traits<_Ty*> { #ifdef __cpp_lib_concepts template concept _Has_to_address = requires(const _Ty& _Val) { - typename pointer_traits<_Ty>; - pointer_traits<_Ty>::to_address(_Val); -}; + typename pointer_traits<_Ty>; + pointer_traits<_Ty>::to_address(_Val); + }; #else // ^^^ Use concept / use variable template vvv template inline constexpr bool _Has_to_address = false; // determines whether pointer_traits<_Ty> has to_address @@ -371,6 +371,7 @@ namespace ranges { concept _Can_deref = requires(_Ty&& __t) { *static_cast<_Ty&&>(__t); }; + // clang-format on class _Cpo { private: @@ -410,7 +411,6 @@ namespace ranges { } } }; - // clang-format on } // namespace _Iter_move inline namespace _Cpos { @@ -446,12 +446,13 @@ _EXPORT_STD template using iter_common_reference_t = common_reference_t, iter_value_t<_Ty>&>; _EXPORT_STD template -concept indirectly_writable = requires(_It && __i, _Ty&& __t) { - *__i = static_cast<_Ty&&>(__t); - *static_cast<_It&&>(__i) = static_cast<_Ty&&>(__t); - const_cast&&>(*__i) = static_cast<_Ty&&>(__t); - const_cast&&>(*static_cast<_It&&>(__i)) = static_cast<_Ty&&>(__t); -}; +concept indirectly_writable = + requires(_It && __i, _Ty&& __t) { + *__i = static_cast<_Ty&&>(__t); + *static_cast<_It&&>(__i) = static_cast<_Ty&&>(__t); + const_cast&&>(*__i) = static_cast<_Ty&&>(__t); + const_cast&&>(*static_cast<_It&&>(__i)) = static_cast<_Ty&&>(__t); + }; template struct _Make_unsigned_like_impl { @@ -493,8 +494,8 @@ _NODISCARD constexpr auto _To_signed_like(const _Ty _Value) noexcept { _EXPORT_STD template concept incrementable = regular<_Ty> && weakly_incrementable<_Ty> && requires(_Ty __t) { - { __t++ } -> same_as<_Ty>; -}; + { __t++ } -> same_as<_Ty>; + }; template struct _Iter_concept_impl2 { @@ -724,7 +725,6 @@ namespace ranges { static constexpr _Choice_t<_St> _Choice = _Choose<_Ty1, _Ty2>(); public: - // clang-format off template requires (_Choice<_Ty1, _Ty2>._Strategy != _St::_None) constexpr void operator()(_Ty1&& _Val1, _Ty2&& _Val2) const noexcept(_Choice<_Ty1, _Ty2>._No_throw) { @@ -741,7 +741,6 @@ namespace ranges { static_assert(_Always_false<_Ty1>, "should be unreachable"); } } - // clang-format on }; } // namespace _Iter_swap @@ -774,10 +773,10 @@ namespace ranges { _EXPORT_STD template concept mergeable = input_iterator<_It1> && input_iterator<_It2> // - && weakly_incrementable<_Out> // - && indirectly_copyable<_It1, _Out> // - && indirectly_copyable<_It2, _Out> // - && indirect_strict_weak_order<_Pr, projected<_It1, _Pj1>, projected<_It2, _Pj2>>; + && weakly_incrementable<_Out> // + && indirectly_copyable<_It1, _Out> // + && indirectly_copyable<_It2, _Out> // + && indirect_strict_weak_order<_Pr, projected<_It1, _Pj1>, projected<_It2, _Pj2>>; _EXPORT_STD template concept sortable = permutable<_It> && indirect_strict_weak_order<_Pr, projected<_It, _Proj>>; @@ -935,7 +934,7 @@ _INLINE_VAR constexpr bool template _INLINE_VAR constexpr bool _Unwrappable_for_unverified_v = - _Unwrappable_v<_Iter>&& _Do_unwrap_when_unverified_v<_Remove_cvref_t<_Iter>>; + _Unwrappable_v<_Iter> && _Do_unwrap_when_unverified_v<_Remove_cvref_t<_Iter>>; template _NODISCARD constexpr decltype(auto) _Get_unwrapped_unverified(_Iter&& _It) { @@ -974,7 +973,7 @@ _INLINE_VAR constexpr bool template _INLINE_VAR constexpr bool _Unwrappable_for_offset_v = - _Unwrappable_v<_Iter>&& _Offset_verifiable_v<_Remove_cvref_t<_Iter>>; + _Unwrappable_v<_Iter> && _Offset_verifiable_v<_Remove_cvref_t<_Iter>>; template _NODISCARD constexpr decltype(auto) _Get_unwrapped_n(_Iter&& _It, const _Diff _Off) { @@ -1206,8 +1205,8 @@ template ; template -_INLINE_VAR constexpr bool _Has_nothrow_operator_arrow<_Iter, _Pointer, false> = noexcept( - _Fake_copy_init<_Pointer>(_STD declval<_Iter>().operator->())); +_INLINE_VAR constexpr bool _Has_nothrow_operator_arrow<_Iter, _Pointer, false> = + noexcept(_Fake_copy_init<_Pointer>(_STD declval<_Iter>().operator->())); _EXPORT_STD template class reverse_iterator { @@ -1271,7 +1270,7 @@ public: noexcept(is_nothrow_copy_constructible_v<_BidIt>&& noexcept(--(_STD declval<_BidIt&>())) && _Has_nothrow_operator_arrow<_BidIt&, pointer>) /* strengthened */ #ifdef __cpp_lib_concepts - requires(is_pointer_v<_BidIt> || requires(const _BidIt __i) { __i.operator->(); }) + requires (is_pointer_v<_BidIt> || requires(const _BidIt __i) { __i.operator->(); }) #endif { _BidIt _Tmp = current; @@ -1405,7 +1404,9 @@ _NODISCARD _CONSTEXPR17 bool } // clang-format on #endif // __cpp_lib_concepts -{ return _Left._Get_current() == _Right._Get_current(); } +{ + return _Left._Get_current() == _Right._Get_current(); +} _EXPORT_STD template _NODISCARD _CONSTEXPR17 bool @@ -1418,7 +1419,9 @@ _NODISCARD _CONSTEXPR17 bool } // clang-format on #endif // __cpp_lib_concepts -{ return _Left._Get_current() != _Right._Get_current(); } +{ + return _Left._Get_current() != _Right._Get_current(); +} _EXPORT_STD template _NODISCARD _CONSTEXPR17 bool @@ -1431,7 +1434,9 @@ _NODISCARD _CONSTEXPR17 bool } // clang-format on #endif // __cpp_lib_concepts -{ return _Left._Get_current() > _Right._Get_current(); } +{ + return _Left._Get_current() > _Right._Get_current(); +} _EXPORT_STD template _NODISCARD _CONSTEXPR17 bool @@ -1444,7 +1449,9 @@ _NODISCARD _CONSTEXPR17 bool } // clang-format on #endif // __cpp_lib_concepts -{ return _Left._Get_current() < _Right._Get_current(); } +{ + return _Left._Get_current() < _Right._Get_current(); +} _EXPORT_STD template _NODISCARD _CONSTEXPR17 bool @@ -1457,7 +1464,9 @@ _NODISCARD _CONSTEXPR17 bool } // clang-format on #endif // __cpp_lib_concepts -{ return _Left._Get_current() >= _Right._Get_current(); } +{ + return _Left._Get_current() >= _Right._Get_current(); +} _EXPORT_STD template _NODISCARD _CONSTEXPR17 bool @@ -1470,7 +1479,9 @@ _NODISCARD _CONSTEXPR17 bool } // clang-format on #endif // __cpp_lib_concepts -{ return _Left._Get_current() <= _Right._Get_current(); } +{ + return _Left._Get_current() <= _Right._Get_current(); +} #ifdef __cpp_lib_concepts _EXPORT_STD template _BidIt2> @@ -1502,11 +1513,9 @@ _NODISCARD _CONSTEXPR17 reverse_iterator<_BidIt> make_reverse_iterator(_BidIt _I } #ifdef __cpp_lib_concepts -// clang-format off template requires (!sized_sentinel_for<_BidIt1, _BidIt2>) inline constexpr bool disable_sized_sentinel_for, reverse_iterator<_BidIt2>> = true; -// clang-format on #endif // __cpp_lib_concepts _EXPORT_STD template @@ -1680,17 +1689,15 @@ _NODISCARD constexpr const _Elem* data(initializer_list<_Elem> _Ilist) noexcept #ifdef __cpp_lib_concepts template -concept _Not_same_as = !same_as, remove_cvref_t<_Ty2>>; +concept _Not_same_as = (!same_as, remove_cvref_t<_Ty2>>); namespace ranges { template inline constexpr bool _Has_complete_elements = false; - // clang-format off template requires requires(_Ty& __t) { sizeof(__t[0]); } inline constexpr bool _Has_complete_elements<_Ty> = true; - // clang-format on _EXPORT_STD template inline constexpr bool enable_borrowed_range = false; @@ -1706,13 +1713,14 @@ namespace ranges { template concept _Has_member = requires(_Ty __t) { - { _Fake_copy_init(__t.begin()) } -> input_or_output_iterator; - }; + { _Fake_copy_init(__t.begin()) } -> input_or_output_iterator; + }; template - concept _Has_ADL = _Has_class_or_enum_type<_Ty> && requires(_Ty __t) { - { _Fake_copy_init(begin(__t)) } -> input_or_output_iterator; - }; + concept _Has_ADL = _Has_class_or_enum_type<_Ty> // + && requires(_Ty __t) { + { _Fake_copy_init(begin(__t)) } -> input_or_output_iterator; + }; class _Cpo { private: @@ -1740,7 +1748,6 @@ namespace ranges { static constexpr _Choice_t<_St> _Choice = _Choose<_Ty>(); public: - // clang-format off template <_Should_range_access _Ty> requires (_Choice<_Ty&>._Strategy != _St::_None) _NODISCARD constexpr auto operator()(_Ty&& _Val) const noexcept(_Choice<_Ty&>._No_throw) { @@ -1756,7 +1763,6 @@ namespace ranges { static_assert(_Always_false<_Ty>, "Should be unreachable"); } } - // clang-format on }; } // namespace _Begin @@ -1775,13 +1781,14 @@ namespace ranges { template concept _Has_member = requires(_Ty __t) { - { _Fake_copy_init(__t.end()) } -> sentinel_for>; - }; + { _Fake_copy_init(__t.end()) } -> sentinel_for>; + }; template - concept _Has_ADL = _Has_class_or_enum_type<_Ty> && requires(_Ty __t) { - { _Fake_copy_init(end(__t)) } -> sentinel_for>; - }; + concept _Has_ADL = _Has_class_or_enum_type<_Ty> // + && requires(_Ty __t) { + { _Fake_copy_init(end(__t)) } -> sentinel_for>; + }; class _Cpo { private: @@ -1815,7 +1822,6 @@ namespace ranges { static constexpr _Choice_t<_St> _Choice = _Choose<_Ty>(); public: - // clang-format off template <_Should_range_access _Ty> requires (_Choice<_Ty&>._Strategy != _St::_None) _NODISCARD constexpr auto operator()(_Ty&& _Val) const noexcept(_Choice<_Ty&>._No_throw) { @@ -1832,7 +1838,6 @@ namespace ranges { static_assert(_Always_false<_Ty>, "should be unreachable"); } } - // clang-format on }; } // namespace _End @@ -1842,39 +1847,34 @@ namespace ranges { _EXPORT_STD template concept range = requires(_Rng & __r) { - _RANGES begin(__r); - _RANGES end(__r); - }; + _RANGES begin(__r); + _RANGES end(__r); + }; _EXPORT_STD template using sentinel_t = decltype(_RANGES end(_STD declval<_Rng&>())); template concept _Weakly_unwrappable = - same_as::_Prevent_inheriting_unwrap, remove_cvref_t<_Wrapped>> // - && requires(_Wrapped&& _Wr) { - _STD forward<_Wrapped>(_Wr)._Unwrapped(); - }; + same_as::_Prevent_inheriting_unwrap, remove_cvref_t<_Wrapped>> + && requires(_Wrapped&& _Wr) { _STD forward<_Wrapped>(_Wr)._Unwrapped(); }; - // clang-format off template concept _Weakly_unwrappable_sentinel = _Weakly_unwrappable&>; - // clang-format on template concept _Weakly_unwrappable_iterator = // _Weakly_unwrappable<_Iter> // - && requires(_Iter&& _It, remove_cvref_t<_Iter>& _MutIt) { - _MutIt._Seek_to(_STD forward<_Iter>(_It)._Unwrapped()); - }; + && requires( + _Iter&& _It, remove_cvref_t<_Iter>& _MutIt) { _MutIt._Seek_to(_STD forward<_Iter>(_It)._Unwrapped()); }; template concept _Unwrappable_sentinel_for = // _Weakly_unwrappable_sentinel<_Sent> // && _Weakly_unwrappable_iterator<_Iter> // && requires(_Iter&& _It, const remove_reference_t<_Sent>& _Se) { - { _Se._Unwrapped() } -> sentinel_for(_It)._Unwrapped())>; - }; + { _Se._Unwrapped() } -> sentinel_for(_It)._Unwrapped())>; + }; template _NODISCARD constexpr decltype(auto) _Unwrap_iter(_Iter&& _It) noexcept( @@ -1929,13 +1929,11 @@ namespace ranges { namespace _Unchecked_begin { template concept _Has_member = requires(_Ty& __t) { - { __t._Unchecked_begin() } -> input_or_output_iterator; - }; + { __t._Unchecked_begin() } -> input_or_output_iterator; + }; template - concept _Can_begin = requires(_Ty& __t) { - _Unwrap_range_iter<_Ty>(_RANGES begin(__t)); - }; + concept _Can_begin = requires(_Ty& __t) { _Unwrap_range_iter<_Ty>(_RANGES begin(__t)); }; class _Cpo { private: @@ -1960,11 +1958,9 @@ namespace ranges { static constexpr _Choice_t<_St> _Choice = _Choose<_Ty>(); public: - // clang-format off template <_Should_range_access _Ty> requires (_Choice<_Ty&>._Strategy != _St::_None) _NODISCARD constexpr auto operator()(_Ty&& _Val) const noexcept(_Choice<_Ty&>._No_throw) { - // clang-format on constexpr _St _Strat = _Choice<_Ty&>._Strategy; if constexpr (_Strat == _St::_Member) { @@ -1984,15 +1980,14 @@ namespace ranges { namespace _Unchecked_end { template - concept _Has_member = _Unchecked_begin::_Has_member<_Ty> && requires(_Ty& __t) { - __t._Unchecked_begin(); // required explicitly for better diagnostics - { __t._Unchecked_end() } -> sentinel_for; - }; + concept _Has_member = _Unchecked_begin::_Has_member<_Ty> + && requires(_Ty& __t) { + __t._Unchecked_begin(); // required explicitly for better diagnostics + { __t._Unchecked_end() } -> sentinel_for; + }; template - concept _Can_end = requires(_Ty& __t) { - _Unwrap_range_sent<_Ty>(_RANGES end(__t)); - }; + concept _Can_end = requires(_Ty& __t) { _Unwrap_range_sent<_Ty>(_RANGES end(__t)); }; class _Cpo { private: @@ -2014,7 +2009,6 @@ namespace ranges { static constexpr _Choice_t<_St> _Choice = _Choose<_Ty>(); public: - // clang-format off template <_Should_range_access _Ty> requires (_Choice<_Ty&>._Strategy != _St::_None) _NODISCARD constexpr auto operator()(_Ty&& _Val) const noexcept(_Choice<_Ty&>._No_throw) { @@ -2028,7 +2022,6 @@ namespace ranges { static_assert(_Always_false<_Ty>, "Should be unreachable"); } } - // clang-format on }; } // namespace _Unchecked_end @@ -2089,19 +2082,20 @@ namespace ranges { template concept _Has_member = requires(_Ty __t) { - { _Fake_copy_init(__t.rbegin()) } -> input_or_output_iterator; - }; + { _Fake_copy_init(__t.rbegin()) } -> input_or_output_iterator; + }; template - concept _Has_ADL = _Has_class_or_enum_type<_Ty> && requires(_Ty __t) { - { _Fake_copy_init(rbegin(__t)) } -> input_or_output_iterator; - }; + concept _Has_ADL = _Has_class_or_enum_type<_Ty> // + && requires(_Ty __t) { + { _Fake_copy_init(rbegin(__t)) } -> input_or_output_iterator; + }; template concept _Can_make_reverse = requires(_Ty __t) { - { _RANGES begin(__t) } -> bidirectional_iterator; - { _RANGES end(__t) } -> same_as; - }; + { _RANGES begin(__t) } -> bidirectional_iterator; + { _RANGES end(__t) } -> same_as; + }; class _Cpo { private: @@ -2125,7 +2119,6 @@ namespace ranges { static constexpr _Choice_t<_St> _Choice = _Choose<_Ty>(); public: - // clang-format off template <_Should_range_access _Ty> requires (_Choice<_Ty&>._Strategy != _St::_None) _NODISCARD constexpr auto operator()(_Ty&& _Val) const noexcept(_Choice<_Ty&>._No_throw) { @@ -2141,7 +2134,6 @@ namespace ranges { static_assert(_Always_false<_Ty>, "should be unreachable"); } } - // clang-format on }; } // namespace _Rbegin @@ -2157,19 +2149,20 @@ namespace ranges { template concept _Has_member = requires(_Ty __t) { - { _Fake_copy_init(__t.rend()) } -> sentinel_for; - }; + { _Fake_copy_init(__t.rend()) } -> sentinel_for; + }; template - concept _Has_ADL = _Has_class_or_enum_type<_Ty> && requires(_Ty __t) { - { _Fake_copy_init(rend(__t)) } -> sentinel_for; - }; + concept _Has_ADL = _Has_class_or_enum_type<_Ty> // + && requires(_Ty __t) { + { _Fake_copy_init(rend(__t)) } -> sentinel_for; + }; template concept _Can_make_reverse = requires(_Ty __t) { - { _RANGES begin(__t) } -> bidirectional_iterator; - { _RANGES end(__t) } -> same_as; - }; + { _RANGES begin(__t) } -> bidirectional_iterator; + { _RANGES end(__t) } -> same_as; + }; class _Cpo { private: @@ -2194,7 +2187,6 @@ namespace ranges { static constexpr _Choice_t<_St> _Choice = _Choose<_Ty>(); public: - // clang-format off template <_Should_range_access _Ty> requires (_Choice<_Ty&>._Strategy != _St::_None) _NODISCARD constexpr auto operator()(_Ty&& _Val) const noexcept(_Choice<_Ty&>._No_throw) { @@ -2210,7 +2202,6 @@ namespace ranges { static_assert(_Always_false<_Ty>, "should be unreachable"); } } - // clang-format on }; } // namespace _Rend @@ -2258,20 +2249,22 @@ namespace ranges { void size(const _Ty&) = delete; template - concept _Has_member = !disable_sized_range<_UnCV> && requires(_Ty __t) { - { _Fake_copy_init(__t.size()) } -> _Integer_like; - }; + concept _Has_member = (!disable_sized_range<_UnCV>) // + && requires(_Ty __t) { + { _Fake_copy_init(__t.size()) } -> _Integer_like; + }; template - concept _Has_ADL = _Has_class_or_enum_type<_Ty> && !disable_sized_range<_UnCV> && requires(_Ty __t) { - { _Fake_copy_init(size(__t)) } -> _Integer_like; - }; + concept _Has_ADL = _Has_class_or_enum_type<_Ty> && (!disable_sized_range<_UnCV>) // + && requires(_Ty __t) { + { _Fake_copy_init(size(__t)) } -> _Integer_like; + }; template concept _Can_difference = requires(_Ty __t) { - { _RANGES begin(__t) } -> forward_iterator; - { _RANGES end(__t) } -> sized_sentinel_for; - }; + { _RANGES begin(__t) } -> forward_iterator; + { _RANGES end(__t) } -> sized_sentinel_for; + }; class _Cpo { private: @@ -2304,7 +2297,6 @@ namespace ranges { static constexpr _Choice_t<_St> _Choice = _Choose<_Ty>(); public: - // clang-format off template requires (_Choice<_Ty&>._Strategy != _St::_None) _NODISCARD constexpr auto operator()(_Ty&& _Val) const noexcept(_Choice<_Ty&>._No_throw) { @@ -2324,7 +2316,6 @@ namespace ranges { static_assert(_Always_false<_Ty>, "should be unreachable"); } } - // clang-format on }; } // namespace _Size @@ -2334,20 +2325,16 @@ namespace ranges { namespace _Empty { template - concept _Has_member = requires(_Ty __t) { - static_cast(__t.empty()); - }; + concept _Has_member = requires(_Ty __t) { static_cast(__t.empty()); }; template - concept _Has_size = requires(_Ty __t) { - _RANGES size(__t); - }; + concept _Has_size = requires(_Ty __t) { _RANGES size(__t); }; template concept _Can_begin_end = requires(_Ty __t) { - { _RANGES begin(__t) } -> forward_iterator; - _RANGES end(__t); - }; + { _RANGES begin(__t) } -> forward_iterator; + _RANGES end(__t); + }; class _Cpo { private: @@ -2405,13 +2392,13 @@ namespace ranges { template concept _Has_member = requires(_Ty __t) { - { _Fake_copy_init(__t.data()) } -> _Points_to_object; - }; + { _Fake_copy_init(__t.data()) } -> _Points_to_object; + }; template concept _Has_contiguous_iterator = requires(_Ty __t) { - { _RANGES begin(__t) } -> contiguous_iterator; - }; + { _RANGES begin(__t) } -> contiguous_iterator; + }; class _Cpo { private: @@ -2433,7 +2420,6 @@ namespace ranges { static constexpr _Choice_t<_St> _Choice = _Choose<_Ty>(); public: - // clang-format off template <_Should_range_access _Ty> requires (_Choice<_Ty&>._Strategy != _St::_None) _NODISCARD constexpr auto operator()(_Ty&& _Val) const noexcept(_Choice<_Ty&>._No_throw) { @@ -2447,7 +2433,6 @@ namespace ranges { static_assert(_Always_false<_Ty>, "should be unreachable"); } } - // clang-format on }; } // namespace _Data @@ -2471,9 +2456,7 @@ namespace ranges { } _EXPORT_STD template - concept sized_range = range<_Rng> && requires(_Rng & __r) { - _RANGES size(__r); - }; + concept sized_range = range<_Rng> && requires(_Rng & __r) { _RANGES size(__r); }; _EXPORT_STD template using range_size_t = decltype(_RANGES size(_STD declval<_Rng&>())); @@ -2484,9 +2467,11 @@ namespace ranges { void _Derived_from_specialization_impl(const _Template<_Args...>&); template class _Template> - concept _Derived_from_specialization_of = is_object_v<_Ty> && requires(const _Ty& _Obj) { - _RANGES _Derived_from_specialization_impl<_Template>(_Obj); // qualified: avoid ADL, handle incompletable types - }; + concept _Derived_from_specialization_of = + is_object_v<_Ty> && requires(const _Ty& _Obj) { + _RANGES _Derived_from_specialization_impl<_Template>( + _Obj); // qualified: avoid ADL, handle incompletable types + }; _EXPORT_STD template requires is_class_v<_Derived> && same_as<_Derived, remove_cv_t<_Derived>> @@ -2515,9 +2500,10 @@ namespace ranges { concept random_access_range = range<_Rng> && random_access_iterator>; _EXPORT_STD template - concept contiguous_range = range<_Rng> && contiguous_iterator> && requires(_Rng & __r) { - { _RANGES data(__r) } -> same_as>>; - }; + concept contiguous_range = range<_Rng> && contiguous_iterator> + && requires(_Rng & __r) { + { _RANGES data(__r) } -> same_as>>; + }; class _Not_quite_object { public: @@ -2640,7 +2626,7 @@ namespace ranges { using _Not_quite_object::_Not_quite_object; template _Se> - requires(!sized_sentinel_for<_Se, _It>) + requires (!sized_sentinel_for<_Se, _It>) _NODISCARD constexpr iter_difference_t<_It> operator()(_It _First, _Se _Last) const noexcept(noexcept(_Distance_unchecked(_Get_unwrapped(_STD move(_First)), _Get_unwrapped(_STD move(_Last))))) /* strengthened */ { // Per LWG-3664 @@ -2679,8 +2665,8 @@ namespace ranges { } template - static constexpr bool _Nothrow_size = noexcept( - _Distance_unchecked(_Ubegin(_STD declval<_Rng&>()), _Uend(_STD declval<_Rng&>()))); + static constexpr bool _Nothrow_size = + noexcept(_Distance_unchecked(_Ubegin(_STD declval<_Rng&>()), _Uend(_STD declval<_Rng&>()))); template static constexpr bool _Nothrow_size<_Rng> = noexcept(_RANGES size(_STD declval<_Rng&>())); @@ -2822,9 +2808,7 @@ namespace ranges { concept _Bidi_common_range = common_range<_Rng> && bidirectional_iterator>; template - concept _Can_empty = requires(_Ty __t) { - _RANGES empty(__t); - }; + concept _Can_empty = requires(_Ty __t) { _RANGES empty(__t); }; // clang-format off _EXPORT_STD template @@ -3099,11 +3083,9 @@ namespace ranges { constexpr explicit _Subrange_base(const _Size_type&) noexcept {} }; - // clang-format off _EXPORT_STD template _Se, subrange_kind _Ki> requires (_Ki == subrange_kind::sized || !sized_sentinel_for<_Se, _It>) class subrange : public _Subrange_base<_It, _Se, _Ki> { - // clang-format on private: using _Mybase = _Subrange_base<_It, _Se, _Ki>; using _Mybase::_Store_size; @@ -3156,15 +3138,17 @@ namespace ranges { requires _Convertible_to_non_slicing, _It> && convertible_to, _Se> constexpr subrange(_Rng&& _Val, const _Size_type _Count) requires (_Ki == subrange_kind::sized) : subrange{_RANGES begin(_Val), _RANGES end(_Val), _Count} {} + // clang-format on template <_Not_same_as _Pair_like> requires _Pair_like_convertible_from<_Pair_like, const _It&, const _Se&> constexpr operator _Pair_like() const { return _Pair_like(_First, _Last); } - // clang-format on - _NODISCARD constexpr _It begin() const requires copyable<_It> { + _NODISCARD constexpr _It begin() const + requires copyable<_It> + { return _First; } // clang-format off @@ -3191,7 +3175,9 @@ namespace ranges { } } - _NODISCARD constexpr subrange next() const& requires forward_iterator<_It> { + _NODISCARD constexpr subrange next() const& + requires forward_iterator<_It> + { auto _Tmp = *this; if (_Tmp._First != _Tmp._Last) { ++_Tmp._First; @@ -3201,7 +3187,9 @@ namespace ranges { } return _Tmp; } - _NODISCARD constexpr subrange next(const iter_difference_t<_It> _Count) const& requires forward_iterator<_It> { + _NODISCARD constexpr subrange next(const iter_difference_t<_It> _Count) const& + requires forward_iterator<_It> + { auto _Tmp = *this; _Tmp.advance(_Count); return _Tmp; @@ -3221,7 +3209,9 @@ namespace ranges { return _STD move(*this); } - _NODISCARD constexpr subrange prev() const requires bidirectional_iterator<_It> { + _NODISCARD constexpr subrange prev() const + requires bidirectional_iterator<_It> + { auto _Tmp = *this; --_Tmp._First; if constexpr (_Store_size) { @@ -3229,8 +3219,9 @@ namespace ranges { } return _Tmp; } - _NODISCARD constexpr subrange prev( - const iter_difference_t<_It> _Count) const requires bidirectional_iterator<_It> { + _NODISCARD constexpr subrange prev(const iter_difference_t<_It> _Count) const + requires bidirectional_iterator<_It> + { auto _Tmp = *this; _Tmp.advance(-_Count); return _Tmp; @@ -3273,7 +3264,6 @@ namespace ranges { template inline constexpr bool enable_borrowed_range> = true; - // clang-format off _EXPORT_STD template requires ((_Idx == 0 && copyable<_It>) || _Idx == 1) _NODISCARD constexpr auto get(const subrange<_It, _Se, _Ki>& _Val) { @@ -3293,7 +3283,6 @@ namespace ranges { return _Val.end(); } } - // clang-format on _EXPORT_STD struct dangling { constexpr dangling() noexcept = default; @@ -3604,7 +3593,9 @@ _NODISCARD _CONSTEXPR17 bool } // clang-format on #endif // __cpp_lib_concepts -{ return _Left.base() == _Right.base(); } +{ + return _Left.base() == _Right.base(); +} #if !_HAS_CXX20 template @@ -3625,37 +3616,39 @@ _NODISCARD _CONSTEXPR17 bool } // clang-format on #endif // __cpp_lib_concepts -{ return _Left.base() < _Right.base(); } +{ + return _Left.base() < _Right.base(); +} _EXPORT_STD template _NODISCARD _CONSTEXPR17 bool operator>(const move_iterator<_Iter1>& _Left, const move_iterator<_Iter2>& _Right) noexcept(noexcept(_Right < _Left)) /* strengthened */ #ifdef __cpp_lib_concepts - // clang-format off requires requires { _Right < _Left; } -// clang-format on #endif // __cpp_lib_concepts -{ return _Right < _Left; } +{ + return _Right < _Left; +} _EXPORT_STD template _NODISCARD _CONSTEXPR17 bool operator<=(const move_iterator<_Iter1>& _Left, const move_iterator<_Iter2>& _Right) noexcept(noexcept(_Right < _Left)) /* strengthened */ #ifdef __cpp_lib_concepts - // clang-format off requires requires { _Right < _Left; } -// clang-format on #endif // __cpp_lib_concepts -{ return !(_Right < _Left); } +{ + return !(_Right < _Left); +} _EXPORT_STD template _NODISCARD _CONSTEXPR17 bool operator>=(const move_iterator<_Iter1>& _Left, const move_iterator<_Iter2>& _Right) noexcept(noexcept(_Left < _Right)) /* strengthened */ #ifdef __cpp_lib_concepts - // clang-format off requires requires { _Left < _Right; } -// clang-format on #endif // __cpp_lib_concepts -{ return !(_Left < _Right); } +{ + return !(_Left < _Right); +} #ifdef __cpp_lib_concepts _EXPORT_STD template _Iter2> @@ -3683,7 +3676,9 @@ _NODISCARD _CONSTEXPR17 move_iterator<_Iter> } // clang-format on #endif // __cpp_lib_concepts -{ return move_iterator<_Iter>(_Right.base() + _Off); } +{ + return move_iterator<_Iter>(_Right.base() + _Off); +} _EXPORT_STD template _NODISCARD _CONSTEXPR17 move_iterator<_Iter> make_move_iterator(_Iter _It) noexcept( @@ -3744,19 +3739,20 @@ _NODISCARD constexpr auto _To_address(const move_iterator<_Iter>& _Val) noexcept template _INLINE_VAR constexpr bool _Iterators_are_contiguous = - _Iterator_is_contiguous<_Iter1>&& _Iterator_is_contiguous<_Iter2>; + _Iterator_is_contiguous<_Iter1> && _Iterator_is_contiguous<_Iter2>; template _INLINE_VAR constexpr bool _Iterator_is_volatile = is_volatile_v>>; template -_INLINE_VAR constexpr bool _Is_pointer_address_convertible = is_void_v<_Source> || is_void_v<_Dest> - // NOTE: is_same_v is required for function pointers to work - || is_same_v, remove_cv_t<_Dest>> +_INLINE_VAR constexpr bool _Is_pointer_address_convertible = is_void_v<_Source> + || is_void_v<_Dest> + // NOTE: is_same_v is required for function pointers to work + || is_same_v, remove_cv_t<_Dest>> #ifdef __cpp_lib_is_pointer_interconvertible - || is_pointer_interconvertible_base_of_v<_Dest, _Source> + || is_pointer_interconvertible_base_of_v<_Dest, _Source> #endif // __cpp_lib_is_pointer_interconvertible - ; + ; template struct _Trivial_cat { @@ -3768,7 +3764,7 @@ struct _Trivial_cat { // If _UDest is bool, _USource also needs to be bool // Conversion from non-bool => non-bool | bool => bool | bool => non-bool is fine. // Conversion from non-bool => bool is not fine. - && is_same_v >= is_same_v // + && is_same_v >= is_same_v && (is_same_v<_USource, _UDest> || (is_integral_v<_USource> && is_integral_v<_UDest>) || (is_floating_point_v<_USource> && is_floating_point_v<_UDest>) ); @@ -3984,12 +3980,10 @@ namespace ranges { } }; - // clang-format off template requires sentinel_for, _It> _NODISCARD constexpr _Unwrap_iter_t<_It, _Se> _Get_final_iterator_unwrapped( const _Unwrap_iter_t<_It, _Se>& _UFirst, _Se&& _Last) { - // clang-format on // find the iterator in [_UFirst, _Unwrap_sent<_It>(_Last)) which equals _Unwrap_sent<_It>(_Last) // [possibly O(N)] if constexpr (is_same_v<_Unwrap_iter_t<_It, _Se>, _Unwrap_sent_t<_Se, _It>>) { @@ -4058,11 +4052,9 @@ namespace ranges { _EXPORT_STD template using copy_result = in_out_result<_In, _Out>; - // clang-format off template _Se, weakly_incrementable _Out> requires indirectly_copyable<_It, _Out> _NODISCARD constexpr copy_result<_It, _Out> _Copy_unchecked(_It _First, _Se _Last, _Out _Result) { - // clang-format on if constexpr (_Sent_copy_cat<_It, _Se, _Out>::_Bitcopy_assignable) { if (!_STD is_constant_evaluated()) { if constexpr (is_same_v<_It, _Se>) { @@ -4088,7 +4080,6 @@ namespace ranges { public: using _Not_quite_object::_Not_quite_object; - // clang-format off template _Se, weakly_incrementable _Out> requires indirectly_copyable<_It, _Out> constexpr copy_result<_It, _Out> operator()(_It _First, _Se _Last, _Out _Result) const { @@ -4108,7 +4099,6 @@ namespace ranges { _Seek_wrapped(_First, _STD move(_UResult.in)); return {_STD move(_First), _STD move(_UResult.out)}; } - // clang-format on }; _EXPORT_STD inline constexpr _Copy_fn copy{_Not_quite_object::_Construct_tag {}}; @@ -4499,8 +4489,8 @@ _INLINE_VAR constexpr bool template _INLINE_VAR constexpr bool _Is_pointer_address_comparable = - _Can_compare_with_operator_equal<_Ty1*, - _Ty2*> && (_Is_pointer_address_convertible<_Ty1, _Ty2> || _Is_pointer_address_convertible<_Ty2, _Ty1>); + _Can_compare_with_operator_equal<_Ty1*, _Ty2*> + && (_Is_pointer_address_convertible<_Ty1, _Ty2> || _Is_pointer_address_convertible<_Ty2, _Ty1>); // _Can_memcmp_elements<_Elem1, _Elem2> reports whether `_Elem1 == _Elem2` can be optimized to memcmp. // Here, _Elem1 and _Elem2 aren't top-level const, because we remove_const_t before using _Can_memcmp_elements. @@ -4543,8 +4533,8 @@ _INLINE_VAR constexpr bool _Can_memcmp_elements_with_pred = false; // object representation (we use _Iter_copy_cat for this task) and _Elem3 can be safely memcmp'ed with itself template _INLINE_VAR constexpr bool _Can_memcmp_elements_with_pred<_Elem1, _Elem2, equal_to<_Elem3>> = - _Iter_copy_cat<_Elem1*, _Elem3*>::_Bitcopy_constructible&& _Iter_copy_cat<_Elem2*, - _Elem3*>::_Bitcopy_constructible&& _Can_memcmp_elements, remove_cv_t<_Elem3>>; + _Iter_copy_cat<_Elem1*, _Elem3*>::_Bitcopy_constructible && _Iter_copy_cat<_Elem2*, _Elem3*>::_Bitcopy_constructible + && _Can_memcmp_elements, remove_cv_t<_Elem3>>; // equal_to<> is transparent. template @@ -4742,13 +4732,11 @@ namespace ranges { return {_STD move(_First1), _STD move(_First2)}; } - // clang-format off template _Se1, input_iterator _It2, sentinel_for<_It2> _Se2, class _Pr, class _Pj1, class _Pj2> requires indirectly_comparable<_It1, _It2, _Pr, _Pj1, _Pj2> _NODISCARD constexpr mismatch_result<_It1, _It2> _Mismatch_4( _It1 _First1, _Se1 _Last1, _It2 _First2, _Se2 _Last2, _Pr _Pred, _Pj1 _Proj1, _Pj2 _Proj2) { - // clang-format on for (; _First1 != _Last1 && _First2 != _Last2; ++_First1, (void) ++_First2) { if (!_STD invoke(_Pred, _STD invoke(_Proj1, *_First1), _STD invoke(_Proj2, *_First2))) { @@ -4795,13 +4783,11 @@ namespace ranges { } } - // clang-format off template requires indirectly_comparable, iterator_t<_Rng2>, _Pr, _Pj1, _Pj2> _NODISCARD constexpr mismatch_result, borrowed_iterator_t<_Rng2>> operator()( _Rng1&& _Range1, _Rng2&& _Range2, _Pr _Pred = {}, _Pj1 _Proj1 = {}, _Pj2 _Proj2 = {}) const { - // clang-format on if constexpr (sized_range<_Rng1> && sized_range<_Rng2>) { range_difference_t<_Rng1> _Count1 = _RANGES distance(_Range1); const range_difference_t<_Rng2> _Count2 = _RANGES distance(_Range2); @@ -4849,7 +4835,7 @@ struct _Lex_compare_memcmp_classify_pred { template struct _Lex_compare_memcmp_classify_pred<_Elem1, _Elem2, less<_Elem3>> { - using _Pred = conditional_t<_Lex_compare_memcmp_classify_elements<_Elem3, _Elem3> // + using _Pred = conditional_t<_Lex_compare_memcmp_classify_elements<_Elem3, _Elem3> && _Iter_copy_cat<_Elem1*, _Elem3*>::_Bitcopy_constructible && _Iter_copy_cat<_Elem2*, _Elem3*>::_Bitcopy_constructible, less, void>; @@ -4862,7 +4848,7 @@ struct _Lex_compare_memcmp_classify_pred<_Elem1, _Elem2, less<>> { template struct _Lex_compare_memcmp_classify_pred<_Elem1, _Elem2, greater<_Elem3>> { - using _Pred = conditional_t<_Lex_compare_memcmp_classify_elements<_Elem3, _Elem3> // + using _Pred = conditional_t<_Lex_compare_memcmp_classify_elements<_Elem3, _Elem3> && _Iter_copy_cat<_Elem1*, _Elem3*>::_Bitcopy_constructible && _Iter_copy_cat<_Elem2*, _Elem3*>::_Bitcopy_constructible, greater, void>; @@ -4962,8 +4948,8 @@ struct _Lex_compare_three_way_memcmp_classify_comp { template struct _Lex_compare_three_way_memcmp_classify_comp<_Elem1, _Elem2, compare_three_way> { - using _Comp = conditional_t<_Lex_compare_memcmp_classify_elements<_Elem1, - _Elem2> && three_way_comparable_with, + using _Comp = conditional_t<_Lex_compare_memcmp_classify_elements<_Elem1, _Elem2> + && three_way_comparable_with, compare_three_way, void>; }; @@ -5165,7 +5151,6 @@ namespace ranges { template concept _Sized_or_unreachable_sentinel_for = sized_sentinel_for<_Se, _It> || same_as<_Se, unreachable_sentinel_t>; - // clang-format off template concept _Sized_or_infinite_range = range<_Rng> && (sized_range<_Rng> || same_as, unreachable_sentinel_t>); @@ -5174,10 +5159,9 @@ namespace ranges { template _Se, class _Ty, class _Pj = identity> requires indirect_binary_predicate, const _Ty*> _NODISCARD constexpr _It _Find_unchecked(_It _First, const _Se _Last, const _Ty& _Val, _Pj _Proj = {}) { - // clang-format on constexpr bool _Is_sized = sized_sentinel_for<_Se, _It>; - if constexpr (_Vector_alg_in_find_is_safe<_It, - _Ty> && _Sized_or_unreachable_sentinel_for<_Se, _It> && same_as<_Pj, identity>) { + if constexpr (_Vector_alg_in_find_is_safe<_It, _Ty> && _Sized_or_unreachable_sentinel_for<_Se, _It> + && same_as<_Pj, identity>) { if (!_STD is_constant_evaluated()) { if (!_Within_limits(_First, _Val)) { if constexpr (_Is_sized) { @@ -5260,12 +5244,10 @@ namespace ranges { return _First; } - // clang-format off template requires indirect_binary_predicate, _Pj>, const _Ty*> _NODISCARD constexpr borrowed_iterator_t<_Rng> operator()( _Rng&& _Range, const _Ty& _Val, _Pj _Proj = {}) const { - // clang-format on auto _First = _RANGES begin(_Range); auto _UResult = _RANGES _Find_unchecked( _Unwrap_range_iter<_Rng>(_STD move(_First)), _Uend(_Range), _Val, _Pass_fn(_Proj)); @@ -5837,13 +5819,11 @@ namespace ranges { public: using _Not_quite_object::_Not_quite_object; - // clang-format off template _Se1, forward_iterator _It2, sentinel_for<_It2> _Se2, class _Pr = ranges::equal_to, class _Pj1 = identity, class _Pj2 = identity> requires indirectly_comparable<_It1, _It2, _Pr, _Pj1, _Pj2> _NODISCARD constexpr subrange<_It1> operator()(_It1 _First1, _Se1 _Last1, _It2 _First2, _Se2 _Last2, _Pr _Pred = {}, _Pj1 _Proj1 = {}, _Pj2 _Proj2 = {}) const { - // clang-format on _Adl_verify_range(_First1, _Last1); _Adl_verify_range(_First2, _Last2); auto _UFirst1 = _Unwrap_iter<_Se1>(_STD move(_First1)); @@ -5864,13 +5844,11 @@ namespace ranges { } } - // clang-format off template requires indirectly_comparable, iterator_t<_Rng2>, _Pr, _Pj1, _Pj2> _NODISCARD constexpr borrowed_subrange_t<_Rng1> operator()( _Rng1&& _Range1, _Rng2&& _Range2, _Pr _Pred = {}, _Pj1 _Proj1 = {}, _Pj2 _Proj2 = {}) const { - // clang-format on if constexpr (sized_range<_Rng1> && sized_range<_Rng2>) { const auto _Count1 = _RANGES distance(_Range1); const auto _Count2 = _RANGES distance(_Range2); @@ -6003,7 +5981,7 @@ _CONSTEXPR20 _FwdIt2 _Swap_ranges_unchecked(_FwdIt1 _First1, const _FwdIt1 _Last #if _USE_STD_VECTOR_ALGORITHMS using _Elem1 = remove_reference_t<_Iter_ref_t<_FwdIt1>>; using _Elem2 = remove_reference_t<_Iter_ref_t<_FwdIt2>>; - if constexpr (is_same_v<_Elem1, _Elem2> && _Is_trivially_swappable_v<_Elem1> // + if constexpr (is_same_v<_Elem1, _Elem2> && _Is_trivially_swappable_v<_Elem1> && _Iterators_are_contiguous<_FwdIt1, _FwdIt2>) { #if _HAS_CXX20 if (!_STD is_constant_evaluated()) diff --git a/stl/inc/yvals_core.h b/stl/inc/yvals_core.h index 42d2838ebf..7e7c78319f 100644 --- a/stl/inc/yvals_core.h +++ b/stl/inc/yvals_core.h @@ -449,14 +449,12 @@ #define _STL_PRAGMA_MESSAGE(MESSAGE) _STL_PRAGMA(message(MESSAGE)) #define _EMIT_STL_MESSAGE(MESSAGE) _STL_PRAGMA_MESSAGE(__FILE__ "(" _CRT_STRINGIZE(__LINE__) "): " MESSAGE) -// clang-format off -#define _EMIT_STL_WARNING(NUMBER, MESSAGE) \ +#define _EMIT_STL_WARNING(NUMBER, MESSAGE) \ _EMIT_STL_MESSAGE("warning " #NUMBER ": " MESSAGE) \ static_assert(true, "") -#define _EMIT_STL_ERROR(NUMBER, MESSAGE) \ +#define _EMIT_STL_ERROR(NUMBER, MESSAGE) \ _EMIT_STL_MESSAGE("error " #NUMBER ": " MESSAGE) \ static_assert(false, "Error in C++ Standard Library usage.") -// clang-format on #ifndef _STL_WARNING_LEVEL #if defined(_MSVC_WARNING_LEVEL) && _MSVC_WARNING_LEVEL >= 4 @@ -781,8 +779,8 @@ _EMIT_STL_ERROR(STL1002, "Unexpected compiler version, expected CUDA 11.6 or new #elif defined(__EDG__) // not attempting to detect __EDG_VERSION__ being less than expected #elif defined(__clang__) -#if __clang_major__ < 14 -_EMIT_STL_ERROR(STL1000, "Unexpected compiler version, expected Clang 14.0.0 or newer."); +#if __clang_major__ < 15 +_EMIT_STL_ERROR(STL1000, "Unexpected compiler version, expected Clang 15.0.0 or newer."); #endif // ^^^ old Clang ^^^ #elif defined(_MSC_VER) #if _MSC_VER < 1934 // Coarse-grained, not inspecting _MSC_FULL_VER diff --git a/stl/src/mutex.cpp b/stl/src/mutex.cpp index 031fb02b9c..7b99c2b292 100644 --- a/stl/src/mutex.cpp +++ b/stl/src/mutex.cpp @@ -129,6 +129,7 @@ static int mtx_do_lock(_Mtx_t mtx, const xtime* target) { // lock mutex xtime_get(&now, TIME_UTC); } } + if (res == WAIT_OBJECT_0 || res == WAIT_ABANDONED) { if (1 < ++mtx->count) { // check count if ((mtx->type & _Mtx_recursive) != _Mtx_recursive) { // not recursive, fixup count diff --git a/stl/src/ppltasks.cpp b/stl/src/ppltasks.cpp index c8b66affd5..c577b5bdba 100644 --- a/stl/src/ppltasks.cpp +++ b/stl/src/ppltasks.cpp @@ -28,7 +28,7 @@ static GUID const Local_IID_ICallbackWithNoReentrancyToApplicationSTA = { // Introduce stacktrace API for Debug CRT_APP #if defined(_CRT_APP) && defined(_DEBUG) extern "C" NTSYSAPI WORD NTAPI RtlCaptureStackBackTrace(_In_ DWORD FramesToSkip, _In_ DWORD FramesToCapture, - _Out_writes_to_(FramesToCapture, return ) PVOID* BackTrace, _Out_opt_ PDWORD BackTraceHash); + _Out_writes_to_(FramesToCapture, return) PVOID* BackTrace, _Out_opt_ PDWORD BackTraceHash); #endif namespace Concurrency { diff --git a/stl/src/tzdb.cpp b/stl/src/tzdb.cpp index 58f5ddd37d..59974d15db 100644 --- a/stl/src/tzdb.cpp +++ b/stl/src/tzdb.cpp @@ -377,14 +377,16 @@ _NODISCARD __std_tzdb_time_zones_info* __stdcall __std_tzdb_get_time_zones() noe _Info->_Num_time_zones = static_cast(_Num_time_zones); // value-init to ensure __std_tzdb_delete_time_zones() cleanup is valid - _Info->_Names = new (_STD nothrow) const char* [_Info->_Num_time_zones] {}; - if (_Info->_Names == nullptr) { + if (const auto _Names = new (_STD nothrow) const char* [_Info->_Num_time_zones] {}; _Names) { + _Info->_Names = _Names; + } else { return nullptr; } // value-init to ensure __std_tzdb_delete_time_zones() cleanup is valid - _Info->_Links = new (_STD nothrow) const char* [_Info->_Num_time_zones] {}; - if (_Info->_Links == nullptr) { + if (const auto _Links = new (_STD nothrow) const char* [_Info->_Num_time_zones] {}; _Links) { + _Info->_Links = _Links; + } else { return nullptr; } diff --git a/stl/src/winapisupp.cpp b/stl/src/winapisupp.cpp index 51db06103d..481d7af600 100644 --- a/stl/src/winapisupp.cpp +++ b/stl/src/winapisupp.cpp @@ -282,7 +282,7 @@ extern "C" _CRTIMP2 BOOLEAN __cdecl __crtCreateSymbolicLinkW( } // TRANSITION, ABI: preserved for binary compatibility -extern "C" _CRTIMP2 _Success_(return ) BOOL __cdecl __crtGetFileInformationByHandleEx(_In_ HANDLE const hFile, +extern "C" _CRTIMP2 _Success_(return) BOOL __cdecl __crtGetFileInformationByHandleEx(_In_ HANDLE const hFile, _In_ FILE_INFO_BY_HANDLE_CLASS const FileInformationClass, _Out_writes_bytes_(dwBufferSize) LPVOID const lpFileInformation, _In_ DWORD const dwBufferSize) { return GetFileInformationByHandleEx(hFile, FileInformationClass, lpFileInformation, dwBufferSize); diff --git a/stl/src/xfdscale.cpp b/stl/src/xfdscale.cpp index 7a93ddd0fd..e7a5c84e06 100644 --- a/stl/src/xfdscale.cpp +++ b/stl/src/xfdscale.cpp @@ -42,6 +42,7 @@ short _FDscale(float* px, long lexp) { // scale *px by 2^xexp with checking ps->_Sh[_F0] = 0; xexp += 16; } + if (xexp != 0) { // scale by bits xexp = -xexp; psx = (ps->_Sh[_F1] << (16 - xexp)) | (psx != 0 ? 1 : 0); diff --git a/stl/src/xstopfx.cpp b/stl/src/xstopfx.cpp index 207b4cd7c6..fc5928205e 100644 --- a/stl/src/xstopfx.cpp +++ b/stl/src/xstopfx.cpp @@ -42,6 +42,7 @@ int _Stopfx(const char** ps, char** endptr) { // parse prefix of floating-point } } } + if (endptr != nullptr) { *endptr = const_cast(s); } diff --git a/stl/src/xstoxflt.cpp b/stl/src/xstoxflt.cpp index 82a2f8b409..196ba95d85 100644 --- a/stl/src/xstoxflt.cpp +++ b/stl/src/xstoxflt.cpp @@ -26,7 +26,7 @@ _In_range_(0, maxsig) int _Stoxflt( const char* pd; static constexpr char digits[] = "0123456789abcdefABCDEF"; // hex digits in both cases static constexpr char vals[] = { - 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 10, 11, 12, 13, 14, 15}; // values of hex digits + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 10, 11, 12, 13, 14, 15}; // values of hex digits maxsig *= _Ndig; // convert word count to digit count if (_Maxsig < maxsig) { diff --git a/stl/src/xstrxfrm.cpp b/stl/src/xstrxfrm.cpp index c83198306d..df11d084b7 100644 --- a/stl/src/xstrxfrm.cpp +++ b/stl/src/xstrxfrm.cpp @@ -52,7 +52,7 @@ _EXTERN_C_UNLESS_PURE // Exceptions: // Non-standard: if OM/API error, return INT_MAX. _CRTIMP2_PURE size_t __CLRCALL_PURE_OR_CDECL _Strxfrm(_Out_writes_(end1 - string1) - _Post_readable_size_(return ) char* string1, + _Post_readable_size_(return) char* string1, _In_z_ char* end1, const char* string2, const char* end2, const _Collvec* ploc) { size_t n1 = end1 - string1; size_t n2 = end2 - string2; diff --git a/stl/src/xtime.cpp b/stl/src/xtime.cpp index 4bc4d3ff23..1f7109b76f 100644 --- a/stl/src/xtime.cpp +++ b/stl/src/xtime.cpp @@ -34,6 +34,7 @@ static xtime xtime_diff(const xtime* xt, diff.sec -= now->sec; diff.nsec -= now->nsec; } + if (diff.sec < 0 || (diff.sec == 0 && diff.nsec <= 0)) { // time is zero diff.sec = 0; diff.nsec = 0; diff --git a/stl/src/xwcsxfrm.cpp b/stl/src/xwcsxfrm.cpp index 185b45c502..1a1cc5be91 100644 --- a/stl/src/xwcsxfrm.cpp +++ b/stl/src/xwcsxfrm.cpp @@ -44,7 +44,7 @@ _EXTERN_C_UNLESS_PURE // // Exceptions: // Non-standard: if OM/API error, return INT_MAX. -_CRTIMP2_PURE size_t __CLRCALL_PURE_OR_CDECL _Wcsxfrm(_Out_writes_(end1 - string1) _Post_readable_size_(return ) +_CRTIMP2_PURE size_t __CLRCALL_PURE_OR_CDECL _Wcsxfrm(_Out_writes_(end1 - string1) _Post_readable_size_(return) wchar_t* string1, _In_z_ wchar_t* end1, const wchar_t* string2, const wchar_t* end2, const _Collvec* ploc) { size_t n1 = end1 - string1; diff --git a/stl/src/xwstoxfl.cpp b/stl/src/xwstoxfl.cpp index 4c89411be8..5ed68f104b 100644 --- a/stl/src/xwstoxfl.cpp +++ b/stl/src/xwstoxfl.cpp @@ -26,7 +26,7 @@ _In_range_(0, maxsig) int _WStoxflt(const wchar_t* s0, const wchar_t* s, wchar_t const wchar_t* pd; static constexpr wchar_t digits[] = L"0123456789abcdefABCDEF"; // hex digits in both cases static constexpr char vals[] = { - 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 10, 11, 12, 13, 14, 15}; // values of hex digits + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 10, 11, 12, 13, 14, 15}; // values of hex digits maxsig *= _Ndig; // convert word count to digit count if (_Maxsig < maxsig) { diff --git a/tests/libcxx/expected_results.txt b/tests/libcxx/expected_results.txt index 50a2607b9e..1182ac9f0b 100644 --- a/tests/libcxx/expected_results.txt +++ b/tests/libcxx/expected_results.txt @@ -222,6 +222,7 @@ std/ranges/range.adaptors/range.zip/size.pass.cpp FAIL # P2255R2 "Type Traits To Detect References Binding To Temporaries" std/language.support/support.limits/support.limits.general/type_traits.version.compile.pass.cpp FAIL + # *** MISSING COMPILER FEATURES *** # Nothing here! :-) @@ -855,16 +856,16 @@ std/numerics/rand/rand.dist/rand.dist.pois/rand.dist.pois.poisson/eval.pass.cpp # I don't know which is right. std/language.support/support.limits/limits/numeric.limits.members/tinyness_before.pass.cpp SKIPPED -# Not yet analyzed. the test fails on AMD64 but passes on X86 +# Not yet analyzed. the test fails on x64 but passes on x86 std/containers/associative/map/map.access/iterator.pass.cpp:0 SKIPPED std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.-/sentinel.pass.cpp:0 SKIPPED std/algorithms/alg.modifying.operations/alg.random.shuffle/ranges_shuffle.pass.cpp:0 SKIPPED -# Not yet analyzed. the test fails on X86 but passes on AMD64 +# Not yet analyzed. the test fails on x86 but passes on x64 std/algorithms/alg.sorting/alg.set.operations/includes/ranges_includes.pass.cpp:0 SKIPPED std/algorithms/alg.modifying.operations/alg.unique/ranges_unique.pass.cpp:0 SKIPPED -# Not yet analyzed. the test fails on AMD64 but passes on ARM +# Not yet analyzed. These tests are marked `XFAIL: msvc`, citing DevCom-1660844. std/localization/locale.categories/category.numeric/locale.nm.put/facet.num.put.members/put_long_double.hex.pass.cpp SKIPPED std/localization/locale.categories/category.numeric/locale.nm.put/facet.num.put.members/put_double.hex.pass.cpp SKIPPED @@ -872,7 +873,7 @@ std/localization/locale.categories/category.numeric/locale.nm.put/facet.num.put. std/utilities/format/format.functions/ascii.pass.cpp FAIL std/utilities/format/format.functions/unicode.pass.cpp:0 FAIL -#Not yet analyzed. "constexpr evaluation hit maximum step limit; possible infinite loop?" +# Not yet analyzed. "constexpr evaluation hit maximum step limit; possible infinite loop?" std/utilities/template.bitset/bitset.members/left_shift_eq.pass.cpp FAIL std/utilities/template.bitset/bitset.members/op_and_eq.pass.cpp FAIL std/utilities/template.bitset/bitset.members/op_or_eq.pass.cpp FAIL diff --git a/tests/libcxx/skipped_tests.txt b/tests/libcxx/skipped_tests.txt index e5f86ae367..66038b777d 100644 --- a/tests/libcxx/skipped_tests.txt +++ b/tests/libcxx/skipped_tests.txt @@ -856,16 +856,16 @@ numerics\rand\rand.dist\rand.dist.pois\rand.dist.pois.poisson\eval.pass.cpp # I don't know which is right. language.support\support.limits\limits\numeric.limits.members\tinyness_before.pass.cpp -# Not yet analyzed. the test fails on AMD64 but passes on X86 +# Not yet analyzed. the test fails on x64 but passes on x86 containers\associative\map\map.access\iterator.pass.cpp iterators\predef.iterators\move.iterators\move.iter.ops\move.iter.op.-\sentinel.pass.cpp algorithms\alg.modifying.operations\alg.random.shuffle\ranges_shuffle.pass.cpp -# Not yet analyzed. the test fails on X86 but passes on AMD64 +# Not yet analyzed. the test fails on x86 but passes on x64 algorithms\alg.sorting\alg.set.operations\includes\ranges_includes.pass.cpp algorithms\alg.modifying.operations\alg.unique\ranges_unique.pass.cpp -# Not yet analyzed. the test fails on ARM but passes on AMD64 +# Not yet analyzed. These tests are marked `XFAIL: msvc`, citing DevCom-1660844. localization\locale.categories\category.numeric\locale.nm.put\facet.num.put.members\put_long_double.hex.pass.cpp localization\locale.categories\category.numeric\locale.nm.put\facet.num.put.members\put_double.hex.pass.cpp @@ -873,7 +873,7 @@ localization\locale.categories\category.numeric\locale.nm.put\facet.num.put.memb utilities\format\format.functions\ascii.pass.cpp utilities\format\format.functions\unicode.pass.cpp -#Not yet analyzed. "constexpr evaluation hit maximum step limit; possible infinite loop?" +# Not yet analyzed. "constexpr evaluation hit maximum step limit; possible infinite loop?" utilities\template.bitset\bitset.members\left_shift_eq.pass.cpp utilities\template.bitset\bitset.members\op_and_eq.pass.cpp utilities\template.bitset\bitset.members\op_or_eq.pass.cpp @@ -954,7 +954,6 @@ iterators\predef.iterators\move.iterators\move.iterator\iterator_concept_conform language.support\support.limits\support.limits.general\cmath.version.compile.pass.cpp language.support\support.limits\support.limits.general\cstdlib.version.compile.pass.cpp language.support\support.limits\support.limits.general\new.version.compile.pass.cpp -language.support\support.limits\support.limits.general\version.version.compile.pass.cpp localization\locale.categories\category.monetary\locale.money.get\locale.money.get.members\get_long_double_zh_CN.pass.cpp ranges\range.adaptors\range.filter\iterator\arrow.pass.cpp ranges\range.adaptors\range.filter\iterator\base.pass.cpp diff --git a/tests/libcxx/usual_matrix.lst b/tests/libcxx/usual_matrix.lst index 476cad997d..cf126f8c80 100644 --- a/tests/libcxx/usual_matrix.lst +++ b/tests/libcxx/usual_matrix.lst @@ -6,4 +6,4 @@ RUNALL_CROSSLIST PM_CL="/EHsc /MTd /std:c++latest /permissive- /FImsvc_stdlib_force_include.h /wd4643 /D_STL_CALL_ABORT_INSTEAD_OF_INVALID_PARAMETER /D_USE_JOIN_VIEW_INPUT_RANGE" RUNALL_CROSSLIST PM_CL="/analyze:autolog- /Zc:preprocessor" -PM_COMPILER="clang-cl" PM_CL="-fno-ms-compatibility -fno-delayed-template-parsing" +PM_COMPILER="clang-cl" PM_CL="-fno-ms-compatibility -fno-delayed-template-parsing -Wno-unqualified-std-cast-call" diff --git a/tests/std/include/range_algorithm_support.hpp b/tests/std/include/range_algorithm_support.hpp index 3301b6371b..1f88f13a11 100644 --- a/tests/std/include/range_algorithm_support.hpp +++ b/tests/std/include/range_algorithm_support.hpp @@ -138,13 +138,17 @@ namespace test { return Constinel{ptr_}; } - [[nodiscard]] constexpr auto _Unwrapped() const noexcept requires(is_wrapped(Wrapped)) { + [[nodiscard]] constexpr auto _Unwrapped() const noexcept + requires (is_wrapped(Wrapped)) + { return unwrap{ptr_}; } static constexpr bool _Unwrap_when_unverified = true; - constexpr void _Seek_to(unwrap const& s) noexcept requires(is_wrapped(Wrapped)) { + constexpr void _Seek_to(unwrap const& s) noexcept + requires (is_wrapped(Wrapped)) + { ptr_ = s.peek(); } @@ -171,33 +175,33 @@ namespace test { template concept CanEq = requires(T const& t, U const& u) { - { t == u } -> convertible_to; - }; + { t == u } -> convertible_to; + }; template concept CanNEq = requires(T const& t, U const& u) { - { t != u } -> convertible_to; - }; + { t != u } -> convertible_to; + }; template concept CanLt = requires(T const& t, U const& u) { - { t < u } -> convertible_to; - }; + { t < u } -> convertible_to; + }; template concept CanLtE = requires(T const& t, U const& u) { - { t <= u } -> convertible_to; - }; + { t <= u } -> convertible_to; + }; template concept CanGt = requires(T const& t, U const& u) { - { t > u } -> convertible_to; - }; + { t > u } -> convertible_to; + }; template concept CanGtE = requires(T const& t, U const& u) { - { t >= u } -> convertible_to; - }; + { t >= u } -> convertible_to; + }; template class proxy_reference { @@ -209,8 +213,9 @@ namespace test { constexpr explicit proxy_reference(Element& r) : ref_{r} {} proxy_reference(proxy_reference const&) = default; - constexpr proxy_reference const& operator=( - proxy_reference const& that) const requires assignable_from { + constexpr proxy_reference const& operator=(proxy_reference const& that) const + requires assignable_from + { ref_ = that.ref_; return *this; } @@ -219,40 +224,48 @@ namespace test { constexpr operator Element&() const requires derived_from { return ref_; } + // clang-format on template requires (!std::same_as, proxy_reference> && assignable_from) constexpr void operator=(T&& val) const { ref_ = std::forward(val); } - // clang-format on template - [[nodiscard]] constexpr boolish operator==( - proxy_reference that) const requires CanEq { + [[nodiscard]] constexpr boolish operator==(proxy_reference that) const + requires CanEq + { return {ref_ == that.peek()}; } template - [[nodiscard]] constexpr boolish operator!=( - proxy_reference that) const requires CanNEq { + [[nodiscard]] constexpr boolish operator!=(proxy_reference that) const + requires CanNEq + { return {ref_ != that.peek()}; } template - [[nodiscard]] constexpr boolish operator<(proxy_reference that) const requires CanLt { + [[nodiscard]] constexpr boolish operator<(proxy_reference that) const + requires CanLt + { return {ref_ < that.peek()}; } template - [[nodiscard]] constexpr boolish operator>(proxy_reference that) const requires CanGt { + [[nodiscard]] constexpr boolish operator>(proxy_reference that) const + requires CanGt + { return {ref_ > that.peek()}; } template - [[nodiscard]] constexpr boolish operator<=( - proxy_reference that) const requires CanLtE { + [[nodiscard]] constexpr boolish operator<=(proxy_reference that) const + requires CanLtE + { return {ref_ <= that.peek()}; } template - [[nodiscard]] constexpr boolish operator>=( - proxy_reference that) const requires CanGtE { + [[nodiscard]] constexpr boolish operator>=(proxy_reference that) const + requires CanGtE + { return {ref_ >= that.peek()}; } @@ -318,15 +331,12 @@ namespace test { common_reference(Ref r) : ref_{static_cast(r)} {} - // clang-format off template requires convertible_to common_reference(proxy_reference pref) : ref_{pref.peek()} {} - // clang-format on }; } // namespace test -// clang-format off template class TQuals, template class UQuals> requires std::common_reference_with> struct std::basic_common_reference<::test::proxy_reference, U, TQuals, UQuals> { @@ -346,10 +356,8 @@ struct std::basic_common_reference<::test::proxy_reference, ::test: UQuals> { using type = common_reference_t; }; -// clang-format on namespace test { - // clang-format off template }, @@ -360,10 +368,9 @@ namespace test { // Interact with the STL's iterator unwrapping machinery? WrappedState Wrapped = WrappedState::wrapped> requires (to_bool(Eq) || !derived_from) - && (Proxy == ProxyRef::no || !derived_from) + && (Proxy == ProxyRef::no || !derived_from) class iterator : public prevent_inheriting_unwrap_base, Wrapped> { - // clang-format on Element* ptr_; template @@ -391,7 +398,9 @@ namespace test { using Consterator = iterator; // output iterator operations - iterator() requires at_least ||(Eq == CanCompare::yes) = default; + // clang-format off + iterator() requires at_least || (Eq == CanCompare::yes) = default; + // clang-format on constexpr explicit iterator(Element* ptr) noexcept : ptr_{ptr} {} @@ -415,25 +424,31 @@ namespace test { template [[nodiscard]] friend constexpr boolish operator==( - iterator const& i, sentinel const& s) noexcept requires - compatible_wrapped_state { + iterator const& i, sentinel const& s) noexcept + requires compatible_wrapped_state + { return boolish{i.peek() == s.peek()}; } template - [[nodiscard]] friend constexpr boolish operator==(sentinel const& s, - iterator const& i) noexcept requires compatible_wrapped_state { + [[nodiscard]] friend constexpr boolish operator==( + sentinel const& s, iterator const& i) noexcept + requires compatible_wrapped_state + { return i == s; } template [[nodiscard]] friend constexpr boolish operator!=( - iterator const& i, sentinel const& s) noexcept requires - compatible_wrapped_state { + iterator const& i, sentinel const& s) noexcept + requires compatible_wrapped_state + { return !(i == s); } template - [[nodiscard]] friend constexpr boolish operator!=(sentinel const& s, - iterator const& i) noexcept requires compatible_wrapped_state { + [[nodiscard]] friend constexpr boolish operator!=( + sentinel const& s, iterator const& i) noexcept + requires compatible_wrapped_state + { return !(i == s); } @@ -442,7 +457,9 @@ namespace test { return *this; } - constexpr post_increment_proxy operator++(int) & noexcept requires std::is_same_v { + constexpr post_increment_proxy operator++(int) & noexcept + requires std::is_same_v + { post_increment_proxy result{ptr_}; ++ptr_; return result; @@ -455,7 +472,9 @@ namespace test { STATIC_ASSERT(always_false); } - friend void iter_swap(iterator const&, iterator const&) requires std::is_same_v { + friend void iter_swap(iterator const&, iterator const&) + requires std::is_same_v + { STATIC_ASSERT(always_false); } @@ -473,96 +492,139 @@ namespace test { } // input iterator operations: - constexpr void operator++(int) & noexcept requires std::is_same_v { + constexpr void operator++(int) & noexcept + requires std::is_same_v + { ++ptr_; } - [[nodiscard]] friend constexpr Element&& iter_move(iterator const& i) requires at_least { + [[nodiscard]] friend constexpr Element&& iter_move(iterator const& i) + requires at_least + { return std::move(*i.ptr_); } friend constexpr void iter_swap(iterator const& x, iterator const& y) noexcept( - std::is_nothrow_swappable_v) requires at_least && std::swappable { + std::is_nothrow_swappable_v) + requires at_least && std::swappable + { ranges::swap(*x.ptr_, *y.ptr_); } // forward iterator operations: - constexpr iterator operator++(int) & noexcept requires at_least { + constexpr iterator operator++(int) & noexcept + requires at_least + { auto tmp = *this; ++ptr_; return tmp; } // sentinel operations (implied by forward iterator): - iterator(iterator const&) requires(to_bool(Eq)) = default; - iterator& operator=(iterator const&) requires(to_bool(Eq)) = default; + // clang-format off + iterator(iterator const&) requires (to_bool(Eq)) = default; + iterator& operator=(iterator const&) requires (to_bool(Eq)) = default; + // clang-format on - constexpr operator Consterator() const& noexcept requires(to_bool(Eq)) { + constexpr operator Consterator() const& noexcept + requires (to_bool(Eq)) + { return Consterator{ptr_}; } - [[nodiscard]] constexpr boolish operator==(iterator const& that) const noexcept requires(to_bool(Eq)) { + [[nodiscard]] constexpr boolish operator==(iterator const& that) const noexcept + requires (to_bool(Eq)) + { return {ptr_ == that.ptr_}; } - [[nodiscard]] constexpr boolish operator!=(iterator const& that) const noexcept requires(to_bool(Eq)) { + [[nodiscard]] constexpr boolish operator!=(iterator const& that) const noexcept + requires (to_bool(Eq)) + { return !(*this == that); } // bidi iterator operations: - constexpr iterator& operator--() & noexcept requires at_least { + constexpr iterator& operator--() & noexcept + requires at_least + { --ptr_; return *this; } - constexpr iterator operator--(int) & noexcept requires at_least { + constexpr iterator operator--(int) & noexcept + requires at_least + { auto tmp = *this; --ptr_; return tmp; } // random-access iterator operations: - [[nodiscard]] constexpr boolish operator<(iterator const& that) const noexcept requires at_least { + [[nodiscard]] constexpr boolish operator<(iterator const& that) const noexcept + requires at_least + { return {ptr_ < that.ptr_}; } - [[nodiscard]] constexpr boolish operator>(iterator const& that) const noexcept requires at_least { + [[nodiscard]] constexpr boolish operator>(iterator const& that) const noexcept + requires at_least + { return that < *this; } - [[nodiscard]] constexpr boolish operator<=(iterator const& that) const noexcept requires at_least { + [[nodiscard]] constexpr boolish operator<=(iterator const& that) const noexcept + requires at_least + { return !(that < *this); } - [[nodiscard]] constexpr boolish operator>=(iterator const& that) const noexcept requires at_least { + [[nodiscard]] constexpr boolish operator>=(iterator const& that) const noexcept + requires at_least + { return !(*this < that); } - [[nodiscard]] constexpr auto operator<=>(iterator const& that) const noexcept requires at_least { + [[nodiscard]] constexpr auto operator<=>(iterator const& that) const noexcept + requires at_least + { return ptr_ <=> that.ptr_; } - [[nodiscard]] constexpr ReferenceType operator[](ptrdiff_t const n) const& noexcept requires at_least { + [[nodiscard]] constexpr ReferenceType operator[](ptrdiff_t const n) const& noexcept + requires at_least + { return ReferenceType{ptr_[n]}; } - constexpr iterator& operator+=(ptrdiff_t const n) & noexcept requires at_least { + constexpr iterator& operator+=(ptrdiff_t const n) & noexcept + requires at_least + { ptr_ += n; return *this; } - constexpr iterator& operator-=(ptrdiff_t const n) & noexcept requires at_least { + constexpr iterator& operator-=(ptrdiff_t const n) & noexcept + requires at_least + { ptr_ -= n; return *this; } - [[nodiscard]] constexpr iterator operator+(ptrdiff_t const n) const noexcept requires at_least { + [[nodiscard]] constexpr iterator operator+(ptrdiff_t const n) const noexcept + requires at_least + { return iterator{ptr_ + n}; } - [[nodiscard]] friend constexpr iterator operator+( - ptrdiff_t const n, iterator const& i) noexcept requires at_least { + [[nodiscard]] friend constexpr iterator operator+(ptrdiff_t const n, iterator const& i) noexcept + requires at_least + { return i + n; } - [[nodiscard]] constexpr iterator operator-(ptrdiff_t const n) const noexcept requires at_least { + [[nodiscard]] constexpr iterator operator-(ptrdiff_t const n) const noexcept + requires at_least + { return iterator{ptr_ - n}; } // contiguous iterator operations: - [[nodiscard]] constexpr Element* operator->() const noexcept requires at_least { + [[nodiscard]] constexpr Element* operator->() const noexcept + requires at_least + { return ptr_; } @@ -594,17 +656,23 @@ namespace test { iterator>; using unwrapping_ignorant = iterator; - [[nodiscard]] constexpr auto _Unwrapped() const& noexcept requires(is_wrapped(Wrapped) && to_bool(Eq)) { + [[nodiscard]] constexpr auto _Unwrapped() const& noexcept + requires (is_wrapped(Wrapped) && to_bool(Eq)) + { return unwrap{ptr_}; } - [[nodiscard]] constexpr auto _Unwrapped() && noexcept requires(is_wrapped(Wrapped)) { + [[nodiscard]] constexpr auto _Unwrapped() && noexcept + requires (is_wrapped(Wrapped)) + { return unwrap{exchange(ptr_, nullptr)}; } static constexpr bool _Unwrap_when_unverified = true; - constexpr void _Seek_to(unwrap const& i) noexcept requires(is_wrapped(Wrapped) && to_bool(Eq)) { + constexpr void _Seek_to(unwrap const& i) noexcept + requires (is_wrapped(Wrapped) && to_bool(Eq)) + { if constexpr (at_least) { ptr_ = i; } else { @@ -612,7 +680,9 @@ namespace test { } } - constexpr void _Seek_to(unwrap&& i) noexcept requires(is_wrapped(Wrapped)) { + constexpr void _Seek_to(unwrap&& i) noexcept + requires (is_wrapped(Wrapped)) + { if constexpr (at_least) { ptr_ = i; } else { @@ -1360,129 +1430,82 @@ constexpr void test_in_in_write() { template struct get_nth_fn { template - [[nodiscard]] constexpr auto&& operator()(T&& t) const noexcept requires requires { - get(std::forward(t)); + [[nodiscard]] constexpr auto&& operator()(T&& t) const noexcept + requires requires { get(std::forward(t)); } + { + return get(std::forward(t)); } - { return get(std::forward(t)); } template - [[nodiscard]] constexpr decltype(auto) operator()( - test::proxy_reference r) const noexcept requires requires { - (*this)(r.peek()); + [[nodiscard]] constexpr decltype(auto) operator()(test::proxy_reference r) const noexcept + requires requires { (*this)(r.peek()); } + { + return (*this)(r.peek()); } - { return (*this)(r.peek()); } }; inline constexpr get_nth_fn<0> get_first; inline constexpr get_nth_fn<1> get_second; template -concept CanBegin = requires(R&& r) { - ranges::begin(std::forward(r)); -}; +concept CanBegin = requires(R&& r) { ranges::begin(std::forward(r)); }; template -concept CanMemberBegin = requires(R&& r) { - std::forward(r).begin(); -}; +concept CanMemberBegin = requires(R&& r) { std::forward(r).begin(); }; template -concept CanEnd = requires(R&& r) { - ranges::end(std::forward(r)); -}; +concept CanEnd = requires(R&& r) { ranges::end(std::forward(r)); }; template -concept CanMemberEnd = requires(R&& r) { - std::forward(r).end(); -}; +concept CanMemberEnd = requires(R&& r) { std::forward(r).end(); }; template -concept CanCBegin = requires(R&& r) { - ranges::cbegin(std::forward(r)); -}; +concept CanCBegin = requires(R&& r) { ranges::cbegin(std::forward(r)); }; template -concept CanCEnd = requires(R&& r) { - ranges::cend(std::forward(r)); -}; +concept CanCEnd = requires(R&& r) { ranges::cend(std::forward(r)); }; template -concept CanRBegin = requires(R&& r) { - ranges::rbegin(std::forward(r)); -}; +concept CanRBegin = requires(R&& r) { ranges::rbegin(std::forward(r)); }; template -concept CanREnd = requires(R&& r) { - ranges::rend(std::forward(r)); -}; +concept CanREnd = requires(R&& r) { ranges::rend(std::forward(r)); }; template -concept CanCRBegin = requires(R&& r) { - ranges::crbegin(std::forward(r)); -}; +concept CanCRBegin = requires(R&& r) { ranges::crbegin(std::forward(r)); }; template -concept CanCREnd = requires(R&& r) { - ranges::crend(std::forward(r)); -}; +concept CanCREnd = requires(R&& r) { ranges::crend(std::forward(r)); }; template -concept CanEmpty = requires(R&& r) { - ranges::empty(std::forward(r)); -}; +concept CanEmpty = requires(R&& r) { ranges::empty(std::forward(r)); }; template -concept CanSize = requires(R&& r) { - ranges::size(std::forward(r)); -}; +concept CanSize = requires(R&& r) { ranges::size(std::forward(r)); }; template -concept CanMemberSize = requires(R&& r) { - std::forward(r).size(); -}; +concept CanMemberSize = requires(R&& r) { std::forward(r).size(); }; template -concept CanSSize = requires(R&& r) { - ranges::ssize(std::forward(r)); -}; +concept CanSSize = requires(R&& r) { ranges::ssize(std::forward(r)); }; template -concept CanData = requires(R&& r) { - ranges::data(std::forward(r)); -}; +concept CanData = requires(R&& r) { ranges::data(std::forward(r)); }; template -concept CanMemberData = requires(R&& r) { - std::forward(r).data(); -}; +concept CanMemberData = requires(R&& r) { std::forward(r).data(); }; template -concept CanCData = requires(R&& r) { - ranges::cdata(std::forward(r)); -}; +concept CanCData = requires(R&& r) { ranges::cdata(std::forward(r)); }; template -concept CanMemberBase = requires(T&& t) { - std::forward(t).base(); -}; +concept CanMemberBase = requires(T&& t) { std::forward(t).base(); }; template -concept CanMemberEmpty = requires(R&& r) { - std::forward(r).empty(); -}; +concept CanMemberEmpty = requires(R&& r) { std::forward(r).empty(); }; template -concept CanMemberFront = requires(R&& r) { - std::forward(r).front(); -}; +concept CanMemberFront = requires(R&& r) { std::forward(r).front(); }; template -concept CanMemberBack = requires(R&& r) { - std::forward(r).back(); -}; +concept CanMemberBack = requires(R&& r) { std::forward(r).back(); }; template -concept CanIndex = requires(R&& r, const ranges::range_difference_t i) { - std::forward(r)[i]; -}; +concept CanIndex = requires(R&& r, const ranges::range_difference_t i) { std::forward(r)[i]; }; template -concept CanBool = requires(R&& r) { - std::forward(r) ? true : false; -}; +concept CanBool = requires(R&& r) { std::forward(r) ? true : false; }; template -concept CanIterSwap = requires(I&& i1, I&& i2) { - ranges::iter_swap(std::forward(i1), std::forward(i2)); -}; +concept CanIterSwap = requires(I&& i1, I&& i2) { ranges::iter_swap(std::forward(i1), std::forward(i2)); }; diff --git a/tests/std/tests/GH_002030_asan_annotate_string/env.lst b/tests/std/tests/GH_002030_asan_annotate_string/env.lst index dc799b3d15..a18ef67c74 100644 --- a/tests/std/tests/GH_002030_asan_annotate_string/env.lst +++ b/tests/std/tests/GH_002030_asan_annotate_string/env.lst @@ -57,7 +57,7 @@ PM_CL="/D_ANNOTATE_STRING /Za /EHsc /MD /std:c++latest /permissive- /fno-sanitiz PM_CL="/D_ANNOTATE_STRING /Za /EHsc /MDd /std:c++latest /permissive- /fno-sanitize-address-vcasan-lib" # TRANSITION, clang-cl does not support /alternatename so we cannot test /D_ANNOTATE_STRING without -fsanitize=address # TRANSITION, VSO-1586016: String annotations disabled temporarily. clang-cl fails to link with empty main. -# PM_COMPILER="clang-cl" PM_CL="-fsanitize=address -fno-ms-compatibility -fno-delayed-template-parsing /EHsc /MD /std:c++14" -# PM_COMPILER="clang-cl" PM_CL="-fsanitize=address -fno-ms-compatibility -fno-delayed-template-parsing /EHsc /MD /std:c++17" -# PM_COMPILER="clang-cl" PM_CL="-fsanitize=address -fno-ms-compatibility -fno-delayed-template-parsing /EHsc /MT /std:c++latest /permissive-" -# PM_COMPILER="clang-cl" PM_CL="-fsanitize=address -fno-ms-compatibility -fno-delayed-template-parsing /EHsc /MT /std:c++latest /permissive- /D_HAS_CXX23 /fp:strict" +# PM_COMPILER="clang-cl" PM_CL="-fsanitize=address -fno-ms-compatibility -fno-delayed-template-parsing -Wno-unqualified-std-cast-call /EHsc /MD /std:c++14" +# PM_COMPILER="clang-cl" PM_CL="-fsanitize=address -fno-ms-compatibility -fno-delayed-template-parsing -Wno-unqualified-std-cast-call /EHsc /MD /std:c++17" +# PM_COMPILER="clang-cl" PM_CL="-fsanitize=address -fno-ms-compatibility -fno-delayed-template-parsing -Wno-unqualified-std-cast-call /EHsc /MT /std:c++latest /permissive-" +# PM_COMPILER="clang-cl" PM_CL="-fsanitize=address -fno-ms-compatibility -fno-delayed-template-parsing -Wno-unqualified-std-cast-call /EHsc /MT /std:c++latest /permissive- /D_HAS_CXX23 /fp:strict" diff --git a/tests/std/tests/GH_002030_asan_annotate_vector/env.lst b/tests/std/tests/GH_002030_asan_annotate_vector/env.lst index 6518c31135..b6dd36fe05 100644 --- a/tests/std/tests/GH_002030_asan_annotate_vector/env.lst +++ b/tests/std/tests/GH_002030_asan_annotate_vector/env.lst @@ -50,7 +50,7 @@ PM_CL="/D_ANNOTATE_VECTOR /EHsc /MTd /std:c++latest /permissive- /analyze:only / PM_CL="/D_ANNOTATE_VECTOR /EHsc /MTd /std:c++latest /permissive- /fp:strict /fno-sanitize-address-vcasan-lib" PM_CL="/D_ANNOTATE_VECTOR /EHsc /MTd /std:c++latest /permissive- /fno-sanitize-address-vcasan-lib" # TRANSITION, clang-cl does not support /alternatename so we cannot test /D_ANNOTATE_VECTOR without -fsanitize=address -PM_COMPILER="clang-cl" PM_CL="-fsanitize=address -fno-ms-compatibility -fno-delayed-template-parsing /EHsc /MD /std:c++14" -PM_COMPILER="clang-cl" PM_CL="-fsanitize=address -fno-ms-compatibility -fno-delayed-template-parsing /EHsc /MD /std:c++17" -PM_COMPILER="clang-cl" PM_CL="-fsanitize=address -fno-ms-compatibility -fno-delayed-template-parsing /EHsc /MT /std:c++20 /permissive-" -PM_COMPILER="clang-cl" PM_CL="-fsanitize=address -fno-ms-compatibility -fno-delayed-template-parsing /EHsc /MT /std:c++latest /permissive- /fp:strict" +PM_COMPILER="clang-cl" PM_CL="-fsanitize=address -fno-ms-compatibility -fno-delayed-template-parsing -Wno-unqualified-std-cast-call /EHsc /MD /std:c++14" +PM_COMPILER="clang-cl" PM_CL="-fsanitize=address -fno-ms-compatibility -fno-delayed-template-parsing -Wno-unqualified-std-cast-call /EHsc /MD /std:c++17" +PM_COMPILER="clang-cl" PM_CL="-fsanitize=address -fno-ms-compatibility -fno-delayed-template-parsing -Wno-unqualified-std-cast-call /EHsc /MT /std:c++20 /permissive-" +PM_COMPILER="clang-cl" PM_CL="-fsanitize=address -fno-ms-compatibility -fno-delayed-template-parsing -Wno-unqualified-std-cast-call /EHsc /MT /std:c++latest /permissive- /fp:strict" diff --git a/tests/std/tests/GH_002030_asan_annotate_vector/test.cpp b/tests/std/tests/GH_002030_asan_annotate_vector/test.cpp index 4361f97656..ff60de47e5 100644 --- a/tests/std/tests/GH_002030_asan_annotate_vector/test.cpp +++ b/tests/std/tests/GH_002030_asan_annotate_vector/test.cpp @@ -235,7 +235,7 @@ struct explicit_allocator : custom_test_allocator { } void deallocate(T* p, size_t) noexcept { - delete[](p - 1); + delete[] (p - 1); } }; @@ -251,7 +251,7 @@ struct implicit_allocator : custom_test_allocator { } void deallocate(T* p, size_t) noexcept { - delete[](p - 1); + delete[] (p - 1); } }; diff --git a/tests/std/tests/GH_002558_format_presetPadding/env.lst b/tests/std/tests/GH_002558_format_presetPadding/env.lst index e92cc3c5fb..7ad91d88fe 100644 --- a/tests/std/tests/GH_002558_format_presetPadding/env.lst +++ b/tests/std/tests/GH_002558_format_presetPadding/env.lst @@ -21,5 +21,5 @@ PM_CL="/MTd /D_ITERATOR_DEBUG_LEVEL=2 /std:c++latest /permissive" PM_CL="/MTd /D_ITERATOR_DEBUG_LEVEL=2 /std:c++latest /permissive- /analyze:only /analyze:autolog-" # PM_CL="/std:c++20 /permissive- /BE /c /MD" # PM_CL="/std:c++latest /permissive- /BE /c /MTd" -# PM_COMPILER="clang-cl" PM_CL="-fno-ms-compatibility -fno-delayed-template-parsing /std:c++20 /permissive- /MD" -# PM_COMPILER="clang-cl" PM_CL="-fno-ms-compatibility -fno-delayed-template-parsing /std:c++latest /permissive- /MTd /fp:strict" +# PM_COMPILER="clang-cl" PM_CL="-fno-ms-compatibility -fno-delayed-template-parsing -Wno-unqualified-std-cast-call /std:c++20 /permissive- /MD" +# PM_COMPILER="clang-cl" PM_CL="-fno-ms-compatibility -fno-delayed-template-parsing -Wno-unqualified-std-cast-call /std:c++latest /permissive- /MTd /fp:strict" diff --git a/tests/std/tests/GH_002992_unwrappable_iter_sent_pairs/test.compile.pass.cpp b/tests/std/tests/GH_002992_unwrappable_iter_sent_pairs/test.compile.pass.cpp index 5f6598a3ff..c842f06b84 100644 --- a/tests/std/tests/GH_002992_unwrappable_iter_sent_pairs/test.compile.pass.cpp +++ b/tests/std/tests/GH_002992_unwrappable_iter_sent_pairs/test.compile.pass.cpp @@ -45,9 +45,7 @@ void test_unwrappable_range() { using It = ranges::iterator_t; using Se = ranges::sentinel_t; - constexpr bool is_const_unwrappable = requires(const It& ci) { - ci._Unwrapped(); - }; + constexpr bool is_const_unwrappable = requires(const It& ci) { ci._Unwrapped(); }; if constexpr (is_const_unwrappable) { STATIC_ASSERT(same_as()._Unwrapped()), decltype(declval()._Unwrapped())>); diff --git a/tests/std/tests/LWG3610_iota_view_size_and_integer_class/test.compile.pass.cpp b/tests/std/tests/LWG3610_iota_view_size_and_integer_class/test.compile.pass.cpp index b97e4628c2..37896cc965 100644 --- a/tests/std/tests/LWG3610_iota_view_size_and_integer_class/test.compile.pass.cpp +++ b/tests/std/tests/LWG3610_iota_view_size_and_integer_class/test.compile.pass.cpp @@ -6,9 +6,7 @@ using namespace std; template -concept CanSize = requires(R& r) { - ranges::size(r); -}; +concept CanSize = requires(R& r) { ranges::size(r); }; // Validate standard signed integer types static_assert(CanSize>); diff --git a/tests/std/tests/P0088R3_variant/env.lst b/tests/std/tests/P0088R3_variant/env.lst index 273fc9dcab..941eaa7656 100644 --- a/tests/std/tests/P0088R3_variant/env.lst +++ b/tests/std/tests/P0088R3_variant/env.lst @@ -32,7 +32,7 @@ PM_CL="/BE /c /EHsc /MD /std:c++latest /permissive-" PM_CL="/BE /c /EHsc /MDd /std:c++17 /permissive-" PM_CL="/BE /c /EHsc /MT /std:c++20 /permissive-" PM_CL="/BE /c /EHsc /MTd /std:c++latest /permissive-" -PM_COMPILER="clang-cl" PM_CL="-fno-ms-compatibility -fno-delayed-template-parsing /EHsc /MD /std:c++latest /permissive-" -PM_COMPILER="clang-cl" PM_CL="-fno-ms-compatibility -fno-delayed-template-parsing /EHsc /MDd /std:c++17 /DTEST_PERMISSIVE" -PM_COMPILER="clang-cl" PM_CL="-fno-ms-compatibility -fno-delayed-template-parsing /EHsc /MT /std:c++20 /permissive-" -PM_COMPILER="clang-cl" PM_CL="-fno-ms-compatibility -fno-delayed-template-parsing /EHsc /MTd /std:c++latest /permissive- /fp:strict" +PM_COMPILER="clang-cl" PM_CL="-fno-ms-compatibility -fno-delayed-template-parsing -Wno-unqualified-std-cast-call /EHsc /MD /std:c++latest /permissive-" +PM_COMPILER="clang-cl" PM_CL="-fno-ms-compatibility -fno-delayed-template-parsing -Wno-unqualified-std-cast-call /EHsc /MDd /std:c++17 /DTEST_PERMISSIVE" +PM_COMPILER="clang-cl" PM_CL="-fno-ms-compatibility -fno-delayed-template-parsing -Wno-unqualified-std-cast-call /EHsc /MT /std:c++20 /permissive-" +PM_COMPILER="clang-cl" PM_CL="-fno-ms-compatibility -fno-delayed-template-parsing -Wno-unqualified-std-cast-call /EHsc /MTd /std:c++latest /permissive- /fp:strict" diff --git a/tests/std/tests/P0218R1_filesystem/test.cpp b/tests/std/tests/P0218R1_filesystem/test.cpp index 2f278a4c08..ab63f68abf 100644 --- a/tests/std/tests/P0218R1_filesystem/test.cpp +++ b/tests/std/tests/P0218R1_filesystem/test.cpp @@ -35,8 +35,8 @@ using namespace std::filesystem; constexpr wstring_view badPath = L"// ?? ?? ///// ?? ?? ? ////"sv; const path nonexistentPaths[] = { - L"C:/This/Path/Should/Not/Exist"sv, - L"//this_path_does_not_exist_on_the_network_e9da301701f70ead24c65bd30f600d15/docs"sv, + L"C:/This/Path/Should/Not/Exist"sv, + L"//this_path_does_not_exist_on_the_network_e9da301701f70ead24c65bd30f600d15/docs"sv, }; constexpr wstring_view longSuffix = LR"(really\long\path\longer\than\max_path\goes\here\and it just goes)" @@ -1517,6 +1517,7 @@ void expect_absolute(const path& input, const wstring_view expected) { if (actual.native() != expected) { wcerr << L"Actual result: " << actual.native() << L"\n"; } + if (ec) { wcerr << L"The call failed.\n"; } @@ -3847,6 +3848,7 @@ basic_ostream& operator<<(basic_ostream& ostr, const if (p == perms::owner_all) { return ostr << L"perms::owner_all"; } + if (p == perms::owner_read) { return ostr << L"perms::owner_read"; } diff --git a/tests/std/tests/P0220R1_polymorphic_memory_resources/test.cpp b/tests/std/tests/P0220R1_polymorphic_memory_resources/test.cpp index 5f3eb8e7b7..459fde682c 100644 --- a/tests/std/tests/P0220R1_polymorphic_memory_resources/test.cpp +++ b/tests/std/tests/P0220R1_polymorphic_memory_resources/test.cpp @@ -168,6 +168,7 @@ namespace { } else { result = std::malloc(bytes); } + if (result) { return result; } @@ -199,15 +200,17 @@ namespace { } else { bytes_ = bytes; } + if (align_ != 0) { CHECK(align == align_); } else { align_ = align; } + if (align <= __STDCPP_DEFAULT_NEW_ALIGNMENT__) { return ptr_ = ::operator new(bytes); } else { - return ptr_ = ::operator new (bytes, std::align_val_t{align}); + return ptr_ = ::operator new(bytes, std::align_val_t{align}); } } @@ -219,6 +222,7 @@ namespace { } else { bytes_ = bytes; } + if (align_ != 0) { CHECK(align == align_); } else { @@ -228,14 +232,16 @@ namespace { if (bytes_ != 0) { CHECK(bytes == bytes_); } + if (align_ != 0) { CHECK(align == align_); } } + if (align <= __STDCPP_DEFAULT_NEW_ALIGNMENT__) { ::operator delete(ptr, bytes); } else { - ::operator delete (ptr, bytes, std::align_val_t{align}); + ::operator delete(ptr, bytes, std::align_val_t{align}); } } @@ -353,7 +359,7 @@ namespace { if (align <= __STDCPP_DEFAULT_NEW_ALIGNMENT__) { ::operator delete(ptr, size); } else { - ::operator delete (ptr, size, std::align_val_t{align}); + ::operator delete(ptr, size, std::align_val_t{align}); } } } @@ -366,7 +372,7 @@ namespace { for (auto align = 1_zu; align <= 512_zu && size % align == 0_zu; align *= 2_zu) { auto ptr = (align <= __STDCPP_DEFAULT_NEW_ALIGNMENT__) ? ::operator new(size) - : ::operator new (size, std::align_val_t{align}); + : ::operator new(size, std::align_val_t{align}); ndr.deallocate(ptr, size, align); } } @@ -407,12 +413,12 @@ namespace { for (auto align = 1_zu; align <= 512_zu && size % align == 0_zu; align *= 2_zu) { void* ptr = align <= __STDCPP_DEFAULT_NEW_ALIGNMENT__ ? ::operator new(size) - : ::operator new (size, std::align_val_t{align}); + : ::operator new(size, std::align_val_t{align}); nmr.deallocate(ptr, size, align); if (align <= __STDCPP_DEFAULT_NEW_ALIGNMENT__) { ::operator delete(ptr, size); } else { - ::operator delete (ptr, size, std::align_val_t{align}); + ::operator delete(ptr, size, std::align_val_t{align}); } } } @@ -1342,7 +1348,7 @@ namespace { } // namespace allocate_deallocate namespace release { - void test() { // + void test() { recording_resource rr; std::pmr::unsynchronized_pool_resource upr{{0_zu, sizeof(void*) << 8}, &rr}; diff --git a/tests/std/tests/P0288R9_move_only_function/test.cpp b/tests/std/tests/P0288R9_move_only_function/test.cpp index 6683b1e509..ffe9581a15 100644 --- a/tests/std/tests/P0288R9_move_only_function/test.cpp +++ b/tests/std/tests/P0288R9_move_only_function/test.cpp @@ -467,16 +467,16 @@ void test_qual() { move_only_function f1_nx([](auto i) noexcept { return i + 1; }); assert(f1_nx(1) == 2); - move_only_function f2_nx([](auto i) noexcept { return i + 1; }); + move_only_function f2_nx([](auto i) noexcept { return i + 1; }); assert(f2_nx(2) == 3); - move_only_function f3_nx([](auto i) noexcept { return i + 1; }); + move_only_function f3_nx([](auto i) noexcept { return i + 1; }); assert(move(f3_nx)(3) == 4); move_only_function f1c_nx([](auto i) noexcept { return i + 1; }); assert(f1c_nx(4) == 5); - move_only_function f2c_nx([](auto i) noexcept { return i + 1; }); + move_only_function f2c_nx([](auto i) noexcept { return i + 1; }); assert(f2c_nx(5) == 6); - move_only_function f3c_nx([](auto i) noexcept { return i + 1; }); + move_only_function f3c_nx([](auto i) noexcept { return i + 1; }); assert(move(f3c_nx)(6) == 7); } @@ -492,8 +492,8 @@ static_assert(is_same_v::result_type, void>) static_assert(is_same_v::result_type, short>); static_assert(is_same_v::result_type, int>); static_assert(is_same_v::result_type, void>); -static_assert(is_same_v::result_type, short>); -static_assert(is_same_v::result_type, int>); +static_assert(is_same_v::result_type, short>); +static_assert(is_same_v::result_type, int>); #endif // ^^^ defined(__cpp_noexcept_function_type) ^^^ bool fail_allocations = false; diff --git a/tests/std/tests/P0323R12_expected/test.cpp b/tests/std/tests/P0323R12_expected/test.cpp index 65febdefdd..97238c75a7 100644 --- a/tests/std/tests/P0323R12_expected/test.cpp +++ b/tests/std/tests/P0323R12_expected/test.cpp @@ -201,7 +201,9 @@ namespace test_expected { constexpr bool should_be_defaultable = IsYes(defaultConstructible); struct payload_default_constructor { - constexpr payload_default_constructor() requires(should_be_defaultable) : _val(42) {} + constexpr payload_default_constructor() + requires (should_be_defaultable) + : _val(42) {} [[nodiscard]] constexpr bool operator==(const int val) const noexcept { return _val == val; @@ -231,8 +233,8 @@ namespace test_expected { struct payload_copy_constructor { payload_copy_constructor() = default; payload_copy_constructor& operator=(const payload_copy_constructor&) = delete; - constexpr payload_copy_constructor(const payload_copy_constructor&) noexcept(should_be_noexcept) // - requires(!should_be_trivial) + constexpr payload_copy_constructor(const payload_copy_constructor&) noexcept(should_be_noexcept) + requires (!should_be_trivial) : _val(42) {} constexpr payload_copy_constructor(const payload_copy_constructor&) = default; @@ -323,8 +325,8 @@ namespace test_expected { payload_move_constructor() = default; payload_move_constructor(const payload_move_constructor&) = default; payload_move_constructor& operator=(payload_move_constructor&&) = delete; - constexpr payload_move_constructor(payload_move_constructor&&) noexcept(should_be_noexcept) // - requires(!should_be_trivial) + constexpr payload_move_constructor(payload_move_constructor&&) noexcept(should_be_noexcept) + requires (!should_be_trivial) : _val(42) {} constexpr payload_move_constructor(payload_move_constructor&&) = default; diff --git a/tests/std/tests/P0645R10_text_formatting_legacy_text_encoding/env.lst b/tests/std/tests/P0645R10_text_formatting_legacy_text_encoding/env.lst index 5ac3f805fe..4b3fe1c1c3 100644 --- a/tests/std/tests/P0645R10_text_formatting_legacy_text_encoding/env.lst +++ b/tests/std/tests/P0645R10_text_formatting_legacy_text_encoding/env.lst @@ -23,5 +23,5 @@ PM_CL="/MTd /D_ITERATOR_DEBUG_LEVEL=2 /std:c++latest /permissive" PM_CL="/MTd /D_ITERATOR_DEBUG_LEVEL=2 /std:c++latest /permissive- /analyze:only /analyze:autolog-" # PM_CL="/std:c++20 /permissive- /BE /c /MD" # PM_CL="/std:c++latest /permissive- /BE /c /MTd" -# PM_COMPILER="clang-cl" PM_CL="-fno-ms-compatibility -fno-delayed-template-parsing /std:c++20 /permissive- /MD" -# PM_COMPILER="clang-cl" PM_CL="-fno-ms-compatibility -fno-delayed-template-parsing /std:c++latest /permissive- /MTd /fp:strict" +# PM_COMPILER="clang-cl" PM_CL="-fno-ms-compatibility -fno-delayed-template-parsing -Wno-unqualified-std-cast-call /std:c++20 /permissive- /MD" +# PM_COMPILER="clang-cl" PM_CL="-fno-ms-compatibility -fno-delayed-template-parsing -Wno-unqualified-std-cast-call /std:c++latest /permissive- /MTd /fp:strict" diff --git a/tests/std/tests/P0718R2_atomic_smart_ptrs/test.cpp b/tests/std/tests/P0718R2_atomic_smart_ptrs/test.cpp index 35f23ecc50..cce5ed2949 100644 --- a/tests/std/tests/P0718R2_atomic_smart_ptrs/test.cpp +++ b/tests/std/tests/P0718R2_atomic_smart_ptrs/test.cpp @@ -544,13 +544,16 @@ void ensure_nonmember_calls_compile() { if (atomic_compare_exchange_weak(&instance, &loaded, loaded)) { // intentionally empty } + if (atomic_compare_exchange_weak_explicit( &instance, &loaded, loaded, memory_order::relaxed, memory_order::relaxed)) { // intentionally empty } + if (atomic_compare_exchange_strong(&instance, &loaded, loaded)) { // intentionally empty } + if (atomic_compare_exchange_strong_explicit( &instance, &loaded, loaded, memory_order::relaxed, memory_order::relaxed)) { // intentionally empty @@ -571,6 +574,7 @@ void ensure_member_calls_compile() { if (instance.compare_exchange_weak(loaded, constInstance)) { // intentionally empty } + if (instance.compare_exchange_strong(loaded, constInstance)) { // intentionally empty } diff --git a/tests/std/tests/P0768R1_spaceship_cpos/test.cpp b/tests/std/tests/P0768R1_spaceship_cpos/test.cpp index 3eb7a1c5d1..e275923196 100644 --- a/tests/std/tests/P0768R1_spaceship_cpos/test.cpp +++ b/tests/std/tests/P0768R1_spaceship_cpos/test.cpp @@ -24,11 +24,9 @@ struct CpoResultImpl { using type = IllFormed; }; -// clang-format off template requires requires { CPO(declval(), declval()); } struct CpoResultImpl { - // clang-format on using type = decltype(CPO(declval(), declval())); }; diff --git a/tests/std/tests/P0784R7_library_support_for_more_constexpr_containers/test.cpp b/tests/std/tests/P0784R7_library_support_for_more_constexpr_containers/test.cpp index a91077e6c8..57c6480608 100644 --- a/tests/std/tests/P0784R7_library_support_for_more_constexpr_containers/test.cpp +++ b/tests/std/tests/P0784R7_library_support_for_more_constexpr_containers/test.cpp @@ -18,19 +18,14 @@ using namespace std; #ifdef __cpp_lib_concepts template -concept can_std_construct_at = requires(Ty* ptr, Types&&... args) { - construct_at(ptr, forward(args)...); -}; +concept can_std_construct_at = requires(Ty* ptr, Types&&... args) { construct_at(ptr, forward(args)...); }; template -concept can_ranges_construct_at = requires(Ty* ptr, Types&&... args) { - ranges::construct_at(ptr, forward(args)...); -}; +concept can_ranges_construct_at = + requires(Ty* ptr, Types&&... args) { ranges::construct_at(ptr, forward(args)...); }; template -concept can_ranges_destroy_at = requires(Ty* ptr) { - ranges::destroy_at(ptr); -}; +concept can_ranges_destroy_at = requires(Ty* ptr) { ranges::destroy_at(ptr); }; template inline constexpr bool can_construct_at = [] { @@ -405,11 +400,15 @@ struct Alloc { allocator{}.deallocate(ptr, n); } - constexpr void construct(value_type* ptr, value_type n) requires Construct { + constexpr void construct(value_type* ptr, value_type n) + requires Construct + { construct_at(ptr, n); } - constexpr void destroy(value_type* ptr) requires Destroy { + constexpr void destroy(value_type* ptr) + requires Destroy + { destroy_at(ptr); } diff --git a/tests/std/tests/P0896R4_P1614R2_comparisons/test.cpp b/tests/std/tests/P0896R4_P1614R2_comparisons/test.cpp index 11b9f4192f..a1de3fcb61 100644 --- a/tests/std/tests/P0896R4_P1614R2_comparisons/test.cpp +++ b/tests/std/tests/P0896R4_P1614R2_comparisons/test.cpp @@ -133,7 +133,6 @@ constexpr bool test_three_way_comparable(std::integer_sequence) { STATIC_ASSERT(test_three_way_comparable(std::make_integer_sequence{})); // Validate three_way_comparable_with -// clang-format off // 4: not common_reference_with // 5: common_reference_t is not three_way_comparable @@ -143,6 +142,8 @@ struct std::common_type, three_way_archetype; }; +// clang-format off + // 6: not _Weakly_equality_comparable_with template requires ((I1 != I2 || !same_as) && (I1 == 6 || I2 == 6)) @@ -168,6 +169,8 @@ template requires (I1 != I2 || !same_as) bool operator>=(three_way_archetype const&, three_way_archetype const&); +// clang-format on + // 8: <=> isn't defined template requires ((I1 != I2 || !same_as) && I1 != 8 && I1 != 9 && I2 != 8 && I2 != 9) @@ -179,8 +182,6 @@ template requires ((I1 != I2 || !same_as) && I1 == 9 && I2 == 9) int operator<=>(three_way_archetype const&, three_way_archetype const&); -// clang-format on - constexpr int three_way_with_max = 10; template @@ -221,14 +222,10 @@ STATIC_ASSERT(test_three_way_comparable_with(std::make_integer_sequence -concept is_trait = requires { - typename T::type; -}; +concept is_trait = requires { typename T::type; }; template -concept can_three_way = requires(T const& t, U const& u) { - t <=> u; -}; +concept can_three_way = requires(T const& t, U const& u) { t <=> u; }; template constexpr bool test_compare_three_way() { diff --git a/tests/std/tests/P0896R4_common_iterator/test.cpp b/tests/std/tests/P0896R4_common_iterator/test.cpp index 854ffb21b6..d1736b99cf 100644 --- a/tests/std/tests/P0896R4_common_iterator/test.cpp +++ b/tests/std/tests/P0896R4_common_iterator/test.cpp @@ -13,16 +13,16 @@ using P = pair; template concept CanDifference = requires(Iter it) { - {it - it}; -}; + { it - it }; + }; template -concept HasProxy = !is_reference_v>; +concept HasProxy = (!is_reference_v>); template concept CanArrow = requires(const Iter& i) { - {i.operator->()}; -}; + { i.operator->() }; + }; struct instantiator { template diff --git a/tests/std/tests/P0896R4_counted_iterator/test.cpp b/tests/std/tests/P0896R4_counted_iterator/test.cpp index 1eafd539e1..c59a735a1b 100644 --- a/tests/std/tests/P0896R4_counted_iterator/test.cpp +++ b/tests/std/tests/P0896R4_counted_iterator/test.cpp @@ -14,7 +14,6 @@ using namespace std; template inline constexpr void* must_be_countable = nullptr; -// clang-format off template requires requires { typename counted_iterator; } inline constexpr bool must_be_countable = true; @@ -22,6 +21,7 @@ inline constexpr bool must_be_countable = true; template concept Counted = (must_be_countable && ...); +// clang-format off template concept CountedCompare = Counted && requires(const counted_iterator& c1, const counted_iterator& c2) { @@ -276,6 +276,7 @@ struct instantiator { assert(counted_iterator{} <=> counted_iterator{} == strong_ordering::equal); assert(counted_iterator{} <=> counted_iterator{} == strong_ordering::equivalent); } + if constexpr (common_with) { { // equality converting counted_iterator const_iter1{ConstIter{input}, 2}; diff --git a/tests/std/tests/P0896R4_ranges_alg_merge/test.cpp b/tests/std/tests/P0896R4_ranges_alg_merge/test.cpp index 21e83ada8f..f536f27be6 100644 --- a/tests/std/tests/P0896R4_ranges_alg_merge/test.cpp +++ b/tests/std/tests/P0896R4_ranges_alg_merge/test.cpp @@ -30,7 +30,7 @@ struct instantiator { static constexpr P elements1[] = {{0, 10}, {0, 11}, {0, 12}, {1, 10}, {1, 11}, {3, 10}}; static constexpr P elements2[] = {{13, 0}, {14, 0}, {10, 2}, {11, 3}, {12, 3}}; static constexpr P expected[] = { - {0, 10}, {0, 11}, {0, 12}, {13, 0}, {14, 0}, {1, 10}, {1, 11}, {10, 2}, {3, 10}, {11, 3}, {12, 3}}; + {0, 10}, {0, 11}, {0, 12}, {13, 0}, {14, 0}, {1, 10}, {1, 11}, {10, 2}, {3, 10}, {11, 3}, {12, 3}}; static constexpr auto counting_compare(size_t& counter) { return [&counter](auto&& x, auto&& y) { diff --git a/tests/std/tests/P0896R4_ranges_alg_minmax/test.cpp b/tests/std/tests/P0896R4_ranges_alg_minmax/test.cpp index bd4dc3315b..394d3ec2c5 100644 --- a/tests/std/tests/P0896R4_ranges_alg_minmax/test.cpp +++ b/tests/std/tests/P0896R4_ranges_alg_minmax/test.cpp @@ -347,8 +347,8 @@ void test_gh_1893() { string high = "n"; int projection_count = 0; const auto clamped = ranges::clamp( - ref(val), ref(low), ref(high), [](auto x, auto y) { return x < y; }, - [&projection_count](const auto& x) -> decltype(auto) { + ref(val), ref(low), ref(high), [](auto x, auto y) { return x < y; }, + [&projection_count](const auto& x) -> decltype(auto) { ++projection_count; return x.get(); }); diff --git a/tests/std/tests/P0896R4_ranges_iterator_machinery/test.cpp b/tests/std/tests/P0896R4_ranges_iterator_machinery/test.cpp index 563a0229e3..974de15f0f 100644 --- a/tests/std/tests/P0896R4_ranges_iterator_machinery/test.cpp +++ b/tests/std/tests/P0896R4_ranges_iterator_machinery/test.cpp @@ -21,44 +21,28 @@ inline constexpr bool always_false = false; template using reference_to = T&; template -concept can_reference = requires { - typename reference_to; -}; +concept can_reference = requires { typename reference_to; }; template -concept has_eq = requires(T const& t, U const& u) { - t == u; -}; +concept has_eq = requires(T const& t, U const& u) { t == u; }; template -concept has_neq = requires(T const& t, U const& u) { - t != u; -}; +concept has_neq = requires(T const& t, U const& u) { t != u; }; template -concept has_less = requires(T const& t, U const& u) { - t < u; -}; +concept has_less = requires(T const& t, U const& u) { t < u; }; template -concept has_greater = requires(T const& t, U const& u) { - t > u; -}; +concept has_greater = requires(T const& t, U const& u) { t > u; }; template -concept has_less_eq = requires(T const& t, U const& u) { - t <= u; -}; +concept has_less_eq = requires(T const& t, U const& u) { t <= u; }; template -concept has_greater_eq = requires(T const& t, U const& u) { - t >= u; -}; +concept has_greater_eq = requires(T const& t, U const& u) { t >= u; }; template -concept has_difference = requires(T const& t, U const& u) { - t - u; -}; +concept has_difference = requires(T const& t, U const& u) { t - u; }; struct no_such_type; // not defined @@ -97,32 +81,20 @@ struct my_iterator { }; template -concept has_member_iter_concept = requires { - typename T::iterator_concept; -}; +concept has_member_iter_concept = requires { typename T::iterator_concept; }; template -concept has_member_iter_category = requires { - typename T::iterator_category; -}; +concept has_member_iter_category = requires { typename T::iterator_category; }; template -concept has_member_value_type = requires { - typename T::value_type; -}; +concept has_member_value_type = requires { typename T::value_type; }; template -concept has_iter_value = requires { - typename std::iter_value_t; -}; +concept has_iter_value = requires { typename std::iter_value_t; }; template -concept has_member_difference_type = requires { - typename T::difference_type; -}; +concept has_member_difference_type = requires { typename T::difference_type; }; template -concept has_iter_diff = requires { - typename std::iter_difference_t; -}; +concept has_iter_diff = requires { typename std::iter_difference_t; }; template struct arrow_base { @@ -318,7 +290,8 @@ inline constexpr std::size_t destructible_archetype_max = 1; template struct semiregular_archetype : destructible_archetype { - semiregular_archetype() requires(I != 5); + semiregular_archetype() + requires (I != 5); COPYABLE_OPS(semiregular); }; @@ -367,7 +340,8 @@ inline constexpr std::size_t weakly_incrementable_archetype_max = 11; template struct incrementable_archetype : weakly_incrementable_archetype, increment_ops, incrementable_archetype> { - incrementable_archetype() requires(I != 11); + incrementable_archetype() + requires (I != 11); COPYABLE_OPS(incrementable); using increment_ops, incrementable_archetype>::operator++; @@ -397,7 +371,8 @@ inline constexpr std::size_t iterator_archetype_max = 12; template struct sentinel_archetype : semiregular_archetype { - sentinel_archetype() requires(I != 5); + sentinel_archetype() + requires (I != 5); COPYABLE_OPS(sentinel); // clang-format off @@ -411,11 +386,11 @@ inline constexpr std::size_t sentinel_archetype_max = 7; template struct sized_sentinel_archetype : sentinel_archetype { - sized_sentinel_archetype() requires(I != 5); + sized_sentinel_archetype() + requires (I != 5); COPYABLE_OPS(sized_sentinel); }; -// clang-format off template requires (I == 8) double operator-(sized_sentinel_archetype const&, iterator_archetype const&); @@ -433,7 +408,6 @@ template requires (I < 9 || I >= 11) std::iter_difference_t> operator-( iterator_archetype const&, sized_sentinel_archetype const&); -// clang-format on template inline constexpr bool std::disable_sized_sentinel_for, I> = true; @@ -498,7 +472,8 @@ inline constexpr std::size_t input_iterator_archetype_max = 16; template struct forward_iterator_archetype : input_iterator_archetype, increment_ops, forward_iterator_archetype> { - forward_iterator_archetype() requires(I != 16); + forward_iterator_archetype() + requires (I != 16); COPYABLE_OPS(forward_iterator); using increment_ops, forward_iterator_archetype>::operator++; @@ -524,7 +499,8 @@ template struct bidi_iterator_archetype : forward_iterator_archetype, increment_ops, bidi_iterator_archetype>, decrement_ops> { - bidi_iterator_archetype() requires(I != 16); + bidi_iterator_archetype() + requires (I != 16); COPYABLE_OPS(bidi_iterator); using increment_ops, bidi_iterator_archetype>::operator++; }; @@ -535,7 +511,8 @@ template struct random_iterator_archetype : bidi_iterator_archetype, increment_ops, random_iterator_archetype>, decrement_ops> { - random_iterator_archetype() requires(I != 16); + random_iterator_archetype() + requires (I != 16); COPYABLE_OPS(random_iterator); using increment_ops, random_iterator_archetype>::operator++; using decrement_ops>::operator--; @@ -565,11 +542,9 @@ struct contig_iterator_archetype_types : random_iterator_archetype { using iterator_concept = std::contiguous_iterator_tag; using iterator_category = std::random_access_iterator_tag; }; -// clang-format off template requires (I == 14 || I == 15 || I == 31) struct contig_iterator_archetype_types : random_iterator_archetype {}; -// clang-format on template <> struct contig_iterator_archetype_types<32> : random_iterator_archetype<32> { using iterator_category = std::random_access_iterator_tag; @@ -584,7 +559,8 @@ template struct contig_iterator_archetype : increment_ops, contig_iterator_archetype>, decrement_ops>, contig_iterator_archetype_types { - contig_iterator_archetype() requires(I != 16); + contig_iterator_archetype() + requires (I != 16); COPYABLE_OPS(contig_iterator); using increment_ops, contig_iterator_archetype>::operator++; using decrement_ops>::operator--; @@ -638,9 +614,7 @@ namespace iterator_synopsis_test { // Validate iter_reference_t template - concept can_iter_ref = requires { - typename iter_reference_t; - }; + concept can_iter_ref = requires { typename iter_reference_t; }; STATIC_ASSERT(!can_iter_ref); STATIC_ASSERT(!can_iter_ref); @@ -1008,13 +982,9 @@ namespace iterator_cust_move_test { using std::iter_rvalue_reference_t, std::same_as; template - concept can_iter_move = requires(T&& t) { - ranges::iter_move(std::forward(t)); - }; + concept can_iter_move = requires(T&& t) { ranges::iter_move(std::forward(t)); }; template - concept can_iter_rvalue_ref = requires { - typename iter_rvalue_reference_t; - }; + concept can_iter_rvalue_ref = requires { typename iter_rvalue_reference_t; }; // N4820 [iterator.cust.move]/1.1 "iter_move(E), if that expression is valid, with overload resolution..." struct friend_hook { @@ -1121,9 +1091,7 @@ namespace iterator_cust_swap_test { std::same_as, std::swappable_with; template - concept can_iter_swap = requires(T&& t, U&& u) { - ranges::iter_swap(std::forward(t), std::forward(u)); - }; + concept can_iter_swap = requires(T&& t, U&& u) { ranges::iter_swap(std::forward(t), std::forward(u)); }; // N4820 [iterator.cust.swap]/4.1: "(void)iter_swap(E1, E2), if that expression is valid, with..." namespace adl_barrier { @@ -1131,9 +1099,7 @@ namespace iterator_cust_swap_test { void iter_swap(T, U) = delete; template - concept bullet1 = requires(T&& t, U&& u) { - iter_swap(std::forward(t), std::forward(u)); - }; + concept bullet1 = requires(T&& t, U&& u) { iter_swap(std::forward(t), std::forward(u)); }; } // namespace adl_barrier using adl_barrier::bullet1; @@ -1240,7 +1206,7 @@ namespace iterator_cust_swap_test { // N4820 [iterator.cust.swap]/4.4: "Otherwise, ranges::iter_swap(E1, E2) is ill-formed." template - concept bullet4 = !can_iter_swap; + concept bullet4 = (!can_iter_swap); STATIC_ASSERT(bullet4); STATIC_ASSERT(bullet4); @@ -1401,7 +1367,8 @@ namespace iterator_concept_writable_test { operator int() const; reference& operator=(int); - reference const& operator=(int) const requires HasConstAssign; + reference const& operator=(int) const + requires HasConstAssign; }; reference operator*() const; @@ -1825,10 +1792,13 @@ namespace unwrap_move_only { bool operator==(std::default_sentinel_t const&) const noexcept; static constexpr bool _Unwrap_when_unverified = true; - iter _Unwrapped() && noexcept requires IsWrapped; - void _Seek_to(iter) noexcept requires IsWrapped; + iter _Unwrapped() && noexcept + requires IsWrapped; + void _Seek_to(iter) noexcept + requires IsWrapped; - void _Verify_offset(std::ptrdiff_t) const noexcept requires IsWrapped; + void _Verify_offset(std::ptrdiff_t) const noexcept + requires IsWrapped; }; STATIC_ASSERT(std::input_iterator>); STATIC_ASSERT(!has_member_iter_category>>); @@ -1896,11 +1866,14 @@ namespace iter_ops { constexpr explicit trace_iterator(int const pos, trace& t) noexcept(NoThrow == nothrow::yes) : trace_{&t}, pos_{pos} {} + // clang-format off trace_iterator(trace_iterator const&) requires is_forward = default; - trace_iterator(trace_iterator&&) = default; + // clang-format on + trace_iterator(trace_iterator&&) = default; - constexpr trace_iterator& operator=(trace_iterator const& that) noexcept( - NoThrow == nothrow::yes) requires is_forward { + constexpr trace_iterator& operator=(trace_iterator const& that) noexcept(NoThrow == nothrow::yes) + requires is_forward + { if (!trace_) { trace_ = that.trace_; } @@ -1939,45 +1912,59 @@ namespace iter_ops { ++trace_->compares_; return pos_ == sentinel_position; } - constexpr int operator-(default_sentinel_t) const noexcept(NoThrow == nothrow::yes) requires is_sized { + constexpr int operator-(default_sentinel_t) const noexcept(NoThrow == nothrow::yes) + requires is_sized + { ++trace_->differences_; return pos_ - sentinel_position; } - friend constexpr int operator-(default_sentinel_t, trace_iterator const& i) noexcept( - NoThrow == nothrow::yes) requires is_sized { + friend constexpr int operator-(default_sentinel_t, trace_iterator const& i) noexcept(NoThrow == nothrow::yes) + requires is_sized + { return -(i - default_sentinel); } - constexpr bool operator==(trace_iterator const& that) const - noexcept(NoThrow == nothrow::yes) requires is_forward { + constexpr bool operator==(trace_iterator const& that) const noexcept(NoThrow == nothrow::yes) + requires is_forward + { ++trace_->compares_; return pos_ == that.pos_; } - constexpr trace_iterator& operator--() noexcept(NoThrow == nothrow::yes) requires is_bidi { + constexpr trace_iterator& operator--() noexcept(NoThrow == nothrow::yes) + requires is_bidi + { ++trace_->decrements_; --pos_; return *this; } - trace_iterator operator--(int) noexcept(NoThrow == nothrow::yes) requires is_bidi; + trace_iterator operator--(int) noexcept(NoThrow == nothrow::yes) + requires is_bidi; - std::strong_ordering operator<=>(trace_iterator const&) const - noexcept(NoThrow == nothrow::yes) requires is_random; + std::strong_ordering operator<=>(trace_iterator const&) const noexcept(NoThrow == nothrow::yes) + requires is_random; - constexpr trace_iterator& operator+=(int const n) noexcept(NoThrow == nothrow::yes) requires is_random { + constexpr trace_iterator& operator+=(int const n) noexcept(NoThrow == nothrow::yes) + requires is_random + { ++trace_->seeks_; pos_ += n; return *this; } - trace_iterator operator+(int) const noexcept(NoThrow == nothrow::yes) requires is_random; - friend trace_iterator operator+(int, trace_iterator const&) noexcept( - NoThrow == nothrow::yes) requires is_random {} + trace_iterator operator+(int) const noexcept(NoThrow == nothrow::yes) + requires is_random; + friend trace_iterator operator+(int, trace_iterator const&) noexcept(NoThrow == nothrow::yes) + requires is_random + {} - trace_iterator& operator-=(int) noexcept(NoThrow == nothrow::yes) requires is_random; - trace_iterator operator-(int) const noexcept(NoThrow == nothrow::yes) requires is_random; + trace_iterator& operator-=(int) noexcept(NoThrow == nothrow::yes) + requires is_random; + trace_iterator operator-(int) const noexcept(NoThrow == nothrow::yes) + requires is_random; - constexpr int operator-(trace_iterator const& that) const - noexcept(NoThrow == nothrow::yes) requires is_random || is_sized { + constexpr int operator-(trace_iterator const& that) const noexcept(NoThrow == nothrow::yes) + requires is_random || is_sized + { ++trace_->differences_; return pos_ - that.pos_; } @@ -3215,11 +3202,13 @@ namespace move_iterator_test { } }; - input_iter() = default; - input_iter(input_iter const&) requires CanCopy = default; - input_iter(input_iter&&) = default; + input_iter() = default; + // clang-format off + input_iter(input_iter const&) requires CanCopy = default; + input_iter(input_iter&&) = default; input_iter& operator=(input_iter const&) requires CanCopy = default; - input_iter& operator=(input_iter&&) = default; + // clang-format on + input_iter& operator=(input_iter&&) = default; reference operator*() const; input_iter& operator++(); @@ -3336,9 +3325,7 @@ namespace move_iterator_test { // Validate that move_sentinel requires a semiregular template argument, and models semiregular template - concept CanMoveSentinel = requires { - typename move_sentinel; - }; + concept CanMoveSentinel = requires { typename move_sentinel; }; struct moveonly { moveonly() = default; moveonly(moveonly&&) = default; diff --git a/tests/std/tests/P0896R4_ranges_range_machinery/test.cpp b/tests/std/tests/P0896R4_ranges_range_machinery/test.cpp index b3727c3a1f..8779e29c7a 100644 --- a/tests/std/tests/P0896R4_ranges_range_machinery/test.cpp +++ b/tests/std/tests/P0896R4_ranges_range_machinery/test.cpp @@ -40,9 +40,7 @@ template concept Decayed = std::same_as, T>; template -concept CanSizeType = requires { - typename ranges::range_size_t; -}; +concept CanSizeType = requires { typename ranges::range_size_t; }; struct invalid_type {}; @@ -856,11 +854,9 @@ struct fancy_pointer { fancy_pointer() = default; fancy_pointer(std::nullptr_t); - // clang-format off template requires std::convertible_to fancy_pointer(fancy_pointer); - // clang-format on element_type& operator*() const; element_type& operator[](difference_type) const; @@ -1547,13 +1543,18 @@ struct arbitrary_range { arbitrary_range(arbitrary_range&&) = default; arbitrary_range& operator=(arbitrary_range&&) = default; - int* begin() requires AllowNonConst; - int* end() requires AllowNonConst; + int* begin() + requires AllowNonConst; + int* end() + requires AllowNonConst; - int const* begin() const requires AllowConst; - int const* end() const requires AllowConst; + int const* begin() const + requires AllowConst; + int const* end() const + requires AllowConst; - unsigned char size() const requires AllowSize; + unsigned char size() const + requires AllowSize; }; using mutable_unsized_range = arbitrary_range; diff --git a/tests/std/tests/P0896R4_ranges_ref_view/test.cpp b/tests/std/tests/P0896R4_ranges_ref_view/test.cpp index cf710708cf..8eaa06f81f 100644 --- a/tests/std/tests/P0896R4_ranges_ref_view/test.cpp +++ b/tests/std/tests/P0896R4_ranges_ref_view/test.cpp @@ -13,17 +13,11 @@ using namespace std; template -concept can_empty = requires(Range& r) { - ranges::empty(r); -}; +concept can_empty = requires(Range& r) { ranges::empty(r); }; template -concept can_data = requires(Range& r) { - ranges::data(r); -}; +concept can_data = requires(Range& r) { ranges::data(r); }; template -concept can_size = requires(Range& r) { - ranges::size(r); -}; +concept can_size = requires(Range& r) { ranges::size(r); }; struct instantiator { template diff --git a/tests/std/tests/P0896R4_ranges_subrange/test.compile.pass.cpp b/tests/std/tests/P0896R4_ranges_subrange/test.compile.pass.cpp index 8be8875737..2d35641a23 100644 --- a/tests/std/tests/P0896R4_ranges_subrange/test.compile.pass.cpp +++ b/tests/std/tests/P0896R4_ranges_subrange/test.compile.pass.cpp @@ -34,9 +34,7 @@ struct empty {}; namespace test_view_interface { template - concept CanViewInterface = requires { - typename ranges::view_interface; - }; + concept CanViewInterface = requires { typename ranges::view_interface; }; template constexpr bool test_template_id() { @@ -771,9 +769,7 @@ namespace test_subrange { // * template-id: subrange is a valid template-id iff I models input_or_output_iterator, S models // sentinel_for, and sized_sentinel_for implies K == sized. template - concept CanSubrange = requires { - typename subrange; - }; + concept CanSubrange = requires { typename subrange; }; STATIC_ASSERT(CanSubrange); STATIC_ASSERT(!CanSubrange); STATIC_ASSERT(!CanSubrange); @@ -784,13 +780,13 @@ namespace test_subrange { template concept HasMemberEmpty = requires(std::remove_reference_t const r) { - { r.empty() } -> same_as; - }; + { r.empty() } -> same_as; + }; template concept HasMemberSize = requires(std::remove_reference_t const r) { - { r.size() } -> std::integral; - }; + { r.size() } -> std::integral; + }; // Validate default template arguments: second defaults to first, and third defaults to subrange_kind::sized iff // sized_sentinel_for. @@ -841,8 +837,8 @@ namespace test_subrange { STATIC_ASSERT(constructible_from == (!sized || sized_range || sized_sentinel_for) ); STATIC_ASSERT(constructible_from == sized); - STATIC_ASSERT(constructible_from == (borrowed_range && (!sized || sized_range || sized_sentinel_for) )); + STATIC_ASSERT(constructible_from + == (borrowed_range && (!sized || sized_range || sized_sentinel_for) )); STATIC_ASSERT(constructible_from == (sized && borrowed_range) ); // Validate begin/end/empty @@ -1086,7 +1082,8 @@ namespace test_subrange { using reference = int; iterator() = default; - iterator(iterator) requires IsConst; + iterator(iterator) + requires IsConst; iterator(iterator&&) = default; iterator& operator=(iterator&&) = default; @@ -1099,7 +1096,8 @@ namespace test_subrange { template struct sentinel { sentinel() = default; - sentinel(sentinel) requires IsConst; + sentinel(sentinel) + requires IsConst; bool operator==(iterator const&) const; }; @@ -1497,14 +1495,10 @@ namespace test_subrange { namespace test_lwg_3589 { // LWG-3589 added a Constraint to std::get<0>(const subrange&) to require the iterator type to be copyable template - concept CanGet = requires { - std::get(std::declval()); - }; + concept CanGet = requires { std::get(std::declval()); }; template - concept CanRangesGet = requires { - ranges::get(std::declval()); - }; + concept CanRangesGet = requires { ranges::get(std::declval()); }; template constexpr bool test() { diff --git a/tests/std/tests/P0896R4_ranges_test_machinery/test.compile.pass.cpp b/tests/std/tests/P0896R4_ranges_test_machinery/test.compile.pass.cpp index 93b6dd7f87..6414a38b0f 100644 --- a/tests/std/tests/P0896R4_ranges_test_machinery/test.compile.pass.cpp +++ b/tests/std/tests/P0896R4_ranges_test_machinery/test.compile.pass.cpp @@ -26,7 +26,7 @@ constexpr bool iter_test() { STATIC_ASSERT(!movable || indirectly_writable); - constexpr bool can_write = derived_from // + constexpr bool can_write = derived_from || (derived_from && assignable_from); STATIC_ASSERT(!can_write || output_iterator); @@ -205,9 +205,9 @@ STATIC_ASSERT( // Validate test::range template concept has_member_size = requires(const R& r) { - typename ranges::range_size_t; - { r.size() } -> same_as>; -}; + typename ranges::range_size_t; + { r.size() } -> same_as>; + }; using test::Sized, test::Common; diff --git a/tests/std/tests/P0896R4_views_all/test.cpp b/tests/std/tests/P0896R4_views_all/test.cpp index 33191e5fc2..47d91036f8 100644 --- a/tests/std/tests/P0896R4_views_all/test.cpp +++ b/tests/std/tests/P0896R4_views_all/test.cpp @@ -13,9 +13,7 @@ using namespace std; template -concept CanViewAll = requires(Rng&& r) { - views::all(forward(r)); -}; +concept CanViewAll = requires(Rng&& r) { views::all(forward(r)); }; // Test a silly precomposed range adaptor pipeline constexpr auto pipeline = views::all | views::all | views::all | views::all | views::all | views::all; diff --git a/tests/std/tests/P0896R4_views_common/test.cpp b/tests/std/tests/P0896R4_views_common/test.cpp index 6028381dca..59be975a7e 100644 --- a/tests/std/tests/P0896R4_views_common/test.cpp +++ b/tests/std/tests/P0896R4_views_common/test.cpp @@ -12,14 +12,10 @@ using namespace std; template -concept CanViewCommon = requires(Rng&& r) { - views::common(static_cast(r)); -}; +concept CanViewCommon = requires(Rng&& r) { views::common(static_cast(r)); }; template -concept CanViewAll = requires(Rng&& r) { - views::all(static_cast(r)); -}; +concept CanViewAll = requires(Rng&& r) { views::all(static_cast(r)); }; // Test a silly precomposed range adaptor pipeline constexpr auto pipeline = views::all | views::common; diff --git a/tests/std/tests/P0896R4_views_drop/test.cpp b/tests/std/tests/P0896R4_views_drop/test.cpp index ff4681f066..56ab4fe217 100644 --- a/tests/std/tests/P0896R4_views_drop/test.cpp +++ b/tests/std/tests/P0896R4_views_drop/test.cpp @@ -71,11 +71,9 @@ struct mapped> { template using apply = ranges::iota_view; }; -// clang-format off template requires random_access_iterator struct mapped> { - // clang-format on template using apply = ranges::subrange; }; @@ -87,9 +85,7 @@ template using pipeline_t = mapped_t>>>; template -concept CanViewDrop = requires(Rng&& r) { - views::drop(forward(r), 42); -}; +concept CanViewDrop = requires(Rng&& r) { views::drop(forward(r), 42); }; template constexpr bool test_one(Rng&& rng, Expected&& expected) { @@ -338,6 +334,7 @@ constexpr bool test_one(Rng&& rng, Expected&& expected) { if constexpr (CanIndex) { assert(r[0] == *r.begin()); } + if constexpr (CanIndex) { assert(as_const(r)[0] == *as_const(r).begin()); } diff --git a/tests/std/tests/P0896R4_views_drop_while/test.cpp b/tests/std/tests/P0896R4_views_drop_while/test.cpp index 2910ece2d9..7aede8f7fc 100644 --- a/tests/std/tests/P0896R4_views_drop_while/test.cpp +++ b/tests/std/tests/P0896R4_views_drop_while/test.cpp @@ -28,9 +28,7 @@ using pipeline_t = ranges::drop_while_view< ranges::drop_while_view, Pred>, Pred>, Pred>; template -concept CanViewDropWhile = requires(Rng&& r) { - views::drop_while(forward(r), is_less_than<3>); -}; +concept CanViewDropWhile = requires(Rng&& r) { views::drop_while(forward(r), is_less_than<3>); }; template constexpr bool test_one(Rng&& rng, Expected&& expected) { diff --git a/tests/std/tests/P0896R4_views_elements/test.cpp b/tests/std/tests/P0896R4_views_elements/test.cpp index 0972fbc9cd..13cfd0716c 100644 --- a/tests/std/tests/P0896R4_views_elements/test.cpp +++ b/tests/std/tests/P0896R4_views_elements/test.cpp @@ -24,9 +24,7 @@ template > using pipeline_t = ranges::elements_view; template -concept CanViewElements = requires(Rng&& r) { - views::elements<0>(forward(r)); -}; +concept CanViewElements = requires(Rng&& r) { views::elements<0>(forward(r)); }; constexpr P some_pairs[] = {{0, -1}, {1, -2}, {2, -3}, {3, -4}, {4, -5}, {5, -6}, {6, -7}, {7, -8}}; constexpr int expected_keys[] = {0, 1, 2, 3, 4, 5, 6, 7}; diff --git a/tests/std/tests/P0896R4_views_filter/test.cpp b/tests/std/tests/P0896R4_views_filter/test.cpp index dfb0181e43..d152070157 100644 --- a/tests/std/tests/P0896R4_views_filter/test.cpp +++ b/tests/std/tests/P0896R4_views_filter/test.cpp @@ -26,9 +26,7 @@ using pipeline_t = ranges::filter_view, Pred>, Pred>, Pred>; template -concept CanViewFilter = requires(Rng&& r) { - views::filter(forward(r), is_even); -}; +concept CanViewFilter = requires(Rng&& r) { views::filter(forward(r), is_even); }; template constexpr bool test_one(Rng&& rng, Expected&& expected) { diff --git a/tests/std/tests/P0896R4_views_iota/test.cpp b/tests/std/tests/P0896R4_views_iota/test.cpp index ca83946879..be5ed9e4f7 100644 --- a/tests/std/tests/P0896R4_views_iota/test.cpp +++ b/tests/std/tests/P0896R4_views_iota/test.cpp @@ -15,14 +15,10 @@ using namespace std; static_assert(ranges::_Advanceable); template -concept CanViewIota = requires(W w, B b) { - views::iota(w, b); -}; +concept CanViewIota = requires(W w, B b) { views::iota(w, b); }; template -concept CanSize = requires(R& r) { - ranges::size(r); -}; +concept CanSize = requires(R& r) { ranges::size(r); }; struct empty_type {}; diff --git a/tests/std/tests/P0896R4_views_join/test.cpp b/tests/std/tests/P0896R4_views_join/test.cpp index 32bd1ada10..7da95ce34b 100644 --- a/tests/std/tests/P0896R4_views_join/test.cpp +++ b/tests/std/tests/P0896R4_views_join/test.cpp @@ -20,9 +20,7 @@ using namespace std; template -concept CanViewJoin = requires(Rng&& r) { - views::join(forward(r)); -}; +concept CanViewJoin = requires(Rng&& r) { views::join(forward(r)); }; template constexpr bool test_one(Outer&& rng, Expected&& expected) { diff --git a/tests/std/tests/P0896R4_views_lazy_split/test.cpp b/tests/std/tests/P0896R4_views_lazy_split/test.cpp index b3edce0f68..55a785f3e2 100644 --- a/tests/std/tests/P0896R4_views_lazy_split/test.cpp +++ b/tests/std/tests/P0896R4_views_lazy_split/test.cpp @@ -13,9 +13,8 @@ using namespace std; template -concept CanViewLazySplit = requires(Rng&& r, Delimiter&& d) { - views::lazy_split(forward(r), forward(d)); -}; +concept CanViewLazySplit = + requires(Rng&& r, Delimiter&& d) { views::lazy_split(forward(r), forward(d)); }; constexpr auto equal_ranges = [](auto&& left, auto&& right) { return ranges::equal(left, right); }; constexpr auto text = "This is a test, this is only a test."sv; @@ -68,8 +67,8 @@ constexpr void test_one(Base&& base, Delimiter&& delimiter, Expected&& expected) } // ... with const lvalue argument - STATIC_ASSERT(CanViewLazySplit&, - Delimiter&> == (!is_view || copy_constructible>) ); + STATIC_ASSERT(CanViewLazySplit&, Delimiter&> + == (!is_view || copy_constructible>) ); if constexpr (is_view && copy_constructible>) { constexpr bool is_noexcept = is_nothrow_copy_constructible_v> && is_nothrow_copy_constructible_v; @@ -114,8 +113,8 @@ constexpr void test_one(Base&& base, Delimiter&& delimiter, Expected&& expected) } // ... with const rvalue argument - STATIC_ASSERT(CanViewLazySplit, - Delimiter&> == (is_view && copy_constructible>) ); + STATIC_ASSERT(CanViewLazySplit, Delimiter&> + == (is_view && copy_constructible>) ); if constexpr (is_view && copy_constructible>) { constexpr bool is_noexcept = is_nothrow_copy_constructible_v> && is_nothrow_copy_constructible_v; diff --git a/tests/std/tests/P0896R4_views_reverse/test.cpp b/tests/std/tests/P0896R4_views_reverse/test.cpp index 1ef078f802..ba624f3d4d 100644 --- a/tests/std/tests/P0896R4_views_reverse/test.cpp +++ b/tests/std/tests/P0896R4_views_reverse/test.cpp @@ -15,9 +15,7 @@ using namespace std; template -concept CanViewReverse = requires(Rng&& r) { - views::reverse(forward(r)); -}; +concept CanViewReverse = requires(Rng&& r) { views::reverse(forward(r)); }; // Test a silly precomposed range adaptor pipeline constexpr auto pipeline = views::all | views::reverse | views::all | views::reverse | views::all | views::reverse; diff --git a/tests/std/tests/P0896R4_views_split/test.cpp b/tests/std/tests/P0896R4_views_split/test.cpp index 5fdf935644..b1290189df 100644 --- a/tests/std/tests/P0896R4_views_split/test.cpp +++ b/tests/std/tests/P0896R4_views_split/test.cpp @@ -16,9 +16,7 @@ using namespace std; template -concept CanViewSplit = requires(Rng&& r, Delimiter&& d) { - views::split(forward(r), forward(d)); -}; +concept CanViewSplit = requires(Rng&& r, Delimiter&& d) { views::split(forward(r), forward(d)); }; constexpr auto equal_ranges = [](auto&& left, auto&& right) { return ranges::equal(left, right); }; constexpr auto text = "This is a test, this is only a test."sv; @@ -71,8 +69,8 @@ constexpr void test_one(Base&& base, Delimiter&& delimiter, Expected&& expected) } // ... with const lvalue argument - STATIC_ASSERT(CanViewSplit&, - Delimiter&> == (!is_view || copy_constructible>) ); + STATIC_ASSERT(CanViewSplit&, Delimiter&> + == (!is_view || copy_constructible>) ); if constexpr (is_view && copy_constructible>) { constexpr bool is_noexcept = is_nothrow_copy_constructible_v> && is_nothrow_copy_constructible_v; @@ -117,8 +115,8 @@ constexpr void test_one(Base&& base, Delimiter&& delimiter, Expected&& expected) } // ... with const rvalue argument - STATIC_ASSERT(CanViewSplit, - Delimiter&> == (is_view && copy_constructible>) ); + STATIC_ASSERT(CanViewSplit, Delimiter&> + == (is_view && copy_constructible>) ); if constexpr (is_view && copy_constructible>) { constexpr bool is_noexcept = is_nothrow_copy_constructible_v> && is_nothrow_copy_constructible_v; diff --git a/tests/std/tests/P0896R4_views_take/test.cpp b/tests/std/tests/P0896R4_views_take/test.cpp index 528611c9e4..9998ecfe9a 100644 --- a/tests/std/tests/P0896R4_views_take/test.cpp +++ b/tests/std/tests/P0896R4_views_take/test.cpp @@ -72,11 +72,9 @@ struct mapped> { template using apply = ranges::iota_view; }; -// clang-format off template requires random_access_iterator struct mapped> { - // clang-format on template using apply = ranges::subrange; }; @@ -88,9 +86,7 @@ template using pipeline_t = mapped_t>>>; template -concept CanViewTake = requires(Rng&& r) { - views::take(forward(r), 42); -}; +concept CanViewTake = requires(Rng&& r) { views::take(forward(r), 42); }; template constexpr bool test_one(Rng&& rng, Expected&& expected) { @@ -367,6 +363,7 @@ constexpr bool test_one(Rng&& rng, Expected&& expected) { if constexpr (CanIndex) { assert(r[0] == *r.begin()); } + if constexpr (CanIndex) { assert(as_const(r)[0] == *as_const(r).begin()); } diff --git a/tests/std/tests/P0896R4_views_take_while/test.cpp b/tests/std/tests/P0896R4_views_take_while/test.cpp index 7582f44677..4b64b77a54 100644 --- a/tests/std/tests/P0896R4_views_take_while/test.cpp +++ b/tests/std/tests/P0896R4_views_take_while/test.cpp @@ -30,9 +30,7 @@ using pipeline_t = ranges::take_while_view< ranges::take_while_view, Pred>, Pred>, Pred>; template -concept CanViewTakeWhile = requires(Rng&& r) { - views::take_while(forward(r), is_less_than<3>); -}; +concept CanViewTakeWhile = requires(Rng&& r) { views::take_while(forward(r), is_less_than<3>); }; template constexpr bool test_one(Rng&& rng, Expected&& expected) { diff --git a/tests/std/tests/P0896R4_views_transform/test.cpp b/tests/std/tests/P0896R4_views_transform/test.cpp index c3e469f94e..bb7ec19ba7 100644 --- a/tests/std/tests/P0896R4_views_transform/test.cpp +++ b/tests/std/tests/P0896R4_views_transform/test.cpp @@ -34,9 +34,7 @@ using pipeline_t = Fun>; template -concept CanViewTransform = requires(Rng&& r) { - views::transform(forward(r), add8); -}; +concept CanViewTransform = requires(Rng&& r) { views::transform(forward(r), add8); }; template constexpr bool test_one(Rng&& rng, Expected&& expected) { @@ -356,7 +354,7 @@ constexpr void test_difference_on_const_functor(Rng&& rng) { using VItCat = typename iterator_traits::iterator_category; using TVItCat = typename iterator_traits::iterator_category; STATIC_ASSERT( - is_same_v // + is_same_v || (is_same_v && is_same_v) ); } diff --git a/tests/std/tests/P0898R3_concepts/test.cpp b/tests/std/tests/P0898R3_concepts/test.cpp index ac00cf1d74..5aeea6ffd2 100644 --- a/tests/std/tests/P0898R3_concepts/test.cpp +++ b/tests/std/tests/P0898R3_concepts/test.cpp @@ -301,7 +301,6 @@ namespace test_same_as { STATIC_ASSERT(same_as); STATIC_ASSERT(same_as); - // clang-format off // Verify that `same_as` subsumes `same_as` (note reversed argument order) template requires same_as @@ -314,7 +313,6 @@ namespace test_same_as { constexpr bool f() { return true; } - // clang-format on STATIC_ASSERT(!f()); STATIC_ASSERT(!f()); @@ -1625,7 +1623,6 @@ namespace test_move_constructible { namespace test_ranges_swap { namespace ranges = std::ranges; - // clang-format off template constexpr bool can_swap = false; template @@ -1637,7 +1634,6 @@ namespace test_ranges_swap { template requires can_swap constexpr bool can_nothrow_swap = noexcept(ranges::swap(std::declval(), std::declval())); - // clang-format on STATIC_ASSERT(!can_swap); STATIC_ASSERT(!can_swap); @@ -2680,8 +2676,8 @@ namespace test_totally_ordered_with { STATIC_ASSERT(totally_ordered_with == result); } - if constexpr (!std::is_same_v> && !std::is_same_v>) { + if constexpr (!std::is_same_v> + && !std::is_same_v>) { STATIC_ASSERT(totally_ordered_with == result); STATIC_ASSERT(totally_ordered_with == result); STATIC_ASSERT(totally_ordered_with == result); @@ -3348,11 +3344,9 @@ namespace test_relation { template struct A {}; - // clang-format off template requires (0 < U) Bool operator==(A, A); // A<0> == A<0> is invalid - // clang-format on STATIC_ASSERT(!test>()); STATIC_ASSERT(test>()); @@ -3383,11 +3377,9 @@ namespace test_relation { struct C {}; enum E : bool { No, Yes }; E operator==(C<0>&, C<0>&); // const C<0> == const C<0> is invalid - // clang-format off template requires (0 != I) E operator==(C, C); - // clang-format on STATIC_ASSERT(!test>()); STATIC_ASSERT(test>()); diff --git a/tests/std/tests/P0912R5_coroutine/env.lst b/tests/std/tests/P0912R5_coroutine/env.lst index f4987cdd82..79bd2bf7d0 100644 --- a/tests/std/tests/P0912R5_coroutine/env.lst +++ b/tests/std/tests/P0912R5_coroutine/env.lst @@ -21,5 +21,5 @@ PM_CL="/EHsc /MTd /std:c++latest /permissive- /Zc:preprocessor" PM_CL="/EHsc /MD /std:c++latest /permissive- /analyze:only /analyze:autolog-" PM_CL="/BE /c /EHsc /MD /std:c++20 /permissive-" PM_CL="/BE /c /EHsc /MTd /std:c++latest /permissive-" -PM_COMPILER="clang-cl" PM_CL="-fno-ms-compatibility -fno-delayed-template-parsing /EHsc /MD /std:c++20 /permissive-" -PM_COMPILER="clang-cl" PM_CL="-fno-ms-compatibility -fno-delayed-template-parsing /EHsc /MTd /std:c++latest /permissive-" +PM_COMPILER="clang-cl" PM_CL="-fno-ms-compatibility -fno-delayed-template-parsing -Wno-unqualified-std-cast-call /EHsc /MD /std:c++20 /permissive-" +PM_COMPILER="clang-cl" PM_CL="-fno-ms-compatibility -fno-delayed-template-parsing -Wno-unqualified-std-cast-call /EHsc /MTd /std:c++latest /permissive-" diff --git a/tests/std/tests/P1206R7_from_range/test.compile.pass.cpp b/tests/std/tests/P1206R7_from_range/test.compile.pass.cpp index 7c7b91a457..46197fc82f 100644 --- a/tests/std/tests/P1206R7_from_range/test.compile.pass.cpp +++ b/tests/std/tests/P1206R7_from_range/test.compile.pass.cpp @@ -14,8 +14,6 @@ static_assert(semiregular); void helper(auto); template -concept can_implicitly_construct = requires { - helper({}); -}; +concept can_implicitly_construct = requires { helper({}); }; static_assert(!can_implicitly_construct); diff --git a/tests/std/tests/P1208R6_source_location/test.cpp b/tests/std/tests/P1208R6_source_location/test.cpp index 29560a7d57..23bae2090a 100644 --- a/tests/std/tests/P1208R6_source_location/test.cpp +++ b/tests/std/tests/P1208R6_source_location/test.cpp @@ -65,11 +65,7 @@ constexpr void argument_test( constexpr void sloc_constructor_test() { const s x; assert(x.loc.line() == __LINE__ - 1); -#ifdef _PREFAST_ - assert(x.loc.column() == 14 || x.loc.column() == 13); // TRANSITION, 17.4 Preview 3 -#else // _PREFAST_ assert(x.loc.column() == 13); -#endif // _PREFAST_ if (is_constant_evaluated()) { assert(x.loc.function_name() == "main"sv); // TRANSITION, VSO-1285783 } else { @@ -89,11 +85,7 @@ constexpr void different_constructor_test() { constexpr void sub_member_test() { const s2 s; assert(s.x.loc.line() == __LINE__ - 1); -#ifdef _PREFAST_ - assert(s.x.loc.column() == 15 || s.x.loc.column() == 14); // TRANSITION, 17.4 Preview 3 -#else // _PREFAST_ assert(s.x.loc.column() == 14); -#endif // _PREFAST_ if (is_constant_evaluated()) { assert(s.x.loc.function_name() == "main"sv); // TRANSITION, VSO-1285783 } else { diff --git a/tests/std/tests/P1522R1_difference_type/test.cpp b/tests/std/tests/P1522R1_difference_type/test.cpp index 3a0cb740e2..511187f856 100644 --- a/tests/std/tests/P1522R1_difference_type/test.cpp +++ b/tests/std/tests/P1522R1_difference_type/test.cpp @@ -856,9 +856,7 @@ T val() noexcept; #ifdef __cpp_lib_concepts // TRANSITION, GH-395 template -concept CanConditional = requires { - true ? val() : val(); -}; +concept CanConditional = requires { true ? val() : val(); }; #else // ^^^ has concepts / has no concepts vvv template constexpr bool CanConditional = false; diff --git a/tests/std/tests/P1614R2_spaceship/test.cpp b/tests/std/tests/P1614R2_spaceship/test.cpp index 5a70349a94..daeccca953 100644 --- a/tests/std/tests/P1614R2_spaceship/test.cpp +++ b/tests/std/tests/P1614R2_spaceship/test.cpp @@ -43,9 +43,7 @@ #include template -concept HasSpaceshipWith = requires { - std::declval() <=> std::declval(); -}; +concept HasSpaceshipWith = requires { std::declval() <=> std::declval(); }; using PartiallyOrdered = double; diff --git a/tests/std/tests/P1659R3_ranges_alg_ends_with/test.cpp b/tests/std/tests/P1659R3_ranges_alg_ends_with/test.cpp index ca553e46e1..da99d7caac 100644 --- a/tests/std/tests/P1659R3_ranges_alg_ends_with/test.cpp +++ b/tests/std/tests/P1659R3_ranges_alg_ends_with/test.cpp @@ -12,10 +12,10 @@ using namespace std; -// clang-format off template concept testable_range = ranges::input_range && (ranges::forward_range || ranges::sized_range); +// clang-format off template concept testable_sentinel = ranges::input_range && (ranges::forward_range || sized_sentinel_for, ranges::iterator_t>); diff --git a/tests/std/tests/P1899R3_views_stride/test.cpp b/tests/std/tests/P1899R3_views_stride/test.cpp index 3abfdbea4b..454886b880 100644 --- a/tests/std/tests/P1899R3_views_stride/test.cpp +++ b/tests/std/tests/P1899R3_views_stride/test.cpp @@ -15,9 +15,7 @@ using namespace std; template -concept CanViewStride = requires(Rng&& r) { - views::stride(forward(r), 3); -}; +concept CanViewStride = requires(Rng&& r) { views::stride(forward(r), 3); }; template constexpr bool test_one(Rng&& rng, Expected&& expected) { @@ -198,6 +196,7 @@ constexpr bool test_one(Rng&& rng, Expected&& expected) { } } } + if constexpr (!common_range) { STATIC_ASSERT(same_as, default_sentinel_t>); } @@ -222,6 +221,7 @@ constexpr bool test_one(Rng&& rng, Expected&& expected) { } } } + if constexpr (!common_range) { STATIC_ASSERT(same_as, default_sentinel_t>); } @@ -376,8 +376,8 @@ constexpr bool test_one(Rng&& rng, Expected&& expected) { || same_as); } - constexpr bool constructible_from_nonconst = convertible_to, iterator_t> && // - convertible_to, sentinel_t>; + constexpr bool constructible_from_nonconst = convertible_to, iterator_t> // + && convertible_to, sentinel_t>; if constexpr (forward_range) { [[maybe_unused]] const iterator_t const_defaulted; diff --git a/tests/std/tests/P2387R3_pipe_support_for_user_defined_range_adaptors/test.cpp b/tests/std/tests/P2387R3_pipe_support_for_user_defined_range_adaptors/test.cpp index ab0eac62d5..6f96a10512 100644 --- a/tests/std/tests/P2387R3_pipe_support_for_user_defined_range_adaptors/test.cpp +++ b/tests/std/tests/P2387R3_pipe_support_for_user_defined_range_adaptors/test.cpp @@ -10,9 +10,7 @@ using namespace std; template -concept CanInstantiateRangeAdaptorClosure = requires { - typename ranges::range_adaptor_closure; -}; +concept CanInstantiateRangeAdaptorClosure = requires { typename ranges::range_adaptor_closure; }; class EmptyTestType {}; class IncompleteTestType; @@ -25,14 +23,12 @@ static_assert(!CanInstantiateRangeAdaptorClosure); static_assert(CanInstantiateRangeAdaptorClosure); template -concept CanPipe = requires(LHS lhs, RHS rhs) { - forward(lhs) | forward(rhs); -}; +concept CanPipe = requires(LHS lhs, RHS rhs) { forward(lhs) | forward(rhs); }; template concept CanPipe_R = requires(LHS lhs, RHS rhs) { - { forward(lhs) | forward(rhs) } -> same_as; -}; + { forward(lhs) | forward(rhs) } -> same_as; + }; using TestRange = array; @@ -127,15 +123,15 @@ static_assert(CanPipe_R>); static_assert(CanPipe_R>); -using FirstIdentityThenMemberRefQualTest = decltype( - IdentityRangeAdaptorClosure{} | RangeAdaptorClosureMemberRefQualTest{}); +using FirstIdentityThenMemberRefQualTest = + decltype(IdentityRangeAdaptorClosure{} | RangeAdaptorClosureMemberRefQualTest{}); static_assert(CanPipe_R>); static_assert(CanPipe_R>); static_assert(CanPipe_R>); static_assert(CanPipe_R>); -using FirstTransformThenMemberRefQualTest = decltype( - views::transform([](auto x) { return x; }) | RangeAdaptorClosureMemberRefQualTest{}); +using FirstTransformThenMemberRefQualTest = + decltype(views::transform([](auto x) { return x; }) | RangeAdaptorClosureMemberRefQualTest{}); static_assert(CanPipe_R>); static_assert(CanPipe_R>); static_assert(CanPipe_R>); diff --git a/tests/std/tests/P2408R5_ranges_iterators_to_classic_algorithms/test.cpp b/tests/std/tests/P2408R5_ranges_iterators_to_classic_algorithms/test.cpp index b2d59b49eb..1ada4b097e 100644 --- a/tests/std/tests/P2408R5_ranges_iterators_to_classic_algorithms/test.cpp +++ b/tests/std/tests/P2408R5_ranges_iterators_to_classic_algorithms/test.cpp @@ -50,7 +50,9 @@ template struct helper { helper(second>... ils) : tup(ils...) {} - helper(initializer_list il) requires(sizeof...(Is) > 1) : tup(second_v(il.size())...) { + helper(initializer_list il) + requires (sizeof...(Is) > 1) + : tup(second_v(il.size())...) { get<0>(tup).v.assign(il); } diff --git a/tests/std/tests/P2415R2_owning_view/test.cpp b/tests/std/tests/P2415R2_owning_view/test.cpp index 5fc604e777..8355ca854e 100644 --- a/tests/std/tests/P2415R2_owning_view/test.cpp +++ b/tests/std/tests/P2415R2_owning_view/test.cpp @@ -204,9 +204,8 @@ struct instantiator { const owning_view test_view{R{input}}; assert(test_view.front() == input[0]); - STATIC_ASSERT( - CanMemberBack< - const owning_view> == (bidirectional_range && common_range) ); + STATIC_ASSERT(CanMemberBack> + == (bidirectional_range && common_range) ); if constexpr (bidirectional_range && common_range) { assert(test_view.back() == input[2]); } diff --git a/tests/std/tests/P2441R2_views_join_with/test.cpp b/tests/std/tests/P2441R2_views_join_with/test.cpp index 81d5b2bc84..0233e7a5b0 100644 --- a/tests/std/tests/P2441R2_views_join_with/test.cpp +++ b/tests/std/tests/P2441R2_views_join_with/test.cpp @@ -15,9 +15,8 @@ using namespace std; template -concept CanViewJoinWith = requires(Rng&& r, Delimiter&& d) { - views::join_with(forward(r), forward(d)); -}; +concept CanViewJoinWith = + requires(Rng&& r, Delimiter&& d) { views::join_with(forward(r), forward(d)); }; template struct delimiter_view_impl { @@ -51,11 +50,9 @@ constexpr void test_one(Outer&& rng, Delimiter&& delimiter, Expected&& expected) STATIC_ASSERT(ranges::view); STATIC_ASSERT(input_range); STATIC_ASSERT(forward_range == (deref_is_glvalue && forward_range && forward_range) ); - // clang-format off STATIC_ASSERT(bidirectional_range == (deref_is_glvalue && bidirectional_range && bidirectional_range && common_range && bidirectional_range && common_range) ); - // clang-format on STATIC_ASSERT(!ranges::random_access_range); // Validate range adaptor object and range adaptor closure @@ -140,10 +137,8 @@ constexpr void test_one(Outer&& rng, Delimiter&& delimiter, Expected&& expected) // Validate join_with_view::begin STATIC_ASSERT(CanMemberBegin); - // clang-format off STATIC_ASSERT(CanMemberBegin == (input_range && forward_range && is_reference_v>) ); - // clang-format on if (forward_range) { // intentionally not if constexpr const auto i = r.begin(); if (!is_empty) { @@ -177,7 +172,6 @@ constexpr void test_one(Outer&& rng, Delimiter&& delimiter, Expected&& expected) // Validate join_with_view::end static_assert(CanMemberEnd); - // clang-format off static_assert(CanMemberEnd == (input_range && forward_range && is_reference_v>) ); static_assert(common_range @@ -187,7 +181,6 @@ constexpr void test_one(Outer&& rng, Delimiter&& delimiter, Expected&& expected) == (forward_range && forward_range && is_reference_v> && common_range && forward_range> && common_range>) ); - // clang-format on const same_as> auto s = r.end(); if (!is_empty) { if constexpr (bidirectional_range && common_range) { diff --git a/tests/std/tests/P2442R1_views_chunk/test.cpp b/tests/std/tests/P2442R1_views_chunk/test.cpp index c3e6725b4a..685ac77ac6 100644 --- a/tests/std/tests/P2442R1_views_chunk/test.cpp +++ b/tests/std/tests/P2442R1_views_chunk/test.cpp @@ -14,9 +14,7 @@ using namespace std; template -concept CanViewChunk = requires(Rng&& r) { - views::chunk(forward(r), 2); -}; +concept CanViewChunk = requires(Rng&& r) { views::chunk(forward(r), 2); }; constexpr auto equal_ranges = [](auto&& left, auto&& right) { return ranges::equal(left, right); }; @@ -211,8 +209,8 @@ constexpr bool test_one(Rng&& rng, Expected&& expected) { if constexpr (CanMemberBegin) { const same_as> auto cs = as_const(r).end(); assert((r.begin() == cs) == is_empty); - STATIC_ASSERT(common_range // - == (forward_range && common_range // + STATIC_ASSERT(common_range + == (forward_range && common_range && (sized_range || !bidirectional_range) )); if constexpr (common_range && bidirectional_range) { if (!is_empty) { diff --git a/tests/std/tests/P2442R1_views_slide/test.cpp b/tests/std/tests/P2442R1_views_slide/test.cpp index 3da81edc29..c381dc9d4d 100644 --- a/tests/std/tests/P2442R1_views_slide/test.cpp +++ b/tests/std/tests/P2442R1_views_slide/test.cpp @@ -14,9 +14,7 @@ using namespace std; template -concept CanViewSlide = requires(Rng&& r) { - views::slide(forward(r), 4); -}; +concept CanViewSlide = requires(Rng&& r) { views::slide(forward(r), 4); }; constexpr auto equal_ranges = [](auto&& left, auto&& right) { return ranges::equal(left, right); }; diff --git a/tests/std/tests/P2443R1_views_chunk_by/test.cpp b/tests/std/tests/P2443R1_views_chunk_by/test.cpp index db69d0a4bf..f795622cbd 100644 --- a/tests/std/tests/P2443R1_views_chunk_by/test.cpp +++ b/tests/std/tests/P2443R1_views_chunk_by/test.cpp @@ -20,9 +20,7 @@ using Pred = less<>; constexpr Pred pred{}; template -concept CanViewChunkBy = requires(Rng&& r) { - views::chunk_by(forward(r), pred); -}; +concept CanViewChunkBy = requires(Rng&& r) { views::chunk_by(forward(r), pred); }; template constexpr bool test_one(Rng&& rng, Expected&& expected) { diff --git a/tests/std/tests/P2446R2_views_as_rvalue/test.cpp b/tests/std/tests/P2446R2_views_as_rvalue/test.cpp index 91d8d60c1e..5c3f24f4b8 100644 --- a/tests/std/tests/P2446R2_views_as_rvalue/test.cpp +++ b/tests/std/tests/P2446R2_views_as_rvalue/test.cpp @@ -18,9 +18,7 @@ using namespace std; template -concept CanViewAsRvalue = requires(Rng&& r) { - views::as_rvalue(forward(r)); -}; +concept CanViewAsRvalue = requires(Rng&& r) { views::as_rvalue(forward(r)); }; template constexpr bool test_one(Rng&& rng, Expected&& expected) { diff --git a/tests/std/tests/P2494R2_move_only_range_adaptors/test.cpp b/tests/std/tests/P2494R2_move_only_range_adaptors/test.cpp index d723b7a7da..fd6b137b2a 100644 --- a/tests/std/tests/P2494R2_move_only_range_adaptors/test.cpp +++ b/tests/std/tests/P2494R2_move_only_range_adaptors/test.cpp @@ -29,21 +29,19 @@ template struct Transform : BaseTransform { using BaseTransform::BaseTransform; - Transform(const Transform&) noexcept(CCtor == Nothrow) // - requires(CCtor != Deleted) = default; - Transform(const Transform&) requires(CCtor == Deleted) = delete; + // clang-format off + Transform(const Transform&) noexcept(CCtor == Nothrow) requires (CCtor != Deleted) = default; + Transform(const Transform&) requires (CCtor == Deleted) = delete; - Transform(Transform&&) noexcept(MCtor == Nothrow) // - requires(MCtor != Deleted) = default; - Transform(Transform&&) requires(MCtor == Deleted) = delete; + Transform(Transform&&) noexcept(MCtor == Nothrow) requires (MCtor != Deleted) = default; + Transform(Transform&&) requires (MCtor == Deleted) = delete; - Transform& operator=(const Transform&) noexcept(CAssign == Nothrow) // - requires(CAssign != Deleted) = default; - Transform& operator=(const Transform&) requires(CAssign == Deleted) = delete; + Transform& operator=(const Transform&) noexcept(CAssign == Nothrow) requires (CAssign != Deleted) = default; + Transform& operator=(const Transform&) requires (CAssign == Deleted) = delete; - Transform& operator=(Transform&&) noexcept(MAssign == Nothrow) // - requires(MAssign != Deleted) = default; - Transform& operator=(Transform&&) requires(MAssign == Deleted) = delete; + Transform& operator=(Transform&&) noexcept(MAssign == Nothrow) requires (MAssign != Deleted) = default; + Transform& operator=(Transform&&) requires (MAssign == Deleted) = delete; + // clang-format on }; template diff --git a/tests/std/tests/VSO_0000000_more_pair_tuple_sfinae/test.cpp b/tests/std/tests/VSO_0000000_more_pair_tuple_sfinae/test.cpp index 9dab1d60db..2f52432beb 100644 --- a/tests/std/tests/VSO_0000000_more_pair_tuple_sfinae/test.cpp +++ b/tests/std/tests/VSO_0000000_more_pair_tuple_sfinae/test.cpp @@ -56,7 +56,7 @@ struct ExplicitDefault { }; template -constexpr bool OrdinaryDC = is_default_constructible_v&& IsImplicitlyDefaultConstructible::value; +constexpr bool OrdinaryDC = is_default_constructible_v && IsImplicitlyDefaultConstructible::value; template constexpr bool ExplicitDC = is_default_constructible_v && !IsImplicitlyDefaultConstructible::value; diff --git a/tests/std/tests/VSO_0157762_feature_test_macros/env.lst b/tests/std/tests/VSO_0157762_feature_test_macros/env.lst index 11b8cdb9e3..87535f05c2 100644 --- a/tests/std/tests/VSO_0157762_feature_test_macros/env.lst +++ b/tests/std/tests/VSO_0157762_feature_test_macros/env.lst @@ -30,10 +30,10 @@ PM_CL="/BE /c /EHsc /MD /std:c++14" PM_CL="/BE /c /EHsc /MDd /std:c++17 /permissive-" PM_CL="/BE /c /EHsc /MT /std:c++20 /permissive-" PM_CL="/BE /c /EHsc /MTd /std:c++latest /permissive-" -PM_COMPILER="clang-cl" PM_CL="-fno-ms-compatibility -fno-delayed-template-parsing /EHsc /MD /std:c++14" -PM_COMPILER="clang-cl" PM_CL="-fno-ms-compatibility -fno-delayed-template-parsing /EHsc /MDd /std:c++17" -PM_COMPILER="clang-cl" PM_CL="-fno-ms-compatibility -fno-delayed-template-parsing /EHsc /MT /std:c++20 /permissive-" -PM_COMPILER="clang-cl" PM_CL="-fno-ms-compatibility -fno-delayed-template-parsing /EHsc /MTd /std:c++latest /permissive- /fp:strict" +PM_COMPILER="clang-cl" PM_CL="-fno-ms-compatibility -fno-delayed-template-parsing -Wno-unqualified-std-cast-call /EHsc /MD /std:c++14" +PM_COMPILER="clang-cl" PM_CL="-fno-ms-compatibility -fno-delayed-template-parsing -Wno-unqualified-std-cast-call /EHsc /MDd /std:c++17" +PM_COMPILER="clang-cl" PM_CL="-fno-ms-compatibility -fno-delayed-template-parsing -Wno-unqualified-std-cast-call /EHsc /MT /std:c++20 /permissive-" +PM_COMPILER="clang-cl" PM_CL="-fno-ms-compatibility -fno-delayed-template-parsing -Wno-unqualified-std-cast-call /EHsc /MTd /std:c++latest /permissive- /fp:strict" # The following lines are extras not present in usual_matrix.lst PM_CL="/MT /std:c++latest /permissive- /EHsc /D_HAS_STD_BYTE=0" diff --git a/tests/std/tests/VSO_0792651_unordered_set_rehash_invalidates_key/test.cpp b/tests/std/tests/VSO_0792651_unordered_set_rehash_invalidates_key/test.cpp index c2a56c6e1a..c5576900fa 100644 --- a/tests/std/tests/VSO_0792651_unordered_set_rehash_invalidates_key/test.cpp +++ b/tests/std/tests/VSO_0792651_unordered_set_rehash_invalidates_key/test.cpp @@ -21,6 +21,7 @@ struct eq { if (p == nullptr) { return q == nullptr; } + if (q == nullptr) { return false; } diff --git a/tests/std/tests/VSO_0938757_attribute_order/env.lst b/tests/std/tests/VSO_0938757_attribute_order/env.lst index 5d75daac0a..e11f90f1df 100644 --- a/tests/std/tests/VSO_0938757_attribute_order/env.lst +++ b/tests/std/tests/VSO_0938757_attribute_order/env.lst @@ -3,4 +3,4 @@ RUNALL_INCLUDE ..\prefix.lst RUNALL_CROSSLIST -PM_COMPILER="clang-cl" PM_CL="-fno-ms-compatibility -fno-delayed-template-parsing /EHsc /MTd /std:c++latest /permissive- /D_PREFAST_ -Wno-ignored-attributes" +PM_COMPILER="clang-cl" PM_CL="-fno-ms-compatibility -fno-delayed-template-parsing -Wno-unqualified-std-cast-call /EHsc /MTd /std:c++latest /permissive- /D_PREFAST_ -Wno-ignored-attributes" diff --git a/tests/std/tests/char8_t_17_matrix.lst b/tests/std/tests/char8_t_17_matrix.lst index 47f569fa05..7baa882d0d 100644 --- a/tests/std/tests/char8_t_17_matrix.lst +++ b/tests/std/tests/char8_t_17_matrix.lst @@ -31,7 +31,7 @@ PM_CL="/BE /c /EHsc /MD /std:c++latest /permissive-" PM_CL="/BE /c /EHsc /MDd /std:c++17 /permissive-" PM_CL="/BE /c /EHsc /MT /std:c++20 /permissive-" PM_CL="/BE /c /EHsc /MTd /std:c++latest /permissive-" -PM_COMPILER="clang-cl" PM_CL="-fno-ms-compatibility -fno-delayed-template-parsing /EHsc /MD /std:c++latest /permissive-" -PM_COMPILER="clang-cl" PM_CL="-fno-ms-compatibility -fno-delayed-template-parsing /EHsc /MDd /std:c++17" -PM_COMPILER="clang-cl" PM_CL="-fno-ms-compatibility -fno-delayed-template-parsing /EHsc /MT /std:c++20 /permissive-" -PM_COMPILER="clang-cl" PM_CL="-fno-ms-compatibility -fno-delayed-template-parsing /EHsc /MTd /std:c++latest /permissive- /fp:strict" +PM_COMPILER="clang-cl" PM_CL="-fno-ms-compatibility -fno-delayed-template-parsing -Wno-unqualified-std-cast-call /EHsc /MD /std:c++latest /permissive-" +PM_COMPILER="clang-cl" PM_CL="-fno-ms-compatibility -fno-delayed-template-parsing -Wno-unqualified-std-cast-call /EHsc /MDd /std:c++17" +PM_COMPILER="clang-cl" PM_CL="-fno-ms-compatibility -fno-delayed-template-parsing -Wno-unqualified-std-cast-call /EHsc /MT /std:c++20 /permissive-" +PM_COMPILER="clang-cl" PM_CL="-fno-ms-compatibility -fno-delayed-template-parsing -Wno-unqualified-std-cast-call /EHsc /MTd /std:c++latest /permissive- /fp:strict" diff --git a/tests/std/tests/char8_t_impure_matrix.lst b/tests/std/tests/char8_t_impure_matrix.lst index 261fb438f0..451d256e7e 100644 --- a/tests/std/tests/char8_t_impure_matrix.lst +++ b/tests/std/tests/char8_t_impure_matrix.lst @@ -33,7 +33,7 @@ PM_CL="/BE /c /EHsc /MD /std:c++14" PM_CL="/BE /c /EHsc /MDd /std:c++17 /permissive-" PM_CL="/BE /c /EHsc /MT /std:c++20 /permissive-" PM_CL="/BE /c /EHsc /MTd /std:c++latest /permissive-" -PM_COMPILER="clang-cl" PM_CL="-fno-ms-compatibility -fno-delayed-template-parsing /EHsc /MD /std:c++14" -PM_COMPILER="clang-cl" PM_CL="-fno-ms-compatibility -fno-delayed-template-parsing /EHsc /MDd /std:c++17" -PM_COMPILER="clang-cl" PM_CL="-fno-ms-compatibility -fno-delayed-template-parsing /EHsc /MT /std:c++20 /permissive-" -PM_COMPILER="clang-cl" PM_CL="-fno-ms-compatibility -fno-delayed-template-parsing /EHsc /MTd /std:c++latest /permissive- /fp:strict" +PM_COMPILER="clang-cl" PM_CL="-fno-ms-compatibility -fno-delayed-template-parsing -Wno-unqualified-std-cast-call /EHsc /MD /std:c++14" +PM_COMPILER="clang-cl" PM_CL="-fno-ms-compatibility -fno-delayed-template-parsing -Wno-unqualified-std-cast-call /EHsc /MDd /std:c++17" +PM_COMPILER="clang-cl" PM_CL="-fno-ms-compatibility -fno-delayed-template-parsing -Wno-unqualified-std-cast-call /EHsc /MT /std:c++20 /permissive-" +PM_COMPILER="clang-cl" PM_CL="-fno-ms-compatibility -fno-delayed-template-parsing -Wno-unqualified-std-cast-call /EHsc /MTd /std:c++latest /permissive- /fp:strict" diff --git a/tests/std/tests/char8_t_matrix.lst b/tests/std/tests/char8_t_matrix.lst index 4dc18c17b6..2171c31e5e 100644 --- a/tests/std/tests/char8_t_matrix.lst +++ b/tests/std/tests/char8_t_matrix.lst @@ -32,7 +32,7 @@ PM_CL="/BE /c /EHsc /MD /std:c++14 /w14640 /Zc:threadSafeInit-" PM_CL="/BE /c /EHsc /MDd /std:c++17 /permissive- /w14640 /Zc:threadSafeInit-" PM_CL="/BE /c /EHsc /MT /std:c++20 /permissive- /w14640 /Zc:threadSafeInit-" PM_CL="/BE /c /EHsc /MTd /std:c++latest /permissive- /w14640 /Zc:threadSafeInit-" -PM_COMPILER="clang-cl" PM_CL="-fno-ms-compatibility -fno-delayed-template-parsing /EHsc /MD /std:c++14 /w14640 /Zc:threadSafeInit-" -PM_COMPILER="clang-cl" PM_CL="-fno-ms-compatibility -fno-delayed-template-parsing /EHsc /MDd /std:c++17 /w14640 /Zc:threadSafeInit-" -PM_COMPILER="clang-cl" PM_CL="-fno-ms-compatibility -fno-delayed-template-parsing /EHsc /MT /std:c++20 /permissive- /w14640 /Zc:threadSafeInit-" -PM_COMPILER="clang-cl" PM_CL="-fno-ms-compatibility -fno-delayed-template-parsing /EHsc /MTd /std:c++latest /permissive- /fp:strict /w14640 /Zc:threadSafeInit-" +PM_COMPILER="clang-cl" PM_CL="-fno-ms-compatibility -fno-delayed-template-parsing -Wno-unqualified-std-cast-call /EHsc /MD /std:c++14 /w14640 /Zc:threadSafeInit-" +PM_COMPILER="clang-cl" PM_CL="-fno-ms-compatibility -fno-delayed-template-parsing -Wno-unqualified-std-cast-call /EHsc /MDd /std:c++17 /w14640 /Zc:threadSafeInit-" +PM_COMPILER="clang-cl" PM_CL="-fno-ms-compatibility -fno-delayed-template-parsing -Wno-unqualified-std-cast-call /EHsc /MT /std:c++20 /permissive- /w14640 /Zc:threadSafeInit-" +PM_COMPILER="clang-cl" PM_CL="-fno-ms-compatibility -fno-delayed-template-parsing -Wno-unqualified-std-cast-call /EHsc /MTd /std:c++latest /permissive- /fp:strict /w14640 /Zc:threadSafeInit-" diff --git a/tests/std/tests/concepts_20_matrix.lst b/tests/std/tests/concepts_20_matrix.lst index 8d7d5e7756..c4ad11e571 100644 --- a/tests/std/tests/concepts_20_matrix.lst +++ b/tests/std/tests/concepts_20_matrix.lst @@ -23,5 +23,5 @@ PM_CL="/MTd /D_ITERATOR_DEBUG_LEVEL=2 /std:c++latest /permissive" PM_CL="/MTd /D_ITERATOR_DEBUG_LEVEL=2 /std:c++latest /permissive- /analyze:only /analyze:autolog-" # PM_CL="/std:c++20 /permissive- /BE /c /MD" # PM_CL="/std:c++latest /permissive- /BE /c /MTd" -PM_COMPILER="clang-cl" PM_CL="-fno-ms-compatibility -fno-delayed-template-parsing /std:c++20 /permissive- /MD" -PM_COMPILER="clang-cl" PM_CL="-fno-ms-compatibility -fno-delayed-template-parsing /std:c++latest /permissive- /MTd /fp:strict" +PM_COMPILER="clang-cl" PM_CL="-fno-ms-compatibility -fno-delayed-template-parsing -Wno-unqualified-std-cast-call /std:c++20 /permissive- /MD" +PM_COMPILER="clang-cl" PM_CL="-fno-ms-compatibility -fno-delayed-template-parsing -Wno-unqualified-std-cast-call /std:c++latest /permissive- /MTd /fp:strict" diff --git a/tests/std/tests/concepts_latest_matrix.lst b/tests/std/tests/concepts_latest_matrix.lst index 2d77518d86..73625bbbb8 100644 --- a/tests/std/tests/concepts_latest_matrix.lst +++ b/tests/std/tests/concepts_latest_matrix.lst @@ -20,5 +20,5 @@ PM_CL="/MTd /D_ITERATOR_DEBUG_LEVEL=2 /permissive" PM_CL="/MTd /D_ITERATOR_DEBUG_LEVEL=2 /permissive- /analyze:only /analyze:autolog-" # PM_CL="/permissive- /BE /c /MD" # PM_CL="/permissive- /BE /c /MTd" -PM_COMPILER="clang-cl" PM_CL="-fno-ms-compatibility -fno-delayed-template-parsing /permissive- /MD" -PM_COMPILER="clang-cl" PM_CL="-fno-ms-compatibility -fno-delayed-template-parsing /permissive- /MTd /fp:strict" +PM_COMPILER="clang-cl" PM_CL="-fno-ms-compatibility -fno-delayed-template-parsing -Wno-unqualified-std-cast-call /permissive- /MD" +PM_COMPILER="clang-cl" PM_CL="-fno-ms-compatibility -fno-delayed-template-parsing -Wno-unqualified-std-cast-call /permissive- /MTd /fp:strict" diff --git a/tests/std/tests/floating_point_model_matrix.lst b/tests/std/tests/floating_point_model_matrix.lst index 8a9b369c3b..8ce4465c0f 100644 --- a/tests/std/tests/floating_point_model_matrix.lst +++ b/tests/std/tests/floating_point_model_matrix.lst @@ -11,9 +11,9 @@ PM_CL="/Od /MDd" PM_CL="/O2 /MD /permissive-" PM_CL="/O2 /MT /GL" # TRANSITION, -Wno-unused-command-line-argument is needed for the internal test harness -PM_COMPILER="clang-cl" PM_CL="-fno-ms-compatibility -fno-delayed-template-parsing -Wno-unused-command-line-argument /Od /MTd" -PM_COMPILER="clang-cl" PM_CL="-fno-ms-compatibility -fno-delayed-template-parsing -Wno-unused-command-line-argument /O2 /MT" -PM_COMPILER="clang-cl" PM_CL="-fno-ms-compatibility -fno-delayed-template-parsing -Wno-unused-command-line-argument /O2 /MD /Oi-" +PM_COMPILER="clang-cl" PM_CL="-fno-ms-compatibility -fno-delayed-template-parsing -Wno-unqualified-std-cast-call -Wno-unused-command-line-argument /Od /MTd" +PM_COMPILER="clang-cl" PM_CL="-fno-ms-compatibility -fno-delayed-template-parsing -Wno-unqualified-std-cast-call -Wno-unused-command-line-argument /O2 /MT" +PM_COMPILER="clang-cl" PM_CL="-fno-ms-compatibility -fno-delayed-template-parsing -Wno-unqualified-std-cast-call -Wno-unused-command-line-argument /O2 /MD /Oi-" RUNALL_CROSSLIST PM_CL="" PM_CL="/arch:IA32" diff --git a/tests/std/tests/impure_matrix.lst b/tests/std/tests/impure_matrix.lst index c3198df967..c6ef78d0eb 100644 --- a/tests/std/tests/impure_matrix.lst +++ b/tests/std/tests/impure_matrix.lst @@ -31,7 +31,7 @@ PM_CL="/BE /c /EHsc /MD /std:c++14" PM_CL="/BE /c /EHsc /MDd /std:c++17 /permissive-" PM_CL="/BE /c /EHsc /MT /std:c++20 /permissive-" PM_CL="/BE /c /EHsc /MTd /std:c++latest /permissive-" -PM_COMPILER="clang-cl" PM_CL="-fno-ms-compatibility -fno-delayed-template-parsing /EHsc /MD /std:c++14" -PM_COMPILER="clang-cl" PM_CL="-fno-ms-compatibility -fno-delayed-template-parsing /EHsc /MDd /std:c++17" -PM_COMPILER="clang-cl" PM_CL="-fno-ms-compatibility -fno-delayed-template-parsing /EHsc /MT /std:c++20 /permissive-" -PM_COMPILER="clang-cl" PM_CL="-fno-ms-compatibility -fno-delayed-template-parsing /EHsc /MTd /std:c++latest /permissive- /fp:strict" +PM_COMPILER="clang-cl" PM_CL="-fno-ms-compatibility -fno-delayed-template-parsing -Wno-unqualified-std-cast-call /EHsc /MD /std:c++14" +PM_COMPILER="clang-cl" PM_CL="-fno-ms-compatibility -fno-delayed-template-parsing -Wno-unqualified-std-cast-call /EHsc /MDd /std:c++17" +PM_COMPILER="clang-cl" PM_CL="-fno-ms-compatibility -fno-delayed-template-parsing -Wno-unqualified-std-cast-call /EHsc /MT /std:c++20 /permissive-" +PM_COMPILER="clang-cl" PM_CL="-fno-ms-compatibility -fno-delayed-template-parsing -Wno-unqualified-std-cast-call /EHsc /MTd /std:c++latest /permissive- /fp:strict" diff --git a/tests/std/tests/locale0_implib_cpp_matrix.lst b/tests/std/tests/locale0_implib_cpp_matrix.lst index d646a44373..1f7116af9d 100644 --- a/tests/std/tests/locale0_implib_cpp_matrix.lst +++ b/tests/std/tests/locale0_implib_cpp_matrix.lst @@ -33,7 +33,7 @@ PM_CL="/BE /c /EHsc /MD /std:c++14 /w14640 /Zc:threadSafeInit-" PM_CL="/BE /c /EHsc /MDd /std:c++17 /permissive- /w14640 /Zc:threadSafeInit-" PM_CL="/BE /c /EHsc /MT /std:c++20 /permissive- /w14640 /Zc:threadSafeInit-" PM_CL="/BE /c /EHsc /MTd /std:c++latest /permissive- /w14640 /Zc:threadSafeInit-" -PM_COMPILER="clang-cl" PM_CL="-fno-ms-compatibility -fno-delayed-template-parsing /EHsc /MD /std:c++14 /w14640 /Zc:threadSafeInit-" -PM_COMPILER="clang-cl" PM_CL="-fno-ms-compatibility -fno-delayed-template-parsing /EHsc /MDd /std:c++17 /w14640 /Zc:threadSafeInit-" -PM_COMPILER="clang-cl" PM_CL="-fno-ms-compatibility -fno-delayed-template-parsing /EHsc /MT /std:c++20 /permissive- /w14640 /Zc:threadSafeInit-" -PM_COMPILER="clang-cl" PM_CL="-fno-ms-compatibility -fno-delayed-template-parsing /EHsc /MTd /std:c++latest /permissive- /fp:strict /w14640 /Zc:threadSafeInit-" +PM_COMPILER="clang-cl" PM_CL="-fno-ms-compatibility -fno-delayed-template-parsing -Wno-unqualified-std-cast-call /EHsc /MD /std:c++14 /w14640 /Zc:threadSafeInit-" +PM_COMPILER="clang-cl" PM_CL="-fno-ms-compatibility -fno-delayed-template-parsing -Wno-unqualified-std-cast-call /EHsc /MDd /std:c++17 /w14640 /Zc:threadSafeInit-" +PM_COMPILER="clang-cl" PM_CL="-fno-ms-compatibility -fno-delayed-template-parsing -Wno-unqualified-std-cast-call /EHsc /MT /std:c++20 /permissive- /w14640 /Zc:threadSafeInit-" +PM_COMPILER="clang-cl" PM_CL="-fno-ms-compatibility -fno-delayed-template-parsing -Wno-unqualified-std-cast-call /EHsc /MTd /std:c++latest /permissive- /fp:strict /w14640 /Zc:threadSafeInit-" diff --git a/tests/std/tests/native_17_matrix.lst b/tests/std/tests/native_17_matrix.lst index d6555acba6..1e99386f2c 100644 --- a/tests/std/tests/native_17_matrix.lst +++ b/tests/std/tests/native_17_matrix.lst @@ -26,6 +26,6 @@ PM_CL="/BE /c /EHsc /MD /std:c++latest /permissive-" PM_CL="/BE /c /EHsc /MDd /std:c++17 /permissive-" PM_CL="/BE /c /EHsc /MT /std:c++20 /permissive-" PM_CL="/BE /c /EHsc /MTd /std:c++latest /permissive-" -PM_COMPILER="clang-cl" PM_CL="-fno-ms-compatibility -fno-delayed-template-parsing /EHsc /MD /std:c++17" -PM_COMPILER="clang-cl" PM_CL="-fno-ms-compatibility -fno-delayed-template-parsing /EHsc /MDd /std:c++20 /permissive- /fp:strict" -PM_COMPILER="clang-cl" PM_CL="-fno-ms-compatibility -fno-delayed-template-parsing /EHsc /MTd /std:c++latest /permissive-" +PM_COMPILER="clang-cl" PM_CL="-fno-ms-compatibility -fno-delayed-template-parsing -Wno-unqualified-std-cast-call /EHsc /MD /std:c++17" +PM_COMPILER="clang-cl" PM_CL="-fno-ms-compatibility -fno-delayed-template-parsing -Wno-unqualified-std-cast-call /EHsc /MDd /std:c++20 /permissive- /fp:strict" +PM_COMPILER="clang-cl" PM_CL="-fno-ms-compatibility -fno-delayed-template-parsing -Wno-unqualified-std-cast-call /EHsc /MTd /std:c++latest /permissive-" diff --git a/tests/std/tests/native_matrix.lst b/tests/std/tests/native_matrix.lst index 1507c5ba73..1d8993732a 100644 --- a/tests/std/tests/native_matrix.lst +++ b/tests/std/tests/native_matrix.lst @@ -26,7 +26,7 @@ PM_CL="/BE /c /EHsc /MD /std:c++14" PM_CL="/BE /c /EHsc /MDd /std:c++17 /permissive-" PM_CL="/BE /c /EHsc /MT /std:c++20 /permissive-" PM_CL="/BE /c /EHsc /MTd /std:c++latest /permissive-" -PM_COMPILER="clang-cl" PM_CL="-fno-ms-compatibility -fno-delayed-template-parsing /EHsc /MD /std:c++14" -PM_COMPILER="clang-cl" PM_CL="-fno-ms-compatibility -fno-delayed-template-parsing /EHsc /MDd /std:c++17" -PM_COMPILER="clang-cl" PM_CL="-fno-ms-compatibility -fno-delayed-template-parsing /EHsc /MT /std:c++20" -PM_COMPILER="clang-cl" PM_CL="-fno-ms-compatibility -fno-delayed-template-parsing /EHsc /MTd /std:c++latest /permissive- /fp:strict" +PM_COMPILER="clang-cl" PM_CL="-fno-ms-compatibility -fno-delayed-template-parsing -Wno-unqualified-std-cast-call /EHsc /MD /std:c++14" +PM_COMPILER="clang-cl" PM_CL="-fno-ms-compatibility -fno-delayed-template-parsing -Wno-unqualified-std-cast-call /EHsc /MDd /std:c++17" +PM_COMPILER="clang-cl" PM_CL="-fno-ms-compatibility -fno-delayed-template-parsing -Wno-unqualified-std-cast-call /EHsc /MT /std:c++20" +PM_COMPILER="clang-cl" PM_CL="-fno-ms-compatibility -fno-delayed-template-parsing -Wno-unqualified-std-cast-call /EHsc /MTd /std:c++latest /permissive- /fp:strict" diff --git a/tests/std/tests/strict_concepts_20_matrix.lst b/tests/std/tests/strict_concepts_20_matrix.lst index 899cde239b..3ddc473e07 100644 --- a/tests/std/tests/strict_concepts_20_matrix.lst +++ b/tests/std/tests/strict_concepts_20_matrix.lst @@ -22,5 +22,5 @@ PM_CL="/MTd /D_ITERATOR_DEBUG_LEVEL=2 /std:c++latest" PM_CL="/MTd /D_ITERATOR_DEBUG_LEVEL=2 /std:c++latest /analyze:only /analyze:autolog-" # PM_CL="/std:c++20 /BE /c /MD" # PM_CL="/std:c++latest /BE /c /MTd" -PM_COMPILER="clang-cl" PM_CL="-fno-ms-compatibility -fno-delayed-template-parsing /std:c++20 /MD" -PM_COMPILER="clang-cl" PM_CL="-fno-ms-compatibility -fno-delayed-template-parsing /std:c++latest /MTd /fp:strict" +PM_COMPILER="clang-cl" PM_CL="-fno-ms-compatibility -fno-delayed-template-parsing -Wno-unqualified-std-cast-call /std:c++20 /MD" +PM_COMPILER="clang-cl" PM_CL="-fno-ms-compatibility -fno-delayed-template-parsing -Wno-unqualified-std-cast-call /std:c++latest /MTd /fp:strict" diff --git a/tests/std/tests/strict_concepts_latest_matrix.lst b/tests/std/tests/strict_concepts_latest_matrix.lst index b670c6d91b..3b126ab4c1 100644 --- a/tests/std/tests/strict_concepts_latest_matrix.lst +++ b/tests/std/tests/strict_concepts_latest_matrix.lst @@ -22,5 +22,5 @@ PM_CL="/MTd /D_ITERATOR_DEBUG_LEVEL=2" PM_CL="/MTd /D_ITERATOR_DEBUG_LEVEL=2 /analyze:only /analyze:autolog-" # PM_CL="/BE /c /MD" # PM_CL="/BE /c /MTd" -PM_COMPILER="clang-cl" PM_CL="-fno-ms-compatibility -fno-delayed-template-parsing /MD" -PM_COMPILER="clang-cl" PM_CL="-fno-ms-compatibility -fno-delayed-template-parsing /MTd /fp:strict" +PM_COMPILER="clang-cl" PM_CL="-fno-ms-compatibility -fno-delayed-template-parsing -Wno-unqualified-std-cast-call /MD" +PM_COMPILER="clang-cl" PM_CL="-fno-ms-compatibility -fno-delayed-template-parsing -Wno-unqualified-std-cast-call /MTd /fp:strict" diff --git a/tests/std/tests/usual_17_matrix.lst b/tests/std/tests/usual_17_matrix.lst index 74b627c09d..62a74dd2a8 100644 --- a/tests/std/tests/usual_17_matrix.lst +++ b/tests/std/tests/usual_17_matrix.lst @@ -30,7 +30,7 @@ PM_CL="/BE /c /EHsc /MD /std:c++latest /permissive-" PM_CL="/BE /c /EHsc /MDd /std:c++17 /permissive-" PM_CL="/BE /c /EHsc /MT /std:c++20 /permissive-" PM_CL="/BE /c /EHsc /MTd /std:c++latest /permissive-" -PM_COMPILER="clang-cl" PM_CL="-fno-ms-compatibility -fno-delayed-template-parsing /EHsc /MD /std:c++latest /permissive-" -PM_COMPILER="clang-cl" PM_CL="-fno-ms-compatibility -fno-delayed-template-parsing /EHsc /MDd /std:c++17" -PM_COMPILER="clang-cl" PM_CL="-fno-ms-compatibility -fno-delayed-template-parsing /EHsc /MT /std:c++20 /permissive-" -PM_COMPILER="clang-cl" PM_CL="-fno-ms-compatibility -fno-delayed-template-parsing /EHsc /MTd /std:c++latest /permissive- /fp:strict" +PM_COMPILER="clang-cl" PM_CL="-fno-ms-compatibility -fno-delayed-template-parsing -Wno-unqualified-std-cast-call /EHsc /MD /std:c++latest /permissive-" +PM_COMPILER="clang-cl" PM_CL="-fno-ms-compatibility -fno-delayed-template-parsing -Wno-unqualified-std-cast-call /EHsc /MDd /std:c++17" +PM_COMPILER="clang-cl" PM_CL="-fno-ms-compatibility -fno-delayed-template-parsing -Wno-unqualified-std-cast-call /EHsc /MT /std:c++20 /permissive-" +PM_COMPILER="clang-cl" PM_CL="-fno-ms-compatibility -fno-delayed-template-parsing -Wno-unqualified-std-cast-call /EHsc /MTd /std:c++latest /permissive- /fp:strict" diff --git a/tests/std/tests/usual_20_matrix.lst b/tests/std/tests/usual_20_matrix.lst index 38eef3ee0c..00f7e75118 100644 --- a/tests/std/tests/usual_20_matrix.lst +++ b/tests/std/tests/usual_20_matrix.lst @@ -20,5 +20,5 @@ PM_CL="/MTd /D_ITERATOR_DEBUG_LEVEL=2 /std:c++latest /permissive" PM_CL="/MTd /D_ITERATOR_DEBUG_LEVEL=2 /std:c++latest /permissive- /analyze:only /analyze:autolog-" PM_CL="/BE /c /MD /std:c++20 /permissive-" PM_CL="/BE /c /MTd /std:c++latest /permissive-" -PM_COMPILER="clang-cl" PM_CL="-fno-ms-compatibility -fno-delayed-template-parsing /std:c++20 /permissive- /MD" -PM_COMPILER="clang-cl" PM_CL="-fno-ms-compatibility -fno-delayed-template-parsing /std:c++latest /permissive- /MTd /fp:strict" +PM_COMPILER="clang-cl" PM_CL="-fno-ms-compatibility -fno-delayed-template-parsing -Wno-unqualified-std-cast-call /std:c++20 /permissive- /MD" +PM_COMPILER="clang-cl" PM_CL="-fno-ms-compatibility -fno-delayed-template-parsing -Wno-unqualified-std-cast-call /std:c++latest /permissive- /MTd /fp:strict" diff --git a/tests/std/tests/usual_latest_matrix.lst b/tests/std/tests/usual_latest_matrix.lst index 1e8b61bbcb..0f50c36029 100644 --- a/tests/std/tests/usual_latest_matrix.lst +++ b/tests/std/tests/usual_latest_matrix.lst @@ -20,5 +20,5 @@ PM_CL="/MTd /D_ITERATOR_DEBUG_LEVEL=2 /permissive" PM_CL="/MTd /D_ITERATOR_DEBUG_LEVEL=2 /permissive- /analyze:only /analyze:autolog-" PM_CL="/BE /c /MD /permissive-" PM_CL="/BE /c /MTd /permissive-" -PM_COMPILER="clang-cl" PM_CL="-fno-ms-compatibility -fno-delayed-template-parsing /permissive- /MD" -PM_COMPILER="clang-cl" PM_CL="-fno-ms-compatibility -fno-delayed-template-parsing /permissive- /MTd /fp:strict" +PM_COMPILER="clang-cl" PM_CL="-fno-ms-compatibility -fno-delayed-template-parsing -Wno-unqualified-std-cast-call /permissive- /MD" +PM_COMPILER="clang-cl" PM_CL="-fno-ms-compatibility -fno-delayed-template-parsing -Wno-unqualified-std-cast-call /permissive- /MTd /fp:strict" diff --git a/tests/std/tests/usual_matrix.lst b/tests/std/tests/usual_matrix.lst index 82858d1522..7fc105215c 100644 --- a/tests/std/tests/usual_matrix.lst +++ b/tests/std/tests/usual_matrix.lst @@ -32,7 +32,7 @@ PM_CL="/BE /c /EHsc /MD /std:c++14 /w14640 /Zc:threadSafeInit-" PM_CL="/BE /c /EHsc /MDd /std:c++17 /permissive- /w14640 /Zc:threadSafeInit-" PM_CL="/BE /c /EHsc /MT /std:c++20 /permissive- /w14640 /Zc:threadSafeInit-" PM_CL="/BE /c /EHsc /MTd /std:c++latest /permissive- /w14640 /Zc:threadSafeInit-" -PM_COMPILER="clang-cl" PM_CL="-fno-ms-compatibility -fno-delayed-template-parsing /EHsc /MD /std:c++14 /w14640 /Zc:threadSafeInit-" -PM_COMPILER="clang-cl" PM_CL="-fno-ms-compatibility -fno-delayed-template-parsing /EHsc /MDd /std:c++17 /w14640 /Zc:threadSafeInit-" -PM_COMPILER="clang-cl" PM_CL="-fno-ms-compatibility -fno-delayed-template-parsing /EHsc /MT /std:c++20 /permissive- /w14640 /Zc:threadSafeInit-" -PM_COMPILER="clang-cl" PM_CL="-fno-ms-compatibility -fno-delayed-template-parsing /EHsc /MTd /std:c++latest /permissive- /fp:strict /w14640 /Zc:threadSafeInit-" +PM_COMPILER="clang-cl" PM_CL="-fno-ms-compatibility -fno-delayed-template-parsing -Wno-unqualified-std-cast-call /EHsc /MD /std:c++14 /w14640 /Zc:threadSafeInit-" +PM_COMPILER="clang-cl" PM_CL="-fno-ms-compatibility -fno-delayed-template-parsing -Wno-unqualified-std-cast-call /EHsc /MDd /std:c++17 /w14640 /Zc:threadSafeInit-" +PM_COMPILER="clang-cl" PM_CL="-fno-ms-compatibility -fno-delayed-template-parsing -Wno-unqualified-std-cast-call /EHsc /MT /std:c++20 /permissive- /w14640 /Zc:threadSafeInit-" +PM_COMPILER="clang-cl" PM_CL="-fno-ms-compatibility -fno-delayed-template-parsing -Wno-unqualified-std-cast-call /EHsc /MTd /std:c++latest /permissive- /fp:strict /w14640 /Zc:threadSafeInit-" diff --git a/tests/tr1/env.lst b/tests/tr1/env.lst index d5acdbd60e..960f31b74f 100644 --- a/tests/tr1/env.lst +++ b/tests/tr1/env.lst @@ -27,7 +27,7 @@ PM_CL="/BE /c /EHsc /MD /std:c++14" PM_CL="/BE /c /EHsc /MDd /std:c++17 /permissive-" PM_CL="/BE /c /EHsc /MT /std:c++20 /permissive-" PM_CL="/BE /c /EHsc /MTd /std:c++latest /permissive-" -PM_COMPILER="clang-cl" PM_CL="-fno-ms-compatibility -fno-delayed-template-parsing -Xclang -Wno-deprecated-declarations -Xclang -Wno-self-assign /EHsc /MD /std:c++14" -PM_COMPILER="clang-cl" PM_CL="-fno-ms-compatibility -fno-delayed-template-parsing -Xclang -Wno-deprecated-declarations -Xclang -Wno-self-assign /EHsc /MDd /std:c++17" -PM_COMPILER="clang-cl" PM_CL="-fno-ms-compatibility -fno-delayed-template-parsing -Xclang -Wno-deprecated-declarations -Xclang -Wno-self-assign /EHsc /MT /std:c++20 /permissive-" -PM_COMPILER="clang-cl" PM_CL="-fno-ms-compatibility -fno-delayed-template-parsing -Xclang -Wno-deprecated-declarations -Xclang -Wno-self-assign /EHsc /MTd /std:c++latest /permissive-" +PM_COMPILER="clang-cl" PM_CL="-fno-ms-compatibility -fno-delayed-template-parsing -Wno-unqualified-std-cast-call -Xclang -Wno-deprecated-declarations -Xclang -Wno-self-assign /EHsc /MD /std:c++14" +PM_COMPILER="clang-cl" PM_CL="-fno-ms-compatibility -fno-delayed-template-parsing -Wno-unqualified-std-cast-call -Xclang -Wno-deprecated-declarations -Xclang -Wno-self-assign /EHsc /MDd /std:c++17" +PM_COMPILER="clang-cl" PM_CL="-fno-ms-compatibility -fno-delayed-template-parsing -Wno-unqualified-std-cast-call -Xclang -Wno-deprecated-declarations -Xclang -Wno-self-assign /EHsc /MT /std:c++20 /permissive-" +PM_COMPILER="clang-cl" PM_CL="-fno-ms-compatibility -fno-delayed-template-parsing -Wno-unqualified-std-cast-call -Xclang -Wno-deprecated-declarations -Xclang -Wno-self-assign /EHsc /MTd /std:c++latest /permissive-" diff --git a/tests/tr1/env_minus_md_idl.lst b/tests/tr1/env_minus_md_idl.lst index 4a6377dfed..e23a7b03bc 100644 --- a/tests/tr1/env_minus_md_idl.lst +++ b/tests/tr1/env_minus_md_idl.lst @@ -23,6 +23,6 @@ PM_CL="/clr:pure /MDd /std:c++14" PM_CL="/BE /c /EHsc /MD /std:c++14 /w14640 /Zc:threadSafeInit-" PM_CL="/BE /c /EHsc /MDd /std:c++17 /permissive- /w14640 /Zc:threadSafeInit-" PM_CL="/BE /c /EHsc /MTd /std:c++latest /permissive- /w14640 /Zc:threadSafeInit-" -PM_COMPILER="clang-cl" PM_CL="-fno-ms-compatibility -fno-delayed-template-parsing -Xclang -Wno-deprecated-declarations -Xclang -Wno-self-assign /EHsc /MD /std:c++14 /w14640 /Zc:threadSafeInit-" -PM_COMPILER="clang-cl" PM_CL="-fno-ms-compatibility -fno-delayed-template-parsing -Xclang -Wno-deprecated-declarations -Xclang -Wno-self-assign /EHsc /MDd /std:c++17 /w14640 /Zc:threadSafeInit-" -PM_COMPILER="clang-cl" PM_CL="-fno-ms-compatibility -fno-delayed-template-parsing -Xclang -Wno-deprecated-declarations -Xclang -Wno-self-assign /EHsc /MTd /std:c++latest /permissive- /w14640 /Zc:threadSafeInit-" +PM_COMPILER="clang-cl" PM_CL="-fno-ms-compatibility -fno-delayed-template-parsing -Wno-unqualified-std-cast-call -Xclang -Wno-deprecated-declarations -Xclang -Wno-self-assign /EHsc /MD /std:c++14 /w14640 /Zc:threadSafeInit-" +PM_COMPILER="clang-cl" PM_CL="-fno-ms-compatibility -fno-delayed-template-parsing -Wno-unqualified-std-cast-call -Xclang -Wno-deprecated-declarations -Xclang -Wno-self-assign /EHsc /MDd /std:c++17 /w14640 /Zc:threadSafeInit-" +PM_COMPILER="clang-cl" PM_CL="-fno-ms-compatibility -fno-delayed-template-parsing -Wno-unqualified-std-cast-call -Xclang -Wno-deprecated-declarations -Xclang -Wno-self-assign /EHsc /MTd /std:c++latest /permissive- /w14640 /Zc:threadSafeInit-" diff --git a/tests/tr1/env_minus_pure.lst b/tests/tr1/env_minus_pure.lst index ae211bea51..844b85277f 100644 --- a/tests/tr1/env_minus_pure.lst +++ b/tests/tr1/env_minus_pure.lst @@ -24,6 +24,6 @@ PM_CL="/clr /MDd /std:c++17" PM_CL="/BE /c /EHsc /MD /std:c++14" PM_CL="/BE /c /EHsc /MDd /std:c++17 /permissive-" PM_CL="/BE /c /EHsc /MTd /std:c++latest /permissive-" -PM_COMPILER="clang-cl" PM_CL="-fno-ms-compatibility -fno-delayed-template-parsing -Xclang -Wno-deprecated-declarations -Xclang -Wno-self-assign /EHsc /MD /std:c++14" -PM_COMPILER="clang-cl" PM_CL="-fno-ms-compatibility -fno-delayed-template-parsing -Xclang -Wno-deprecated-declarations -Xclang -Wno-self-assign /EHsc /MDd /std:c++17" -PM_COMPILER="clang-cl" PM_CL="-fno-ms-compatibility -fno-delayed-template-parsing -Xclang -Wno-deprecated-declarations -Xclang -Wno-self-assign /EHsc /MTd /std:c++latest /permissive-" +PM_COMPILER="clang-cl" PM_CL="-fno-ms-compatibility -fno-delayed-template-parsing -Wno-unqualified-std-cast-call -Xclang -Wno-deprecated-declarations -Xclang -Wno-self-assign /EHsc /MD /std:c++14" +PM_COMPILER="clang-cl" PM_CL="-fno-ms-compatibility -fno-delayed-template-parsing -Wno-unqualified-std-cast-call -Xclang -Wno-deprecated-declarations -Xclang -Wno-self-assign /EHsc /MDd /std:c++17" +PM_COMPILER="clang-cl" PM_CL="-fno-ms-compatibility -fno-delayed-template-parsing -Wno-unqualified-std-cast-call -Xclang -Wno-deprecated-declarations -Xclang -Wno-self-assign /EHsc /MTd /std:c++latest /permissive-" diff --git a/tests/tr1/env_threads.lst b/tests/tr1/env_threads.lst index 1aa6f4b610..26827847fa 100644 --- a/tests/tr1/env_threads.lst +++ b/tests/tr1/env_threads.lst @@ -20,6 +20,6 @@ PM_CL="/EHsc /MTd /D_ITERATOR_DEBUG_LEVEL=2 /std:c++latest /permissive- /analyze PM_CL="/BE /c /EHsc /MD /std:c++14" PM_CL="/BE /c /EHsc /MDd /std:c++17 /permissive-" PM_CL="/BE /c /EHsc /MTd /std:c++latest /permissive-" -PM_COMPILER="clang-cl" PM_CL="-fno-ms-compatibility -fno-delayed-template-parsing -Xclang -Wno-deprecated-declarations -Xclang -Wno-self-assign /EHsc /MD /std:c++14" -PM_COMPILER="clang-cl" PM_CL="-fno-ms-compatibility -fno-delayed-template-parsing -Xclang -Wno-deprecated-declarations -Xclang -Wno-self-assign /EHsc /MDd /std:c++17" -PM_COMPILER="clang-cl" PM_CL="-fno-ms-compatibility -fno-delayed-template-parsing -Xclang -Wno-deprecated-declarations -Xclang -Wno-self-assign /EHsc /MTd /std:c++latest /permissive-" +PM_COMPILER="clang-cl" PM_CL="-fno-ms-compatibility -fno-delayed-template-parsing -Wno-unqualified-std-cast-call -Xclang -Wno-deprecated-declarations -Xclang -Wno-self-assign /EHsc /MD /std:c++14" +PM_COMPILER="clang-cl" PM_CL="-fno-ms-compatibility -fno-delayed-template-parsing -Wno-unqualified-std-cast-call -Xclang -Wno-deprecated-declarations -Xclang -Wno-self-assign /EHsc /MDd /std:c++17" +PM_COMPILER="clang-cl" PM_CL="-fno-ms-compatibility -fno-delayed-template-parsing -Wno-unqualified-std-cast-call -Xclang -Wno-deprecated-declarations -Xclang -Wno-self-assign /EHsc /MTd /std:c++latest /permissive-" diff --git a/tests/tr1/include/tcvt.h b/tests/tr1/include/tcvt.h index 06c4619001..1d9842b839 100644 --- a/tests/tr1/include/tcvt.h +++ b/tests/tr1/include/tcvt.h @@ -60,10 +60,10 @@ bool test_write(const char* fname, const Mystring& mystring) { // write sequence STD wbuffer_convert mybuf(&mybbuf); Myostream mystr(&mybuf); - for (size_t idx = 0; idx < mystring.size(); ++idx) - if (mystr.write(&mystring[idx], 1)) + for (size_t idx = 0; idx < mystring.size(); ++idx) { + if (mystr.write(&mystring[idx], 1)) { CHECK(1); - else { // write failed, quit + } else { // write failed, quit #ifndef TERSE cout << hex << "write failed for " << (unsigned long) mystring[idx] << endl; #endif // TERSE @@ -71,6 +71,7 @@ bool test_write(const char* fname, const Mystring& mystring) { // write sequence CHECK_INT((int) idx, -1); return false; } + } return true; } @@ -93,9 +94,9 @@ bool test_read(const char* fname, const Mystring& mystring) { // read sequences MYWCHAR ch; for (size_t idx = 0; idx < mystring.size(); ++idx) { // read a wide char and test for expected value ch = (MYWCHAR) (-1); - if (mystr.read(&ch, 1) && ch == mystring[idx]) + if (mystr.read(&ch, 1) && ch == mystring[idx]) { CHECK(1); - else { // read failed, quit + } else { // read failed, quit #ifndef TERSE cout << hex << "read failed for " << (unsigned long) mystring[idx] << ", got " << (unsigned long) ch << endl; @@ -124,12 +125,14 @@ void test_main() { // write a file and read it back for (unsigned long ch = 0; ch <= MYWC_MAX && mystring.size() < NCHARS; ++ch) { // add a wide character if valid string buf = myconv.to_bytes((MYWCHAR) ch); - if (0 < buf.size() && ch != (unsigned long) WEOF) + if (0 < buf.size() && ch != (unsigned long) WEOF) { mystring.insert(mystring.end(), (MYWCHAR) ch); + } } #endif // defined(MYMAKE) - if (test_write(fname, mystring)) + if (test_write(fname, mystring)) { test_read(fname, mystring); + } remove(fname); } diff --git a/tests/tr1/include/tdefs.h b/tests/tr1/include/tdefs.h index 411e1ad647..a4cb88d7d6 100644 --- a/tests/tr1/include/tdefs.h +++ b/tests/tr1/include/tdefs.h @@ -100,15 +100,17 @@ int verbose = 0; int check_one(int ok, unsigned int ch, const char* label, const char* file_name, int line_number, int test) { // accumulate and maybe display failures if (test != 0) { // succeeded, display if verbose - if (verbose) + if (verbose) { CSTD printf(" PASS test %.3d at line %.3d in %s for %#.2x: %s\n", total_pass + total_fail + 1, line_number, file_name, ch, label); + } } else { // failed, accumulate and maybe display ++total_fail; ok = 0; - if (!terse) + if (!terse) { CSTD printf(" FAIL test %.3d at line %.3d in %s for %#.2x: %s\n", total_pass + total_fail + 1, line_number, file_name, ch, label); + } } return ok; } @@ -116,9 +118,10 @@ int check_one(int ok, unsigned int ch, const char* label, const char* file_name, void results(const char* label, const char* file_name, int line_number, int test) { // display results if (test != 0) { // pass, count and maybe display ++total_pass; - if (verbose) + if (verbose) { CSTD printf( " PASS test %.3d at line %.3d in %s: %s\n", total_pass + total_fail, line_number, file_name, label); + } } else { // fail, count and display ++total_fail; CSTD printf(" FAIL test %.3d at line %.3d in %s: %s\n", total_pass + total_fail, line_number, file_name, label); @@ -128,16 +131,18 @@ void results(const char* label, const char* file_name, int line_number, int test void check_int(const char* label, const char* file_name, int line_number, int left, int right) { int ans = left == right; - if (!terse && !ans) + if (!terse && !ans) { CSTD printf(" GOT %d != %d\n", left, right); + } results(label, file_name, line_number, ans); } void check_size_t(const char* label, const char* file_name, int line_number, size_t left, size_t right) { int ans = left == right; - if (!terse && !ans) + if (!terse && !ans) { CSTD printf(" GOT %zu != %zu\n", left, right); + } results(label, file_name, line_number, ans); } @@ -148,17 +153,23 @@ void check_mem(const char* label, const char* file_name, int line_number, const const char* s1 = (const char*) left; const char* s2 = (const char*) right; - for (; 0 <= --n && *s1 == *s2; ++s1, ++s2) + for (; 0 <= --n && *s1 == *s2; ++s1, ++s2) { ; - if (n <= 0) + } + + if (n <= 0) { ans = 1; + } + if (!terse && !ans) { // put differing strings CSTD printf(" GOT \""); - for (n = length, s1 = (const char*) left; 0 <= --n; ++s1) + for (n = length, s1 = (const char*) left; 0 <= --n; ++s1) { CSTD printf("%c", *s1); + } CSTD printf("\" != \""); - for (n = length, s2 = (const char*) right; 0 <= --n; ++s2) + for (n = length, s2 = (const char*) right; 0 <= --n; ++s2) { CSTD printf("%c", *s2); + } CSTD printf("\"\n"); } results(label, file_name, line_number, ans); @@ -168,8 +179,9 @@ void check_ptr(const char* label, const char* file_name, int line_number, const const void* right) { // check for pointer equality int ans = left == right; - if (!terse && !ans) + if (!terse && !ans) { CSTD printf(" GOT %p != %p\n", left, right); + } results(label, file_name, line_number, ans); } @@ -179,13 +191,15 @@ void check_str(const char* label, const char* file_name, int line_number, const const char* s1 = left; const char* s2 = right; - for (; *s1 == *s2; ++s1, ++s2) + for (; *s1 == *s2; ++s1, ++s2) { if (*s1 == '\0') { // equal through NUL terminator ans = 1; break; } - if (!terse && !ans) + } + if (!terse && !ans) { CSTD printf(" GOT \"%s\" != \"%s\"\n", left, right); + } results(label, file_name, line_number, ans); } @@ -196,17 +210,23 @@ void check_wmem(const char* label, const char* file_name, int line_number, const const wchar_t* s1 = left; const wchar_t* s2 = right; - for (; 0 <= --n && *s1 == *s2; ++s1, ++s2) + for (; 0 <= --n && *s1 == *s2; ++s1, ++s2) { ; - if (n <= 0) + } + + if (n <= 0) { ans = 1; + } + if (!terse && !ans) { // put differing strings CSTD printf(" GOT L\""); - for (n = length; 0 <= --n; ++left) + for (n = length; 0 <= --n; ++left) { CSTD printf("%c", (char) *left); + } CSTD printf("\" != \""); - for (n = length; 0 <= --n; ++right) + for (n = length; 0 <= --n; ++right) { CSTD printf("%c", (char) *right); + } CSTD printf("\"\n"); } results(label, file_name, line_number, ans); @@ -218,18 +238,21 @@ void check_wstr(const char* label, const char* file_name, int line_number, const const wchar_t* s1 = left; const wchar_t* s2 = right; - for (; *s1 == *s2; ++s1, ++s2) + for (; *s1 == *s2; ++s1, ++s2) { if (*s1 == L'\0') { // equal through NUL terminator ans = 1; break; } + } if (!terse && !ans) { // failure, print wide strings CSTD printf(" GOT L\""); - for (; *left != L'\0'; ++left) + for (; *left != L'\0'; ++left) { CSTD printf("%c", (char) *left); + } CSTD printf("\" != L\""); - for (; *right != L'\0'; ++right) + for (; *right != L'\0'; ++right) { CSTD printf("%c", (char) *right); + } CSTD printf("\"\n"); } results(label, file_name, line_number, ans); @@ -242,8 +265,9 @@ void check_type(const char* label, const char* file_name, int line_number, const const STD type_info& right) { // check for int equality int ans = left == right; - if (!terse && !ans) + if (!terse && !ans) { CSTD printf(" GOT %s != %s\n", left.name(), right.name()); + } results(label, file_name, line_number, ans); } #endif // __cplusplus @@ -252,24 +276,29 @@ void check_double(const char* label, const char* file_name, int line_number, dou int ans = left == right; if (!terse && !ans) { // print hex or decimal floating-point - if (afmt) + if (afmt) { CSTD printf(" GOT %a != %a\n", left, right); - else + } else { CSTD printf(" GOT %f != %f\n", left, right); + } } results(label, file_name, line_number, ans); } int leave_chk(const char* file_name) { // print summary on exit - if (!terse || 0 < total_fail) + if (!terse || 0 < total_fail) { CSTD printf("***** %d erroneous test cases in %s *****\n", total_fail, file_name); - if (!terse) + } + + if (!terse) { CSTD printf("***** %d successful test cases in %s *****\n", total_pass, file_name); + } - if (0 < total_fail) + if (0 < total_fail) { CSTD printf("#FAILED: %s\n", file_name); - else + } else { CSTD printf("#PASSED: %s\n", file_name); + } return EXIT_STATUS; } @@ -343,10 +372,13 @@ int approx2(Float_type d1, Float_type d2, Float_type sensitivity) { // test for #if 199901L <= __STDC_VERSION__ if (isunordered(d1, d2)) { // at least one NaN if (!terse) { // report NaNs - if (isnan(d1)) + if (isnan(d1)) { CSTD printf("approx(x, y): x is a NaN\n"); - if (isnan(d2)) + } + + if (isnan(d2)) { CSTD printf("approx(x, y): y is a NaN\n"); + } } return 0; } else @@ -354,25 +386,30 @@ int approx2(Float_type d1, Float_type d2, Float_type sensitivity) { // test for { // compare finite values Float_type err; - if (d2 != (Float_type) 0) + if (d2 != (Float_type) 0) { err = (d2 - d1) / d2; - else + } else { err = d1; - if (err < (Float_type) 0) + } + + if (err < (Float_type) 0) { err = -err; + } sensitivity += static_cast(ulp); if (err <= sensitivity * eps0) { // close enough, maybe display then succeed - if (verbose) + if (verbose) { CSTD printf("difference is %.2g ulp (<= %.2g ulp)" " for %.5Lg vs. %.5Lg\n", (double) (err / eps0), (double) sensitivity, (long double) d1, (long double) d2); + } return 1; } else { // too different, maybe display then fail - if (!terse) + if (!terse) { CSTD printf("difference is %.2g ulp (> %.2g ulp)" " for %.5Lg vs. %.5Lg\n", (double) (err / eps0), (double) sensitivity, (long double) d1, (long double) d2); + } return 0; } } @@ -537,13 +574,15 @@ int main(int argc, char** argv) { // call test, print summary, return int nextarg; CSTD setvbuf(stdout, nullptr, _IONBF, 0); // disable output buffering - for (nextarg = 1; nextarg < argc; ++nextarg) - if (strcmp(argv[nextarg], "-v") == 0) + for (nextarg = 1; nextarg < argc; ++nextarg) { + if (strcmp(argv[nextarg], "-v") == 0) { verbose = 1; - else if (strcmp(argv[nextarg], "-t") == 0) + } else if (strcmp(argv[nextarg], "-t") == 0) { terse = 1; - else + } else { printf("UNEXPECTED argument: %s\n", argv[nextarg]); + } + } #ifndef __cplusplus test_main(); // call C test function diff --git a/tests/tr1/include/tspec_random.h b/tests/tr1/include/tspec_random.h index f104b36fd3..9be4e7a6ba 100644 --- a/tests/tr1/include/tspec_random.h +++ b/tests/tr1/include/tspec_random.h @@ -37,14 +37,16 @@ class do_random_test { // template for running a random distribution test // load wanted probabilities from data int i; - for (i = 0; i < 10; ++i) + for (i = 0; i < 10; ++i) { prob_want[(int) tab[i].arg1] = tab[i].ans; + } // collect random sample data from given distribution mt19937 gen; i = 0; - for (; i < BINSIZE; ++i) + for (; i < BINSIZE; ++i) { got_count[i] = 0; + } over_bin = 0; under_bin = 0; @@ -58,17 +60,19 @@ class do_random_test { // template for running a random distribution test Ty zero = (Ty) 0; // to quiet diagnostics if (zero <= rand_value && rand_value < (Ty) BINSIZE) { // increase the count of the proper bin got_count[(int) rand_value]++; - } else if (rand_value < zero) + } else if (rand_value < zero) { ++under_bin; - else if ((Ty) (BINSIZE - 1) < rand_value) + } else if ((Ty) (BINSIZE - 1) < rand_value) { ++over_bin; - else + } else { ++junk_bin; + } } int tc0 = 0; - if (verbose) + if (verbose) { printf("bin\twant(bin)\tgot(bin)\n"); + } // Compute results for (i = 0; i < BINSIZE; ++i) { // compute results for each bin @@ -76,8 +80,9 @@ class do_random_test { // template for running a random distribution test if ((int) i == (int) tab[tc0].arg1) { ++tc0; - if (verbose) + if (verbose) { printf("%.2d\t%.9g\t%d\n", i, want_count[i], got_count[i]); + } } } @@ -85,25 +90,29 @@ class do_random_test { // template for running a random distribution test double chi_squared = 0; int tc = 0; - for (i = 0; i < BINSIZE; i++) + for (i = 0; i < BINSIZE; i++) { if ((int) i == (int) tab[tc].arg1) { ++tc; if (0 < want_count[i]) { // avoid divide by zero and count empty bins double want_diff = got_count[i] - (double) want_count[i]; chi_squared += (want_diff * want_diff) / (double) want_count[i]; - } else if (0 < got_count[i]) + } else if (0 < got_count[i]) { chi_squared += got_count[i]; + } } + } // Check results int under_bin_ok = 1; int over_bin_ok = 1; - if (0 < under_bin && !smaller_ok) + if (0 < under_bin && !smaller_ok) { under_bin_ok = 0; + } - if (0 < over_bin && !larger_ok) + if (0 < over_bin && !larger_ok) { over_bin_ok = 0; + } CHECK_MSG("smaller values not ok\n", under_bin_ok); CHECK_MSG("larger values not ok\n", over_bin_ok); diff --git a/tests/tr1/tests/algorithm/test.cpp b/tests/tr1/tests/algorithm/test.cpp index b9a31e48c8..8a0d2d339a 100644 --- a/tests/tr1/tests/algorithm/test.cpp +++ b/tests/tr1/tests/algorithm/test.cpp @@ -165,8 +165,9 @@ void test_find(char* first, char* last) { // test searching template functions // TEST GENERATING TEMPLATE FUNCTIONS CSTD size_t gen_count = 0; void count_c(char ch) { // count calls with value 'c' - if (ch == 'c') + if (ch == 'c') { ++gen_count; + } } char gen_x() { // return literal x diff --git a/tests/tr1/tests/chrono/test.cpp b/tests/tr1/tests/chrono/test.cpp index 9341bd4d0f..d02fa73132 100644 --- a/tests/tr1/tests/chrono/test.cpp +++ b/tests/tr1/tests/chrono/test.cpp @@ -186,11 +186,13 @@ namespace { typedef STD chrono::duration dur; CHECK_TYPE(typename Clock::duration, dur); typedef STD chrono::time_point tp; - if (tp_known) + if (tp_known) { CHECK_TYPE(typename Clock::time_point, tp); + } static_assert(STD is_same_v, "incorrect is_steady type"); - if (steady_known) + if (steady_known) { CHECK_INT(Clock::is_steady, steady); + } CHECK_INT(Clock::now() < Clock::time_point::max(), true); } @@ -233,8 +235,9 @@ namespace { CHECK_TYPE(tp::period, r_1_1); bool is_steady = my_clock::is_steady; // to quiet diagnostics - if (is_steady) + if (is_steady) { my_clock::now(); + } // constructors, time_since_epoch tp t0; diff --git a/tests/tr1/tests/codecvt/test.cpp b/tests/tr1/tests/codecvt/test.cpp index 76bfe097b6..548dbf7b25 100644 --- a/tests/tr1/tests/codecvt/test.cpp +++ b/tests/tr1/tests/codecvt/test.cpp @@ -24,14 +24,16 @@ void test_write(Cvt*, int maxval = 0x10ffff) { // test codecvt writes STD basic_ostream sink(&ocvtbuf); int ch; - for (ch = 1; ch <= maxval; ch <<= 1) + for (ch = 1; ch <= maxval; ch <<= 1) { sink.put((char_type) ch); + } STD stringbuf istrbuf(ostrbuf.str()); STD wbuffer_convert icvtbuf(&istrbuf); STD basic_istream source(&icvtbuf); - for (ch = 1; ch <= maxval; ch <<= 1) + for (ch = 1; ch <= maxval; ch <<= 1) { CHECK_INT(source.get(), ch); + } } void test_main() { // test wbuffer_convert diff --git a/tests/tr1/tests/cstdio/test.cpp b/tests/tr1/tests/cstdio/test.cpp index e8c490d88c..e0bacf6c45 100644 --- a/tests/tr1/tests/cstdio/test.cpp +++ b/tests/tr1/tests/cstdio/test.cpp @@ -184,8 +184,9 @@ void test_cpp() { // test C++ header assert((pf = STDx tmpfile()) != nullptr); CHECK_INT(STDx fputc('x', pf), 'x'); errno = EDOM; - if (!terse) + if (!terse) { STDx perror("Domain error reported as"); + } } } diff --git a/tests/tr1/tests/cvt/wstring/test.cpp b/tests/tr1/tests/cvt/wstring/test.cpp index fbbd80fd6c..ce337e2684 100644 --- a/tests/tr1/tests/cvt/wstring/test.cpp +++ b/tests/tr1/tests/cvt/wstring/test.cpp @@ -91,7 +91,7 @@ void test_to_bytes() { // test wstring_convert from wide to bytes // check error handling const char* mesg = "to_bytes didn't throw"; wchar_t bad[] = { - // bad two-word sequence + // bad two-word sequence (wchar_t) 0xd800, // first of two words (wchar_t) 0xd800, // not second word 0, diff --git a/tests/tr1/tests/exception/test.cpp b/tests/tr1/tests/exception/test.cpp index 51a1f2a65f..fb4cffc6e1 100644 --- a/tests/tr1/tests/exception/test.cpp +++ b/tests/tr1/tests/exception/test.cpp @@ -35,8 +35,9 @@ void try_terminate() { // test terminate machinery if (setjmp(jbuf) == 0) { // try calling terminate int zero = 0; - if (zero == 0) + if (zero == 0) { STDx terminate(); + } CHECK_MSG("terminate() doesn't return", 0); } CHECK(STDx set_terminate(save_hand) == &jmpback); diff --git a/tests/tr1/tests/filesystem1/test.cpp b/tests/tr1/tests/filesystem1/test.cpp index 6972334c1f..1a79e04fc1 100644 --- a/tests/tr1/tests/filesystem1/test.cpp +++ b/tests/tr1/tests/filesystem1/test.cpp @@ -32,18 +32,21 @@ typedef PFX path::value_type path_value_type; STD string fix_bslash(const STD string& tbl_str) { // convert table entry to preferred STD string str; - for (size_t idx = 0; idx < tbl_str.size(); ++idx) - if (tbl_str[idx] == '/' || tbl_str[idx] == '\\') + for (size_t idx = 0; idx < tbl_str.size(); ++idx) { + if (tbl_str[idx] == '/' || tbl_str[idx] == '\\') { str.append((size_t) 1, BSLASH[0]); - else + } else { str.append((size_t) 1, tbl_str[idx]); + } + } return str; } STD string native_to_char(const path_string_type& path_str) { // convert native to string STD string str; - for (size_t idx = 0; idx < path_str.size(); ++idx) + for (size_t idx = 0; idx < path_str.size(); ++idx) { str.append((size_t) 1, (char) path_str[idx]); + } return str; } @@ -141,29 +144,33 @@ void test_path_data() { // test path accesses against data tables str.clear(); PFX path::iterator pi = p.begin(); - for (int i = 0; i < 10 && pi != p.end(); ++i, ++pi) - if (str.empty()) + for (int i = 0; i < 10 && pi != p.end(); ++i, ++pi) { + if (str.empty()) { str.append(*pi); - else { // append with separator + } else { // append with separator str.append(1, '|'); str.append(*pi); } + } CHECK_TBL(str, pd->pd_fields); str.clear(); pi = p.end(); - if (pi != p.begin()) + if (pi != p.begin()) { for (int i = 0; i < 10; ++i) { // prepend an element --pi; - if (str.empty()) + if (str.empty()) { str.append(*pi); - else { // prepend with separator + } else { // prepend with separator str.insert((size_t) 0, (size_t) 1, '|'); str.insert((size_t) 0, *pi); } - if (pi == p.begin()) + + if (pi == p.begin()) { break; + } } + } CHECK_TBL(str, pd->pd_fields); str = p.native(); @@ -893,8 +900,9 @@ void test_ops() { // test operations PFX create_directory_symlink(PFX current_path(), tpz, ec); CHECK(PFX exists(tpz)); } catch (...) { // link failed - if (!terse) + if (!terse) { CSTD printf("symlink not supported\n"); + } } PFX remove(tpy); PFX remove(tpz); @@ -915,8 +923,9 @@ void test_ops() { // test operations PFX create_hard_link(tpx, tpz, ec); CHECK(PFX exists(tpz)); } catch (...) { // link failed - if (!terse) + if (!terse) { CSTD printf("hard link not supported\n"); + } } PFX remove(tpy); PFX remove(tpz); diff --git a/tests/tr1/tests/forward_list/test.cpp b/tests/tr1/tests/forward_list/test.cpp index adf6941060..cdab222ec8 100644 --- a/tests/tr1/tests/forward_list/test.cpp +++ b/tests/tr1/tests/forward_list/test.cpp @@ -18,16 +18,18 @@ typedef STD forward_list Mycont; CSTD size_t size(const Mycont& flist) { // get size of list CSTD size_t ans = 0; Mycont::const_iterator it = flist.begin(); - for (; it != flist.end(); ++it) + for (; it != flist.end(); ++it) { ++ans; + } return ans; } Mycont::const_iterator before_end(const Mycont& flist) { // get iterator for last element of list Mycont::const_iterator it = flist.before_begin(); Mycont::const_iterator it2; - for (it2 = it; ++it2 != flist.end(); it = it2) + for (it2 = it; ++it2 != flist.end(); it = it2) { ; + } return it; } diff --git a/tests/tr1/tests/future1/test.cpp b/tests/tr1/tests/future1/test.cpp index d50a737679..205deb4f11 100644 --- a/tests/tr1/tests/future1/test.cpp +++ b/tests/tr1/tests/future1/test.cpp @@ -41,8 +41,10 @@ class future_tester_base { // base class for testing future types with set and g pr = MyPromise(); - if (when == set_after_get) + if (when == set_after_get) { fut = pr.get_future(); + } + if (what == set_a_value) { STD thread thr0(&future_tester_base::set_value, this); thr = STD move(thr0); @@ -50,13 +52,18 @@ class future_tester_base { // base class for testing future types with set and g STD thread thr0(&future_tester_base::set_exception, this); thr = STD move(thr0); } - while (status == ready) + + while (status == ready) { cnd.wait(lock); - if (when == set_before_get) + } + + if (when == set_before_get) { fut = pr.get_future(); - if (what == set_a_value) + } + + if (what == set_a_value) { check_value(); - else if (what == set_an_exception) { // get() should throw exception + } else if (what == set_an_exception) { // get() should throw exception bool thrown = false; try { // try to get() fut.get(); diff --git a/tests/tr1/tests/istream1/test.cpp b/tests/tr1/tests/istream1/test.cpp index 2e12aa6322..0fb59e92a4 100644 --- a/tests/tr1/tests/istream1/test.cpp +++ b/tests/tr1/tests/istream1/test.cpp @@ -33,11 +33,11 @@ STD istream& operator>>(STD istream& istr, Boolx& b) { // extract a Boolx if (ok) { // state okay, extract Y or N const int c = istr.rdbuf()->sbumpc(); - if (c == 'Y') + if (c == 'Y') { b.value(1); - else if (c == 'N') + } else if (c == 'N') { b.value(0); - else { // report failure + } else { // report failure istr.rdbuf()->sputbackc((char) c); state = STD ios::failbit; } diff --git a/tests/tr1/tests/istream2/test.cpp b/tests/tr1/tests/istream2/test.cpp index ee3c297411..4aa8c514cf 100644 --- a/tests/tr1/tests/istream2/test.cpp +++ b/tests/tr1/tests/istream2/test.cpp @@ -34,11 +34,11 @@ STD wistream& operator>>(STD wistream& istr, Boolx& b) { // extract a Boolx if (ok) { // state okay, extract Y or N const CSTD wint_t c = istr.rdbuf()->sbumpc(); - if (c == L'Y') + if (c == L'Y') { b.value(1); - else if (c == L'N') + } else if (c == L'N') { b.value(0); - else { // report failure + } else { // report failure istr.rdbuf()->sputbackc(c); state = STD ios::failbit; } diff --git a/tests/tr1/tests/iterator/test.cpp b/tests/tr1/tests/iterator/test.cpp index 1f52ac12b3..8bf057aabe 100644 --- a/tests/tr1/tests/iterator/test.cpp +++ b/tests/tr1/tests/iterator/test.cpp @@ -339,8 +339,9 @@ void test_istreamit() { // test istream_iterator p_traits = p_traits; p_istream = p_istream; - for (n = 0; n < 5 && iit != iit0; ++n) + for (n = 0; n < 5 && iit != iit0; ++n) { CHECK_INT(*iit++, n); + } CHECK(!(iit != iit0)); CHECK_INT(n, 4); } @@ -385,8 +386,9 @@ void test_istrbufit() { // test istreambuf_iterator p_istream = p_istream; int n; - for (n = 0; n < 5 && iit != iit0; ++n) + for (n = 0; n < 5 && iit != iit0; ++n) { CHECK_INT(*iit++, n + '0'); + } CHECK(!(iit != iit0)); CHECK_INT(n, 4); CHECK(iit0.equal(iit1)); diff --git a/tests/tr1/tests/limits/test.cpp b/tests/tr1/tests/limits/test.cpp index 703a690bca..96bdfa08d8 100644 --- a/tests/tr1/tests/limits/test.cpp +++ b/tests/tr1/tests/limits/test.cpp @@ -27,18 +27,20 @@ void test_main() { // test basic workings of limits definitions STD round_toward_infinity, STD round_toward_neg_infinity}; int i, j, ok; - for (ok = 1, i = sizeof(fds) / sizeof(fds[0]); 0 < i;) + for (ok = 1, i = sizeof(fds) / sizeof(fds[0]); 0 < i;) { for (j = --i; 0 < j;) { // test an (i, j) pair int testno = i * 0x100 + j; ok = CHECK0(ok, testno, fds[i] != fds[--j]); } + } CHECK_MSG("float_denorm_style values are distinct", ok); - for (ok = 1, i = sizeof(frs) / sizeof(frs[0]); 0 < i;) + for (ok = 1, i = sizeof(frs) / sizeof(frs[0]); 0 < i;) { for (j = --i; 0 < j;) { // test an (i, j) pair int testno = i * 0x100 + j; ok = CHECK0(ok, testno, frs[i] != frs[--j]); } + } CHECK_MSG("float_round_style values are distinct", ok); { // check limits template diff --git a/tests/tr1/tests/locale1/test.cpp b/tests/tr1/tests/locale1/test.cpp index cbef307615..94ba34d617 100644 --- a/tests/tr1/tests/locale1/test.cpp +++ b/tests/tr1/tests/locale1/test.cpp @@ -41,11 +41,12 @@ void test_codecvt() { // test codecvt int i, j, ok; - for (ok = 1, i = sizeof(res_tab) / sizeof(res_tab[0]); 0 < i;) + for (ok = 1, i = sizeof(res_tab) / sizeof(res_tab[0]); 0 < i;) { for (j = --i; 0 < j;) { // test an (i, j) pair int testno = i * 0x100 + j; ok = CHECK0(ok, testno, res_tab[i] != res_tab[--j]); } + } CHECK_MSG("codecvt_base::result values are distinct", ok); const char ibuf[] = "abc"; @@ -187,11 +188,12 @@ void test_ctype() { // test ctype int i, j, ok; - for (ok = 1, i = sizeof(masks) / sizeof(masks[0]); 0 < i;) + for (ok = 1, i = sizeof(masks) / sizeof(masks[0]); 0 < i;) { for (j = --i; 0 < j;) { // test an (i, j) pair int testno = i * 0x100 + j; ok = CHECK0(ok, testno, masks[i] != masks[--j]); } + } CHECK_MSG("ctype_base::mask values are distinct", ok); Myxctype* pf3 = new Myxctype(masks); @@ -231,20 +233,22 @@ struct Myxctype2 : public STD ctype { // get protected members } virtual char do_widen(char ch) const { // widen a character - if (ch == '-') + if (ch == '-') { return '@'; - else if (ch == '0') + } else if (ch == '0') { return 'A'; - else if (ch == '1') + } else if (ch == '1') { return 'b'; - else + } else { return ch; + } } virtual const char* do_widen(const char* first, const char* last, char* dest) const { // widen a character sequence - for (; first != last; ++first, ++dest) + for (; first != last; ++first, ++dest) { *dest = do_widen(*first); + } return first; } }; @@ -451,16 +455,18 @@ void test_main() { // test basic workings of locale definitions int i, j, ok; - for (ok = 1, i = sizeof(cats) / sizeof(cats[0]); 0 < i;) + for (ok = 1, i = sizeof(cats) / sizeof(cats[0]); 0 < i;) { for (j = --i; 0 < j;) { // test an (i, j) pair int testno = i * 0x100 + j; ok = CHECK0(ok, testno, cats[i] != cats[--j]); } + } CHECK_MSG("locale::category values are distinct", ok); STD locale::category allcats = 0; - for (i = 1; i < 7; ++i) + for (i = 1; i < 7; ++i) { allcats |= cats[i]; + } CHECK_INT(cats[7] & allcats, allcats); STD locale cloc("C"); diff --git a/tests/tr1/tests/locale2/test.cpp b/tests/tr1/tests/locale2/test.cpp index 96f090c15a..b437e179a9 100644 --- a/tests/tr1/tests/locale2/test.cpp +++ b/tests/tr1/tests/locale2/test.cpp @@ -166,20 +166,22 @@ struct Myxctype2 : public STD ctype { // get protected members } virtual wchar_t do_widen(char ch) const { // widen a character - if (ch == '-') + if (ch == '-') { return L'@'; - else if (ch == '0') + } else if (ch == '0') { return L'A'; - else if (ch == '1') + } else if (ch == '1') { return L'b'; - else + } else { return (wchar_t) ch; + } } virtual const char* do_widen(const char* first, const char* last, wchar_t* dest) const { // widen a character sequence - for (; first != last; ++first, ++dest) + for (; first != last; ++first, ++dest) { *dest = do_widen(*first); + } return first; } }; diff --git a/tests/tr1/tests/locale3/test.cpp b/tests/tr1/tests/locale3/test.cpp index bdf93d40c7..8ca9e9f9c4 100644 --- a/tests/tr1/tests/locale3/test.cpp +++ b/tests/tr1/tests/locale3/test.cpp @@ -118,38 +118,42 @@ struct Myxctype2 : public STD ctype { // get protected members } virtual char do_widen(char ch) const { // widen a character - if (ch == '-') + if (ch == '-') { return '@'; - else if (ch == '0') + } else if (ch == '0') { return 'A'; - else if (ch == '1') + } else if (ch == '1') { return 'b'; - else + } else { return ch; + } } virtual const char* do_widen(const char* first, const char* last, char* dest) const { // widen a character sequence - for (; first != last; ++first, ++dest) + for (; first != last; ++first, ++dest) { *dest = do_widen(*first); + } return first; } virtual char do_narrow(char ch, char) const { // narrow a character - if (ch == 'P') + if (ch == 'P') { return '%'; - else if (ch == 'K') + } else if (ch == 'K') { return ':'; - else if (ch == 'Z') + } else if (ch == 'Z') { return 'H'; - else + } else { return ch; + } } virtual const char* do_narrow( const char* first, const char* last, char, char* dest) const { // narrow a character sequence - for (; first != last; ++first, ++dest) + for (; first != last; ++first, ++dest) { *dest = do_narrow(*first, '\0'); + } return first; } }; diff --git a/tests/tr1/tests/locale4/test.cpp b/tests/tr1/tests/locale4/test.cpp index 633823ed2b..474fdd0068 100644 --- a/tests/tr1/tests/locale4/test.cpp +++ b/tests/tr1/tests/locale4/test.cpp @@ -111,38 +111,42 @@ struct Myxctype2 : public STD ctype { // get protected members } virtual wchar_t do_widen(char ch) const { // widen a character - if (ch == '-') + if (ch == '-') { return L'@'; - else if (ch == '0') + } else if (ch == '0') { return L'A'; - else if (ch == '1') + } else if (ch == '1') { return L'b'; - else + } else { return (wchar_t) ch; + } } virtual const char* do_widen(const char* first, const char* last, wchar_t* dest) const { // widen a character sequence - for (; first != last; ++first, ++dest) + for (; first != last; ++first, ++dest) { *dest = do_widen(*first); + } return first; } virtual char do_narrow(wchar_t ch, char) const { // narrow a character - if (ch == L'P') + if (ch == L'P') { return '%'; - else if (ch == L'K') + } else if (ch == L'K') { return ':'; - else if (ch == L'Z') + } else if (ch == L'Z') { return 'H'; - else + } else { return (char) ch; + } } virtual const wchar_t* do_narrow( const wchar_t* first, const wchar_t* last, char, char* dest) const { // narrow a character sequence - for (; first != last; ++first, ++dest) + for (; first != last; ++first, ++dest) { *dest = do_narrow(*first, '\0'); + } return first; } }; diff --git a/tests/tr1/tests/locale8/test.cpp b/tests/tr1/tests/locale8/test.cpp index 66288624df..f1b6e7b4d4 100644 --- a/tests/tr1/tests/locale8/test.cpp +++ b/tests/tr1/tests/locale8/test.cpp @@ -93,7 +93,7 @@ void test_to_bytes() { // test wstring_convert from wide to bytes // check error handling const char* mesg = "to_bytes didn't throw"; wchar_t bad[] = { - // bad two-word sequence + // bad two-word sequence (wchar_t) 0xd800, // first of two words (wchar_t) 0xd800, // not second word 0, diff --git a/tests/tr1/tests/memory2/test.cpp b/tests/tr1/tests/memory2/test.cpp index d10ad41d90..c03407804a 100644 --- a/tests/tr1/tests/memory2/test.cpp +++ b/tests/tr1/tests/memory2/test.cpp @@ -32,12 +32,15 @@ static void ctors() { // construct a gazillion shared and weak pointers lock_guard lock(start_mtx); } - for (int i = 0; i < NSETS; ++i) - for (int j = 0; j < NREPS; ++j) - if (rand() % 2 != 0) + for (int i = 0; i < NSETS; ++i) { + for (int j = 0; j < NREPS; ++j) { + if (rand() % 2 != 0) { shared_ptr sp0(sp); - else + } else { weak_ptr wp0(sp); + } + } + } } static void tctors() { // check for race conditions @@ -46,12 +49,14 @@ static void tctors() { // check for race conditions { // wait for access lock_guard lock(start_mtx); - for (int i = 0; i < NTHREADS; ++i) + for (int i = 0; i < NTHREADS; ++i) { grp.emplace_back(ctors); + } } - for (int i = 0; i < NTHREADS; ++i) + for (int i = 0; i < NTHREADS; ++i) { grp[i].join(); + } CHECK_INT(sp.use_count(), 1); } diff --git a/tests/tr1/tests/ostream1/test.cpp b/tests/tr1/tests/ostream1/test.cpp index 74bc179157..9bcb472bbc 100644 --- a/tests/tr1/tests/ostream1/test.cpp +++ b/tests/tr1/tests/ostream1/test.cpp @@ -32,10 +32,11 @@ STD ostream& operator<<(STD ostream& ostr, const Boolx& b) { // insert a Boolx const STD ostream::sentry ok(ostr); if (ok) { - if (b.value() != 0) + if (b.value() != 0) { ostr.rdbuf()->sputc('Y'); - else + } else { ostr.rdbuf()->sputc('N'); + } } ostr.setstate(state); return ostr; diff --git a/tests/tr1/tests/ostream2/test.cpp b/tests/tr1/tests/ostream2/test.cpp index 6a2701ecb9..52b269d420 100644 --- a/tests/tr1/tests/ostream2/test.cpp +++ b/tests/tr1/tests/ostream2/test.cpp @@ -33,10 +33,11 @@ STD wostream& operator<<(STD wostream& ostr, const Boolx& b) { // insert a Boolx const STD wostream::sentry ok(ostr); if (ok) { - if (b.value() != 0) + if (b.value() != 0) { ostr.rdbuf()->sputc(L'Y'); - else + } else { ostr.rdbuf()->sputc(L'N'); + } } ostr.setstate(state); return ostr; diff --git a/tests/tr1/tests/random1/test.cpp b/tests/tr1/tests/random1/test.cpp index 92641fe9cd..49c4cfefb9 100644 --- a/tests/tr1/tests/random1/test.cpp +++ b/tests/tr1/tests/random1/test.cpp @@ -137,8 +137,9 @@ static void tminstd_rand0() { CHECK_INT(rng_t::modulus, 2147483647); rng_t rng; Int32 res = 0; - for (int i = 0; i < 10000; ++i) + for (int i = 0; i < 10000; ++i) { res = rng(); + } CHECK_INT(res, 1043618065); } @@ -149,8 +150,9 @@ static void tminstd_rand() { CHECK_INT(rng_t::modulus, 2147483647); rng_t rng; Int32 res = 0; - for (int i = 0; i < 10000; ++i) + for (int i = 0; i < 10000; ++i) { res = rng(); + } CHECK_INT(res, 399268537); } @@ -231,8 +233,9 @@ static void tmt19937() { CHECK_INT(rng_t::output_l, 18); rng_t rng; Int32 res = 0; - for (int i = 0; i < 10000; ++i) + for (int i = 0; i < 10000; ++i) { res = rng(); + } CHECK_INT(res, (int) 4123659995UL); rng_t rng0, rng1; @@ -332,8 +335,9 @@ static void tranlux3() { CHECK_INT(rng_t::base_type::short_lag, 10); rng_t rng; Int32 res = 0; - for (int i = 0; i < 10000; ++i) + for (int i = 0; i < 10000; ++i) { res = rng(); + } CHECK_INT(res, 5957620); } @@ -346,8 +350,9 @@ static void tranlux4() { CHECK_INT(rng_t::base_type::short_lag, 10); rng_t rng; Int32 res = 0; - for (int i = 0; i < 10000; ++i) + for (int i = 0; i < 10000; ++i) { res = rng(); + } CHECK_INT(res, 8587295); } @@ -433,8 +438,9 @@ static void tranlux3_01() { CHECK_INT(rng_t::base_type::long_lag, 24); rng_t rng; float res = 0; - for (int i = 0; i < 10000; ++i) + for (int i = 0; i < 10000; ++i) { res = rng(); + } CHECK_DOUBLE(res, 5957620 / CSTD pow(2.0f, 24)); } @@ -447,8 +453,9 @@ static void tranlux4_01() { CHECK_INT(rng_t::base_type::long_lag, 24); rng_t rng; float res = 0; - for (int i = 0; i < 10000; ++i) + for (int i = 0; i < 10000; ++i) { res = rng(); + } CHECK_DOUBLE(res, 8587295 / STD pow(2.0f, 24)); } #endif // _HAS_TR1_NAMESPACE @@ -495,8 +502,9 @@ static void tdiscard() { rng_base_t rng4; rng_t rng5; - for (i = 0; i < rng_t::used_block; ++i) + for (i = 0; i < rng_t::used_block; ++i) { CHECK_INT(rng4(), rng5()); + } CHECK(rng4() != rng5()); for (; i < rng_t::block_size; ++i) { (void) rng4(); diff --git a/tests/tr1/tests/random2/test.cpp b/tests/tr1/tests/random2/test.cpp index fb857bed61..641605e176 100644 --- a/tests/tr1/tests/random2/test.cpp +++ b/tests/tr1/tests/random2/test.cpp @@ -28,8 +28,9 @@ struct test_globals { bool mismatched = false; for (int i = 0; i < 10; ++i) { (void) dist2(rng2); - if (dist0(rng0) != dist1(rng1)) + if (dist0(rng0) != dist1(rng1)) { mismatched = true; + } } CHECK(mismatched); STD stringstream str; diff --git a/tests/tr1/tests/random4/test.cpp b/tests/tr1/tests/random4/test.cpp index b71be9a545..0443f3c6dd 100644 --- a/tests/tr1/tests/random4/test.cpp +++ b/tests/tr1/tests/random4/test.cpp @@ -283,8 +283,9 @@ static void tdiscard() { rng_base_t rng4; rng_t rng5; - for (i = 0; i < rng_t::used_block; ++i) + for (i = 0; i < rng_t::used_block; ++i) { CHECK_INT(rng4(), rng5()); + } CHECK(rng4() != rng5()); for (; i < rng_t::block_size; ++i) { (void) rng4(); @@ -404,8 +405,9 @@ static void tmt19937_64() { typedef STD mt19937_64 rng_t; rng_t rng; rng_t::result_type res = 0; - for (int i = 0; i < 10000; ++i) + for (int i = 0; i < 10000; ++i) { res = rng(); + } CHECK(res == 9981545732273789042ULL); } @@ -413,8 +415,9 @@ static void tranlux24_base() { typedef STD ranlux24_base rng_t; rng_t rng; rng_t::result_type res = 0; - for (int i = 0; i < 10000; ++i) + for (int i = 0; i < 10000; ++i) { res = rng(); + } CHECK_INT(res, 7937952); } @@ -422,8 +425,9 @@ static void tranlux24() { typedef STD ranlux24 rng_t; rng_t rng; rng_t::result_type res = 0; - for (int i = 0; i < 10000; ++i) + for (int i = 0; i < 10000; ++i) { res = rng(); + } CHECK_INT(res, 9901578); } @@ -431,8 +435,9 @@ static void tranlux48_base() { typedef STD ranlux48_base rng_t; rng_t rng; rng_t::result_type res = 0; - for (int i = 0; i < 10000; ++i) + for (int i = 0; i < 10000; ++i) { res = rng(); + } CHECK(res == 61839128582725ULL); } @@ -440,8 +445,9 @@ static void tranlux48() { typedef STD ranlux48 rng_t; rng_t rng; rng_t::result_type res = 0; - for (int i = 0; i < 10000; ++i) + for (int i = 0; i < 10000; ++i) { res = rng(); + } CHECK(res == 249142670248501ULL); } @@ -449,8 +455,9 @@ static void tknuth() { typedef STD knuth_b rng_t; rng_t rng; rng_t::result_type res = 0; - for (int i = 0; i < 10000; ++i) + for (int i = 0; i < 10000; ++i) { res = rng(); + } CHECK_INT(res, 1112339016U); } diff --git a/tests/tr1/tests/random5/test.cpp b/tests/tr1/tests/random5/test.cpp index 3ceb58d7c2..a0c7e780b9 100644 --- a/tests/tr1/tests/random5/test.cpp +++ b/tests/tr1/tests/random5/test.cpp @@ -28,8 +28,9 @@ struct test_globals { bool mismatched = false; for (int i = 0; i < 10; ++i) { (void) dist2(rng2); - if (dist0(rng0) != dist1(rng1)) + if (dist0(rng0) != dist1(rng1)) { mismatched = true; + } } CHECK(mismatched); STD stringstream str; diff --git a/tests/tr1/tests/regex1/test.cpp b/tests/tr1/tests/regex1/test.cpp index 74a9162295..e633d92aa6 100644 --- a/tests/tr1/tests/regex1/test.cpp +++ b/tests/tr1/tests/regex1/test.cpp @@ -177,8 +177,9 @@ static void test_traits() { // test template regex_traits CHECK(v0.transform_primary(carr, carr + xlen(carr)) == v0.transform_primary(carr0, carr0 + xlen(carr0))); CHECK(v0.transform_primary(carr0, carr0 + xlen(carr0)) < v0.transform_primary(carr1, carr1 + xlen(carr1))); - for (size_t i = 0; i < sizeof(class_names) / sizeof(*class_names); ++i) + for (size_t i = 0; i < sizeof(class_names) / sizeof(*class_names); ++i) { CHECK(v0.lookup_classname(class_names[i], class_names[i] + xlen(class_names[i])) != 0); + } CHECK(v0.lookup_classname(carr, carr) == 0); CHECK(v0.lookup_collatename(carr, carr + xlen(carr)) != STDString()); CHECK(v0.isctype('0', v0.lookup_classname(class_names[0], class_names[0] + xlen(class_names[0])))); @@ -507,8 +508,9 @@ static void test_match_results() { // test template match_results p_val = p_val; // to quiet diagnostics (void) citer; - if (cref.length() == ref.length()) + if (cref.length() == ref.length()) { p_iter = p_iter; + } p_diff = p_diff; p_size = p_size; p_alloc = p_alloc; @@ -663,8 +665,9 @@ static void test_regex_iterator() { // test template regex_iterator p_val = p_val; p_dif = p_dif; ptr = ptr; - if (ref.size()) + if (ref.size()) { p_tag = p_tag; + } } static void test_regex_token_iterator() { // test template regex_token_iterator @@ -886,8 +889,9 @@ static void test_regex_token_iterator() { // test template regex_token_iterator p_val = p_val; p_dif = p_dif; ptr = ptr; - if (ref.length()) + if (ref.length()) { p_tag = p_tag; + } } static void test_match() { // test function regex_match @@ -1065,11 +1069,12 @@ static void test_replace() { // test function regex_replace static void test_syntax_flags() { // test syntax flags MyRgx r0; int i, j, ok; - for (ok = 1, i = sizeof(synflags) / sizeof(synflags[0]); 0 < i;) + for (ok = 1, i = sizeof(synflags) / sizeof(synflags[0]); 0 < i;) { for (j = --i; 0 < j;) { // test an (i, j) pair int testno = i * 0x100 + j; ok = CHECK0(ok, testno, synflags[i] != synflags[--j]); } + } CHECK_MSG("regex_constants::syntax_option_type values are distinct", ok); r0.assign(T("a")); @@ -1096,11 +1101,12 @@ static void test_match_flags() { // test match flags CHECK_INT(mtchflags[0], 0); CHECK_INT(mtchflags[9], 0); int i, j, ok; - for (ok = 1, i = sizeof(mtchflags) / sizeof(mtchflags[0]); 0 < i;) + for (ok = 1, i = sizeof(mtchflags) / sizeof(mtchflags[0]); 0 < i;) { for (j = --i; 0 < j;) { // test an (i, j) pair int testno = i * 0x100 + j; ok = CHECK0(ok, testno, mtchflags[i] != mtchflags[--j] || mtchflags[i] == 0); } + } CHECK_MSG("regex_constants::match_flag_type values are distinct", ok); r0.assign(T("^a")); @@ -1141,18 +1147,20 @@ static void test_match_flags() { // test match flags static void test_error_flags() { // test error flags int i, j, ok; - for (ok = 1, i = sizeof(errflags) / sizeof(errflags[0]); 0 < i;) + for (ok = 1, i = sizeof(errflags) / sizeof(errflags[0]); 0 < i;) { for (j = --i; 0 < j;) { // test an (i, j) pair int testno = i * 0x100 + j; ok = CHECK0(ok, testno, errflags[i] != errflags[--j]); } + } CHECK_MSG("regex_constants::error_type values are distinct", ok); STD regex_error x(errflags[0]); STD runtime_error* pex = &x; - if (!terse) + if (!terse) { printf("regex_error().what() returns \"%s\"\n", pex->what()); + } CHECK(pex->what() != nullptr); CHECK_INT(x.code(), errflags[0]); diff --git a/tests/tr1/tests/regex2/test.cpp b/tests/tr1/tests/regex2/test.cpp index dbce16f807..146c8809c6 100644 --- a/tests/tr1/tests/regex2/test.cpp +++ b/tests/tr1/tests/regex2/test.cpp @@ -782,10 +782,11 @@ static STD string check_matches( STD ostringstream mtch; mtch << match.size(); for (CSTD size_t i = 0; i < match.size(); ++i) { // append i-th capture group - if (match[i].matched) + if (match[i].matched) { mtch << ' ' << match.position(i) << ' ' << (match.position(i) + match.length(i)); - else + } else { mtch << " -1 -1"; + } } return mtch.str(); } @@ -795,18 +796,20 @@ static void check_match(unsigned int line, const CHR* re, const CHR* txt, const const CHR* p; STD string str; - for (p = re; *p != 0; ++p) + for (p = re; *p != 0; ++p) { str.append(1, (char) *p); + } str.append(" |"); - for (p = txt; *p != 0; ++p) + for (p = txt; *p != 0; ++p) { str.append(1, (char) *p); + } str.append("|"); check_str(str.c_str(), __FILE__, line, mtch, res); } static void test_opt(STD regex_constants::syntax_option_type opts) { // do all valid tests for option set opts - for (size_t i = 0; i < sizeof(tests) / sizeof(tests[0]); ++i) + for (size_t i = 0; i < sizeof(tests) / sizeof(tests[0]); ++i) { if (tests[i].valid & lang(opts)) { // do one test #if NO_EXCEPTIONS STD basic_regex re(tests[i].re, opts); @@ -827,30 +830,37 @@ static void test_opt(STD regex_constants::syntax_option_type opts) { // do all v } #endif // NO_EXCEPTIONS } + } } void test_main() { // test all six regular expression languages - if (!terse) + if (!terse) { puts("Testing ECMAScript"); + } test_opt(STD regex_constants::ECMAScript); - if (!terse) + if (!terse) { puts("Testing UNIX BRE"); + } test_opt(STD regex_constants::basic); - if (!terse) + if (!terse) { puts("Testing grep"); + } test_opt(STD regex_constants::grep); - if (!terse) + if (!terse) { puts("Testing UNIX ERE"); + } test_opt(STD regex_constants::extended); - if (!terse) + if (!terse) { puts("Testing egrep"); + } test_opt(STD regex_constants::egrep); - if (!terse) + if (!terse) { puts("Testing awk"); + } test_opt(STD regex_constants::awk); } diff --git a/tests/tr1/tests/regex3/test.cpp b/tests/tr1/tests/regex3/test.cpp index 634c944d31..d74486aa3c 100644 --- a/tests/tr1/tests/regex3/test.cpp +++ b/tests/tr1/tests/regex3/test.cpp @@ -254,8 +254,9 @@ static void test_uncoveredfunctions() { MyTokIter next(pat, pat + xlen(pat), rx); MyTokIter end; - for (; next != end; ++next) + for (; next != end; ++next) { CHECKSTR(next->str().c_str(), T("aa")); + } // difference_type length() const MySm sub = mr[1]; diff --git a/tests/tr1/tests/stdexcept/test.cpp b/tests/tr1/tests/stdexcept/test.cpp index aee074298c..577a8bc9bf 100644 --- a/tests/tr1/tests/stdexcept/test.cpp +++ b/tests/tr1/tests/stdexcept/test.cpp @@ -24,8 +24,9 @@ void test_main() { // test basic workings of exception definitions STD logic_error* plog = &x2; STD runtime_error* prun = &x7; - if (!terse) + if (!terse) { printf("exception().what() returns \"%s\"\n", pex->what()); + } CHECK(pex->what() != nullptr); pex = plog;