From a351246847eee3afd611ded31fbade7491ee830a Mon Sep 17 00:00:00 2001 From: Blurring Shadow <976999484@qq.com> Date: Wed, 24 May 2023 17:31:33 +0800 Subject: [PATCH 1/6] fix(*all*): correct headers --- include/stdsharp/array/array.h | 10 +++++++--- include/stdsharp/concepts/concepts.h | 13 ++++++------- include/stdsharp/memory/memory.h | 6 ++---- include/stdsharp/type_traits/type_traits.h | 3 ++- include/stdsharp/utility/adl_proof.h | 2 -- include/stdsharp/utility/invocable.h | 2 +- include/stdsharp/utility/utility.h | 3 --- include/stdsharp/utility/value_wrapper.h | 2 ++ 8 files changed, 20 insertions(+), 21 deletions(-) diff --git a/include/stdsharp/array/array.h b/include/stdsharp/array/array.h index ec6b47d6..b10943e7 100644 --- a/include/stdsharp/array/array.h +++ b/include/stdsharp/array/array.h @@ -4,19 +4,23 @@ #include #include +#include "../macros.h" + namespace stdsharp { template<::std::size_t N> struct range_to_array_fn { template - constexpr auto operator()(Rng&& rng, Proj&& proj = {}) const + constexpr auto operator()(Rng&& rng, Proj proj = {}) const { - ::std::array<::std::projected<::std::ranges::iterator_t, Proj>, N> arr{}; + using value_type = ::std::projected<::std::ranges::iterator_t, Proj>::value_type; + + ::std::array arr{}; ::std::ranges::copy( cpp_forward(rng) | // - ::std::views::transform(cpp_forward(proj)) | // + ::std::views::transform(proj) | // ::std::views::take(N), arr.begin() ); diff --git a/include/stdsharp/concepts/concepts.h b/include/stdsharp/concepts/concepts.h index a01441e2..cee7e3fd 100644 --- a/include/stdsharp/concepts/concepts.h +++ b/include/stdsharp/concepts/concepts.h @@ -3,9 +3,9 @@ // #pragma once +#include #include #include -#include #include "../macros.h" @@ -288,14 +288,13 @@ namespace stdsharp template concept nothrow_move_assignable = ::std::is_nothrow_move_assignable_v; - template - concept nothrow_swappable = - requires(T& t1, T& t2) { requires noexcept(::std::ranges::swap(t1, t2)); }; - template concept nothrow_swappable_with = requires(T& t, U& u) { requires noexcept(::std::ranges::swap(t, u)); }; + template + concept nothrow_swappable = nothrow_swappable_with; + template concept nothrow_movable = ::std::movable && // nothrow_move_constructible && @@ -320,11 +319,11 @@ namespace stdsharp concept nothrow_convertible_to = ::std::is_nothrow_convertible_v; template - concept explicitly_convertible = requires { static_cast(std::declval()); }; + concept explicitly_convertible = requires(From&& v) { static_cast(cpp_forward(v)); }; template concept nothrow_explicitly_convertible = - requires { requires noexcept(static_cast(std::declval())); }; + requires(From&& v) { requires noexcept(static_cast(cpp_forward(v))); }; template concept explicitly_convertible_from = explicitly_convertible; diff --git a/include/stdsharp/memory/memory.h b/include/stdsharp/memory/memory.h index 9ecf39e2..20c40457 100644 --- a/include/stdsharp/memory/memory.h +++ b/include/stdsharp/memory/memory.h @@ -1,6 +1,4 @@ #pragma once -#include "pointer_traits.h" -#include "single_static_buffer.h" -#include "static_allocator.h" -#include "raii_memory.h" \ No newline at end of file +#include "small_object_optimization.h" +#include "allocator_reference.h" \ No newline at end of file diff --git a/include/stdsharp/type_traits/type_traits.h b/include/stdsharp/type_traits/type_traits.h index d19f855c..8ac1389d 100644 --- a/include/stdsharp/type_traits/type_traits.h +++ b/include/stdsharp/type_traits/type_traits.h @@ -1,4 +1,5 @@ #pragma once #include "member.h" -#include "object.h" \ No newline at end of file +#include "object.h" +#include "type_sequence.h" \ No newline at end of file diff --git a/include/stdsharp/utility/adl_proof.h b/include/stdsharp/utility/adl_proof.h index 80c0fa71..95d8d943 100644 --- a/include/stdsharp/utility/adl_proof.h +++ b/include/stdsharp/utility/adl_proof.h @@ -1,7 +1,5 @@ #pragma once -#include - namespace stdsharp { namespace details diff --git a/include/stdsharp/utility/invocable.h b/include/stdsharp/utility/invocable.h index af483b2b..c6a275a2 100644 --- a/include/stdsharp/utility/invocable.h +++ b/include/stdsharp/utility/invocable.h @@ -1,6 +1,6 @@ #pragma once -#include "../utility/value_wrapper.h" +#include "value_wrapper.h" namespace stdsharp { diff --git a/include/stdsharp/utility/utility.h b/include/stdsharp/utility/utility.h index 694d9c9f..80d55d5f 100644 --- a/include/stdsharp/utility/utility.h +++ b/include/stdsharp/utility/utility.h @@ -1,14 +1,11 @@ #pragma once -#include - #include "auto_cast.h" #include "cast_to.h" #include "constructor.h" #include "invocable.h" #include "../type_traits/core_traits.h" -#include "value_wrapper.h" namespace stdsharp { diff --git a/include/stdsharp/utility/value_wrapper.h b/include/stdsharp/utility/value_wrapper.h index 0225ad75..bbfa3bde 100644 --- a/include/stdsharp/utility/value_wrapper.h +++ b/include/stdsharp/utility/value_wrapper.h @@ -1,5 +1,7 @@ #pragma once +#include + #include "../concepts/concepts.h" #include "../compilation_config_in.h" From 6a422b6b45f2c795a12a2ee1c1ec656b7b69e977 Mon Sep 17 00:00:00 2001 From: Blurring Shadow <976999484@qq.com> Date: Wed, 24 May 2023 22:05:20 +0800 Subject: [PATCH 2/6] build(cmake): update project version --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index ddaf7a44..97b55ff7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -7,7 +7,7 @@ include(cmake/Utils.cmake) # project( stdsharp - VERSION 0.6.0 + VERSION 0.6.1 LANGUAGES CXX) config_lib(${PROJECT_NAME} INTERFACE STD 23) From e95b590dc92b7ca45e9561f85c030c4c12269cb3 Mon Sep 17 00:00:00 2001 From: Blurring Shadow <976999484@qq.com> Date: Fri, 26 May 2023 11:37:59 +0800 Subject: [PATCH 3/6] refactor(*all*): use std namespace alias --- include/stdsharp/algorithm/algorithm.h | 52 +-- include/stdsharp/array/array.h | 16 +- include/stdsharp/cassert/cassert.h | 10 +- include/stdsharp/cmath/cmath.h | 2 +- include/stdsharp/compare/compare.h | 4 +- include/stdsharp/concepts/concepts.h | 234 ++++++------ include/stdsharp/concurrent_object.h | 48 ++- include/stdsharp/containers/actions.h | 51 ++- include/stdsharp/containers/concepts.h | 350 +++++++++--------- include/stdsharp/cstdint/cstdint.h | 26 +- include/stdsharp/default_operator.h | 8 +- include/stdsharp/enumeration.h | 6 +- include/stdsharp/exception/exception.h | 28 +- include/stdsharp/filesystem/filesystem.h | 204 +++++----- include/stdsharp/format/format.h | 74 ++-- include/stdsharp/fstream/fstream.h | 46 +-- include/stdsharp/functional/compose.h | 23 +- include/stdsharp/functional/invocables.h | 46 +-- include/stdsharp/functional/invoke.h | 22 +- include/stdsharp/functional/operations.h | 68 ++-- include/stdsharp/functional/pipeable.h | 20 +- .../functional/symmetric_operations.h | 22 +- include/stdsharp/iterator/iterator.h | 18 +- include/stdsharp/macros.h | 2 +- include/stdsharp/memory/allocator_aware.h | 52 ++- include/stdsharp/memory/allocator_reference.h | 10 +- include/stdsharp/memory/allocator_traits.h | 134 ++++--- include/stdsharp/memory/composed_allocator.h | 33 +- include/stdsharp/memory/object_allocation.h | 40 +- include/stdsharp/memory/pointer_traits.h | 32 +- .../memory/small_object_optimization.h | 24 +- include/stdsharp/memory/static_allocator.h | 22 +- .../stdsharp/memory/static_memory_resource.h | 49 ++- include/stdsharp/mutex/mutex.h | 24 +- include/stdsharp/namespace_alias.h | 10 + include/stdsharp/pattern_match.h | 26 +- include/stdsharp/random/random.h | 2 +- include/stdsharp/ranges/ranges.h | 14 +- include/stdsharp/reflection/reflection.h | 18 +- include/stdsharp/scope.h | 14 +- include/stdsharp/type_traits/indexed_traits.h | 81 ++-- include/stdsharp/type_traits/member.h | 4 +- include/stdsharp/type_traits/object.h | 14 +- include/stdsharp/type_traits/special_member.h | 36 +- include/stdsharp/type_traits/type_sequence.h | 30 +- include/stdsharp/type_traits/value_sequence.h | 156 ++++---- include/stdsharp/utility/constructor.h | 12 +- .../stdsharp/utility/implement_dispatcher.h | 8 +- include/stdsharp/utility/invocable.h | 38 +- include/stdsharp/utility/utility.h | 7 +- include/stdsharp/utility/value_wrapper.h | 19 +- 51 files changed, 1137 insertions(+), 1152 deletions(-) create mode 100644 include/stdsharp/namespace_alias.h diff --git a/include/stdsharp/algorithm/algorithm.h b/include/stdsharp/algorithm/algorithm.h index d0155e37..accf705b 100644 --- a/include/stdsharp/algorithm/algorithm.h +++ b/include/stdsharp/algorithm/algorithm.h @@ -10,22 +10,22 @@ namespace stdsharp { - inline constexpr auto set_if = [] Comp> - requires ::std::assignable_from // clang-format off + inline constexpr auto set_if = [] Comp> + requires std::assignable_from // clang-format off (T& left, U&& right, Comp comp = {}) noexcept(nothrow_predicate && nothrow_assignable_from) -> T& // clang-format on { - if(::std::invoke(cpp_move(comp), right, left)) left = cpp_forward(right); + if(std::invoke(cpp_move(comp), right, left)) left = cpp_forward(right); return left; }; using set_if_fn = decltype(set_if); inline constexpr auto set_if_greater = [] - requires ::std::invocable // clang-format off + requires std::invocable // clang-format off (T & left, U && right) - noexcept(nothrow_invocable) -> T& // clang-format on + noexcept(nothrow_invocable) -> T& // clang-format on { return set_if(left, cpp_forward(right), greater_v); }; @@ -33,9 +33,9 @@ namespace stdsharp using set_if_greater_fn = decltype(set_if_greater); inline constexpr auto set_if_less = [] - requires ::std::invocable // clang-format off + requires std::invocable // clang-format off (T& left, U&& right) - noexcept(nothrow_invocable) -> T& // clang-format on + noexcept(nothrow_invocable) -> T& // clang-format on { return set_if(left, cpp_forward(right), less_v); }; @@ -46,9 +46,9 @@ namespace stdsharp { template< typename T, - typename Proj = ::std::identity, - ::std::indirect_strict_weak_order<::std::projected> Compare = - ::std::ranges::less // clang-format off + typename Proj = std::identity, + std::indirect_strict_weak_order> Compare = + std::ranges::less // clang-format off > // clang-format on [[nodiscard]] constexpr auto operator()( // NOLINTBEGIN(*-easily-swappable-parameters) const T& t, @@ -61,33 +61,33 @@ namespace stdsharp !is_debug || nothrow_predicate< Compare, - ::std::projected, - ::std::projected // clang-format off + std::projected, + std::projected // clang-format off > // clang-format on ) { - const auto& proj_max = ::std::invoke(proj, max); - const auto& proj_min = ::std::invoke(proj, min); - const auto& proj_t = ::std::invoke(proj, t); + const auto& proj_max = std::invoke(proj, max); + const auto& proj_min = std::invoke(proj, min); + const auto& proj_t = std::invoke(proj, t); - precondition<::std::invalid_argument>( - [&] { return !::std::invoke(cmp, proj_max, proj_min); }, + precondition( + [&] { return !std::invoke(cmp, proj_max, proj_min); }, "max value should not less than min value" ); - return !::std::invoke(cmp, proj_t, proj_min) && !::std::invoke(cmp, proj_max, proj_t); + return !std::invoke(cmp, proj_t, proj_min) && !std::invoke(cmp, proj_max, proj_t); } } is_between{}; constexpr struct strict_compare_fn { - template<::std::ranges::input_range TRng, ::std::ranges::input_range URng> - requires ::std::three_way_comparable_with< + template + requires std::three_way_comparable_with< range_const_reference_t, range_const_reference_t> constexpr auto operator()(const TRng& left, const URng& right) const { - using ordering = ::std::partial_ordering; + using ordering = std::partial_ordering; auto pre = ordering::equivalent; const auto cmp_impl = [](ordering& pre, const ordering next) @@ -106,10 +106,10 @@ namespace stdsharp }; { - auto l_it = ::std::ranges::cbegin(left); - auto r_it = ::std::ranges::cbegin(right); - const auto l_end = ::std::ranges::cend(left); - const auto r_end = ::std::ranges::cend(right); + auto l_it = std::ranges::cbegin(left); + auto r_it = std::ranges::cbegin(right); + const auto l_end = std::ranges::cend(left); + const auto r_end = std::ranges::cend(right); for(; !is_ud(pre); ++l_it, ++r_it) { if(l_it == l_end) @@ -124,7 +124,7 @@ namespace stdsharp break; } - cmp_impl(pre, ::std::compare_three_way{}(*l_it, *r_it)); + cmp_impl(pre, std::compare_three_way{}(*l_it, *r_it)); } } diff --git a/include/stdsharp/array/array.h b/include/stdsharp/array/array.h index b10943e7..95a39270 100644 --- a/include/stdsharp/array/array.h +++ b/include/stdsharp/array/array.h @@ -8,20 +8,20 @@ namespace stdsharp { - template<::std::size_t N> + template struct range_to_array_fn { - template + template constexpr auto operator()(Rng&& rng, Proj proj = {}) const { - using value_type = ::std::projected<::std::ranges::iterator_t, Proj>::value_type; + using value_type = std::projected, Proj>::value_type; - ::std::array arr{}; + std::array arr{}; - ::std::ranges::copy( + std::ranges::copy( cpp_forward(rng) | // - ::std::views::transform(proj) | // - ::std::views::take(N), + std::views::transform(proj) | // + std::views::take(N), arr.begin() ); @@ -29,6 +29,6 @@ namespace stdsharp } }; - template<::std::size_t N> + template inline constexpr range_to_array_fn range_to_array{}; } \ No newline at end of file diff --git a/include/stdsharp/cassert/cassert.h b/include/stdsharp/cassert/cassert.h index 1e14bb8b..6a878e09 100644 --- a/include/stdsharp/cassert/cassert.h +++ b/include/stdsharp/cassert/cassert.h @@ -16,18 +16,18 @@ namespace stdsharp ; template - requires ::std::constructible_from && - ::std::predicate && is_debug + requires std::constructible_from && std::predicate && + is_debug constexpr void precondition(const Predicate& predicate, Args&&... args) { - ::std::invoke(predicate) ? void() : throw Exception{static_cast(args)...}; // NOLINT + std::invoke(predicate) ? void() : throw Exception{static_cast(args)...}; // NOLINT } template - requires ::std::predicate + requires std::predicate constexpr void precondition([[maybe_unused]] const Predicate& predicate, auto&&...) noexcept { - STDSHARP_ASSUME(::std::invoke(predicate)); + STDSHARP_ASSUME(std::invoke(predicate)); } } diff --git a/include/stdsharp/cmath/cmath.h b/include/stdsharp/cmath/cmath.h index 7eed8d0a..79207ed3 100644 --- a/include/stdsharp/cmath/cmath.h +++ b/include/stdsharp/cmath/cmath.h @@ -5,7 +5,7 @@ namespace stdsharp { - constexpr auto ceil_reminder(const ::std::integral auto x, decltype(x) y) noexcept + constexpr auto ceil_reminder(const std::integral auto x, decltype(x) y) noexcept { return (x + y - 1) / y; } diff --git a/include/stdsharp/compare/compare.h b/include/stdsharp/compare/compare.h index 98b24983..6253f7de 100644 --- a/include/stdsharp/compare/compare.h +++ b/include/stdsharp/compare/compare.h @@ -4,8 +4,8 @@ namespace stdsharp { - constexpr bool is_ud(const ::std::partial_ordering c) noexcept + constexpr bool is_ud(const std::partial_ordering c) noexcept { - return c == ::std::partial_ordering::unordered; + return c == std::partial_ordering::unordered; } } \ No newline at end of file diff --git a/include/stdsharp/concepts/concepts.h b/include/stdsharp/concepts/concepts.h index cee7e3fd..e4b397b2 100644 --- a/include/stdsharp/concepts/concepts.h +++ b/include/stdsharp/concepts/concepts.h @@ -8,168 +8,168 @@ #include #include "../macros.h" +#include "../namespace_alias.h" namespace stdsharp { template - concept same_as_any = (::std::same_as || ...); + concept same_as_any = (std::same_as || ...); template - concept all_same = (::std::same_as && ...); + concept all_same = (std::same_as && ...); template - concept enum_ = ::std::is_enum_v; + concept enum_ = std::is_enum_v; template - concept reference = ::std::is_reference_v; + concept reference = std::is_reference_v; template - concept lvalue_ref = ::std::is_lvalue_reference_v; + concept lvalue_ref = std::is_lvalue_reference_v; template - concept rvalue_ref = ::std::is_rvalue_reference_v; + concept rvalue_ref = std::is_rvalue_reference_v; template - concept const_ = ::std::is_const_v; + concept const_ = std::is_const_v; template - concept const_lvalue_ref = - ::std::is_lvalue_reference_v && const_<::std::remove_reference_t>; + concept const_lvalue_ref = std::is_lvalue_reference_v && const_>; template - concept volatile_ = ::std::is_volatile_v; + concept volatile_ = std::is_volatile_v; template concept const_volatile = const_ && volatile_; template - concept abstract = ::std::is_abstract_v; + concept abstract = std::is_abstract_v; template - concept aggregate = ::std::is_aggregate_v; + concept aggregate = std::is_aggregate_v; template concept character = same_as_any; template - concept arithmetic = ::std::is_arithmetic_v; + concept arithmetic = std::is_arithmetic_v; template - concept signed_ = ::std::is_signed_v; + concept signed_ = std::is_signed_v; template - concept empty_type = ::std::is_empty_v; + concept empty_type = std::is_empty_v; template - concept unsigned_ = ::std::is_unsigned_v; + concept unsigned_ = std::is_unsigned_v; template - concept floating_point = ::std::is_floating_point_v; + concept floating_point = std::is_floating_point_v; template concept arithmetic_like = - ::std::three_way_comparable && requires(T t1, U t2) { // clang-format off - { t1 + t2 } -> ::std::same_as; - { t1 - t2 } -> ::std::same_as; - { t1 * t2 } -> ::std::same_as; - { t1 / t2 } -> ::std::same_as; - { t1 % t2 } -> ::std::same_as; - { t1 & t2 } -> ::std::same_as; - { t1 | t2 } -> ::std::same_as; - { t1 ^ t2 } -> ::std::same_as; - { t1 << t2 } -> ::std::same_as; - { t1 >> t2 } -> ::std::same_as; - { t1 += t2 } -> ::std::same_as; - { t1 -= t2 } -> ::std::same_as; - { t1 *= t2 } -> ::std::same_as; - { t1 /= t2 } -> ::std::same_as; - { t1 %= t2 } -> ::std::same_as; - { t1 &= t2 } -> ::std::same_as; - { t1 |= t2 } -> ::std::same_as; - { t1 ^= t2 } -> ::std::same_as; - { t1 <<= t2 } -> ::std::same_as; - { t1 >>= t2 } -> ::std::same_as; + std::three_way_comparable && requires(T t1, U t2) { // clang-format off + { t1 + t2 } -> std::same_as; + { t1 - t2 } -> std::same_as; + { t1 * t2 } -> std::same_as; + { t1 / t2 } -> std::same_as; + { t1 % t2 } -> std::same_as; + { t1 & t2 } -> std::same_as; + { t1 | t2 } -> std::same_as; + { t1 ^ t2 } -> std::same_as; + { t1 << t2 } -> std::same_as; + { t1 >> t2 } -> std::same_as; + { t1 += t2 } -> std::same_as; + { t1 -= t2 } -> std::same_as; + { t1 *= t2 } -> std::same_as; + { t1 /= t2 } -> std::same_as; + { t1 %= t2 } -> std::same_as; + { t1 &= t2 } -> std::same_as; + { t1 |= t2 } -> std::same_as; + { t1 ^= t2 } -> std::same_as; + { t1 <<= t2 } -> std::same_as; + { t1 >>= t2 } -> std::same_as; }; template - concept fundamental_array = ::std::is_array_v; + concept fundamental_array = std::is_array_v; template - concept base_of = ::std::is_base_of_v; + concept base_of = std::is_base_of_v; template - concept class_ = ::std::is_class_v; + concept class_ = std::is_class_v; template - concept function = ::std::is_function_v; + concept function = std::is_function_v; template - concept pointer = ::std::is_pointer_v; + concept pointer = std::is_pointer_v; template - concept fundamental = ::std::is_fundamental_v; + concept fundamental = std::is_fundamental_v; template - concept scalar = ::std::is_scalar_v; + concept scalar = std::is_scalar_v; template - concept object = ::std::is_object_v; + concept object = std::is_object_v; template - concept compound = ::std::is_compound_v; + concept compound = std::is_compound_v; template - concept member_object_pointer = ::std::is_member_object_pointer_v; + concept member_object_pointer = std::is_member_object_pointer_v; template - concept member_function_pointer = ::std::is_member_function_pointer_v; + concept member_function_pointer = std::is_member_function_pointer_v; template - concept member_pointer = ::std::is_member_pointer_v; + concept member_pointer = std::is_member_pointer_v; template - concept polymorphic = ::std::is_polymorphic_v; + concept polymorphic = std::is_polymorphic_v; template - concept final = ::std::is_final_v; + concept final = std::is_final_v; template concept inheritable = class_ && !final; template - concept trivial = ::std::is_trivial_v; + concept trivial = std::is_trivial_v; template - concept assignable = ::std::is_assignable_v; + concept assignable = std::is_assignable_v; template - concept assignable_to = ::std::assignable_from; + concept assignable_to = std::assignable_from; template - concept move_assignable = ::std::assignable_from<::std::add_lvalue_reference_t, T>; + concept move_assignable = std::assignable_from, T>; template concept copy_assignable = move_assignable && // - ::std::assignable_from<::std::add_lvalue_reference_t, ::std::add_const_t> && // - ::std::assignable_from, - ::std::add_lvalue_reference_t + std::assignable_from, std::add_const_t> && // + std::assignable_from, + std::add_lvalue_reference_t > && - ::std::assignable_from< // - ::std::add_lvalue_reference_t, - ::std::add_lvalue_reference_t<::std::add_const_t> + std::assignable_from< // + std::add_lvalue_reference_t, + std::add_lvalue_reference_t> >; template // clang-format off - concept boolean_testable = ::std::convertible_to && requires(B&& b) + concept boolean_testable = std::convertible_to && requires(B&& b) { - { !cpp_forward(b) } -> ::std::convertible_to; + { !cpp_forward(b) } -> std::convertible_to; }; // clang-format on template concept weakly_equality_comparable_with = requires( - const ::std::remove_reference_t& t, - const ::std::remove_reference_t& u + const std::remove_reference_t& t, + const std::remove_reference_t& u ) // clang-format off { { t == u } -> boolean_testable; @@ -180,8 +180,8 @@ namespace stdsharp template concept nothrow_weakly_equality_comparable_with = weakly_equality_comparable_with && - requires(const ::std::remove_reference_t& t, - const ::std::remove_reference_t& u) // + requires(const std::remove_reference_t& t, + const std::remove_reference_t& u) // { noexcept(t == u); noexcept(t != u); @@ -197,8 +197,8 @@ namespace stdsharp template concept partial_ordered_with = requires( - const ::std::remove_reference_t& t, - const ::std::remove_reference_t& u + const std::remove_reference_t& t, + const std::remove_reference_t& u ) // clang-format off { { t < u } -> boolean_testable; @@ -212,111 +212,109 @@ namespace stdsharp }; template - concept list_initializable_from = requires { T{::std::declval()...}; }; + concept list_initializable_from = requires { T{std::declval()...}; }; template concept nothrow_list_initializable_from = - requires { requires noexcept(T{::std::declval()...}); }; + requires { requires noexcept(T{std::declval()...}); }; template - concept implicitly_constructible_from = ::std::constructible_from && - requires { ::std::declval()({::std::declval()...}); }; + concept implicitly_constructible_from = std::constructible_from && + requires { std::declval()({std::declval()...}); }; template concept implicitly_move_constructible = - ::std::move_constructible && implicitly_constructible_from; + std::move_constructible && implicitly_constructible_from; template - concept implicitly_copy_constructible = ::std::copy_constructible && // + concept implicitly_copy_constructible = std::copy_constructible && // implicitly_move_constructible && // implicitly_constructible_from && // implicitly_constructible_from && // implicitly_constructible_from; template - concept trivial_copyable = ::std::is_trivially_copyable_v; + concept trivial_copyable = std::is_trivially_copyable_v; template - concept trivial_constructible = ::std::is_trivially_constructible_v; + concept trivial_constructible = std::is_trivially_constructible_v; template - concept trivial_copy_constructible = ::std::is_trivially_copy_constructible_v; + concept trivial_copy_constructible = std::is_trivially_copy_constructible_v; template - concept trivial_copy_assignable = ::std::is_trivially_copy_assignable_v; + concept trivial_copy_assignable = std::is_trivially_copy_assignable_v; template - concept trivial_move_constructible = ::std::is_trivially_move_constructible_v; + concept trivial_move_constructible = std::is_trivially_move_constructible_v; template - concept trivial_move_assignable = ::std::is_trivially_move_assignable_v; + concept trivial_move_assignable = std::is_trivially_move_assignable_v; template - concept not_same_as = !::std::same_as; + concept not_same_as = !std::same_as; template - concept decay_same_as = ::std::same_as<::std::decay_t, U>; + concept decay_same_as = std::same_as, U>; template - concept decay_constructible = ::std::constructible_from<::std::decay_t, T>; + concept decay_constructible = std::constructible_from, T>; template - concept nothrow_constructible_from = ::std::is_nothrow_constructible_v; + concept nothrow_constructible_from = std::is_nothrow_constructible_v; template - concept nothrow_decay_constructible = nothrow_constructible_from<::std::decay_t, T>; + concept nothrow_decay_constructible = nothrow_constructible_from, T>; template concept nothrow_default_initializable = - ::std::default_initializable && ::std::is_nothrow_default_constructible_v; + std::default_initializable && std::is_nothrow_default_constructible_v; template - concept nothrow_move_constructible = ::std::is_nothrow_move_constructible_v; + concept nothrow_move_constructible = std::is_nothrow_move_constructible_v; template - concept nothrow_copy_constructible = ::std::is_nothrow_copy_constructible_v; + concept nothrow_copy_constructible = std::is_nothrow_copy_constructible_v; template - concept nothrow_assignable = ::std::is_nothrow_assignable_v; + concept nothrow_assignable = std::is_nothrow_assignable_v; template - concept nothrow_assignable_from = ::std::is_nothrow_assignable_v; + concept nothrow_assignable_from = std::is_nothrow_assignable_v; template - concept nothrow_copy_assignable = ::std::is_nothrow_copy_assignable_v; + concept nothrow_copy_assignable = std::is_nothrow_copy_assignable_v; template - concept nothrow_move_assignable = ::std::is_nothrow_move_assignable_v; + concept nothrow_move_assignable = std::is_nothrow_move_assignable_v; template concept nothrow_swappable_with = - requires(T& t, U& u) { requires noexcept(::std::ranges::swap(t, u)); }; + requires(T& t, U& u) { requires noexcept(std::ranges::swap(t, u)); }; template concept nothrow_swappable = nothrow_swappable_with; template - concept nothrow_movable = ::std::movable && // + concept nothrow_movable = std::movable && // nothrow_move_constructible && - nothrow_assignable_from<::std::add_lvalue_reference_t, T> && // + nothrow_assignable_from, T> && // nothrow_swappable; template - concept nothrow_copyable = - nothrow_movable && // + concept nothrow_copyable = nothrow_movable && // nothrow_copy_constructible && // nothrow_assignable_from< // - ::std::add_lvalue_reference_t, - ::std::add_lvalue_reference_t // clang-format off + std::add_lvalue_reference_t, + std::add_lvalue_reference_t // clang-format off > && // clang-format on - nothrow_assignable_from<::std::add_lvalue_reference_t, ::std::add_const_t> && - nothrow_assignable_from< - ::std::add_lvalue_reference_t, - ::std::add_lvalue_reference_t<::std::add_const_t> // clang-format off + nothrow_assignable_from, std::add_const_t> && + nothrow_assignable_from, + std::add_lvalue_reference_t> // clang-format off >; // clang-format on template - concept nothrow_convertible_to = ::std::is_nothrow_convertible_v; + concept nothrow_convertible_to = std::is_nothrow_convertible_v; template concept explicitly_convertible = requires(From&& v) { static_cast(cpp_forward(v)); }; @@ -332,13 +330,13 @@ namespace stdsharp concept nothrow_explicitly_convertible_from = nothrow_explicitly_convertible; template - concept convertible_from = ::std::convertible_to; + concept convertible_from = std::convertible_to; template - concept nothrow_convertible_from = ::std::is_nothrow_convertible_v; + concept nothrow_convertible_from = std::is_nothrow_convertible_v; template - concept inter_convertible = ::std::convertible_to && convertible_from; + concept inter_convertible = std::convertible_to && convertible_from; template concept nothrow_inter_convertible = @@ -353,13 +351,13 @@ namespace stdsharp nothrow_explicitly_convertible && nothrow_explicitly_convertible_from; template - concept nothrow_invocable = ::std::is_nothrow_invocable_v; + concept nothrow_invocable = std::is_nothrow_invocable_v; template - concept invocable_r = ::std::is_invocable_r_v; + concept invocable_r = std::is_invocable_r_v; template - concept nothrow_invocable_r = ::std::is_nothrow_invocable_r_v; + concept nothrow_invocable_r = std::is_nothrow_invocable_r_v; template concept nothrow_predicate = nothrow_invocable_r; @@ -374,14 +372,14 @@ namespace stdsharp concept const_ref_aligned = const_aligned && ref_aligned; template - concept nullable_pointer = ::std::default_initializable && // - ::std::copy_constructible && // + concept nullable_pointer = std::default_initializable && // + std::copy_constructible && // copy_assignable && // - ::std::equality_comparable && // - weakly_equality_comparable_with; + std::equality_comparable && // + weakly_equality_comparable_with; template - concept referenceable = requires { typename ::std::add_lvalue_reference; }; + concept referenceable = requires { typename std::add_lvalue_reference; }; template // clang-format off concept dereferenceable = requires(T& t) { { *t } -> referenceable; }; // clang-format on diff --git a/include/stdsharp/concurrent_object.h b/include/stdsharp/concurrent_object.h index 74ed10d0..736ae3cb 100644 --- a/include/stdsharp/concurrent_object.h +++ b/include/stdsharp/concurrent_object.h @@ -10,12 +10,12 @@ namespace stdsharp { - template + template requires basic_lockable class concurrent_object { public: - using value_type = ::std::optional; + using value_type = std::optional; private: template @@ -38,7 +38,7 @@ namespace stdsharp template static constexpr bool other_assignable = - requires(value_type obj) { assign_value(obj, ::std::declval()); }; + requires(value_type obj) { assign_value(obj, std::declval()); }; static constexpr bool copy_assignable = other_assignable; static constexpr bool move_assignable = other_assignable; @@ -63,8 +63,8 @@ namespace stdsharp template constexpr void operator()(This&& instance, Func&& func) const { - const ::std::shared_lock lock{instance.lockable()}; - ::std::invoke(cpp_forward(func), cpp_forward(instance).object_); + const std::shared_lock lock{instance.lockable()}; + std::invoke(cpp_forward(func), cpp_forward(instance).object_); } }; @@ -73,14 +73,14 @@ namespace stdsharp template constexpr void operator()(concurrent_object&& instance, Func&& func) const { - ::std::invoke(cpp_forward(func), cpp_move(instance).object_); + std::invoke(cpp_forward(func), cpp_move(instance).object_); } template constexpr void operator()(concurrent_object& instance, Func&& func) const { - const ::std::unique_lock lock{instance.lockable()}; - ::std::invoke(cpp_forward(func), instance.object_); + const std::unique_lock lock{instance.lockable()}; + std::invoke(cpp_forward(func), instance.object_); } }; @@ -90,18 +90,18 @@ namespace stdsharp concurrent_object() = default; template - requires ::std::constructible_from && ::std::default_initializable + requires std::constructible_from && std::default_initializable explicit constexpr concurrent_object(Args&&... t_arg): object_(cpp_forward(t_arg)...) { } template - requires ::std::constructible_from && - ::std::constructible_from + requires std::constructible_from && + std::constructible_from explicit constexpr concurrent_object( - const ::std::piecewise_construct_t tag, - ::std::tuple t_arg, - ::std::tuple lock_arg + const std::piecewise_construct_t tag, + std::tuple t_arg, + std::tuple lock_arg ): object_(cpp_forward(t_arg)), lockable_(tag, cpp_move(lock_arg)) { @@ -151,38 +151,36 @@ namespace stdsharp template constexpr void swap(concurrent_object& other) // - requires ::std::swappable_with< + requires std::swappable_with< value_type, - typename ::std::remove_reference_t::value_type // clang-format off + typename std::remove_reference_t::value_type // clang-format off > // clang-format on { write( [&other](value_type& obj) // - { - other.write([&obj](auto& other_obj) { ::std::ranges::swap(obj, other_obj); }); - } // + { other.write([&obj](auto& other_obj) { std::ranges::swap(obj, other_obj); }); } // ); } - template<::std::invocable Func> + template Func> constexpr void read(Func&& func) const& { read_fn{}(*this, cpp_forward(func)); } - template<::std::invocable Func> + template Func> constexpr void read(Func&& func) const&& { read_fn{}(static_cast(*this), cpp_forward(func)); } - template<::std::invocable Func> + template Func> constexpr void write(Func&& func) & { write_fn{}(*this, cpp_forward(func)); } - template<::std::invocable Func> + template Func> constexpr void write(Func&& func) && { write_fn{}(cpp_move(*this), cpp_forward(func)); @@ -191,14 +189,14 @@ namespace stdsharp constexpr const auto& lockable() const noexcept { return lockable_; } private: - ::std::optional object_{}; + std::optional object_{}; mutable Lockable lockable_{}; constexpr auto& lockable() noexcept { return lockable_; } }; template - concurrent_object(T&&) -> concurrent_object<::std::decay_t>; + concurrent_object(T&&) -> concurrent_object>; namespace reflection { diff --git a/include/stdsharp/containers/actions.h b/include/stdsharp/containers/actions.h index aef0473d..7acf52f4 100644 --- a/include/stdsharp/containers/actions.h +++ b/include/stdsharp/containers/actions.h @@ -44,8 +44,8 @@ namespace stdsharp::actions template constexpr auto operator()( Container& container, - const ::std::equality_comparable_with< // clang-format off - typename ::std::decay_t::value_type + const std::equality_comparable_with< // clang-format off + typename std::decay_t::value_type > auto& value // clang-format on ) const requires requires // clang-format off @@ -61,8 +61,8 @@ namespace stdsharp::actions requires associative_like_container constexpr auto operator()( Container& container, - const ::std::equality_comparable_with< - typename ::std::decay_t::key_type // clang-format off + const std::equality_comparable_with< + typename std::decay_t::key_type // clang-format off > auto& key // clang-format on ) const { @@ -71,7 +71,7 @@ namespace stdsharp::actions template< container_erasable Container, - ::std::convertible_to< + std::convertible_to< actions::details::container_citer // clang-format off >... ConstIter > // clang-format on @@ -109,7 +109,7 @@ namespace stdsharp::actions struct emplace_##where##_default_fn \ { \ template \ - requires ::std::invocable< \ + requires std::invocable< \ emplace_fn, \ Container&, \ details::container_citer, \ @@ -123,11 +123,11 @@ namespace stdsharp::actions struct emplace_##where##_mem_fn \ { \ template Container> \ - constexpr typename ::std::decay_t::reference \ + constexpr typename std::decay_t::reference \ operator()(Container& container, Args&&... args) const \ requires requires { \ requires stdsharp::container; \ - container.emplace_##where(::std::declval()...); \ + container.emplace_##where(std::declval()...); \ } \ { \ return container.emplace_##where(cpp_forward(args)...); \ @@ -160,9 +160,9 @@ namespace stdsharp::actions constexpr auto operator()(Container& container, Predicate&& predicate_fn) const requires requires // { - requires ::std::same_as< - decltype(erase_if(container, ::std::declval())), - ::std::ranges::range_size_t // clang-format off + requires std::same_as< + decltype(erase_if(container, std::declval())), + std::ranges::range_size_t // clang-format off >; // clang-format on } { @@ -178,9 +178,8 @@ namespace stdsharp::actions > // clang-format on requires requires // { - requires ::std:: - invocable; - requires ::std::invocable< + requires std::invocable; + requires std::invocable< cpo::erase_fn, Container&, actions::details::container_citer, @@ -189,7 +188,7 @@ namespace stdsharp::actions } constexpr auto operator()(Container& container, Predicate&& predicate_fn) const { - const auto& it = ::std::ranges::remove_if(container, cpp_forward(predicate_fn)); + const auto& it = std::ranges::remove_if(container, cpp_forward(predicate_fn)); const auto removed_size = it.size(); cpo::erase(container, it.begin(), it.end()); return removed_size; @@ -206,7 +205,7 @@ namespace stdsharp::actions inline constexpr struct resize_fn { template - using size_type = ::std::ranges::range_size_t; + using size_type = std::ranges::range_size_t; template constexpr void operator()(Container& container, const size_type size) const @@ -222,7 +221,7 @@ namespace stdsharp::actions struct pop_##where##_default_fn \ { \ template \ - requires ::std:: \ + requires std:: \ invocable> \ constexpr void operator()(Container& container) const \ { \ @@ -236,7 +235,7 @@ namespace stdsharp::actions constexpr void operator()(Container& container) const \ requires requires { \ requires sequence_container; \ - requires ::std::same_as; \ + requires std::same_as; \ } \ { \ return container.pop_##where(); \ @@ -261,7 +260,7 @@ namespace stdsharp::actions { private: template< - ::std::size_t Count, + std::size_t Count, auto HasMember = requires(Container container) { container.reserve(Count); }> static constexpr auto reserved(Container& container) noexcept(!HasMember) { @@ -270,7 +269,7 @@ namespace stdsharp::actions public: template - requires(::std::invocable && ...) + requires(std::invocable && ...) constexpr auto operator()(Args&&... args) const noexcept( // (nothrow_invocable&&...) && // noexcept(reserved()) @@ -283,7 +282,7 @@ namespace stdsharp::actions } template - requires(::std::invocable && ...) + requires(std::invocable && ...) constexpr auto operator()(Args&&... args) const noexcept( // (nothrow_invocable&&...) && // noexcept(reserved()) @@ -308,21 +307,21 @@ namespace stdsharp::actions template struct make_container_from_tuple_fn { - template> + template> requires requires // { - ::std::apply(regular_make_container_fn{}, ::std::declval()); // + std::apply(regular_make_container_fn{}, std::declval()); // } constexpr auto operator()( - const ::std::piecewise_construct_t, + const std::piecewise_construct_t, Tuple&& tuple ) const noexcept( // noexcept( // - ::std::apply(regular_make_container_fn{}, ::std::declval()) + std::apply(regular_make_container_fn{}, std::declval()) ) ) { - return ::std::apply(regular_make_container_fn{}, cpp_forward(tuple)); + return std::apply(regular_make_container_fn{}, cpp_forward(tuple)); } }; } diff --git a/include/stdsharp/containers/concepts.h b/include/stdsharp/containers/concepts.h index e7121d73..b8ddfb56 100644 --- a/include/stdsharp/containers/concepts.h +++ b/include/stdsharp/containers/concepts.h @@ -17,21 +17,21 @@ namespace stdsharp { template - struct allocator_of<::std::array> + struct allocator_of> { - using type = ::std::allocator; + using type = std::allocator; }; template concept erasable = requires(Allocator allocator_instance, ValueType* ptr) // { requires allocator_req; - requires ::std::same_as< + requires std::same_as< Allocator, typename allocator_traits:: // template rebind_alloc // clang-format off >; // clang-format on - requires ::std::destructible; + requires std::destructible; allocator_traits::destroy(allocator_instance, ptr); }; @@ -46,8 +46,8 @@ namespace stdsharp concept container_erasable = requires // { requires erasable< - typename ::std::decay_t::value_type, - allocator_of_t<::std::decay_t> // clang-format off + typename std::decay_t::value_type, + allocator_of_t> // clang-format off >; // clang-format on }; @@ -55,8 +55,8 @@ namespace stdsharp concept container_nothrow_erasable = requires // { requires nothrow_erasable< - typename ::std::decay_t::value_type, - allocator_of_t<::std::decay_t> // clang-format off + typename std::decay_t::value_type, + allocator_of_t> // clang-format off >; // clang-format on }; @@ -64,12 +64,12 @@ namespace stdsharp concept move_insertable = requires(Allocator allocator_instance, ValueType* ptr, ValueType&& rv) // { - requires ::std::same_as< + requires std::same_as< Allocator, typename allocator_traits:: // template rebind_alloc // clang-format off >; // clang-format on - requires ::std::move_constructible; + requires std::move_constructible; allocator_traits::construct(allocator_instance, ptr, cpp_move(rv)); }; @@ -88,8 +88,8 @@ namespace stdsharp concept container_move_insertable = requires // { requires move_insertable< - typename ::std::decay_t::value_type, // clang-format off - allocator_of_t<::std::decay_t> + typename std::decay_t::value_type, // clang-format off + allocator_of_t> >; // clang-format on }; @@ -97,15 +97,15 @@ namespace stdsharp concept container_nothrow_move_insertable = requires // { requires nothrow_move_insertable< - typename ::std::decay_t::value_type, - allocator_of_t<::std::decay_t> // clang-format off + typename std::decay_t::value_type, + allocator_of_t> // clang-format off >; // clang-format on }; template concept copy_insertable = requires(Allocator allocator_instance, ValueType* ptr, ValueType v) // { - requires move_insertable && ::std::copy_constructible; + requires move_insertable && std::copy_constructible; allocator_traits::construct(allocator_instance, ptr, v); }; @@ -122,8 +122,8 @@ namespace stdsharp concept container_copy_insertable = requires // { requires copy_insertable< - typename ::std::decay_t::value_type, - allocator_of_t<::std::decay_t> // clang-format off + typename std::decay_t::value_type, + allocator_of_t> // clang-format off >; // clang-format on }; @@ -131,8 +131,8 @@ namespace stdsharp concept container_nothrow_copy_insertable = requires // { requires nothrow_copy_insertable< - typename ::std::decay_t::value_type, - allocator_of_t<::std::decay_t> // clang-format off + typename std::decay_t::value_type, + allocator_of_t> // clang-format off >; // clang-format on }; @@ -140,12 +140,12 @@ namespace stdsharp concept emplace_constructible = requires(Allocator allocator_instance, ValueType* ptr, Args&&... args) // { - requires ::std::same_as< + requires std::same_as< Allocator, typename allocator_traits:: // template rebind_alloc // clang-format off >; // clang-format on - requires ::std::constructible_from; + requires std::constructible_from; allocator_traits::construct(allocator_instance, ptr, cpp_forward(args)...); }; @@ -163,8 +163,8 @@ namespace stdsharp concept container_emplace_constructible = requires // { requires emplace_constructible< - typename ::std::decay_t::value_type, - allocator_of_t<::std::decay_t>, + typename std::decay_t::value_type, + allocator_of_t>, Args... // clang-format off >; // clang-format on }; @@ -173,8 +173,8 @@ namespace stdsharp concept container_nothrow_emplace_constructible = requires // { requires nothrow_emplace_constructible< - typename ::std::decay_t::value_type, - allocator_of_t<::std::decay_t>, + typename std::decay_t::value_type, + allocator_of_t>, Args... // clang-format off >; // clang-format on }; @@ -183,21 +183,21 @@ namespace stdsharp { template concept iterator_identical = requires( - ::std::iterator_traits t_traits, - ::std::iterator_traits u_traits + std::iterator_traits t_traits, + std::iterator_traits u_traits ) // { - requires ::std::same_as< + requires std::same_as< typename decltype(t_traits)::value_type, typename decltype(u_traits)::value_type // clang-format off >; // clang-format on - requires ::std::same_as< + requires std::same_as< typename decltype(t_traits)::difference_type, typename decltype(u_traits)::difference_type // clang-format off >; // clang-format on - requires ::std:: + requires std:: same_as; - requires ::std::same_as< + requires std::same_as< typename decltype(t_traits)::reference, typename decltype(u_traits)::reference // clang-format off >; // clang-format on @@ -227,14 +227,14 @@ namespace stdsharp requires // clang-format off { { instance.insert(const_iter, cpp_move(value)) } -> - ::std::same_as; // clang-format on + std::same_as; // clang-format on requires logical_imply( container_copy_insertable, requires // clang-format off { { instance.insert(const_iter, const_value) } -> - ::std::same_as; // clang-format on + std::same_as; // clang-format on } ); } @@ -244,17 +244,17 @@ namespace stdsharp template using insert_return_type = - details::insert_return_type_of<::std::set::insert_return_type>::type; + details::insert_return_type_of::insert_return_type>::type; template concept container = requires // { - typename ::std::decay_t; + typename std::decay_t; requires requires( - ::std::decay_t instance, + std::decay_t instance, const decltype(instance) const_instance, decltype(instance)::value_type value, - ::std::ranges::range_reference_t rng_ref, + std::ranges::range_reference_t rng_ref, decltype(instance)::reference ref, decltype(instance)::const_reference const_ref, decltype(instance)::iterator iter, @@ -263,17 +263,17 @@ namespace stdsharp decltype(instance)::size_type size // clang-format off ) // clang-format on { - requires ::std::ranges::forward_range; + requires std::ranges::forward_range; - requires ::std::destructible; + requires std::destructible; requires logical_imply( (nothrow_default_initializable && ...), nothrow_default_initializable // ) || logical_imply( - (::std::default_initializable && ...), - ::std::default_initializable // + (std::default_initializable && ...), + std::default_initializable // ); requires logical_imply( @@ -282,9 +282,9 @@ namespace stdsharp nothrow_copy_constructible // ) || logical_imply( - (::std::copy_constructible && ...) && + (std::copy_constructible && ...) && container_copy_insertable, - ::std::copy_constructible // + std::copy_constructible // ); requires logical_imply( (nothrow_copy_assignable && ...) && @@ -299,8 +299,8 @@ namespace stdsharp ); requires logical_imply( - (::std::move_constructible && ...), - ::std::move_constructible // + (std::move_constructible && ...), + std::move_constructible // ) || logical_imply( (nothrow_move_constructible && ...), @@ -308,15 +308,15 @@ namespace stdsharp ); requires logical_imply( - ::std::equality_comparable, - ::std::equality_comparable // + std::equality_comparable, + std::equality_comparable // ); requires requires( allocator_of_t alloc, allocator_traits traits, - ::std::bool_constant propagate + std::bool_constant propagate ) // { requires container_erasable; @@ -335,47 +335,46 @@ namespace stdsharp ); }; - requires ::std:: - same_as>; - requires ::std::same_as>; - requires ::std::same_as>; - requires ::std::same_as>; - requires ::std::same_as>; + requires std::same_as>; + requires std::same_as>; + requires std::same_as>; + requires std::same_as>; + requires std::same_as>; { const_instance.cbegin() - } -> ::std::same_as; + } -> std::same_as; { const_instance.cend() - } -> ::std::same_as; + } -> std::same_as; - requires ::std::same_as || - ::std::same_as; - requires ::std::same_as< + requires std::same_as || + std::same_as; + requires std::same_as< decltype(const_ref), range_const_reference_t // clang-format off >; // clang-format on - requires ::std::signed_integral; - requires ::std:: - same_as>; - requires ::std::unsigned_integral; + requires std::signed_integral; + requires std:: + same_as>; + requires std::unsigned_integral; requires requires // { - [](::std::forward_list*) {}(&instance); // + [](std::forward_list*) {}(&instance); // } || requires // { - requires ::std:: - same_as>; + requires std:: + same_as>; }; requires( - ::std::numeric_limits::max() > - ::std::numeric_limits::max() + std::numeric_limits::max() > + std::numeric_limits::max() ); // clang-format off - { instance.max_size() } -> ::std::same_as; - { instance.empty() } -> ::std::convertible_to; // clang-format on + { instance.max_size() } -> std::same_as; + { instance.empty() } -> std::convertible_to; // clang-format on }; }; @@ -383,20 +382,20 @@ namespace stdsharp concept reversible_container = container && requires // { - typename ::std::decay_t; + typename std::decay_t; requires requires( - ::std::decay_t instance, + std::decay_t instance, const decltype(instance)& const_instance, decltype(instance)::reverse_iterator iter, decltype(instance)::const_reverse_iterator const_iter ) // clang-format off { - { instance.rbegin() } -> ::std::same_as; - { instance.rend() } -> ::std::same_as; - { const_instance.rbegin() } -> ::std::same_as; - { const_instance.rend() } -> ::std::same_as; - { instance.crbegin() } -> ::std::same_as; - { instance.crend() } -> ::std::same_as; // clang-format on + { instance.rbegin() } -> std::same_as; + { instance.rend() } -> std::same_as; + { const_instance.rbegin() } -> std::same_as; + { const_instance.rend() } -> std::same_as; + { instance.crbegin() } -> std::same_as; + { instance.crend() } -> std::same_as; // clang-format on }; }; @@ -404,18 +403,18 @@ namespace stdsharp concept allocator_aware_container = requires // { requires requires( - ::std::decay_t instance, + std::decay_t instance, decltype(instance)::value_type value, decltype(instance)::allocator_type alloc ) // { requires allocator_req; requires container; - requires ::std::constructible_from; + requires std::constructible_from; requires logical_imply( container_copy_insertable, - ::std::constructible_from< + std::constructible_from< decltype(instance), const decltype(instance)&, decltype(alloc) // clang-format off @@ -423,16 +422,16 @@ namespace stdsharp ); requires logical_imply( container_move_insertable, - ::std::constructible_from< + std::constructible_from< decltype(instance), decltype(instance), decltype(alloc) // clang-format off > // clang-format on ); - requires ::std::same_as; + requires std::same_as; // clang-format off - { instance.get_allocator() } -> ::std::same_as; // clang-format on + { instance.get_allocator() } -> std::same_as; // clang-format on }; }; @@ -441,7 +440,7 @@ namespace stdsharp requires // { requires requires( - ::std::decay_t instance, + std::decay_t instance, const decltype(instance)& const_instance, decltype(instance)::value_type value, const decltype(value)& const_value, @@ -452,7 +451,7 @@ namespace stdsharp { requires logical_imply( container_copy_insertable, - ::std::constructible_from< + std::constructible_from< decltype(instance), decltype(size), decltype(value) // clang-format off @@ -461,28 +460,28 @@ namespace stdsharp requires logical_imply( container_emplace_constructible, - requires(::std::initializer_list v_list) // + requires(std::initializer_list v_list) // { - requires ::std::constructible_from< + requires std::constructible_from< decltype(instance), decltype(const_iter), decltype(const_iter) // clang-format off >; - requires ::std::constructible_from; - { instance.insert(const_iter, v_list) } -> ::std::same_as; - { instance.assign(v_list) } -> ::std::same_as; + requires std::constructible_from; + { instance.insert(const_iter, v_list) } -> std::same_as; + { instance.assign(v_list) } -> std::same_as; { instance.emplace(const_iter, const_value) } -> - ::std::same_as; + std::same_as; { instance.insert(const_iter, const_iter, const_iter) } -> - ::std::same_as; - { instance.assign(const_iter, const_iter) } -> ::std::same_as; + std::same_as; + { instance.assign(const_iter, const_iter) } -> std::same_as; - { instance.erase(const_iter) } -> ::std::same_as; - { instance.erase(const_iter, const_iter) } -> ::std::same_as; + { instance.erase(const_iter) } -> std::same_as; + { instance.erase(const_iter, const_iter) } -> std::same_as; - { instance.clear() } -> ::std::same_as; // clang-format on + { instance.clear() } -> std::same_as; // clang-format on } ); @@ -493,39 +492,39 @@ namespace stdsharp copy_assignable, // clang-format off requires(decltype(size) n) { - requires ::std::assignable_from< + requires std::assignable_from< decltype(instance)&, - ::std::initializer_list + std::initializer_list >; - { instance.insert(const_iter, n, const_value) } -> ::std::same_as; + { instance.insert(const_iter, n, const_value) } -> std::same_as; - { instance.assign(n, const_value) } -> ::std::same_as; + { instance.assign(n, const_value) } -> std::same_as; } ); - { instance.front() } -> ::std::same_as; + { instance.front() } -> std::same_as; { const_instance.front() } -> - ::std::same_as; // clang-format on + std::same_as; // clang-format on }; }; template concept contiguous_container = - container && ::std::ranges::contiguous_range<::std::decay_t>; + container && std::ranges::contiguous_range>; namespace details { template concept unique_associative = requires( - ::std::decay_t instance, + std::decay_t instance, decltype(instance)::node_type node, decltype(instance)::insert_return_type insert_return_v ) // clang-format off { { instance.insert(cpp_move(node)) } -> - ::std::same_as; - requires ::std::same_as< + std::same_as; + requires std::same_as< decltype(insert_return_v), insert_return_type >; @@ -533,24 +532,24 @@ namespace stdsharp template concept multikey_associative = requires( - ::std::decay_t instance, + std::decay_t instance, decltype(instance)::node_type node ) // clang-format off { { instance.insert(cpp_move(node)) } -> - ::std::same_as; // clang-format on + std::same_as; // clang-format on }; template struct container_optional_constructible { template - static constexpr bool value = ::std::constructible_from; + static constexpr bool value = std::constructible_from; template requires(sizeof...(Optional) > 0) static constexpr bool value = - ::std::constructible_from && + std::constructible_from && [](const basic_type_sequence) consteval // { return value; @@ -564,7 +563,7 @@ namespace stdsharp requires // { requires requires( - ::std::decay_t instance, + std::decay_t instance, const decltype(instance)& const_instance, decltype(instance)::key_type key, decltype(instance)::const_reference const_ref, @@ -573,7 +572,7 @@ namespace stdsharp decltype(instance)::iterator iter, decltype(instance)::const_iterator const_iter, decltype(instance)::size_type size, - ::std::initializer_list v_list + std::initializer_list v_list ) // { requires details::container_insertable; @@ -583,39 +582,39 @@ namespace stdsharp requires // clang-format off { { instance.emplace_hint(const_iter, const_ref) } -> - ::std::same_as; + std::same_as; { instance.insert(const_iter, const_iter) } -> - ::std::same_as; - { instance.insert(v_list) } -> ::std::same_as; + std::same_as; + { instance.insert(v_list) } -> std::same_as; } ); - { instance.extract(const_iter) } -> ::std::same_as; - { instance.extract(key) } -> ::std::same_as; + { instance.extract(const_iter) } -> std::same_as; + { instance.extract(key) } -> std::same_as; - { instance.erase(key) } -> ::std::same_as; + { instance.erase(key) } -> std::same_as; - { instance.find(key) } -> ::std::same_as; - { const_instance.find(key) } -> ::std::same_as; + { instance.find(key) } -> std::same_as; + { const_instance.find(key) } -> std::same_as; - { const_instance.count(key) } -> ::std::same_as; + { const_instance.count(key) } -> std::same_as; - { const_instance.contains(key) } -> ::std::same_as; + { const_instance.contains(key) } -> std::same_as; { instance.equal_range(key) } -> - ::std::same_as<::std::pair>; + std::same_as>; { const_instance.equal_range(key) } -> - ::std::same_as<::std::pair>; + std::same_as>; - { instance.insert(const_iter, cpp_move(node)) } -> ::std::same_as; + { instance.insert(const_iter, cpp_move(node)) } -> std::same_as; - { instance.erase(const_iter) } -> ::std::same_as; - { instance.erase(const_iter, const_iter) } -> ::std::same_as; - { instance.erase(iter) } -> ::std::same_as; + { instance.erase(const_iter) } -> std::same_as; + { instance.erase(const_iter, const_iter) } -> std::same_as; + { instance.erase(iter) } -> std::same_as; - { instance.merge(instance) } -> ::std::same_as; + { instance.merge(instance) } -> std::same_as; - { instance.clear() } -> ::std::same_as; // clang-format on + { instance.clear() } -> std::same_as; // clang-format on }; }; @@ -623,7 +622,7 @@ namespace stdsharp concept associative_container = requires // { requires requires( - ::std::decay_t instance, + std::decay_t instance, const decltype(instance)& const_instance, decltype(instance)::value_type value, decltype(instance)::key_type key, @@ -633,17 +632,17 @@ namespace stdsharp decltype(instance)::iterator iter, decltype(instance)::const_iterator const_iter, decltype(instance)::size_type size, - ::std::initializer_list v_list + std::initializer_list v_list ) // { requires associative_like_container; - requires ::std::copyable; - requires ::std::predicate; - requires ::std::constructible_from; + requires std::copyable; + requires std::predicate; + requires std::constructible_from; - requires ::std::copyable; - requires ::std::predicate; + requires std::copyable; + requires std::predicate; requires logical_imply( container_emplace_constructible, @@ -661,18 +660,18 @@ namespace stdsharp #if (defined __cpp_lib_containers_ranges) && !(defined _MSVC_LANG) requires details::container_optional_constructible< decltype(instance), - ::std::from_range_t, + std::from_range_t, decltype(instance) // clang-format off >::template value; #endif - { instance.key_comp() } -> ::std::same_as; - { instance.value_comp() } -> ::std::same_as; + { instance.key_comp() } -> std::same_as; + { instance.value_comp() } -> std::same_as; - { instance.lower_bound(key) } -> ::std::same_as; - { const_instance.lower_bound(key) } -> ::std::same_as; - { instance.upper_bound(key) } -> ::std::same_as; - { const_instance.upper_bound(key) } -> ::std::same_as; // clang-format on + { instance.lower_bound(key) } -> std::same_as; + { const_instance.lower_bound(key) } -> std::same_as; + { instance.upper_bound(key) } -> std::same_as; + { const_instance.upper_bound(key) } -> std::same_as; // clang-format on }; }; @@ -688,7 +687,7 @@ namespace stdsharp concept unordered_associative_container = requires // { requires requires( - ::std::decay_t instance, + std::decay_t instance, const decltype(instance)& const_instance, decltype(instance)::value_type value, decltype(instance)::key_type key, @@ -703,16 +702,16 @@ namespace stdsharp decltype(instance)::const_local_iterator const_local_iter, decltype(instance)::difference_type diff, decltype(instance)::size_type size, - ::std::initializer_list v_list + std::initializer_list v_list ) // { requires associative_like_container; - requires ::std::copyable; - requires ::std::predicate; + requires std::copyable; + requires std::predicate; - requires ::std::copyable; - requires invocable_r; + requires std::copyable; + requires invocable_r; requires details::iterator_identical; requires details::iterator_identical; @@ -747,7 +746,7 @@ namespace stdsharp #if(defined __cpp_lib_containers_ranges) && !(defined _MSVC_LANG) requires details::container_optional_constructible< decltype(instance), - ::std::from_range_t, + std::from_range_t, decltype(instance) // clang-format off >::template value< decltype(size), @@ -761,37 +760,37 @@ namespace stdsharp requires logical_imply( container_copy_insertable && copy_assignable && - ::std::default_initializable && - ::std::default_initializable && - ::std::default_initializable, - ::std::constructible_from // + std::default_initializable && + std::default_initializable && + std::default_initializable, + std::constructible_from // ); // clang-format off - { instance.key_eq() } -> ::std::same_as; - { instance.hash_function() } -> ::std::same_as; + { instance.key_eq() } -> std::same_as; + { instance.hash_function() } -> std::same_as; - { const_instance.bucket(key) } -> ::std::same_as; - { const_instance.bucket_count() } -> ::std::same_as; - { const_instance.max_bucket_count() } -> ::std::same_as; + { const_instance.bucket(key) } -> std::same_as; + { const_instance.bucket_count() } -> std::same_as; + { const_instance.max_bucket_count() } -> std::same_as; - { instance.max_load_factor(0.0f) } -> ::std::same_as; + { instance.max_load_factor(0.0f) } -> std::same_as; - { const_instance.load_factor() } -> ::std::same_as; - { const_instance.max_load_factor() } -> ::std::same_as; + { const_instance.load_factor() } -> std::same_as; + { const_instance.max_load_factor() } -> std::same_as; - { const_instance.bucket_size(size) } -> ::std::same_as; + { const_instance.bucket_size(size) } -> std::same_as; - { instance.rehash(size) } -> ::std::same_as; + { instance.rehash(size) } -> std::same_as; - { instance.reserve(size) } -> ::std::same_as; + { instance.reserve(size) } -> std::same_as; - { instance.begin(size) } -> ::std::same_as; - { instance.end(size) } -> ::std::same_as; + { instance.begin(size) } -> std::same_as; + { instance.end(size) } -> std::same_as; - { const_instance.begin(size) } -> ::std::same_as; - { const_instance.end(size) } -> ::std::same_as; - { const_instance.cbegin(size) } -> ::std::same_as; - { const_instance.cend(size) } -> ::std::same_as; // clang-format on + { const_instance.begin(size) } -> std::same_as; + { const_instance.end(size) } -> std::same_as; + { const_instance.cbegin(size) } -> std::same_as; + { const_instance.cend(size) } -> std::same_as; // clang-format on }; }; @@ -806,6 +805,5 @@ namespace stdsharp details::multikey_associative; template - concept container_predicatable = - ::std::predicate>; + concept container_predicatable = std::predicate>; } \ No newline at end of file diff --git a/include/stdsharp/cstdint/cstdint.h b/include/stdsharp/cstdint/cstdint.h index e588cb80..9b6523aa 100644 --- a/include/stdsharp/cstdint/cstdint.h +++ b/include/stdsharp/cstdint/cstdint.h @@ -8,24 +8,24 @@ namespace stdsharp { - inline constexpr ::std::size_t char_bit = CHAR_BIT; + inline constexpr std::size_t char_bit = CHAR_BIT; - using byte = ::std::underlying_type_t<::std::byte>; - using i8 = ::std::int8_t; ///< 8-bit signed integer type. - using u8 = ::std::uint8_t; ///< 8-bit unsigned integer type. - using i16 = ::std::int16_t; ///< 16-bit signed integer type. - using u16 = ::std::uint16_t; ///< 16-bit unsigned integer type. - using i32 = ::std::int32_t; ///< 32-bit signed integer type. - using u32 = ::std::uint32_t; ///< 32-bit unsigned integer type. - using i64 = ::std::int64_t; ///< 64-bit signed integer type. - using u64 = ::std::uint64_t; ///< 64-bit unsigned integer type. + using byte = std::underlying_type_t; + using i8 = std::int8_t; ///< 8-bit signed integer type. + using u8 = std::uint8_t; ///< 8-bit unsigned integer type. + using i16 = std::int16_t; ///< 16-bit signed integer type. + using u16 = std::uint16_t; ///< 16-bit unsigned integer type. + using i32 = std::int32_t; ///< 32-bit signed integer type. + using u32 = std::uint32_t; ///< 32-bit unsigned integer type. + using i64 = std::int64_t; ///< 64-bit signed integer type. + using u64 = std::uint64_t; ///< 64-bit unsigned integer type. using ssize_t = - ::std::make_signed_t<::std::size_t>; ///< Signed integer type corresponding to `size_t`. + std::make_signed_t; ///< Signed integer type corresponding to `size_t`. inline constexpr struct { template - [[nodiscard]] constexpr ::std::make_unsigned_t operator()(const T t) noexcept + [[nodiscard]] constexpr std::make_unsigned_t operator()(const T t) noexcept { return auto_cast(t); } @@ -34,7 +34,7 @@ namespace stdsharp inline constexpr struct { template - [[nodiscard]] constexpr ::std::make_signed_t operator()(const T t) noexcept + [[nodiscard]] constexpr std::make_signed_t operator()(const T t) noexcept { return auto_cast(t); } diff --git a/include/stdsharp/default_operator.h b/include/stdsharp/default_operator.h index 01bac69d..b0d5d247 100644 --- a/include/stdsharp/default_operator.h +++ b/include/stdsharp/default_operator.h @@ -10,7 +10,7 @@ namespace stdsharp { [[nodiscard]] friend constexpr T operator+(const T& t) // noexcept(nothrow_copy_constructible) - requires ::std::copy_constructible + requires std::copy_constructible { return t; } @@ -37,7 +37,7 @@ namespace stdsharp [[nodiscard]] friend constexpr auto operator++(T& t, int) // noexcept(nothrow_copy_constructible&& noexcept(++t)) - requires ::std::copy_constructible && requires { ++t; } + requires std::copy_constructible && requires { ++t; } { const auto copy = t; ++t; @@ -46,7 +46,7 @@ namespace stdsharp [[nodiscard]] friend constexpr auto operator--(T& t, int) // noexcept(nothrow_copy_constructible&& noexcept(--t)) - requires ::std::copy_constructible && requires { --t; } + requires std::copy_constructible && requires { --t; } { const auto copy = t; --t; @@ -89,7 +89,7 @@ namespace stdsharp [[nodiscard]] friend constexpr T operator op(U&& u, V&& t) noexcept( \ noexcept(cast_fwd(cpp_forward(t)) op cpp_forward(u)) \ ) \ - requires(!::std::convertible_to) && Commutable && \ + requires(!std::convertible_to) && Commutable && \ requires { cast_fwd(cpp_forward(t)) op cpp_forward(u); } \ { \ return cast_fwd(cpp_forward(t)) op cpp_forward(u); \ diff --git a/include/stdsharp/enumeration.h b/include/stdsharp/enumeration.h index 08e9570a..c07e3e46 100644 --- a/include/stdsharp/enumeration.h +++ b/include/stdsharp/enumeration.h @@ -9,7 +9,7 @@ namespace stdsharp struct enumeration { using enum_type = T; - using underlying_type = ::std::underlying_type_t; + using underlying_type = std::underlying_type_t; T value{}; @@ -29,7 +29,7 @@ namespace stdsharp }; template - enumeration(T) -> enumeration<::std::remove_cv_t>; + enumeration(T) -> enumeration>; template struct flag : enumeration @@ -90,5 +90,5 @@ namespace stdsharp }; template - flag(T) -> flag<::std::remove_cv_t>; + flag(T) -> flag>; } \ No newline at end of file diff --git a/include/stdsharp/exception/exception.h b/include/stdsharp/exception/exception.h index 8c6ce1ac..677eb10c 100644 --- a/include/stdsharp/exception/exception.h +++ b/include/stdsharp/exception/exception.h @@ -6,13 +6,13 @@ namespace stdsharp { - template<::std::size_t I> - class aggregate_exceptions : public ::std::exception + template + class aggregate_exceptions : public std::exception { - ::std::array<::std::exception_ptr, I> exceptions_; + std::array exceptions_; public: - aggregate_exceptions(const ::std::array<::std::exception_ptr, I>& exceptions) noexcept: + aggregate_exceptions(const std::array& exceptions) noexcept: exceptions_(exceptions) { } @@ -22,44 +22,44 @@ namespace stdsharp [[nodiscard]] const auto& exceptions() const noexcept { return exceptions_; } }; - template<::std::size_t I> - aggregate_exceptions(const ::std::array<::std::exception_ptr, I>&) -> aggregate_exceptions; + template + aggregate_exceptions(const std::array&) -> aggregate_exceptions; namespace details { - template<::std::invocable T, ::std::size_t I> + template constexpr void aggregate_try(auto& exceptions, T&& t) { try { - ::std::invoke(cpp_forward(t)); + std::invoke(cpp_forward(t)); } catch(...) { - exceptions[I] = ::std::current_exception(); + exceptions[I] = std::current_exception(); throw aggregate_exceptions{exceptions}; } } - template<::std::size_t I, ::std::invocable T, ::std::invocable... U> + template constexpr void aggregate_try(auto& exceptions, T&& t, U&&... u) { try { - ::std::invoke(cpp_forward(t)); + std::invoke(cpp_forward(t)); } catch(...) { - exceptions[I] = ::std::current_exception(); + exceptions[I] = std::current_exception(); aggregate_try(exceptions, cpp_forward(u)...); } } } - template<::std::invocable... T> + template constexpr void aggregate_try(T&&... t) { - ::std::array<::std::exception_ptr, sizeof...(T)> exceptions; + std::array exceptions; details::aggregate_try<0, T...>(exceptions, cpp_forward(t)...); } } \ No newline at end of file diff --git a/include/stdsharp/filesystem/filesystem.h b/include/stdsharp/filesystem/filesystem.h index aa6724dc..f08cd58f 100644 --- a/include/stdsharp/filesystem/filesystem.h +++ b/include/stdsharp/filesystem/filesystem.h @@ -30,17 +30,17 @@ namespace stdsharp::filesystem }; } - template - class space_size> : + template + class space_size> : default_arithmetic_operation< - space_size>, + space_size>, details::space_size_delegate // clang-format off > // clang-format on { public: using rep = Rep; - using period = ::meta::_t<::std::ratio>; + using period = ::meta::_t>; static constexpr auto num = period::num; @@ -55,7 +55,7 @@ namespace stdsharp::filesystem rep value_{}; template - static constexpr auto cast_from(const auto factor, const ::std::ratio) noexcept + static constexpr auto cast_from(const auto factor, const std::ratio) noexcept { return static_cast(factor * denom * N / (num * D)); // NOLINT(*-integer-division) } @@ -63,7 +63,7 @@ namespace stdsharp::filesystem public: static constexpr space_size zero() noexcept { return {}; } - static constexpr space_size max() noexcept { return ::std::numeric_limits::max(); } + static constexpr space_size max() noexcept { return std::numeric_limits::max(); } space_size() = default; @@ -79,7 +79,7 @@ namespace stdsharp::filesystem [[nodiscard]] constexpr auto operator<=>(const space_size other) // const noexcept { - if constexpr(::std::ratio_greater_equal_v) + if constexpr(std::ratio_greater_equal_v) return value_ <=> cast_from(other.value_, Period{}); else return other <=> *this; } @@ -88,7 +88,7 @@ namespace stdsharp::filesystem [[nodiscard]] constexpr auto operator==(const space_size other) // const noexcept { - return (*this <=> other) == ::std::strong_ordering::equal; + return (*this <=> other) == std::strong_ordering::equal; } template @@ -103,27 +103,27 @@ namespace stdsharp::filesystem namespace details { - inline constexpr ::std::uintmax_t size_numeration_base = 1024; + inline constexpr std::uintmax_t size_numeration_base = 1024; } - using bits = space_size<::std::uintmax_t, ::std::ratio<1, char_bit>>; + using bits = space_size>; - using bytes = space_size<::std::uintmax_t, ::std::ratio<1>>; + using bytes = space_size>; - using kilobytes = space_size<::std::uintmax_t, ::std::kilo>; + using kilobytes = space_size; - using megabytes = space_size<::std::uintmax_t, ::std::mega>; + using megabytes = space_size; - using gigabytes = space_size<::std::uintmax_t, ::std::giga>; + using gigabytes = space_size; - using terabytes = space_size<::std::uintmax_t, ::std::tera>; + using terabytes = space_size; - using petabytes = space_size<::std::uintmax_t, ::std::peta>; + using petabytes = space_size; - using exabytes = space_size<::std::uintmax_t, ::std::exa>; + using exabytes = space_size; #if(INTMAX_MAX / 1'000'000'000) >= 1'000'000'000'000 - using zettabytes = space_size<::std::uintmax_t, ::std::zetta>; + using zettabytes = space_size; inline namespace literals { @@ -134,7 +134,7 @@ namespace stdsharp::filesystem [[nodiscard]] constexpr auto operator""_ZB(long double v) noexcept { - return space_size{v}; + return space_size{v}; } } @@ -148,7 +148,7 @@ namespace stdsharp::filesystem }; #if(INTMAX_MAX / 1'000'000'000) >= 1'000'000'000'000'000 - using yottabytes = space_size<::std::uintmax_t, ::std::yotta>; + using yottabytes = space_size; inline namespace literals { @@ -159,7 +159,7 @@ namespace stdsharp::filesystem [[nodiscard]] constexpr auto operator""_YB(long double v) noexcept { - return space_size{v}; + return space_size{v}; } } @@ -174,28 +174,28 @@ namespace stdsharp::filesystem #endif #endif - using kibibytes = space_size<::std::uintmax_t, ::std::ratio>; + using kibibytes = space_size>; using mebibytes = space_size< - ::std::uintmax_t, - ::std::ratio>; + std::uintmax_t, + std::ratio>; using gibibytes = space_size< - ::std::uintmax_t, - ::std::ratio>; + std::uintmax_t, + std::ratio>; using tebibytes = space_size< - ::std::uintmax_t, - ::std::ratio>; + std::uintmax_t, + std::ratio>; using pebibytes = space_size< - ::std::uintmax_t, - ::std::ratio>; + std::uintmax_t, + std::ratio>; using exbibytes = space_size< - ::std::uintmax_t, - ::std::ratio>; + std::uintmax_t, + std::ratio>; #if(INTMAX_MAX / 1024) >= 1'152'921'504'606'846'976 using zebibytes = space_size< - ::std::uintmax_t, - ::std::ratio>; + std::uintmax_t, + std::ratio>; inline namespace literals { @@ -221,8 +221,8 @@ namespace stdsharp::filesystem #if(INTMAX_MAX / 1024 / 1024) >= 1'152'921'504'606'846'976 using yobibytes = space_size< - ::std::uintmax_t, - ::std::ratio>; + std::uintmax_t, + std::ratio>; inline namespace literals { @@ -274,22 +274,22 @@ namespace stdsharp::filesystem { constexpr auto sv = [] { - ::std::string_view sv; + std::string_view sv; constexpr_pattern_match::from_type( - [&](const ::std::type_identity) { sv = "b"; }, - [&](const ::std::type_identity) { sv = "B"; }, - [&](const ::std::type_identity) { sv = "KB"; }, - [&](const ::std::type_identity) { sv = "MB"; }, - [&](const ::std::type_identity) { sv = "GB"; }, - [&](const ::std::type_identity) { sv = "TB"; }, - [&](const ::std::type_identity) { sv = "PB"; }, - [&](const ::std::type_identity) { sv = "EB"; }, - [&](const ::std::type_identity) { sv = "KiB"; }, - [&](const ::std::type_identity) { sv = "MiB"; }, - [&](const ::std::type_identity) { sv = "GiB"; }, - [&](const ::std::type_identity) { sv = "TiB"; }, - [&](const ::std::type_identity) { sv = "PiB"; }, - [&](const ::std::type_identity) { sv = "EiB"; } + [&](const std::type_identity) { sv = "b"; }, + [&](const std::type_identity) { sv = "B"; }, + [&](const std::type_identity) { sv = "KB"; }, + [&](const std::type_identity) { sv = "MB"; }, + [&](const std::type_identity) { sv = "GB"; }, + [&](const std::type_identity) { sv = "TB"; }, + [&](const std::type_identity) { sv = "PB"; }, + [&](const std::type_identity) { sv = "EB"; }, + [&](const std::type_identity) { sv = "KiB"; }, + [&](const std::type_identity) { sv = "MiB"; }, + [&](const std::type_identity) { sv = "GiB"; }, + [&](const std::type_identity) { sv = "TiB"; }, + [&](const std::type_identity) { sv = "PiB"; }, + [&](const std::type_identity) { sv = "EiB"; } ); return sv; @@ -451,47 +451,47 @@ namespace std { template requires requires( - ::stdsharp::filesystem::space_size s, - ::std::basic_stringstream ss + stdsharp::filesystem::space_size s, + std::basic_stringstream ss ) { ss << s; } - struct formatter<::stdsharp::filesystem::space_size, CharT> + struct formatter, CharT> { private: - using space_size = ::stdsharp::filesystem::space_size; + using space_size = stdsharp::filesystem::space_size; - ::stdsharp::fill_spec fill_{}; - ::stdsharp::align_t align_{}; - ::stdsharp::nested_spec<::std::size_t> width_{}; + stdsharp::fill_spec fill_{}; + stdsharp::align_t align_{}; + stdsharp::nested_spec width_{}; - ::stdsharp::precision_spec precision_{}; + stdsharp::precision_spec precision_{}; - ::stdsharp::locale_spec locale_{}; + stdsharp::locale_spec locale_{}; - ::std::basic_string_view from_unit_; + std::basic_string_view from_unit_; template - using identity = ::std::type_identity; + using identity = std::type_identity; public: constexpr auto parse(basic_format_parse_context& ctx) { { basic_format_parse_context copied_ctx{ - ::std::basic_string_view{ctx.begin(), ctx.end()} // + std::basic_string_view{ctx.begin(), ctx.end()} // }; - const auto size = ::std::ranges::size(copied_ctx); + const auto size = std::ranges::size(copied_ctx); - const auto fill = ::stdsharp::parse_fill_spec(copied_ctx); + const auto fill = stdsharp::parse_fill_spec(copied_ctx); if(fill.fill) { - const auto align = ::stdsharp::parse_align_spec(copied_ctx); + const auto align = stdsharp::parse_align_spec(copied_ctx); - if(align != ::stdsharp::align_t::none) + if(align != stdsharp::align_t::none) { const auto width = - ::stdsharp::parse_nested_integer_spec<::std::size_t>(copied_ctx); + stdsharp::parse_nested_integer_spec(copied_ctx); if(!width.valueless_by_exception()) { @@ -499,14 +499,14 @@ namespace std align_ = align; width_ = width; - ctx.advance_to(ctx.begin() + (size - ::std::ranges::size(copied_ctx))); + ctx.advance_to(ctx.begin() + (size - std::ranges::size(copied_ctx))); } } } } - precision_ = ::stdsharp::parse_precision_spec(ctx); - locale_ = ::stdsharp::parse_locale_spec(ctx); + precision_ = stdsharp::parse_precision_spec(ctx); + locale_ = stdsharp::parse_locale_spec(ctx); { const auto [from_unit] = ::ctre::starts_with(ctx); @@ -518,7 +518,7 @@ namespace std } } - ::stdsharp::parse_end_assert(ctx); + stdsharp::parse_end_assert(ctx); return ctx.begin(); } @@ -527,15 +527,15 @@ namespace std auto format(const space_size s, basic_format_context& fc) const { const auto& fill = fill_.fill; - const auto width = ::stdsharp::get_arg(fc, width_); + const auto width = stdsharp::get_arg(fc, width_); const auto& formatted = [this, s = s, &fc]() mutable { const auto& precision = precision_.precision; const auto from_unit = [from_unit_ = from_unit_] { - ::std::array from_unit{}; + std::array from_unit{}; - ::std::ranges::transform( + std::ranges::transform( from_unit_, from_unit.begin(), [](const CharT c) { return static_cast(c); } @@ -543,20 +543,20 @@ namespace std return from_unit; }(); - ::std::string_view current_unit{ + std::string_view current_unit{ from_unit.begin(), - ::std::ranges::find(from_unit, char{}) // + std::ranges::find(from_unit, char{}) // }; - ::std::basic_ostringstream ss; + std::basic_ostringstream ss; const auto do_format = [¤t_unit, &ss, &s] { const auto format_case = [&]( // clang-format off const identity, - const ::std::string_view next_unit + const std::string_view next_unit ) noexcept // clang-format on { - return [&, next_unit](const ::std::string_view) + return [&, next_unit](const std::string_view) { const SpaceSize cast_size = s; @@ -567,19 +567,19 @@ namespace std }; }; - ::stdsharp::pattern_match( + stdsharp::pattern_match( current_unit, - ::std::pair{ - [](const ::std::string_view unit) noexcept { return unit.empty(); }, - [](const ::std::string_view) + std::pair{ + [](const std::string_view unit) noexcept { return unit.empty(); }, + [](const std::string_view) { throw format_error{"Precision exceeded"}; // } // }, -#define STDSHARP_MAKE_PAIR(str, type, next_str) \ - ::std::pair{ \ - [](const ::std::string_view unit) noexcept { return unit == #str; }, \ - format_case(identity<::stdsharp::filesystem::type>{}, #next_str)} +#define STDSHARP_MAKE_PAIR(str, type, next_str) \ + std::pair{ \ + [](const std::string_view unit) noexcept { return unit == #str; }, \ + format_case(identity{}, #next_str)} STDSHARP_MAKE_PAIR(b, bits, ), STDSHARP_MAKE_PAIR(B, bytes, b), @@ -600,9 +600,9 @@ namespace std ); }; - ss.imbue(locale_.use_locale ? fc.locale() : ::std::locale::classic()); + ss.imbue(locale_.use_locale ? fc.locale() : std::locale::classic()); - if(const auto precision_v = ::stdsharp::get_arg(fc, precision); precision_v) + if(const auto precision_v = stdsharp::get_arg(fc, precision); precision_v) for(auto i = *precision_v; i != 0; --i) do_format(); else while(s.size() > 0) @@ -622,7 +622,7 @@ namespace std if( [=, &formatted, &fc, align = align_] { - if(fill && width && align != ::stdsharp::align_t::none) + if(fill && width && align != stdsharp::align_t::none) { const auto width_v = *width; @@ -633,22 +633,22 @@ namespace std switch(align) { - case ::stdsharp::align_t::left: - ::std::ranges::copy(formatted, fc.out()); - ::std::ranges::fill_n(fc.out(), fill_size, fill_c); + case stdsharp::align_t::left: + std::ranges::copy(formatted, fc.out()); + std::ranges::fill_n(fc.out(), fill_size, fill_c); break; - case ::stdsharp::align_t::right: - ::std::ranges::fill_n(fc.out(), fill_size, fill_c); - ::std::ranges::copy(formatted, fc.out()); + case stdsharp::align_t::right: + std::ranges::fill_n(fc.out(), fill_size, fill_c); + std::ranges::copy(formatted, fc.out()); break; - case ::stdsharp::align_t::center: + case stdsharp::align_t::center: { const auto half_fill_s = fill_size / 2; - ::std::ranges::fill_n(fc.out(), half_fill_s, fill_c); - ::std::ranges::copy(formatted, fc.out()); - ::std::ranges::fill_n(fc.out(), fill_size - half_fill_s, fill_c); + std::ranges::fill_n(fc.out(), half_fill_s, fill_c); + std::ranges::copy(formatted, fc.out()); + std::ranges::fill_n(fc.out(), fill_size - half_fill_s, fill_c); } break; @@ -662,7 +662,7 @@ namespace std return true; }() ) - ::std::ranges::copy(formatted, fc.out()); + std::ranges::copy(formatted, fc.out()); return fc.out(); } }; diff --git a/include/stdsharp/format/format.h b/include/stdsharp/format/format.h index 41252d5b..ddc2b5bd 100644 --- a/include/stdsharp/format/format.h +++ b/include/stdsharp/format/format.h @@ -17,18 +17,18 @@ namespace stdsharp namespace details { template - using parse_context = ::std::basic_format_parse_context; + using parse_context = std::basic_format_parse_context; template - using context = ::std::basic_format_context; + using context = std::basic_format_context; template - using iter = typename ::std::basic_format_parse_context::iterator; + using iter = typename std::basic_format_parse_context::iterator; - template<::std::integral T> + template constexpr auto parse_integer(const auto& rng) noexcept { - return ::std::accumulate( + return std::accumulate( rng.begin(), rng.end(), T{0}, @@ -43,7 +43,7 @@ namespace stdsharp struct nested_arg_index { - ::std::size_t value; + std::size_t value; template [[nodiscard]] constexpr decltype(auto) get_from_context( @@ -51,7 +51,7 @@ namespace stdsharp Visitor&& vis // ) const { - return ::std::visit_format_arg(cpp_forward(vis), fc.arg(value)); + return std::visit_format_arg(cpp_forward(vis), fc.arg(value)); } template @@ -62,17 +62,17 @@ namespace stdsharp { return get_from_context( fc, - [](U&& u) noexcept -> ::std::optional + [](U&& u) noexcept -> std::optional { - if constexpr(::std::convertible_to) return static_cast(cpp_forward(u)); - else return ::std::nullopt; + if constexpr(std::convertible_to) return static_cast(cpp_forward(u)); + else return std::nullopt; } ); } }; template - using nested_spec = ::std::variant<::std::monostate, T, nested_arg_index>; + using nested_spec = std::variant; namespace details { @@ -84,21 +84,21 @@ namespace stdsharp [[nodiscard]] constexpr auto get_arg(const details::context& fc, SpecT&& spec) requires requires { details::nested_spec_like(spec); } { - using result_t = ::std::conditional_t< - ::std::same_as, + using result_t = std::conditional_t< + std::same_as, decltype(details::nested_spec_like(spec)), ResultT>; - if(spec.valueless_by_exception() || ::std::holds_alternative<::std::monostate>(spec)) - return ::std::optional{::std::nullopt}; - return ::std::visit( - [&fc](U&& u) -> ::std::optional + if(spec.valueless_by_exception() || std::holds_alternative(spec)) + return std::optional{std::nullopt}; + return std::visit( + [&fc](U&& u) -> std::optional { - if constexpr(::std::same_as<::std::remove_cvref_t, result_t>) - return ::std::optional{cpp_forward(u)}; - else if constexpr(::std::same_as<::std::remove_cvref_t, nested_arg_index>) + if constexpr(std::same_as, result_t>) + return std::optional{cpp_forward(u)}; + else if constexpr(std::same_as, nested_arg_index>) return cpp_forward(u).template get_from_context(fc); - else return ::std::nullopt; + else return std::nullopt; }, spec ); @@ -108,20 +108,20 @@ namespace stdsharp void parse_assert(const details::parse_context& ctx) { const auto begin = ctx.begin(); - throw ::std::format_error{ - ::std::format( + throw std::format_error{ + std::format( "invalid format:\n \"{}\"\n{}", - ::std::basic_string_view{begin, ctx.end()}, - ::std::format( + std::basic_string_view{begin, ctx.end()}, + std::format( "{}^ Unexpected character here", - // TODO: c++23 ::std::ranges::views::repeat + // TODO: c++23 std::ranges::views::repeat ::ranges::views::repeat_n(' ', begin - ctx.begin()) ) ) // }; } - template Predicate> + template Predicate> constexpr void parse_validate(const details::parse_context& ctx, Predicate predicate) { const auto begin = ctx.begin(); @@ -141,10 +141,10 @@ namespace stdsharp if(begin == ctx.end() || *begin == '}') return; - throw ::std::format_error{ - ::std::format( + throw std::format_error{ + std::format( "invalid format: \"{}\"\nEnd of string expected", - ::std::basic_string_view{begin, ctx.end()} + std::basic_string_view{begin, ctx.end()} ) // }; } @@ -152,7 +152,7 @@ namespace stdsharp template struct fill_spec { - ::std::optional fill; + std::optional fill; }; template @@ -165,7 +165,7 @@ namespace stdsharp ctx.advance_to(fill.end()); return {*fill.begin()}; } - return {::std::nullopt}; + return {std::nullopt}; } enum class align_t @@ -176,7 +176,7 @@ namespace stdsharp center }; - template<::std::convertible_to CharT> + template CharT> [[nodiscard]] constexpr auto parse_align_spec(details::parse_context& ctx) { const auto [align] = ::ctre::starts_with<"[<^>]">(ctx); @@ -195,7 +195,7 @@ namespace stdsharp return align_t::none; } - template<::std::integral IntType, ::std::convertible_to CharT> + template CharT> [[nodiscard]] constexpr nested_spec parse_nested_integer_spec(details::parse_context& ctx) { @@ -206,13 +206,13 @@ namespace stdsharp { ctx.advance_to(end); return nested_arg_index{ - ::std::ranges::empty(ref) ? ctx.next_arg_id() : - details::parse_integer<::std::size_t>(ref)}; + std::ranges::empty(ref) ? ctx.next_arg_id() : + details::parse_integer(ref)}; } if(value) { ctx.advance_to(end); - return details::parse_integer<::std::size_t>(value); + return details::parse_integer(value); } return {}; diff --git a/include/stdsharp/fstream/fstream.h b/include/stdsharp/fstream/fstream.h index ca9659bb..2d0b2107 100644 --- a/include/stdsharp/fstream/fstream.h +++ b/include/stdsharp/fstream/fstream.h @@ -13,8 +13,8 @@ namespace stdsharp struct get_from_stream_fn { template - requires ::std::constructible_from - [[nodiscard]] constexpr auto operator()(::std::istream& is, Args&&... args) const + requires std::constructible_from + [[nodiscard]] constexpr auto operator()(std::istream& is, Args&&... args) const { T t{cpp_forward(args)...}; is >> t; @@ -29,24 +29,24 @@ namespace stdsharp namespace details { template - requires ::std::invocable< + requires std::invocable< get_from_stream_fn, - ::std::ifstream // clang-format off + std::ifstream // clang-format off > // clang-format on struct read_all_to_container_fn { - template> - requires ::std::invocable + template> + requires std::invocable [[nodiscard]] auto& - operator()(Container& container, const ::std::filesystem::path& path) const + operator()(Container& container, const std::filesystem::path& path) const { - ::std::ifstream fs{path}; + std::ifstream fs{path}; return (*this)(container, fs); } - template> - requires ::std::invocable - [[nodiscard]] constexpr auto& operator()(Container& container, ::std::istream& is) const + template> + requires std::invocable + [[nodiscard]] constexpr auto& operator()(Container& container, std::istream& is) const { while(is) actions::emplace_back(container, get_from_stream(is)); @@ -60,44 +60,44 @@ namespace stdsharp namespace details { - template - requires ::std::invocable, Container&, ::std::istream&> + template + requires std::invocable, Container&, std::istream&> struct read_all_fn { - [[nodiscard]] constexpr auto operator()(::std::istream& is) const + [[nodiscard]] constexpr auto operator()(std::istream& is) const { Container container{}; return read_all_to_container(container, is); } - [[nodiscard]] auto operator()(const ::std::filesystem::path& path) const + [[nodiscard]] auto operator()(const std::filesystem::path& path) const { - ::std::ifstream fs{path}; + std::ifstream fs{path}; return (*this)(fs); } }; struct read_all_text_fn { - [[nodiscard]] auto operator()(::std::istream& is) const + [[nodiscard]] auto operator()(std::istream& is) const { - using traits_t = ::std::istream::traits_type; + using traits_t = std::istream::traits_type; - ::std::string str; - ::std::getline(is, str, traits_t::to_char_type(traits_t::eof())); + std::string str; + std::getline(is, str, traits_t::to_char_type(traits_t::eof())); return str; } - [[nodiscard]] auto operator()(const ::std::filesystem::path& path) const + [[nodiscard]] auto operator()(const std::filesystem::path& path) const { - ::std::ifstream fs{path}; + std::ifstream fs{path}; return (*this)(fs); } }; } - template> + template> inline constexpr details::read_all_fn read_all{}; inline constexpr details::read_all_text_fn read_all_text{}; diff --git a/include/stdsharp/functional/compose.h b/include/stdsharp/functional/compose.h index 988d56f4..2a9561a1 100644 --- a/include/stdsharp/functional/compose.h +++ b/include/stdsharp/functional/compose.h @@ -15,10 +15,10 @@ namespace stdsharp return cpp_forward(arg); } - template First, typename... Fn> - requires ::std::invocable< + template First, typename... Fn> + requires std::invocable< compose_impl, - ::std::invoke_result_t, + std::invoke_result_t, empty_t, Fn... // clang-format off > // clang-format on @@ -30,14 +30,14 @@ namespace stdsharp ) const noexcept( // nothrow_invocable< compose_impl, - ::std::invoke_result_t, + std::invoke_result_t, empty_t, Fn... // clang-format off > // clang-format on ) { return (*this)( // - ::std::invoke(cpp_forward(first), cpp_forward(arg)...), + std::invoke(cpp_forward(first), cpp_forward(arg)...), empty, cpp_forward(fn)... ); @@ -49,14 +49,14 @@ namespace stdsharp struct composed : private value_wrapper... { template - requires(::std::constructible_from, U> && ...) + requires(std::constructible_from, U> && ...) constexpr composed(U&&... u): value_wrapper(cpp_forward(u))... { } #define BS_OPERATOR(const_, ref) \ template \ - requires ::std::invocable \ + requires std::invocable \ constexpr decltype(auto) operator()(Args&&... args) \ const_ ref noexcept(nothrow_invocable) \ { \ @@ -75,21 +75,20 @@ namespace stdsharp }; template - composed(T&&...) -> composed<::std::decay_t...>; + composed(T&&...) -> composed...>; inline constexpr struct make_composed_fn { template - requires requires { composed{::std::declval()...}; } - constexpr auto operator()(T&&... t) const - noexcept(noexcept(composed{::std::declval()...})) + requires requires { composed{std::declval()...}; } + constexpr auto operator()(T&&... t) const noexcept(noexcept(composed{std::declval()...})) { return composed{cpp_forward(t)...}; } } make_composed{}; template - concept composable = ::std::invocable; + concept composable = std::invocable; template concept nothrow_composable = nothrow_invocable; diff --git a/include/stdsharp/functional/invocables.h b/include/stdsharp/functional/invocables.h index c9fdd37c..e685e2f8 100644 --- a/include/stdsharp/functional/invocables.h +++ b/include/stdsharp/functional/invocables.h @@ -11,19 +11,19 @@ namespace stdsharp { namespace details { - template + template struct indexed_invocable : stdsharp::indexed_value { using base = stdsharp::indexed_value; using base::base; -#define STDSHARP_OPERATOR(const_, ref) \ - template Fn = const_ T ref> \ - constexpr decltype(auto) operator()(Args&&... args) \ - const_ ref noexcept(nothrow_invocable) \ - { \ - return ::std::invoke(static_cast(this->v), cpp_forward(args)...); \ +#define STDSHARP_OPERATOR(const_, ref) \ + template Fn = const_ T ref> \ + constexpr decltype(auto) operator()(Args&&... args) \ + const_ ref noexcept(nothrow_invocable) \ + { \ + return std::invoke(static_cast(this->v), cpp_forward(args)...); \ } STDSHARP_OPERATOR(, &) @@ -37,20 +37,20 @@ namespace stdsharp template struct invocables { - template> + template> struct impl; using type = impl<>; - template<::std::size_t... I> - struct impl<::std::index_sequence> : + template + struct impl> : indexed_invocable..., indexed_types { impl() = default; template - requires(::std::constructible_from && ...) + requires(std::constructible_from && ...) constexpr impl(Args&&... args) // noexcept((nothrow_constructible_from && ...)): indexed_invocable(cpp_forward(args))... @@ -67,11 +67,11 @@ namespace stdsharp inline constexpr make_invocables_fn make_invocables{}; - template<::std::size_t Index> + template struct invoke_at_fn { template - requires ::std::invocable, Args...> + requires std::invocable, Args...> constexpr decltype(auto) operator()(T&& t, Args&&... args) const noexcept(nothrow_invocable, Args...>) { @@ -86,28 +86,28 @@ namespace stdsharp struct invoke_first_fn { private: - template + template requires requires // { requires(Predicator, Args...>::value); // } - static constexpr ::std::size_t find_first_impl(const index_constant) noexcept + static constexpr std::size_t find_first_impl(const index_constant) noexcept { return I; } - template - static constexpr ::std::size_t find_first_impl(const index_constant) noexcept + template + static constexpr std::size_t find_first_impl(const index_constant) noexcept { return find_first(index_constant{}); } - template - static constexpr ::std::size_t find_first(const index_constant = {}) noexcept + template + static constexpr std::size_t find_first(const index_constant = {}) noexcept { if constexpr(requires { typename get_element_t; }) return find_first_impl(index_constant{}); - else return static_cast<::std::size_t>(-1); + else return static_cast(-1); } template @@ -133,7 +133,7 @@ namespace stdsharp namespace details { template - requires ::std::invocable + requires std::invocable struct sequenced_invocables_predicate { static constexpr auto value = true; @@ -155,7 +155,7 @@ namespace stdsharp template< \ typename... Args, \ typename Base = const_ base ref, \ - ::std::invocable Fn = sequenced_invoke_fn> \ + std::invocable Fn = sequenced_invoke_fn> \ constexpr decltype(auto) operator()(Args&&... args) \ const_ ref noexcept(nothrow_invocable) \ { \ @@ -171,7 +171,7 @@ namespace stdsharp }; template - basic_sequenced_invocables(T&&...) -> basic_sequenced_invocables<::std::decay_t...>; + basic_sequenced_invocables(T&&...) -> basic_sequenced_invocables...>; template using sequenced_invocables = adl_proof_t; diff --git a/include/stdsharp/functional/invoke.h b/include/stdsharp/functional/invoke.h index 3711d8f0..e0a51494 100644 --- a/include/stdsharp/functional/invoke.h +++ b/include/stdsharp/functional/invoke.h @@ -16,12 +16,12 @@ namespace stdsharp inline constexpr auto optional_invoke = make_sequenced_invocables(invoke, empty_invoke); template - concept nothrow_optional_invocable = noexcept(optional_invoke(::std::declval()...)); + concept nothrow_optional_invocable = noexcept(optional_invoke(std::declval()...)); template struct conditional_invoke_fn { - template<::std::invocable Func> + template requires(Condition) constexpr decltype(auto) operator()(Func&& func, const auto& = empty_invoke) const noexcept(nothrow_invocable) @@ -29,7 +29,7 @@ namespace stdsharp return func(); } - template<::std::invocable Func = empty_invoke_fn> + template constexpr decltype(auto) operator()(const auto&, Func&& func = empty_invoke) const noexcept(nothrow_invocable) { @@ -41,7 +41,7 @@ namespace stdsharp inline constexpr conditional_invoke_fn conditional_invoke{}; template - concept conditional_invocable = ::std::invocable, T, U>; + concept conditional_invocable = std::invocable, T, U>; template concept nothrow_conditional_invocable = @@ -56,9 +56,9 @@ namespace stdsharp { return #if __cpp_lib_invoke_r >= 202106L - ::std::invoke_r(cpp_forward(args)...) + std::invoke_r(cpp_forward(args)...) #else - static_cast(::std::invoke(cpp_forward(func), cpp_forward(args)...)) + static_cast(std::invoke(cpp_forward(func), cpp_forward(args)...)) #endif ; }; @@ -72,21 +72,21 @@ namespace stdsharp template requires requires // { - requires(::std::invocable && ...); - requires ::std::invocable...>; + requires(std::invocable && ...); + requires std::invocable...>; } constexpr decltype(auto) operator()(Fn&& fn, Projector projector, Args&&... args) const noexcept( (nothrow_invocable && ...) && // - nothrow_invocable...> // + nothrow_invocable...> // ) { - return ::std::invoke(cpp_forward(fn), ::std::invoke(projector, cpp_forward(args))...); + return std::invoke(cpp_forward(fn), std::invoke(projector, cpp_forward(args))...); } } projected_invoke{}; template - concept projected_invocable = ::std::invocable; + concept projected_invocable = std::invocable; template concept projected_nothrow_invocable = nothrow_invocable; diff --git a/include/stdsharp/functional/operations.h b/include/stdsharp/functional/operations.h index 897f5a30..c16b299b 100644 --- a/include/stdsharp/functional/operations.h +++ b/include/stdsharp/functional/operations.h @@ -12,16 +12,16 @@ namespace stdsharp inline constexpr struct copy_fn { template - requires ::std::constructible_from<::std::decay_t, T> - [[nodiscard]] constexpr ::std::decay_t operator()(T&& t) const - noexcept(nothrow_constructible_from<::std::decay_t>) + requires std::constructible_from, T> + [[nodiscard]] constexpr std::decay_t operator()(T&& t) const + noexcept(nothrow_constructible_from>) { return t; } } copy{}; template - using not_fn_t = decltype(::std::not_fn(::std::declval())); + using not_fn_t = decltype(std::not_fn(std::declval())); namespace details { @@ -38,8 +38,8 @@ namespace stdsharp struct assign_by_construct { - template> - requires ::std::constructible_from + template> + requires std::constructible_from constexpr decltype(auto) operator()(T& left, U&&... right) const noexcept(noexcept(left = ActualT{cpp_forward(right)...})) { @@ -53,27 +53,27 @@ namespace stdsharp { } assign_v{}; - inline constexpr ::std::ranges::equal_to equal_to_v{}; - inline constexpr ::std::ranges::not_equal_to not_equal_to_v{}; - inline constexpr ::std::ranges::less less_v{}; - inline constexpr ::std::ranges::greater greater_v{}; - inline constexpr ::std::ranges::less_equal less_equal_v{}; - inline constexpr ::std::ranges::greater_equal greater_equal_v{}; - inline constexpr ::std::compare_three_way compare_three_way_v{}; - inline constexpr ::std::plus<> plus_v{}; - inline constexpr ::std::minus<> minus_v{}; - inline constexpr ::std::divides<> divides_v{}; - inline constexpr ::std::multiplies<> multiplies_v{}; - inline constexpr ::std::modulus<> modulus_v{}; - inline constexpr ::std::negate<> negate_v{}; - inline constexpr ::std::logical_and<> logical_and_v{}; - inline constexpr ::std::logical_not<> logical_not_v{}; - inline constexpr ::std::logical_or<> logical_or_v{}; - - inline constexpr ::std::bit_and<> bit_and_v{}; - inline constexpr ::std::bit_not<> bit_not_v{}; - inline constexpr ::std::bit_or<> bit_or_v{}; - inline constexpr ::std::bit_xor<> bit_xor_v{}; + inline constexpr std::ranges::equal_to equal_to_v{}; + inline constexpr std::ranges::not_equal_to not_equal_to_v{}; + inline constexpr std::ranges::less less_v{}; + inline constexpr std::ranges::greater greater_v{}; + inline constexpr std::ranges::less_equal less_equal_v{}; + inline constexpr std::ranges::greater_equal greater_equal_v{}; + inline constexpr std::compare_three_way compare_three_way_v{}; + inline constexpr std::plus<> plus_v{}; + inline constexpr std::minus<> minus_v{}; + inline constexpr std::divides<> divides_v{}; + inline constexpr std::multiplies<> multiplies_v{}; + inline constexpr std::modulus<> modulus_v{}; + inline constexpr std::negate<> negate_v{}; + inline constexpr std::logical_and<> logical_and_v{}; + inline constexpr std::logical_not<> logical_not_v{}; + inline constexpr std::logical_or<> logical_or_v{}; + + inline constexpr std::bit_and<> bit_and_v{}; + inline constexpr std::bit_not<> bit_not_v{}; + inline constexpr std::bit_or<> bit_or_v{}; + inline constexpr std::bit_xor<> bit_xor_v{}; inline constexpr struct bit_xnor { @@ -172,7 +172,7 @@ namespace stdsharp #undef BS_UTIL_ASSIGN_OPERATE - inline constexpr ::std::identity identity_v{}; + inline constexpr std::identity identity_v{}; #define BS_UTIL_INCREMENT_DECREMENT_OPERATE(operator_prefix, op, al_op) \ inline constexpr struct pre_##operator_prefix##crease \ @@ -204,8 +204,8 @@ namespace stdsharp { struct advance_by_op { - template> - requires ::std::invocable + template> + requires std::invocable constexpr decltype(auto) operator()(T& v, Distance distance) const noexcept(nothrow_invocable) { @@ -214,14 +214,14 @@ namespace stdsharp return v; } - template> + template> requires( - ::std::invocable> && - ::std::invocable // + std::invocable> && + std::invocable // ) constexpr decltype(auto) operator()(T& v, Distance distance) const noexcept( // noexcept( // - nothrow_invocable> && + nothrow_invocable> && nothrow_invocable ) ) diff --git a/include/stdsharp/functional/pipeable.h b/include/stdsharp/functional/pipeable.h index 819c638a..b0f3da09 100644 --- a/include/stdsharp/functional/pipeable.h +++ b/include/stdsharp/functional/pipeable.h @@ -25,18 +25,18 @@ namespace stdsharp template requires requires // { - requires ::std::invocable; - requires ::std::invocable< + requires std::invocable; + requires std::invocable< make_inherited_fn, pipeable_base, - ::std::invoke_result_t // clang-format off + std::invoke_result_t // clang-format off >; // clang-format on } constexpr auto operator()(Fn&& fun) const noexcept( // nothrow_invocable< make_inherited_fn, pipeable_base, - ::std::invoke_result_t // clang-format off + std::invoke_result_t // clang-format off > // clang-format on ) { @@ -48,8 +48,8 @@ namespace stdsharp inline constexpr make_pipeable_fn make_pipeable{}; template - concept pipeable = ::std::derived_from<::std::decay_t, pipeable_base> || // - (Mode == pipe_mode::left && ::ranges::is_pipeable_v<::std::decay_t>); + concept pipeable = std::derived_from, pipeable_base> || // + (Mode == pipe_mode::left && ::ranges::is_pipeable_v>); template requires pipeable || pipeable @@ -60,19 +60,19 @@ namespace stdsharp class pipeable_operator { template Pipe> - requires ::std::invocable + requires std::invocable friend constexpr decltype(auto) operator|(Arg&& arg, Pipe&& pipe) // noexcept(nothrow_invocable) { - return ::std::invoke(pipe, cpp_forward(arg)); + return std::invoke(pipe, cpp_forward(arg)); } template Pipe, typename Arg> - requires ::std::invocable + requires std::invocable friend constexpr decltype(auto) operator|(Pipe&& pipe, Arg&& arg) // noexcept(nothrow_invocable) { - return ::std::invoke(pipe, cpp_forward(arg)); + return std::invoke(pipe, cpp_forward(arg)); } }; } diff --git a/include/stdsharp/functional/symmetric_operations.h b/include/stdsharp/functional/symmetric_operations.h index 079566a2..1416887e 100644 --- a/include/stdsharp/functional/symmetric_operations.h +++ b/include/stdsharp/functional/symmetric_operations.h @@ -11,32 +11,32 @@ namespace stdsharp::cpo::inline cpo_impl struct arithmetic_operation; template<> - struct arithmetic_operation : ::std::type_identity + struct arithmetic_operation : std::type_identity { }; template<> - struct arithmetic_operation : ::std::type_identity + struct arithmetic_operation : std::type_identity { }; template<> - struct arithmetic_operation : ::std::type_identity + struct arithmetic_operation : std::type_identity { }; template<> - struct arithmetic_operation : ::std::type_identity + struct arithmetic_operation : std::type_identity { }; template<> - struct arithmetic_operation : ::std::type_identity + struct arithmetic_operation : std::type_identity { }; template<> - struct arithmetic_operation : ::std::type_identity + struct arithmetic_operation : std::type_identity { }; @@ -44,13 +44,13 @@ namespace stdsharp::cpo::inline cpo_impl { template< typename... Args, - ::std::invocable Operation, + std::invocable Operation, typename SymOp = ::meta::_t> // clang-format off > // clang-format on [[nodiscard]] constexpr auto operator()(const Operation, Args&&... args) const - noexcept(noexcept(bind(SymOp{}, cpp_forward(args)...))) + noexcept(noexcept(bind_as_lvalue(SymOp{}, cpp_forward(args)...))) { - return bind(SymOp{}, cpp_forward(args)...); + return bind_as_lvalue(SymOp{}, cpp_forward(args)...); } }; @@ -60,9 +60,9 @@ namespace stdsharp::cpo::inline cpo_impl struct adl_symmetric_operation_fn { template - requires requires { symmetric_operation(::std::declval()...); } + requires requires { symmetric_operation(std::declval()...); } [[nodiscard]] constexpr decltype(auto) operator()(Args&&... args) const - noexcept(symmetric_operation(::std::declval()...)) + noexcept(symmetric_operation(std::declval()...)) { return symmetric_operation(cpp_forward(args)...); } diff --git a/include/stdsharp/iterator/iterator.h b/include/stdsharp/iterator/iterator.h index b090d950..a68a88da 100644 --- a/include/stdsharp/iterator/iterator.h +++ b/include/stdsharp/iterator/iterator.h @@ -9,29 +9,29 @@ namespace stdsharp { - template<::std::indirectly_readable T> + template using iter_const_reference_t = #if __cpp_lib_ranges_as_const >= 202207L - ::std::iter_const_reference_t + std::iter_const_reference_t #else - ::std::common_reference_t&&, ::std::iter_reference_t> + std::common_reference_t&&, std::iter_reference_t> #endif ; template - concept weakly_decrementable = ::std::movable && + concept weakly_decrementable = std::movable && requires(I i) // { - typename ::std::iter_difference_t; - requires ::std::signed_integral<::std::iter_difference_t>; // clang-format off - { --i } -> ::std::same_as; // clang-format on + typename std::iter_difference_t; + requires std::signed_integral>; // clang-format off + { --i } -> std::same_as; // clang-format on i--; }; template - concept decrementable = ::std::regular && weakly_decrementable && + concept decrementable = std::regular && weakly_decrementable && requires(I i) // clang-format off { - { i-- } -> ::std::same_as; // clang-format on + { i-- } -> std::same_as; // clang-format on }; } \ No newline at end of file diff --git a/include/stdsharp/macros.h b/include/stdsharp/macros.h index b57e2137..4d4504ae 100644 --- a/include/stdsharp/macros.h +++ b/include/stdsharp/macros.h @@ -11,5 +11,5 @@ namespace stdsharp::details #define cpp_forward(...) static_cast(__VA_ARGS__) #define cpp_move(...) \ - static_cast(__VA_ARGS__) + static_cast(__VA_ARGS__) #define cpp_is_constexpr(...) requires { noexcept((__VA_ARGS__, true)); } \ No newline at end of file diff --git a/include/stdsharp/memory/allocator_aware.h b/include/stdsharp/memory/allocator_aware.h index 61eb995e..975cb2c9 100644 --- a/include/stdsharp/memory/allocator_aware.h +++ b/include/stdsharp/memory/allocator_aware.h @@ -127,7 +127,7 @@ namespace stdsharp [[nodiscard]] static constexpr allocation_for move_construct(allocator_type&, allocation_for& other) noexcept { - return ::std::exchange(other, {}); + return std::exchange(other, {}); } template @@ -235,7 +235,7 @@ namespace stdsharp dst_allocation.deallocate(dst_alloc); if constexpr(propagate_on_move_v) dst_alloc = cpp_move(src_alloc); - dst_allocation = ::std::exchange(src_allocation, {}); + dst_allocation = std::exchange(src_allocation, {}); } static constexpr void swap( @@ -245,7 +245,7 @@ namespace stdsharp allocation& src_allocation ) noexcept(!is_debug) { - precondition<::std::invalid_argument>( // + precondition( // [&dst_alloc, &src_alloc] { if constexpr(!always_equal_v) @@ -254,8 +254,8 @@ namespace stdsharp return true; } ); - ::std::swap(dst_allocation, src_allocation); - if constexpr(propagate_on_swap_v) ::std::ranges::swap(dst_alloc, src_alloc); + std::swap(dst_allocation, src_allocation); + if constexpr(propagate_on_swap_v) std::ranges::swap(dst_alloc, src_alloc); } }; @@ -327,7 +327,7 @@ namespace stdsharp operator<(const allocation_obj_req& left, const allocation_obj_req& right) noexcept { bool has_less = false; - const auto cmp = ::std::ranges::equal( + const auto cmp = std::ranges::equal( left.to_array(), right.to_array(), [&has_less](const expr_req left, const expr_req right) @@ -349,7 +349,7 @@ namespace stdsharp operator>(const allocation_obj_req& left, const allocation_obj_req& right) noexcept { bool has_greater = false; - const auto cmp = ::std::ranges::equal( + const auto cmp = std::ranges::equal( left.to_array(), right.to_array(), [&has_greater](const expr_req left, const expr_req right) @@ -370,27 +370,23 @@ namespace stdsharp [[nodiscard]] friend constexpr bool operator<=(const allocation_obj_req& left, const allocation_obj_req& right) noexcept { - return ::std::ranges::equal( - left.to_array(), - right.to_array(), - ::std::ranges::less_equal{} - ); + return std::ranges::equal(left.to_array(), right.to_array(), std::ranges::less_equal{}); } [[nodiscard]] friend constexpr bool operator>=(const allocation_obj_req& left, const allocation_obj_req& right) noexcept { - return ::std::ranges::equal( + return std::ranges::equal( left.to_array(), right.to_array(), - ::std::ranges::greater_equal{} + std::ranges::greater_equal{} ); } [[nodiscard]] friend constexpr bool operator==(const allocation_obj_req& left, const allocation_obj_req& right) noexcept { - return ::std::ranges::equal(left.to_array(), right.to_array()); + return std::ranges::equal(left.to_array(), right.to_array()); } }; @@ -401,19 +397,19 @@ namespace stdsharp public: using value_type = ValueType; - static constexpr auto copy_constructible_req = ::std::min( + static constexpr auto copy_constructible_req = std::min( traits::template construct_req, expr_req::well_formed ); - static constexpr auto copy_assignable_req = ::std::min( + static constexpr auto copy_assignable_req = std::min( traits::template construct_req, get_expr_req(copy_assignable, !propagate_on_copy_v || always_equal_v) ); static constexpr auto move_assignable_req = propagate_on_move_v || always_equal_v ? expr_req::no_exception : - ::std::min( + std::min( traits::template construct_req, get_expr_req(move_assignable, nothrow_move_assignable) ); @@ -435,9 +431,9 @@ namespace stdsharp noexcept(!is_debug): allocation_(allocation), has_value_(has_value) { - precondition<::std::invalid_argument>( // - ::std::bind_front( - ::std::ranges::greater_equal{}, + precondition( // + std::bind_front( + std::ranges::greater_equal{}, allocation_.size(), has_value_ ? sizeof(value_type) : 0 ), @@ -519,10 +515,10 @@ namespace stdsharp template requires requires(const T t, T::allocator_type alloc) // { - requires ::std::derived_from>; + requires std::derived_from>; // clang-format off { t.get_allocator() } noexcept -> - ::std::convertible_to; // clang-format on + std::convertible_to; // clang-format on } struct allocator_aware_ctor : T { @@ -538,13 +534,13 @@ namespace stdsharp template static constexpr auto alloc_arg_ctor = - constructible_from_test; + constructible_from_test; public: template - requires ::std::constructible_from + requires std::constructible_from constexpr allocator_aware_ctor( - const ::std::allocator_arg_t, + const std::allocator_arg_t, const allocator_type& alloc, Args&&... args ) noexcept(nothrow_constructible_from): @@ -554,7 +550,7 @@ namespace stdsharp constexpr allocator_aware_ctor(const this_t& other) // noexcept(nothrow_constructible_from) - requires ::std::constructible_from + requires std::constructible_from : T( // static_cast(other), @@ -565,7 +561,7 @@ namespace stdsharp constexpr allocator_aware_ctor(this_t&& other) // noexcept(nothrow_constructible_from) - requires ::std::constructible_from + requires std::constructible_from : T(static_cast(other), other.get_allocator()) { } diff --git a/include/stdsharp/memory/allocator_reference.h b/include/stdsharp/memory/allocator_reference.h index 90627590..196effcb 100644 --- a/include/stdsharp/memory/allocator_reference.h +++ b/include/stdsharp/memory/allocator_reference.h @@ -5,12 +5,12 @@ namespace stdsharp { template - class allocator_reference : ::std::reference_wrapper + class allocator_reference : std::reference_wrapper { using traits = allocator_traits; public: - using ::std::reference_wrapper::reference_wrapper; + using std::reference_wrapper::reference_wrapper; using value_type = traits::value_type; using pointer = traits::pointer; @@ -46,13 +46,13 @@ namespace stdsharp [[nodiscard]] constexpr auto allocate_at_least(const size_type n) const { - return ::std::allocate_at_least(this->get(), n); + return std::allocate_at_least(this->get(), n); } template constexpr void construct(U* const p, Args&&... args) const // - noexcept(noexcept(traits::construct(this->get(), p, ::std::declval()...))) - requires requires { traits::construct(this->get(), p, ::std::declval()...); } + noexcept(noexcept(traits::construct(this->get(), p, std::declval()...))) + requires requires { traits::construct(this->get(), p, std::declval()...); } { traits::construct(this->get(), p, cpp_forward(args)...); } diff --git a/include/stdsharp/memory/allocator_traits.h b/include/stdsharp/memory/allocator_traits.h index c4ee41ed..3126fdb1 100644 --- a/include/stdsharp/memory/allocator_traits.h +++ b/include/stdsharp/memory/allocator_traits.h @@ -9,7 +9,7 @@ namespace stdsharp { - using max_alignment = ::std::alignment_of<::std::max_align_t>; + using max_alignment = std::alignment_of; inline constexpr auto max_alignment_v = max_alignment::value; @@ -24,7 +24,7 @@ namespace stdsharp concept allocator_pointer = nullable_pointer && nothrow_default_initializable && nothrow_movable && nothrow_swappable && nothrow_copyable && nothrow_weakly_equality_comparable && - nothrow_weakly_equality_comparable_with; + nothrow_weakly_equality_comparable_with; } template @@ -35,7 +35,7 @@ namespace stdsharp requires requires( Alloc alloc, - ::std::allocator_traits t_traits, + std::allocator_traits t_traits, decltype(t_traits)::pointer p, decltype(t_traits)::const_pointer const_p, decltype(t_traits)::void_pointer void_p, @@ -57,16 +57,16 @@ namespace stdsharp details::allocator_pointer && details::allocator_pointer; - requires ::std::random_access_iterator && - ::std::contiguous_iterator; + requires std::random_access_iterator && + std::contiguous_iterator; requires nothrow_convertible_to && - ::std::random_access_iterator && - ::std::contiguous_iterator; + std::random_access_iterator && + std::contiguous_iterator; requires nothrow_convertible_to && nothrow_explicitly_convertible && - ::std::same_as; + std::same_as; requires nothrow_convertible_to && nothrow_convertible_to && @@ -74,22 +74,22 @@ namespace stdsharp nothrow_convertible_to< decltype(void_p), decltype(const_void_p)> && - ::std::same_as< // clang-format off + std::same_as< // clang-format off decltype(const_void_p), typename decltype(u_traits)::const_void_pointer >; // clang-format on - requires ::std::unsigned_integral; + requires std::unsigned_integral; - requires ::std::signed_integral; + requires std::signed_integral; - requires ::std:: + requires std:: same_as, Alloc>; // clang-format off - { *p } -> ::std::same_as<::std::add_lvalue_reference_t>; - { *const_p } -> ::std::same_as>; - { *const_p } -> ::std::same_as>; // clang-format on + { *p } -> std::same_as>; + { *const_p } -> std::same_as>; + { *const_p } -> std::same_as>; // clang-format on requires requires( decltype(u_traits)::pointer other_p, @@ -101,8 +101,8 @@ namespace stdsharp nothrow_constructible_from; nothrow_constructible_from; - { other_p->v } -> ::std::same_as; - { other_const_p->v } -> ::std::same_as; + { other_p->v } -> std::same_as; + { other_const_p->v } -> std::same_as; t_traits.construct(alloc, other_p); t_traits.destroy(alloc, other_p); @@ -110,32 +110,31 @@ namespace stdsharp requires noexcept(alloc == another_alloc) && noexcept(alloc != another_alloc); }; // clang-format on - ::std::pointer_traits::pointer_to(v); // clang-format off + std::pointer_traits::pointer_to(v); // clang-format off - { t_traits.allocate(alloc, size) } -> ::std::same_as; - { t_traits.allocate(alloc, size, const_void_p) } -> ::std::same_as; + { t_traits.allocate(alloc, size) } -> std::same_as; + { t_traits.allocate(alloc, size, const_void_p) } -> std::same_as; noexcept(alloc.deallocate(p, size)); - { t_traits.max_size(alloc) } -> ::std::same_as; + { t_traits.max_size(alloc) } -> std::same_as; // clang-format on - requires ::std::derived_from || - ::std::derived_from; + requires std::derived_from || + std::derived_from; // clang-format off - { t_traits.select_on_container_copy_construction(alloc) } -> ::std::same_as; + { t_traits.select_on_container_copy_construction(alloc) } -> std::same_as; // clang-format on - requires ::std::derived_from && + requires std::derived_from && nothrow_copy_assignable || - ::std::derived_from; + std::derived_from; - requires ::std::derived_from && + requires std::derived_from && nothrow_move_assignable || - ::std::derived_from; + std::derived_from; - requires ::std::derived_from && - nothrow_swappable || - ::std::derived_from; + requires std::derived_from && + nothrow_swappable || std::derived_from; }; }; @@ -145,7 +144,7 @@ namespace stdsharp struct make_obj_using_allocator_fn { template - requires ::std::constructible_from + requires std::constructible_from constexpr T operator()(const Alloc& alloc, Args&&... args) const noexcept(nothrow_constructible_from) { @@ -153,15 +152,11 @@ namespace stdsharp } template - requires ::std::constructible_from + requires std::constructible_from constexpr T operator()(const Alloc& alloc, Args&&... args) const - noexcept(nothrow_constructible_from< - T, - ::std::allocator_arg_t, - const Alloc&, - Args...>) + noexcept(nothrow_constructible_from) { - return T{::std::allocator_arg, alloc, cpp_forward(args)...}; + return T{std::allocator_arg, alloc, cpp_forward(args)...}; } }; } @@ -174,27 +169,27 @@ namespace stdsharp inline constexpr make_obj_uses_allocator_fn make_obj_uses_allocator{}; template - struct allocator_traits : private ::std::allocator_traits + struct allocator_traits : private std::allocator_traits { private: // NOLINTBEGIN(*-owning-memory) struct default_constructor { template constexpr decltype(auto) operator()(const Alloc&, T* const ptr, Args&&... args) const - noexcept(noexcept(::std::ranges::construct_at(ptr, ::std::declval()...))) - requires requires { ::std::ranges::construct_at(ptr, ::std::declval()...); } + noexcept(noexcept(std::ranges::construct_at(ptr, std::declval()...))) + requires requires { std::ranges::construct_at(ptr, std::declval()...); } { - return ::std::ranges::construct_at(ptr, cpp_forward(args)...); + return std::ranges::construct_at(ptr, cpp_forward(args)...); } template constexpr decltype(auto) operator()( const Alloc&, void* const ptr, - const ::std::in_place_type_t, + const std::in_place_type_t, Args&&... args - ) const noexcept(noexcept(::std::ranges::construct_at(ptr, ::std::declval()...))) - requires requires { ::std::ranges::construct_at(ptr, ::std::declval()...); } + ) const noexcept(noexcept(std::ranges::construct_at(ptr, std::declval()...))) + requires requires { std::ranges::construct_at(ptr, std::declval()...); } { return ::new(ptr) T{cpp_forward(args)...}; } @@ -203,43 +198,43 @@ namespace stdsharp struct using_alloc_ctor { template - requires ::std::constructible_from + requires std::constructible_from constexpr void operator()(const Alloc& alloc, T* const ptr, Args&&... args) // const noexcept(stdsharp::nothrow_constructible_from) { - ::std::ranges::construct_at(ptr, cpp_forward(args)..., alloc); + std::ranges::construct_at(ptr, cpp_forward(args)..., alloc); } - template - requires ::std::constructible_from + template + requires std::constructible_from constexpr void operator()(const Alloc& alloc, T* const ptr, Args&&... args) // const noexcept(stdsharp::nothrow_constructible_from) { - ::std::ranges::construct_at(ptr, ::std::allocator_arg, alloc, cpp_forward(args)...); + std::ranges::construct_at(ptr, std::allocator_arg, alloc, cpp_forward(args)...); } template - requires ::std::constructible_from + requires std::constructible_from constexpr void operator()( const Alloc& alloc, void* const ptr, - const ::std::in_place_type_t, + const std::in_place_type_t, Args&&... args ) const noexcept(stdsharp::nothrow_constructible_from) { ::new(ptr) T{cpp_forward(args)..., alloc}; } - template - requires ::std::constructible_from + template + requires std::constructible_from constexpr void operator()( const Alloc& alloc, void* const ptr, - const ::std::in_place_type_t, + const std::in_place_type_t, Args&&... args ) const noexcept(stdsharp::nothrow_constructible_from) { - ::new(ptr) T{::std::allocator_arg, alloc, cpp_forward(args)...}; + ::new(ptr) T{std::allocator_arg, alloc, cpp_forward(args)...}; } }; @@ -247,8 +242,8 @@ namespace stdsharp { template constexpr void operator()(Alloc& a, T* const ptr, Args&&... args) const - noexcept(noexcept(a.construct(ptr, ::std::declval()...))) - requires requires { a.construct(ptr, ::std::declval()...); } + noexcept(noexcept(a.construct(ptr, std::declval()...))) + requires requires { a.construct(ptr, std::declval()...); } { a.construct(ptr, cpp_forward(args)...); } @@ -262,7 +257,7 @@ namespace stdsharp template static constexpr auto construct_req = - get_expr_req(::std::invocable, nothrow_invocable); + get_expr_req(std::invocable, nothrow_invocable); private: struct custom_destructor @@ -280,7 +275,7 @@ namespace stdsharp template constexpr void operator()(const Alloc&, U* const ptr) const noexcept { - ::std::ranges::destroy_at(ptr); + std::ranges::destroy_at(ptr); } }; @@ -290,18 +285,17 @@ namespace stdsharp static constexpr destructor destroy{}; private: - using base = ::std::allocator_traits; + using base = std::allocator_traits; template - static constexpr auto constructible_from = - ::std::invocable; + static constexpr auto constructible_from = std::invocable; template static constexpr auto nothrow_constructible_from = nothrow_invocable; template - static constexpr auto destructible = ::std::invocable; + static constexpr auto destructible = std::invocable; template static constexpr auto nothrow_destructible = nothrow_invocable; @@ -378,7 +372,7 @@ namespace stdsharp ) noexcept requires requires // clang-format off { - { alloc.try_allocate(count) } -> ::std::same_as; // clang-format on + { alloc.try_allocate(count) } -> std::same_as; // clang-format on requires noexcept(alloc.try_allocate(count)); } { @@ -386,7 +380,7 @@ namespace stdsharp requires { { alloc.try_allocate(count, hint) } -> - ::std::same_as; // clang-format on + std::same_as; // clang-format on requires noexcept(alloc.try_allocate(count, hint)); } // ) @@ -397,7 +391,7 @@ namespace stdsharp static constexpr auto allocate_at_least(allocator_type& alloc, const size_type count) { - return ::std::allocate_at_least(alloc, count); + return std::allocate_at_least(alloc, count); } template @@ -419,7 +413,7 @@ namespace stdsharp destructible ? nothrow_destructible ? expr_req::no_exception : expr_req::well_formed : expr_req::ill_formed, - ::std::swappable ? + std::swappable ? nothrow_swappable ? expr_req::no_exception : expr_req::well_formed : expr_req::ill_formed // }; @@ -439,7 +433,7 @@ namespace stdsharp template requires requires { typename T::allocator_type; } - struct allocator_of : ::std::type_identity + struct allocator_of : std::type_identity { }; diff --git a/include/stdsharp/memory/composed_allocator.h b/include/stdsharp/memory/composed_allocator.h index b3edf8b2..65adf095 100644 --- a/include/stdsharp/memory/composed_allocator.h +++ b/include/stdsharp/memory/composed_allocator.h @@ -14,13 +14,13 @@ namespace stdsharp const typename allocator_traits::const_void_pointer ptr ) // clang-format off { - { alloc.contains(ptr) } -> ::std::convertible_to; // clang-format on + { alloc.contains(ptr) } -> std::convertible_to; // clang-format on requires noexcept(alloc.contains(ptr)); }; } template - requires ::std::same_as + requires std::same_as class composed_allocator { public: @@ -28,7 +28,7 @@ namespace stdsharp using second_allocator_type = SecondAlloc; private: - ::std::pair alloc_pair_; + std::pair alloc_pair_; using first_traits = allocator_traits; using second_traits = allocator_traits; @@ -48,17 +48,17 @@ namespace stdsharp public: using value_type = FirstAlloc::value_type; - using propagate_on_container_copy_assignment = ::std::disjunction< + using propagate_on_container_copy_assignment = std::disjunction< typename first_traits::propagate_on_container_copy_assignment, typename second_traits::propagate_on_container_copy_assignment>; - using propagate_on_container_move_assignment = ::std::disjunction< + using propagate_on_container_move_assignment = std::disjunction< typename first_traits::propagate_on_container_move_assignment, typename second_traits::propagate_on_container_move_assignment>; - using propagate_on_container_swap = ::std::disjunction< + using propagate_on_container_swap = std::disjunction< typename first_traits::propagate_on_container_swap, typename second_traits::propagate_on_container_swap>; - using is_always_equal = ::std::conjunction< + using is_always_equal = std::conjunction< typename first_traits::is_always_equal, typename second_traits::is_always_equal>; @@ -72,14 +72,14 @@ namespace stdsharp composed_allocator() = default; - template Pair = decltype(alloc_pair_)> + template Pair = decltype(alloc_pair_)> constexpr explicit composed_allocator(Args&&... args) // noexcept(nothrow_constructible_from): alloc_pair_(cpp_forward(args)...) { } - constexpr auto allocate(const ::std::size_t n, const void* const hint = nullptr) + constexpr auto allocate(const std::size_t n, const void* const hint = nullptr) { const auto ptr = first_traits::try_allocate( alloc_pair_.first, @@ -95,8 +95,7 @@ namespace stdsharp ptr; } - constexpr auto - try_allocate(const ::std::size_t n, const void* const hint = nullptr) noexcept + constexpr auto try_allocate(const std::size_t n, const void* const hint = nullptr) noexcept { const auto ptr = first_traits::try_allocate( alloc_pair_.first, @@ -112,7 +111,7 @@ namespace stdsharp ptr; } - constexpr void deallocate(value_type* const ptr, const ::std::size_t n) + constexpr void deallocate(value_type* const ptr, const std::size_t n) { auto& [first, second] = alloc_pair_; if(first.contains(first_ptr_traits::to_pointer(ptr))) first.deallocate(ptr, n); @@ -121,7 +120,7 @@ namespace stdsharp [[nodiscard]] constexpr auto max_size() const noexcept { - return ::std::min( + return std::min( first_traits::max_size(alloc_pair_.first), second_traits::max_size(alloc_pair_.second) ); @@ -135,12 +134,12 @@ namespace stdsharp }; } - [[nodiscard]] constexpr auto allocate_at_least(const ::std::size_t n) + [[nodiscard]] constexpr auto allocate_at_least(const std::size_t n) { struct { value_type* ptr; - ::std::size_t count; + std::size_t count; } result; aggregate_try( @@ -167,7 +166,7 @@ namespace stdsharp template< typename T, typename... Args, - auto Req = ::std:: + auto Req = std:: min(first_traits::template construct_req, second_traits::template construct_req)> requires(Req >= expr_req::well_formed) @@ -192,5 +191,5 @@ namespace stdsharp }; template - composed_allocator(T&&, U&&) -> composed_allocator<::std::decay_t, ::std::decay_t>; + composed_allocator(T&&, U&&) -> composed_allocator, std::decay_t>; } \ No newline at end of file diff --git a/include/stdsharp/memory/object_allocation.h b/include/stdsharp/memory/object_allocation.h index 49a8aff7..03ac6291 100644 --- a/include/stdsharp/memory/object_allocation.h +++ b/include/stdsharp/memory/object_allocation.h @@ -39,8 +39,8 @@ namespace stdsharp constexpr allocation_dispatchers( const dispatchers& b, - const ::std::string_view current_type, - const ::std::size_t type_size + const std::string_view current_type, + const std::size_t type_size ) noexcept: dispatchers_(b), current_type_(current_type), type_size_(type_size) { @@ -53,9 +53,9 @@ namespace stdsharp template< typename T, - typename AllocationFor = traits::template allocation_for<::std::decay_t>> + typename AllocationFor = traits::template allocation_for>> requires(Req <= AllocationFor::obj_req) - constexpr allocation_dispatchers(const ::std::type_identity) noexcept: + constexpr allocation_dispatchers(const std::type_identity) noexcept: allocation_dispatchers( dispatchers( [](alloc& alloc, allocation& other) noexcept @@ -200,8 +200,8 @@ namespace stdsharp private: dispatchers dispatchers_{}; - ::std::string_view current_type_ = type_id; - ::std::size_t type_size_{}; + std::string_view current_type_ = type_id; + std::size_t type_size_{}; }; template @@ -237,16 +237,15 @@ namespace stdsharp template< typename... Args, typename T, - typename ValueType = ::std::decay_t, - typename Identity = ::std::type_identity // clang-format off + typename ValueType = std::decay_t, + typename Identity = std::type_identity // clang-format off > // clang-format on - requires ::std::constructible_from && - ::std:: - invocable, allocator_type&, Args...> + requires std::constructible_from && + std::invocable, allocator_type&, Args...> constexpr allocation_rsc( - const ::std::allocator_arg_t, + const std::allocator_arg_t, const allocator_type& alloc, - const ::std::in_place_type_t, + const std::in_place_type_t, Args&&... args ): compressed_(Identity{}, alloc), @@ -357,7 +356,7 @@ namespace stdsharp other.get_allocation() ); - ::std::swap(get_dispatchers(), other_dispatchers); + std::swap(get_dispatchers(), other_dispatchers); } [[nodiscard]] constexpr auto& get_allocator() const noexcept @@ -426,9 +425,8 @@ namespace stdsharp public: template static constexpr auto emplace_constructible = - (Base::template construct_req<::std::decay_t, Args...> >= expr_req::well_formed - ) && - ::std::constructible_from>>; + (Base::template construct_req, Args...> >= expr_req::well_formed) && + std::constructible_from>>; using typename Base::allocator_type; using Base::Base; @@ -436,7 +434,7 @@ namespace stdsharp static constexpr auto req = Req; - template<::std::same_as T = void> + template T = void> constexpr void emplace() noexcept { this->destroy(); @@ -446,19 +444,19 @@ namespace stdsharp requires emplace_constructible constexpr decltype(auto) emplace(Args&&... args) { - using value_t = ::std::decay_t; + using value_t = std::decay_t; this->destroy(); get_allocation().allocate(get_allocator(), sizeof(value_t)); this_t::construct(get_allocator(), ptr(), cpp_forward(args)...); - get_dispatchers() = dispatchers_t{::std::type_identity{}}; + get_dispatchers() = dispatchers_t{std::type_identity{}}; return get(); } template - constexpr decltype(auto) emplace(const ::std::initializer_list il, Args&&... args) + constexpr decltype(auto) emplace(const std::initializer_list il, Args&&... args) requires emplace_constructible { return emplace(il, cpp_forward(args)...); diff --git a/include/stdsharp/memory/pointer_traits.h b/include/stdsharp/memory/pointer_traits.h index 62bc9632..ba6b07ff 100644 --- a/include/stdsharp/memory/pointer_traits.h +++ b/include/stdsharp/memory/pointer_traits.h @@ -10,10 +10,10 @@ namespace stdsharp { template - struct pointer_traits : private ::std::pointer_traits + struct pointer_traits : private std::pointer_traits { private: - using base = ::std::pointer_traits; + using base = std::pointer_traits; public: using typename base::pointer; @@ -25,18 +25,18 @@ namespace stdsharp template using rebind = base::template rebind; - using reference = ::std::add_lvalue_reference_t; + using reference = std::add_lvalue_reference_t; using raw_pointer = element_type*; private: struct base_pointer_to { - template<::std::same_as T> + template T> requires requires(T t) // { requires( - requires { Ptr::pointer_to(t); } || requires { ::std::addressof(t); } + requires { Ptr::pointer_to(t); } || requires { std::addressof(t); } ); } constexpr pointer operator()(T t) const noexcept @@ -50,7 +50,7 @@ namespace stdsharp constexpr pointer operator()(auto& r) const noexcept requires nothrow_explicitly_convertible { - return auto_cast(::std::addressof(r)); + return auto_cast(std::addressof(r)); } }; @@ -61,9 +61,9 @@ namespace stdsharp struct base_to_address { constexpr auto operator()(const pointer& p) const noexcept - requires requires { ::std::to_address(p); } + requires requires { std::to_address(p); } { - return ::std::to_address(p); + return std::to_address(p); } }; @@ -87,7 +87,7 @@ namespace stdsharp struct dereference_to_pointer { - template<::std::same_as T = raw_pointer> + template T = raw_pointer> requires requires(const T p) { pointer_to(*p); } constexpr pointer operator()(const T p) const noexcept { @@ -114,20 +114,20 @@ namespace stdsharp public: static constexpr void pointer_to() = delete; - static constexpr auto pointer_to(::std::same_as auto& r) noexcept - requires ::std::invocable + static constexpr auto pointer_to(std::same_as auto& r) noexcept + requires std::invocable { return pointer_to_impl(r); } static constexpr auto to_address(const pointer& p) noexcept - requires ::std::invocable + requires std::invocable { return to_address_impl(p); } static constexpr auto to_pointer(const raw_pointer p) noexcept // NOLINT(*-misplaced-const) - requires ::std::invocable + requires std::invocable { return to_pointer_impl(p); } @@ -141,7 +141,7 @@ namespace stdsharp { using traits = pointer_traits; using ret = - ::std::conditional_t, const void*, void*>; + std::conditional_t, const void*, void*>; return static_cast(traits::to_address(ptr)); } @@ -155,7 +155,7 @@ namespace stdsharp requires requires { pointer_traits{}; } struct traits { - using ptr = ::std:: + using ptr = std:: conditional_t::element_type>, const T*, T*>; }; @@ -164,7 +164,7 @@ namespace stdsharp requires requires // { traits{}; - requires ::std::invocable; + requires std::invocable; requires !explicitly_convertible::ptr>; } STDSHARP_INTRINSIC [[nodiscard]] constexpr auto operator()(const Pointer& p) const noexcept diff --git a/include/stdsharp/memory/small_object_optimization.h b/include/stdsharp/memory/small_object_optimization.h index 74bbbc78..555f1c33 100644 --- a/include/stdsharp/memory/small_object_optimization.h +++ b/include/stdsharp/memory/small_object_optimization.h @@ -8,10 +8,10 @@ namespace stdsharp { template concept soo_alloc = - allocator_req && ::std::same_as; + allocator_req && std::same_as; template< - ::std::size_t Size, + std::size_t Size, typename Allocator, typename Base = composed_allocator< static_allocator_for, @@ -32,20 +32,20 @@ namespace stdsharp }; template - requires ::std::constructible_from + requires std::constructible_from constexpr soo_allocator( static_memory_resource& resource, Args&&... args ) noexcept(nothrow_constructible_from): Base( static_allocator_for{resource}, - Allocator{::std::forward(args)...} + Allocator{std::forward(args)...} ) { } constexpr soo_allocator() noexcept(nothrow_constructible_from) - requires ::std::constructible_from + requires std::constructible_from : soo_allocator(get_static_memory_resource()) { } @@ -53,23 +53,23 @@ namespace stdsharp } template< - ::std::size_t Size = 1, - details::soo_alloc Allocator = ::std::allocator // clang-format off + std::size_t Size = 1, + details::soo_alloc Allocator = std::allocator // clang-format off > // clang-format on using soo_allocator = details::soo_allocator; template< typename T, - ::std::size_t Size = 1, - details::soo_alloc Allocator = ::std::allocator> + std::size_t Size = 1, + details::soo_alloc Allocator = std::allocator> using soo_allocation_for = obj_allocation_for>; - template<::std::size_t Size = 1, details::soo_alloc Allocator = ::std::allocator> + template> using trivial_soo_allocation = trivial_obj_allocation>; - template<::std::size_t Size = 1, details::soo_alloc Allocator = ::std::allocator> + template> using normal_soo_allocation = normal_obj_allocation>; - template<::std::size_t Size = 1, details::soo_alloc Allocator = ::std::allocator> + template> using unique_soo_allocation = unique_obj_allocation>; } \ No newline at end of file diff --git a/include/stdsharp/memory/static_allocator.h b/include/stdsharp/memory/static_allocator.h index 24b55504..29cb9fda 100644 --- a/include/stdsharp/memory/static_allocator.h +++ b/include/stdsharp/memory/static_allocator.h @@ -6,14 +6,14 @@ namespace stdsharp { - template + template class static_allocator { public: using value_type = T; - using propagate_on_container_move_assignment = ::std::true_type; - using propagate_on_container_copy_assignment = ::std::true_type; - using propagate_on_container_swap = ::std::true_type; + using propagate_on_container_move_assignment = std::true_type; + using propagate_on_container_copy_assignment = std::true_type; + using propagate_on_container_swap = std::true_type; static constexpr auto size = ResourceSize; @@ -33,17 +33,17 @@ namespace stdsharp { } - [[nodiscard]] constexpr T* allocate(const ::std::size_t required_size) + [[nodiscard]] constexpr T* allocate(const std::size_t required_size) { return pointer_cast(resource().allocate(to_generic_size(required_size))); } - [[nodiscard]] constexpr T* try_allocate(const ::std::size_t required_size) + [[nodiscard]] constexpr T* try_allocate(const std::size_t required_size) { return pointer_cast(resource().try_allocate(to_generic_size(required_size))); } - constexpr void deallocate(T* const ptr, const ::std::size_t required_size) noexcept + constexpr void deallocate(T* const ptr, const std::size_t required_size) noexcept { if(ptr == nullptr) return; resource().deallocate(pointer_cast(ptr), to_generic_size(required_size)); @@ -62,18 +62,18 @@ namespace stdsharp } private: - ::std::reference_wrapper src_; + std::reference_wrapper src_; - static constexpr auto to_generic_size(const ::std::size_t size_v) + static constexpr auto to_generic_size(const std::size_t size_v) { return ceil_reminder(size_v * sizeof(T), sizeof(all_aligned)); } }; - template<::std::size_t Size> + template static_allocator(static_memory_resource&) -> static_allocator; - template + template using static_allocator_for = static_allocator; } \ No newline at end of file diff --git a/include/stdsharp/memory/static_memory_resource.h b/include/stdsharp/memory/static_memory_resource.h index 77ddc456..bf21060e 100644 --- a/include/stdsharp/memory/static_memory_resource.h +++ b/include/stdsharp/memory/static_memory_resource.h @@ -15,10 +15,10 @@ namespace stdsharp union all_aligned { private: - ::std::max_align_t v; + std::max_align_t v; }; - template<::std::size_t Size> + template class static_memory_resource { public: @@ -26,9 +26,9 @@ namespace stdsharp using value_t = all_aligned; - using states_t = ::std::array; + using states_t = std::array; - using storage_t = ::std::array; + using storage_t = std::array; static_memory_resource() = default; @@ -46,37 +46,36 @@ namespace stdsharp ~static_memory_resource() = default; - [[nodiscard]] constexpr all_aligned* allocate(const ::std::size_t required_size) + [[nodiscard]] constexpr all_aligned* allocate(const std::size_t required_size) { const auto ptr = try_allocate(required_size); - return (ptr == nullptr && required_size != 0) ? throw ::std::bad_alloc{} : ptr; + return (ptr == nullptr && required_size != 0) ? throw std::bad_alloc{} : ptr; } - [[nodiscard]] constexpr all_aligned* try_allocate(const ::std::size_t required_size) + [[nodiscard]] constexpr all_aligned* try_allocate(const std::size_t required_size) { if(required_size == 0) return nullptr; - const auto found = ::std::ranges::search_n(state_, auto_cast(required_size), false); + const auto found = std::ranges::search_n(state_, auto_cast(required_size), false); if(found.empty()) return nullptr; - ::std::ranges::fill(found, true); - return ::std::ranges::next( + std::ranges::fill(found, true); + return std::ranges::next( storage_.data(), - ::std::ranges::distance(state_.cbegin(), found.begin()) + std::ranges::distance(state_.cbegin(), found.begin()) ); } - constexpr void - deallocate(all_aligned* const ptr, const ::std::size_t required_size) noexcept + constexpr void deallocate(all_aligned* const ptr, const std::size_t required_size) noexcept { if(ptr == nullptr) return; - precondition<::std::out_of_range>( + precondition( [ptr, this] { return contains(ptr); }, "pointer does not belong to this resource" ); - ::std::ranges::fill_n(map_state(ptr), auto_cast(required_size), false); + std::ranges::fill_n(map_state(ptr), auto_cast(required_size), false); } constexpr void release() noexcept { state_ = {}; } @@ -87,17 +86,17 @@ namespace stdsharp [[nodiscard]] constexpr auto used() const noexcept { - return ::std::ranges::count(state_, true); + return std::ranges::count(state_, true); } [[nodiscard]] constexpr auto remaining() const noexcept { return size - used(); } [[nodiscard]] constexpr auto contains(const void* const ptr) noexcept { - return ::std::is_constant_evaluated() ? // + return std::is_constant_evaluated() ? // constexpr_map_state_impl(ptr) < size : - (ptr >= ::std::to_address(storage_.cbegin())) && - (ptr < ::std::to_address(storage_.cend())); + (ptr >= std::to_address(storage_.cbegin())) && + (ptr < std::to_address(storage_.cend())); } [[nodiscard]] constexpr bool operator==(const static_memory_resource& other) const noexcept @@ -110,19 +109,19 @@ namespace stdsharp { const auto diff = [&, this] { - return ::std::is_constant_evaluated() ? // + return std::is_constant_evaluated() ? // constexpr_map_state_impl(ptr) : ptr - storage_.data(); }(); - return state_.begin() + ::std::ranges::min(diff, static_cast(size)); + return state_.begin() + std::ranges::min(diff, static_cast(size)); } [[nodiscard]] constexpr auto constexpr_map_state_impl(const void* const ptr) noexcept { const auto data = storage_.data(); - const auto ptr_view = ::std::views::iota(data, ::std::ranges::next(data, size)); - return ::std::ranges::find(ptr_view, ptr) - ptr_view.begin(); + const auto ptr_view = std::views::iota(data, std::ranges::next(data, size)); + return std::ranges::find(ptr_view, ptr) - ptr_view.begin(); } storage_t storage_{}; @@ -130,11 +129,11 @@ namespace stdsharp states_t state_{}; }; - template + template using static_memory_resource_for = static_memory_resource; - template<::std::size_t Size> + template constexpr auto& get_static_memory_resource() noexcept { #ifdef _MSC_VER diff --git a/include/stdsharp/mutex/mutex.h b/include/stdsharp/mutex/mutex.h index c3e62165..44a62be6 100644 --- a/include/stdsharp/mutex/mutex.h +++ b/include/stdsharp/mutex/mutex.h @@ -3,7 +3,7 @@ #include #include -using namespace ::std::literals; +using namespace std::literals; namespace stdsharp { @@ -18,15 +18,15 @@ namespace stdsharp concept lockable = basic_lockable && requires(T t) // { // clang-format off - { t.try_lock() } -> ::std::same_as; // clang-format on + { t.try_lock() } -> std::same_as; // clang-format on }; template concept timed_lockable = lockable && requires(T t) // { // clang-format off - { t.try_lock_for(1s) } -> ::std::same_as; - { t.try_lock_until(std::chrono::system_clock::now()) } -> ::std::same_as; // clang-format on + { t.try_lock_for(1s) } -> std::same_as; + { t.try_lock_until(std::chrono::system_clock::now()) } -> std::same_as; // clang-format on }; template @@ -34,23 +34,23 @@ namespace stdsharp { t.lock_shared(); t.unlock_shared(); // clang-format off - { t.try_lock_shared() } -> ::std::same_as; // clang-format on + { t.try_lock_shared() } -> std::same_as; // clang-format on }; template concept shared_timed_lockable = shared_lockable && requires(T t) // { // clang-format off - { t.try_lock_shared_for(1s) } -> ::std::same_as; - { t.try_lock_shared_until(std::chrono::system_clock::now()) } -> ::std::same_as; // clang-format on + { t.try_lock_shared_for(1s) } -> std::same_as; + { t.try_lock_shared_until(std::chrono::system_clock::now()) } -> std::same_as; // clang-format on }; template - concept mutex = lockable && !::std::movable && ::std::default_initializable && + concept mutex = lockable && !std::movable && std::default_initializable && requires(T t) // { // clang-format off - { t.lock() } -> ::std::same_as; - { t.unlock() } -> ::std::same_as; // clang-format on + { t.lock() } -> std::same_as; + { t.unlock() } -> std::same_as; // clang-format on }; template @@ -61,8 +61,8 @@ namespace stdsharp requires(T t) // { t.try_unlock_shared(); // clang-format off - { t.lock_shared() } -> ::std::same_as; - { t.unlock_shared() } -> ::std::same_as; // clang-format on + { t.lock_shared() } -> std::same_as; + { t.unlock_shared() } -> std::same_as; // clang-format on }; template diff --git a/include/stdsharp/namespace_alias.h b/include/stdsharp/namespace_alias.h new file mode 100644 index 00000000..c0ae2889 --- /dev/null +++ b/include/stdsharp/namespace_alias.h @@ -0,0 +1,10 @@ +#pragma once + +namespace std +{ +} + +namespace stdsharp +{ + namespace std = std; +} \ No newline at end of file diff --git a/include/stdsharp/pattern_match.h b/include/stdsharp/pattern_match.h index 119ab365..3d70ea14 100644 --- a/include/stdsharp/pattern_match.h +++ b/include/stdsharp/pattern_match.h @@ -8,25 +8,25 @@ namespace stdsharp { template< typename Condition, - ::std::predicate... Predicate, - ::std::invocable... Func // clang-format off + std::predicate... Predicate, + std::invocable... Func // clang-format off > // clang-format on constexpr void operator()( const Condition& condition, - ::std::pair... cases // + std::pair... cases // ) const noexcept(( (nothrow_predicate && nothrow_invocable)&&... )) { ( - [&condition](::std::pair&& pair) + [&condition](std::pair&& pair) { auto&& [first, second] = cpp_move(pair); - if(::std::invoke(cpp_move(first), condition)) + if(std::invoke(cpp_move(first), condition)) { - ::std::invoke(cpp_move(second), condition); + std::invoke(cpp_move(second), condition); return true; } return false; @@ -37,17 +37,17 @@ namespace stdsharp template< typename Condition, - ::std::invocable... Func // clang-format off + std::invocable... Func // clang-format off > // clang-format on constexpr void operator()( const Condition& condition, - ::std::pair... cases // + std::pair... cases // ) const noexcept((nothrow_invocable && ...)) { (*this)( condition, make_pair( - ::std::bind_front(equal_to_v, cpp_move(cases.first)), + std::bind_front(equal_to_v, cpp_move(cases.first)), cpp_move(cases.second) )... ); @@ -64,7 +64,7 @@ namespace stdsharp private: template static constexpr bool case_nothrow_invocable_ = - logical_imply(::std::invocable, nothrow_invocable); + logical_imply(std::invocable, nothrow_invocable); public: template @@ -74,9 +74,9 @@ namespace stdsharp ( []([[maybe_unused]] Cases&& c) noexcept(case_nothrow_invocable_) { - if constexpr(::std::invocable) + if constexpr(std::invocable) { - ::std::invoke(cpp_forward(c), T{}); + std::invoke(cpp_forward(c), T{}); return true; } else return false; @@ -88,7 +88,7 @@ namespace stdsharp } template - using from_type_fn = details::impl<::std::type_identity>; + using from_type_fn = details::impl>; template using from_constant_fn = details::impl>; diff --git a/include/stdsharp/random/random.h b/include/stdsharp/random/random.h index 90d48b8d..5f20a302 100644 --- a/include/stdsharp/random/random.h +++ b/include/stdsharp/random/random.h @@ -9,7 +9,7 @@ namespace stdsharp { [[nodiscard]] auto& operator()() const { - thread_local ::std::random_device random_device; + thread_local std::random_device random_device; return random_device; } } get_random_device{}; diff --git a/include/stdsharp/ranges/ranges.h b/include/stdsharp/ranges/ranges.h index b3b57722..f698c7d8 100644 --- a/include/stdsharp/ranges/ranges.h +++ b/include/stdsharp/ranges/ranges.h @@ -17,29 +17,29 @@ namespace stdsharp template using const_iterator_t = #if __cpp_lib_ranges_as_const >= 202207L - ::std::ranges::const_iterator_t; + std::ranges::const_iterator_t; #else - decltype(::std::ranges::cbegin(::std::declval())); + decltype(std::ranges::cbegin(std::declval())); #endif template using const_sentinel_t = #if __cpp_lib_ranges_as_const >= 202207L - ::std::ranges::const_sentinel_t; + std::ranges::const_sentinel_t; #else - decltype(::std::ranges::cend(::std::declval())); + decltype(std::ranges::cend(std::declval())); #endif template using range_const_reference_t = #if __cpp_lib_ranges_as_const >= 202207L - ::std::ranges::range_const_reference_t; + std::ranges::range_const_reference_t; #else - iter_const_reference_t<::std::ranges::iterator_t>; + iter_const_reference_t>; #endif template - using forwarding_views = ::std::ranges::transform_view>; + using forwarding_views = std::ranges::transform_view>; namespace views { diff --git a/include/stdsharp/reflection/reflection.h b/include/stdsharp/reflection/reflection.h index 53a31aee..a81c30e0 100644 --- a/include/stdsharp/reflection/reflection.h +++ b/include/stdsharp/reflection/reflection.h @@ -26,7 +26,7 @@ namespace stdsharp::reflection struct data_meta_getter : member_pointer_traits { template - requires ::std::invocable, T> + requires std::invocable, T> constexpr decltype(auto) operator()(T&& t) const noexcept(nothrow_invocable, T>) { @@ -41,9 +41,9 @@ namespace stdsharp::reflection struct meta_set...> : indexed_types...> { template - requires(::std::ranges::equal(N, Name) || ...) - using member_of_t = ::std::invoke_result_t< // - invocables (*)(constant<::std::ranges::equal(N, Name)>)...>, + requires(std::ranges::equal(N, Name) || ...) + using member_of_t = std::invoke_result_t< // + invocables (*)(constant)...>, constant // clang-format off >; // clang-format on @@ -71,20 +71,20 @@ namespace stdsharp::reflection }; template - inline constexpr ::std::conditional_t(), int, void> function; + inline constexpr std::conditional_t(), int, void> function; template using function_t = decltype(function); template - inline constexpr ::std::conditional_t(), int, void> data; + inline constexpr std::conditional_t(), int, void> data; template using data_t = decltype(data); template - inline constexpr auto data<::std::pair> = - member<::std::pair>::template data_reflect<"first"_ltr, "second"_ltr>( - regular_value_sequence<&::std::pair::first, &::std::pair::second>{} + inline constexpr auto data> = + member>::template data_reflect<"first"_ltr, "second"_ltr>( + regular_value_sequence<&std::pair::first, &std::pair::second>{} ); } \ No newline at end of file diff --git a/include/stdsharp/scope.h b/include/stdsharp/scope.h index 0a68de77..93f3b257 100644 --- a/include/stdsharp/scope.h +++ b/include/stdsharp/scope.h @@ -16,13 +16,13 @@ namespace stdsharp::scope template Policy, nothrow_invocable Fn> struct [[nodiscard]] scoped : // NOLINT(*-special-member-functions) - private ::std::optional, + private std::optional, unique_object { private: constexpr void execute() noexcept { - ::std::invoke(cpp_move(this->value())); + std::invoke(cpp_move(this->value())); this->reset(); }; @@ -30,9 +30,9 @@ namespace stdsharp::scope using exit_fn_t = Fn; template - requires ::std::constructible_from + requires std::constructible_from constexpr explicit scoped(Args&&... args) noexcept(nothrow_constructible_from): - ::std::optional(::std::in_place, cpp_forward(args)...) + std::optional(std::in_place, cpp_forward(args)...) { } @@ -43,7 +43,7 @@ namespace stdsharp::scope if(!this->has_value()) return; if constexpr(policy == exit_fn_policy::on_exit) execute(); - else if(::std::is_constant_evaluated() || ::std::uncaught_exceptions() == 0) + else if(std::is_constant_evaluated() || std::uncaught_exceptions() == 0) { if constexpr(policy.contains(exit_fn_policy::on_success)) execute(); } @@ -59,11 +59,11 @@ namespace stdsharp::scope { private: template - using scoped_t = scoped>; + using scoped_t = scoped>; public: template - requires ::std::constructible_from, Fn> + requires std::constructible_from, Fn> constexpr scoped_t operator()(Fn&& fn) const noexcept(nothrow_constructible_from, Fn>) { diff --git a/include/stdsharp/type_traits/indexed_traits.h b/include/stdsharp/type_traits/indexed_traits.h index 5704c365..c769f4cd 100644 --- a/include/stdsharp/type_traits/indexed_traits.h +++ b/include/stdsharp/type_traits/indexed_traits.h @@ -6,7 +6,7 @@ namespace stdsharp { - template + template struct basic_indexed_type : type_constant { static constexpr type_constant get_type(const index_constant) noexcept { return {}; } @@ -17,7 +17,7 @@ namespace stdsharp } }; - template<::std::size_t Index, typename T> + template [[nodiscard]] constexpr auto get_type(const basic_indexed_type& v) // noexcept { @@ -26,7 +26,7 @@ namespace stdsharp namespace details { - template + template struct indexed_type { struct type : basic_indexed_type @@ -35,30 +35,30 @@ namespace stdsharp }; } - template + template using indexed_type = ::meta::_t>; - template<::std::size_t I> + template struct make_indexed_type_fn { template - [[nodiscard]] constexpr indexed_type operator()(const ::std::type_identity) // + [[nodiscard]] constexpr indexed_type operator()(const std::type_identity) // noexcept { return {}; } }; - template<::std::size_t I> + template inline constexpr make_indexed_type_fn make_indexed_type{}; - template + template struct STDSHARP_EBO basic_indexed_value : value_wrapper, indexed_type { using value_wrapper::value_wrapper; #define STDSHARP_GET(const_, ref) \ - template<::std::size_t Index> \ + template \ [[nodiscard]] constexpr decltype(auto) get(const index_constant) const_ ref noexcept \ { \ return static_cast(this->v); \ @@ -73,7 +73,7 @@ namespace stdsharp }; #define STDSHARP_GET(const_, ref_) \ - template<::std::size_t Index, typename T> \ + template \ [[nodiscard]] constexpr decltype(auto) get(const_ basic_indexed_value ref_ v \ ) noexcept \ { \ @@ -89,7 +89,7 @@ namespace stdsharp namespace details { - template + template struct indexed_value { struct type : basic_indexed_value @@ -99,22 +99,22 @@ namespace stdsharp }; } - template + template using indexed_value = ::meta::_t>; - template<::std::size_t I> + template struct make_indexed_value_fn { template - requires ::std::constructible_from, I>, T> - [[nodiscard]] constexpr indexed_value<::std::decay_t, I> operator()(T&& t) // - noexcept(nothrow_constructible_from, I>, T>) + requires std::constructible_from, I>, T> + [[nodiscard]] constexpr indexed_value, I> operator()(T&& t) // + noexcept(nothrow_constructible_from, I>, T>) { return cpp_forward(t); } }; - template<::std::size_t I> + template inline constexpr make_indexed_value_fn make_indexed_value{}; namespace details @@ -125,7 +125,7 @@ namespace stdsharp template> struct base; - template<::std::size_t... I> + template struct STDSHARP_EBO base> : stdsharp::indexed_type..., regular_type_sequence @@ -135,7 +135,7 @@ namespace stdsharp template constexpr base(U&&... u) // noexcept((nothrow_constructible_from, U> && ...)) - requires(::std::constructible_from, U> && ...) + requires(std::constructible_from, U> && ...) : stdsharp::indexed_type(cpp_forward(u))... { } @@ -145,7 +145,7 @@ namespace stdsharp struct impl : base<> { - template<::std::size_t J> + template using get_t = ::meta::_t(base{}))>; }; }; @@ -157,7 +157,7 @@ namespace stdsharp }; template - basic_indexed_types(::std::type_identity...) -> basic_indexed_types; + basic_indexed_types(std::type_identity...) -> basic_indexed_types; template using indexed_types = adl_proof_t; @@ -166,9 +166,7 @@ namespace stdsharp requires requires // { requires( - ::std::convertible_to< - template_rebind<::std::decay_t, void>, - ::std::type_identity> && + std::convertible_to, void>, std::type_identity> && ... ); } @@ -187,7 +185,7 @@ namespace stdsharp template> struct impl; - template<::std::size_t... I> + template struct STDSHARP_EBO impl> : stdsharp::indexed_value..., stdsharp::indexed_types @@ -195,7 +193,7 @@ namespace stdsharp impl() = default; template - requires(::std::constructible_from, U> && ...) + requires(std::constructible_from, U> && ...) constexpr impl(U&&... u) // noexcept((nothrow_constructible_from, U> && ...)): stdsharp::indexed_value(cpp_forward(u))... @@ -212,7 +210,7 @@ namespace stdsharp }; template - basic_indexed_values(T&&...) -> basic_indexed_values<::std::decay_t...>; + basic_indexed_values(T&&...) -> basic_indexed_values...>; template using indexed_values = adl_proof_t; @@ -220,39 +218,38 @@ namespace stdsharp inline constexpr make_template_type_fn make_indexed_values{}; template - using index_sequence_by = - ::std::make_index_sequence<::std::tuple_size_v<::std::decay_t>>; + using index_sequence_by = std::make_index_sequence>>; inline constexpr struct indexed_apply_fn { private: template< - ::std::size_t... I, + std::size_t... I, typename Indexed, - ::std::invocable...> Fn> + std::invocable...> Fn> static constexpr decltype(auto) impl( Fn&& fn, Indexed&& indexed, - const ::std::index_sequence // + const std::index_sequence // ) noexcept(nothrow_invocable...>) { - return ::std::invoke(cpp_forward(fn), cpo::get_element(cpp_forward(indexed))...); + return std::invoke(cpp_forward(fn), cpo::get_element(cpp_forward(indexed))...); } public: template requires requires // - { impl(::std::declval(), ::std::declval(), index_sequence_by{}); } + { impl(std::declval(), std::declval(), index_sequence_by{}); } constexpr decltype(auto) operator()(Fn&& fn, Indexed&& indexed) const noexcept( // noexcept( // - impl(::std::declval(), ::std::declval(), index_sequence_by{}) + impl(std::declval(), std::declval(), index_sequence_by{}) ) ) { return impl( cpp_forward(fn), cpp_forward(indexed), - ::std::make_index_sequence<::std::tuple_size_v>{} + std::make_index_sequence>{} ); } } indexed_apply{}; @@ -260,29 +257,29 @@ namespace stdsharp namespace std { - template<::std::size_t I, template typename Template, typename... T> - requires(::std::same_as<::stdsharp::regular_type_sequence, Template> || ::std::same_as<::stdsharp::basic_type_sequence, Template>) + template typename Template, typename... T> + requires(std::same_as, Template> || std::same_as, Template>) struct tuple_element> { using type = Template::template get_t; }; template typename Template, typename... T> - requires(::std::same_as<::stdsharp::regular_type_sequence, Template> || ::std::same_as<::stdsharp::basic_type_sequence, Template>) + requires(std::same_as, Template> || std::same_as, Template>) struct tuple_size> { static constexpr auto value = Template::size(); }; - template<::std::size_t I, template typename Template, auto... V> - requires ::std::same_as<::stdsharp::regular_value_sequence, Template> + template typename Template, auto... V> + requires std::same_as, Template> struct tuple_element> { using type = Template::template get_t; }; template typename Template, auto... V> - requires ::std::same_as<::stdsharp::regular_value_sequence, Template> + requires std::same_as, Template> struct tuple_size> { static constexpr auto value = Template::size(); diff --git a/include/stdsharp/type_traits/member.h b/include/stdsharp/type_traits/member.h index d634e4e7..60755986 100644 --- a/include/stdsharp/type_traits/member.h +++ b/include/stdsharp/type_traits/member.h @@ -91,9 +91,9 @@ namespace stdsharp #undef STDSHARP_MEMBER_FUNCTION_TRAITS_CONST_PACK template - concept member_of = ::std::same_as::class_t, ClassT>; + concept member_of = std::same_as::class_t, ClassT>; template concept member_func_of = - ::std::is_member_pointer_v && ::std::same_as::class_t, ClassT>; + std::is_member_pointer_v && std::same_as::class_t, ClassT>; } \ No newline at end of file diff --git a/include/stdsharp/type_traits/object.h b/include/stdsharp/type_traits/object.h index 5ed4e5f1..201a4c18 100644 --- a/include/stdsharp/type_traits/object.h +++ b/include/stdsharp/type_traits/object.h @@ -31,7 +31,7 @@ namespace stdsharp inherited() = default; template - requires ::std::constructible_from && (::std::constructible_from && ...) + requires std::constructible_from && (std::constructible_from && ...) constexpr explicit inherited(U&&... u) noexcept( nothrow_constructible_from && (nothrow_constructible_from && ...) // clang-format off @@ -42,8 +42,8 @@ namespace stdsharp template requires requires // { - requires ::std::constructible_from; - requires(::std::constructible_from && ...); + requires std::constructible_from; + requires(std::constructible_from && ...); } constexpr explicit inherited(BaseT&& base, U&&... u) noexcept( nothrow_constructible_from && @@ -53,7 +53,7 @@ namespace stdsharp } template - requires ::std::assignable_from + requires std::assignable_from constexpr inherited& operator=(U&& u) noexcept(nothrow_assignable_from) { Base::operator=(cpp_forward(u)); @@ -62,17 +62,17 @@ namespace stdsharp }; template - inherited(T&&...) -> inherited<::std::decay_t...>; + inherited(T&&...) -> inherited...>; struct make_inherited_fn { template requires requires // { - inherited{::std::declval(), ::std::declval()...}; + inherited{std::declval(), std::declval()...}; } [[nodiscard]] constexpr auto operator()(Base&& base, U&&... u) const - noexcept(noexcept(inherited{::std::declval(), ::std::declval()...})) + noexcept(noexcept(inherited{std::declval(), std::declval()...})) { return inherited{cpp_forward(base), cpp_forward(u)...}; } diff --git a/include/stdsharp/type_traits/special_member.h b/include/stdsharp/type_traits/special_member.h index 6a39d1a0..68f9f66c 100644 --- a/include/stdsharp/type_traits/special_member.h +++ b/include/stdsharp/type_traits/special_member.h @@ -23,7 +23,7 @@ namespace stdsharp private: [[nodiscard]] constexpr auto to_rng() const noexcept { - return ::std::array{ + return std::array{ move_construct, copy_construct, move_assign, @@ -33,7 +33,7 @@ namespace stdsharp }; } - [[nodiscard]] friend constexpr ::std::partial_ordering + [[nodiscard]] friend constexpr std::partial_ordering operator<=>(const special_mem_req left, const special_mem_req right) noexcept { return strict_compare(left.to_rng(), right.to_rng()); @@ -56,12 +56,12 @@ namespace stdsharp min(const special_mem_req left, const special_mem_req right) noexcept { return { - ::std::min(left.move_construct, right.move_construct), - ::std::min(left.copy_construct, right.copy_construct), - ::std::min(left.move_assign, right.move_assign), - ::std::min(left.copy_assign, right.copy_assign), - ::std::min(left.destruct, right.destruct), - ::std::min(left.swap, right.swap) // + std::min(left.move_construct, right.move_construct), + std::min(left.copy_construct, right.copy_construct), + std::min(left.move_assign, right.move_assign), + std::min(left.copy_assign, right.copy_assign), + std::min(left.destruct, right.destruct), + std::min(left.swap, right.swap) // }; } @@ -69,23 +69,23 @@ namespace stdsharp max(const special_mem_req left, const special_mem_req right) noexcept { return { - ::std::max(left.move_construct, right.move_construct), - ::std::max(left.copy_construct, right.copy_construct), - ::std::max(left.move_assign, right.move_assign), - ::std::max(left.copy_assign, right.copy_assign), - ::std::max(left.destruct, right.destruct), - ::std::max(left.swap, right.swap) // + std::max(left.move_construct, right.move_construct), + std::max(left.copy_construct, right.copy_construct), + std::max(left.move_assign, right.move_assign), + std::max(left.copy_assign, right.copy_assign), + std::max(left.destruct, right.destruct), + std::max(left.swap, right.swap) // }; } template inline constexpr special_mem_req special_mem_req::for_type{ - get_expr_req(::std::move_constructible, nothrow_move_constructible), - get_expr_req(::std::copy_constructible, nothrow_copy_constructible), + get_expr_req(std::move_constructible, nothrow_move_constructible), + get_expr_req(std::copy_constructible, nothrow_copy_constructible), get_expr_req(move_assignable, nothrow_move_assignable), get_expr_req(copy_assignable, nothrow_copy_assignable), - get_expr_req(::std::is_destructible_v, ::std::is_nothrow_destructible_v), - get_expr_req(::std::swappable, nothrow_swappable) // + get_expr_req(std::is_destructible_v, std::is_nothrow_destructible_v), + get_expr_req(std::swappable, nothrow_swappable) // }; inline constexpr special_mem_req special_mem_req::trivial{}; diff --git a/include/stdsharp/type_traits/type_sequence.h b/include/stdsharp/type_traits/type_sequence.h index 4d8506b8..e51acfcd 100644 --- a/include/stdsharp/type_traits/type_sequence.h +++ b/include/stdsharp/type_traits/type_sequence.h @@ -15,7 +15,7 @@ namespace stdsharp template using regular_type_sequence = regular_type_sequence; - template<::std::size_t I> + template requires requires { requires I < Base::size(); } [[nodiscard]] friend constexpr decltype(auto) get(const type_sequence) noexcept { @@ -41,16 +41,16 @@ namespace stdsharp template typename T> using apply_t = T; - template<::std::size_t I> + template using type = Base::template value_type::type; - template<::std::size_t... I> + template using at_t = regular_type_sequence...>; - template<::std::size_t Size> + template using back_t = convert_from_value_sequence>; - template<::std::size_t Size> + template using front_t = convert_from_value_sequence>; template @@ -65,7 +65,7 @@ namespace stdsharp template using append_front_t = regular_type_sequence; - template<::std::size_t Index, typename... Other> + template using insert_t = convert_from_value_sequence< // typename Base::template insert_t< Index, @@ -73,15 +73,15 @@ namespace stdsharp > >; // clang-format on - template<::std::size_t... Index> + template using remove_at_t = convert_from_value_sequence>; - template<::std::size_t Index, typename Other> + template using replace_t = convert_from_value_sequence< typename Base::template replace_t{}>>; - template<::std::size_t From, ::std::size_t Size> + template using select_range_t = convert_from_value_sequence>; }; @@ -98,12 +98,12 @@ namespace stdsharp [] typename Inner, typename... U>(const Inner&) // { return type_sequence{}; // - }(::std::declval()) + }(std::declval()) ); template using reverse_type_sequence = - convert_from_value_sequence{}...>>; + convert_from_value_sequence{}...>>; template using unique_type_sequence = @@ -113,13 +113,13 @@ namespace stdsharp namespace std { template - requires same_as<::stdsharp::template_rebind, ::stdsharp::type_sequence<>> - struct tuple_size : ::stdsharp::index_constant + requires same_as, stdsharp::type_sequence<>> + struct tuple_size : stdsharp::index_constant { }; - template<::std::size_t I, typename Seq> - requires same_as<::stdsharp::template_rebind, ::stdsharp::type_sequence<>> + template + requires same_as, stdsharp::type_sequence<>> struct tuple_element { using type = Seq::template type; diff --git a/include/stdsharp/type_traits/value_sequence.h b/include/stdsharp/type_traits/value_sequence.h index 2252c952..6fa2aeee 100644 --- a/include/stdsharp/type_traits/value_sequence.h +++ b/include/stdsharp/type_traits/value_sequence.h @@ -18,14 +18,14 @@ namespace stdsharp auto... Values>(const Inner) // { return value_sequence{}; // - }(::std::declval()) + }(std::declval()) ); namespace details { template> consteval to_value_sequence< - make_value_sequence_t>:: + make_value_sequence_t>:: template apply_t get_reverse_value_sequence(); @@ -36,11 +36,11 @@ namespace stdsharp static constexpr auto unique_indices = [] { - ::std::array<::std::size_t, seq::size()> indices{seq::find(Values)...}; + std::array indices{seq::find(Values)...}; - ::std::ranges::sort(indices); + std::ranges::sort(indices); - const auto res = ::std::ranges::unique(indices); + const auto res = std::ranges::unique(indices); if(res) res.front() = seq::size(); @@ -48,13 +48,13 @@ namespace stdsharp }(); static constexpr auto unique_indices_size = - ::std::ranges::find(unique_indices, seq::size()) - unique_indices.cbegin(); + std::ranges::find(unique_indices, seq::size()) - unique_indices.cbegin(); static constexpr auto unique_indices_value = [] { - ::std::array<::std::size_t, unique_indices_size> value{}; + std::array value{}; - ::std::ranges::copy_n(unique_indices.cbegin(), value.size(), value.begin()); + std::ranges::copy_n(unique_indices.cbegin(), value.size(), value.begin()); return value; }(); @@ -75,10 +75,10 @@ namespace stdsharp } template - requires ::std::predicate + requires std::predicate constexpr bool operator()(const U& other) const noexcept(nothrow_predicate) { - return ::std::invoke(comp, other, value); + return std::invoke(comp, other, value); } constexpr auto operator()(const auto&) const noexcept { return false; } @@ -94,9 +94,9 @@ namespace stdsharp private: static constexpr basic_indexed_values values{Values...}; - using values_t = ::std::decay_t; + using values_t = std::decay_t; - template<::std::size_t I> + template requires requires { requires I < size(); } [[nodiscard]] friend constexpr decltype(auto) get(const value_sequence) noexcept { @@ -110,24 +110,24 @@ namespace stdsharp template requires requires // { - requires(::std::invocable && ...); - requires ::std::same_as || - ::std::constructible_from< // clang-format off + requires(std::invocable && ...); + requires std::same_as || + std::constructible_from< // clang-format off ResultType, - ::std::invoke_result_t... + std::invoke_result_t... >; // clang-format on } constexpr auto operator()(Func&& func) const noexcept( (nothrow_invocable && ...) && - (::std::same_as || + (std::same_as || nothrow_constructible_from< ResultType, - ::std::invoke_result_t... // clang-format off + std::invoke_result_t... // clang-format off >) // clang-format on ) { - if constexpr(::std::same_as) (::std::invoke(func, Values), ...); - else return ResultType{::std::invoke(func, Values)...}; + if constexpr(std::same_as) (std::invoke(func, Values), ...); + else return ResultType{std::invoke(func, Values)...}; }; }; @@ -137,13 +137,13 @@ namespace stdsharp template typename T> using apply_t = T; - template<::std::size_t I> + template using value_type = values_t::template get_t; - template<::std::size_t I> + template static constexpr value_type value = get(values); - template<::std::size_t... I> + template using at_t = regular_value_sequence...>; private: @@ -154,39 +154,39 @@ namespace stdsharp requires requires // { requires(sizeof...(Func) == 1); - typename value_sequence<::std::invoke(Func..., Values)...>; + typename value_sequence; } { - return value_sequence<::std::invoke(Func..., Values)...>{}; + return value_sequence{}; }; [[nodiscard]] constexpr auto operator()() const noexcept - requires requires { typename value_sequence<::std::invoke(Func, Values)...>; } + requires requires { typename value_sequence; } { - return value_sequence<::std::invoke(Func, Values)...>{}; // clang-format on + return value_sequence{}; // clang-format on }; }; - template<::std::size_t From, ::std::size_t... I> - static consteval at_t<(From + I)...> select_range(::std::index_sequence) noexcept; + template + static consteval at_t<(From + I)...> select_range(std::index_sequence) noexcept; template struct if_not_fn { template - requires ::std::invocable + requires std::invocable [[nodiscard]] constexpr auto operator()(Func&& func) const noexcept(nothrow_invocable) { - return IfFunc{}(::std::not_fn(cpp_forward(func))); + return IfFunc{}(std::not_fn(cpp_forward(func))); } }; template struct from_value_fn { - template - requires ::std::invocable> + template + requires std::invocable> [[nodiscard]] constexpr auto operator()(const T& v, Comp comp = {}) const noexcept(nothrow_invocable>) { @@ -198,7 +198,7 @@ namespace stdsharp struct result_compare_to_size { template - requires ::std::invocable + requires std::invocable [[nodiscard]] constexpr auto operator()(Func&& func) const noexcept(nothrow_invocable) { @@ -211,7 +211,7 @@ namespace stdsharp template struct predicate { - static constexpr auto value = (::std::invocable && ...); + static constexpr auto value = (std::invocable && ...); }; template @@ -226,7 +226,7 @@ namespace stdsharp template Func> constexpr auto operator()(Func func) const noexcept(nothrow_predicate::value) { - (::std::invoke(func, Values), ...); + (std::invoke(func, Values), ...); return func; } } for_each{}; @@ -237,7 +237,7 @@ namespace stdsharp constexpr auto operator()(auto count, Func func) const noexcept(nothrow_predicate::value) { - ((count == 0 ? false : (::std::invoke(func, Values), --count, true)) && ...); + ((count == 0 ? false : (std::invoke(func, Values), --count, true)) && ...); return func; } } for_each_n{}; @@ -248,8 +248,8 @@ namespace stdsharp [[nodiscard]] constexpr auto operator()(Func func) const noexcept(nothrow_predicate::value) { - ::std::size_t i = 0; - empty = ((::std::invoke(func, Values) ? false : (++i, true)) && ...); + std::size_t i = 0; + empty = ((std::invoke(func, Values) ? false : (++i, true)) && ...); return i; } } find_if{}; @@ -268,13 +268,13 @@ namespace stdsharp [[nodiscard]] constexpr auto operator()(Func func) const noexcept(nothrow_predicate::value) { - ::std::size_t i = 0; + std::size_t i = 0; for_each( [&i, &func](const auto& v) noexcept(nothrow_invocable_r // ) { - if(::std::invoke(func, v)) ++i; + if(std::invoke(func, v)) ++i; } // ); @@ -301,15 +301,15 @@ namespace stdsharp static constexpr struct adjacent_find_fn { private: - template<::std::size_t I> + template struct by_index { template - requires ::std::predicate + requires std::predicate constexpr bool operator()(Comp& comp) const noexcept(stdsharp::nothrow_predicate) { - return ::std::invoke(comp, value, value); + return std::invoke(comp, value, value); } constexpr auto operator()(const auto&, const auto&) const noexcept { return false; } @@ -317,18 +317,18 @@ namespace stdsharp struct impl { - template - constexpr auto operator()(Comp& comp, const ::std::index_sequence) const + template + constexpr auto operator()(Comp& comp, const std::index_sequence) const noexcept((nothrow_invocable, Comp> && ...)) { - ::std::size_t res{}; + std::size_t res{}; ( // (by_index{}(comp) ? true : (++res, false)) || ... // ); return res; } - template> + template> constexpr auto operator()(Comp& comp) const noexcept(nothrow_invocable) { @@ -337,8 +337,8 @@ namespace stdsharp }; public: - template - requires((::std::invocable && ...) && size() >= 2) + template + requires((std::invocable && ...) && size() >= 2) [[nodiscard]] constexpr auto operator()(Comp comp = {}) const noexcept(nothrow_invocable) { @@ -355,17 +355,17 @@ namespace stdsharp static constexpr transform_fn transform{}; template - requires ::std::invocable> + requires std::invocable> using transform_t = decltype(transform()); - template<::std::size_t From, ::std::size_t Size> + template using select_range_t = to_value_sequence>:: // template apply_t; - template<::std::size_t Size> + template using back_t = select_range_t; - template<::std::size_t Size> + template using front_t = select_range_t<0, Size>; template @@ -375,7 +375,7 @@ namespace stdsharp using append_front_t = regular_value_sequence; private: - template<::std::size_t Index> + template struct insert { template @@ -391,21 +391,21 @@ namespace stdsharp using type = decltype(impl(front_t{}, back_t{})); }; - template<::std::size_t... Index> + template struct remove_at { - static constexpr ::std::array select_indices = [] + static constexpr std::array select_indices = [] { - constexpr ::std::pair pair = [] + constexpr std::pair pair = [] { - ::std::array<::std::size_t, size()> res{}; - ::std::array excepted = {Index...}; + std::array res{}; + std::array excepted = {Index...}; - ::std::ranges::sort(excepted); + std::ranges::sort(excepted); - const auto size = static_cast<::std::size_t>( - ::std::ranges::set_difference( - ::std::views::iota(::std::size_t{0}, res.size()), + const auto size = static_cast( + std::ranges::set_difference( + std::views::iota(std::size_t{0}, res.size()), excepted, res.begin() ) @@ -413,30 +413,30 @@ namespace stdsharp res.cbegin() ); - return ::std::pair{res, size}; + return std::pair{res, size}; }(); - ::std::array<::std::size_t, pair.second> res{}; - ::std::ranges::copy_n(pair.first.cbegin(), pair.second, res.begin()); + std::array res{}; + std::ranges::copy_n(pair.first.cbegin(), pair.second, res.begin()); return res; }(); - template<::std::size_t... I> + template static constexpr at_t - get_type(::std::index_sequence) noexcept; + get_type(std::index_sequence) noexcept; - using type = decltype(get_type(::std::make_index_sequence{})); + using type = decltype(get_type(std::make_index_sequence{})); }; public: - template<::std::size_t Index, auto... Other> + template using insert_t = insert::template type; - template<::std::size_t... Index> + template using remove_at_t = ::meta::_t>; - template<::std::size_t Index, auto Other> + template using replace_t = to_value_sequence< typename to_value_sequence>::template append_t // clang-format off @@ -453,14 +453,14 @@ namespace stdsharp namespace std { template - struct tuple_size<::stdsharp::value_sequence> : - ::stdsharp::index_constant<::stdsharp::value_sequence::size()> + struct tuple_size> : + stdsharp::index_constant::size()> { }; - template<::std::size_t I, decltype(auto)... Values> - struct tuple_element> + template + struct tuple_element> { - using type = typename ::stdsharp::value_sequence::template value_type; + using type = typename stdsharp::value_sequence::template value_type; }; } \ No newline at end of file diff --git a/include/stdsharp/utility/constructor.h b/include/stdsharp/utility/constructor.h index 10d8c64f..9cf9ddd5 100644 --- a/include/stdsharp/utility/constructor.h +++ b/include/stdsharp/utility/constructor.h @@ -8,7 +8,7 @@ namespace stdsharp struct constructor { template - requires ::std::constructible_from + requires std::constructible_from [[nodiscard]] constexpr auto operator()(Args&&... args) const noexcept(nothrow_constructible_from) { @@ -16,7 +16,7 @@ namespace stdsharp } template - requires(!::std::constructible_from && list_initializable_from) + requires(!std::constructible_from && list_initializable_from) [[nodiscard]] constexpr auto operator()(Args&&... args) const noexcept(nothrow_list_initializable_from) { @@ -24,11 +24,11 @@ namespace stdsharp } template - requires ::std::constructible_from<::std::decay_t, U> && ::std::same_as - [[nodiscard]] constexpr ::std::decay_t operator()(U&& u) const - noexcept(nothrow_constructible_from<::std::decay_t, U>) + requires std::constructible_from, U> && std::same_as + [[nodiscard]] constexpr std::decay_t operator()(U&& u) const + noexcept(nothrow_constructible_from, U>) { - return ::std::decay_t{cpp_forward(u)}; + return std::decay_t{cpp_forward(u)}; } }; diff --git a/include/stdsharp/utility/implement_dispatcher.h b/include/stdsharp/utility/implement_dispatcher.h index 3f2ad780..b5a6d811 100644 --- a/include/stdsharp/utility/implement_dispatcher.h +++ b/include/stdsharp/utility/implement_dispatcher.h @@ -13,11 +13,11 @@ namespace stdsharp template struct implement_dispatcher : - ::std::reference_wrapper> + std::reference_wrapper> { private: using func = ::meta::_t; - using m_base = ::std::reference_wrapper; + using m_base = std::reference_wrapper; template Closure> requires requires // @@ -47,7 +47,7 @@ namespace stdsharp } constexpr implement_dispatcher() noexcept - requires ::std::same_as + requires std::same_as : implement_dispatcher([](const Args&...) noexcept {}) { } @@ -55,7 +55,7 @@ namespace stdsharp constexpr implement_dispatcher() noexcept requires requires // { - requires ::std::default_initializable; + requires std::default_initializable; requires(ExprReq != expr_req::no_exception) || noexcept(Ret{}); } : diff --git a/include/stdsharp/utility/invocable.h b/include/stdsharp/utility/invocable.h index c6a275a2..eedc09e0 100644 --- a/include/stdsharp/utility/invocable.h +++ b/include/stdsharp/utility/invocable.h @@ -11,13 +11,13 @@ namespace stdsharp using base::base; -#define STDSHARP_OPERATOR(const_, ref) \ - template \ - requires ::std::invocable \ - constexpr decltype(auto) operator()(Args&&... args) \ - const_ ref noexcept(nothrow_invocable) \ - { \ - return ::std::invoke(static_cast(this->v), cpp_forward(args)...); \ +#define STDSHARP_OPERATOR(const_, ref) \ + template \ + requires std::invocable \ + constexpr decltype(auto) operator()(Args&&... args) \ + const_ ref noexcept(nothrow_invocable) \ + { \ + return std::invoke(static_cast(this->v), cpp_forward(args)...); \ } STDSHARP_OPERATOR(, &) @@ -37,7 +37,7 @@ namespace stdsharp #define STDSHARP_OPERATOR(const_, ref) \ template \ - requires ::std::invocable \ + requires std::invocable \ [[nodiscard]] constexpr decltype(auto) operator()(Args&&... args) \ const_ ref noexcept(nothrow_invocable) \ { \ @@ -53,20 +53,20 @@ namespace stdsharp }; template - nodiscard_invocable(Func&& func) -> nodiscard_invocable<::std::decay_t>; + nodiscard_invocable(Func&& func) -> nodiscard_invocable>; template - struct ref_invocable_t : ::std::reference_wrapper + struct ref_invocable_t : std::reference_wrapper { - using ::std::reference_wrapper::reference_wrapper; - -#define STDSHARP_OPERATOR(const_, ref) \ - template \ - requires ::std::invocable \ - constexpr decltype(auto) operator()(Args&&... args) \ - const_ ref noexcept(nothrow_invocable) \ - { \ - return ::std::invoke(static_cast(this->get()), cpp_forward(args)...); \ + using std::reference_wrapper::reference_wrapper; + +#define STDSHARP_OPERATOR(const_, ref) \ + template \ + requires std::invocable \ + constexpr decltype(auto) operator()(Args&&... args) \ + const_ ref noexcept(nothrow_invocable) \ + { \ + return std::invoke(static_cast(this->get()), cpp_forward(args)...); \ } STDSHARP_OPERATOR(, &) diff --git a/include/stdsharp/utility/utility.h b/include/stdsharp/utility/utility.h index 80d55d5f..025ffc30 100644 --- a/include/stdsharp/utility/utility.h +++ b/include/stdsharp/utility/utility.h @@ -5,6 +5,7 @@ #include "cast_to.h" #include "constructor.h" #include "invocable.h" +#include "to_lvalue.h" #include "../type_traits/core_traits.h" namespace stdsharp @@ -14,11 +15,11 @@ namespace stdsharp { private: template - using copy_const_t = ::std::conditional_t>, const U, U>; + using copy_const_t = std::conditional_t>, const U, U>; public: template - [[nodiscard]] constexpr ref_align_t>> + [[nodiscard]] constexpr ref_align_t>> operator()(U&& u) const noexcept { return auto_cast(u); @@ -29,5 +30,5 @@ namespace stdsharp inline constexpr forward_like_fn forward_like{}; template - using forward_like_t = decltype(forward_like(::std::declval())); + using forward_like_t = decltype(forward_like(std::declval())); } \ No newline at end of file diff --git a/include/stdsharp/utility/value_wrapper.h b/include/stdsharp/utility/value_wrapper.h index bbfa3bde..250d9d4a 100644 --- a/include/stdsharp/utility/value_wrapper.h +++ b/include/stdsharp/utility/value_wrapper.h @@ -17,7 +17,7 @@ namespace stdsharp value_wrapper() = default; template - requires ::std::constructible_from + requires std::constructible_from constexpr value_wrapper(U&&... u) noexcept(nothrow_constructible_from): v(cpp_forward(u)...) { @@ -30,7 +30,7 @@ namespace stdsharp STDSHARP_NO_UNIQUE_ADDRESS T v{}; template - requires ::std::constructible_from + requires std::constructible_from constexpr value_wrapper(U&&... u) noexcept(nothrow_constructible_from): v(cpp_forward(u)...) { @@ -47,19 +47,18 @@ namespace stdsharp private: template - requires ::std::constructible_from - constexpr value_wrapper(::std::tuple&& args, ::std::index_sequence): - details::value_wrapper(::std::get(cpp_move(args))...) + requires std::constructible_from + constexpr value_wrapper(std::tuple&& args, std::index_sequence): + details::value_wrapper(std::get(cpp_move(args))...) { } public: template - requires ::std::constructible_from && - (!::std:: - constructible_from>) - constexpr value_wrapper(const ::std::piecewise_construct_t, ::std::tuple args): - value_wrapper(cpp_move(args), ::std::index_sequence_for{}) + requires std::constructible_from && + (!std::constructible_from>) + constexpr value_wrapper(const std::piecewise_construct_t, std::tuple args): + value_wrapper(cpp_move(args), std::index_sequence_for{}) { } From f0972a772f7aa12ec4176255eac82519dc6c32de Mon Sep 17 00:00:00 2001 From: Blurring Shadow <976999484@qq.com> Date: Fri, 26 May 2023 11:38:21 +0800 Subject: [PATCH 4/6] feat(utlity): add to_value fn --- include/stdsharp/type_traits/core_traits.h | 194 ++++++++++----------- include/stdsharp/utility/to_lvalue.h | 28 +++ 2 files changed, 123 insertions(+), 99 deletions(-) create mode 100644 include/stdsharp/utility/to_lvalue.h diff --git a/include/stdsharp/type_traits/core_traits.h b/include/stdsharp/type_traits/core_traits.h index 6a8466b6..51987e69 100644 --- a/include/stdsharp/type_traits/core_traits.h +++ b/include/stdsharp/type_traits/core_traits.h @@ -11,18 +11,19 @@ #include "../utility/adl_proof.h" #include "../macros.h" +#include "../namespace_alias.h" -using namespace ::std::literals; +using namespace std::literals; namespace stdsharp { template - concept nttp_able = requires { ::std::integer_sequence{}; }; + concept nttp_able = requires { std::integer_sequence{}; }; template typename T, typename... Args> struct deduction { - using type = T<::std::decay_t...>; + using type = T...>; }; template typename T> @@ -33,9 +34,9 @@ namespace stdsharp using type = deduction::type; template - requires ::std::constructible_from, Args...> + requires std::constructible_from, Args...> constexpr auto operator()(Args&&... args) const - noexcept(::std::is_nothrow_constructible_v, Args...>) + noexcept(std::is_nothrow_constructible_v, Args...>) { return type{cpp_forward(args)...}; } @@ -49,9 +50,9 @@ namespace stdsharp }; template - inline constexpr auto get_ref_qualifier = ::std::is_lvalue_reference_v ? // + inline constexpr auto get_ref_qualifier = std::is_lvalue_reference_v ? // ref_qualifier::lvalue : - ::std::is_rvalue_reference_v ? ref_qualifier::rvalue : ref_qualifier::none; + std::is_rvalue_reference_v ? ref_qualifier::rvalue : ref_qualifier::none; enum class expr_req { @@ -68,29 +69,29 @@ namespace stdsharp template inline constexpr auto invocable_r_test = - get_expr_req(::std::is_invocable_r_v, ::std::is_nothrow_invocable_r_v); + get_expr_req(std::is_invocable_r_v, std::is_nothrow_invocable_r_v); template inline constexpr auto invocable_test = - get_expr_req(::std::is_invocable_v, ::std::is_nothrow_invocable_v); + get_expr_req(std::is_invocable_v, std::is_nothrow_invocable_v); template inline constexpr auto constructible_from_test = - get_expr_req(::std::is_constructible_v, ::std::is_nothrow_constructible_v); + get_expr_req(std::is_constructible_v, std::is_nothrow_constructible_v); template - using apply_const = ::std::conditional_t, T>; + using apply_const = std::conditional_t, T>; template - using apply_volatile = ::std::conditional_t, T>; + using apply_volatile = std::conditional_t, T>; template - using apply_ref = ::std::conditional_t< - ::std::ranges::equal_to{}(ref, ref_qualifier::lvalue), - ::std::add_lvalue_reference_t, - ::std::conditional_t< - ::std::ranges::equal_to{}(ref, ref_qualifier::rvalue), - ::std::add_rvalue_reference_t, + using apply_ref = std::conditional_t< + std::ranges::equal_to{}(ref, ref_qualifier::lvalue), + std::add_lvalue_reference_t, + std::conditional_t< + std::ranges::equal_to{}(ref, ref_qualifier::rvalue), + std::add_rvalue_reference_t, T // clang-format off > >; // clang-format on @@ -104,7 +105,7 @@ namespace stdsharp return false; } - using ignore_t = decltype(::std::ignore); + using ignore_t = decltype(std::ignore); inline constexpr struct empty_t : ignore_t { @@ -118,19 +119,19 @@ namespace stdsharp } empty; template - using add_const_lvalue_ref_t = ::std::add_lvalue_reference_t<::std::add_const_t>; + using add_const_lvalue_ref_t = std::add_lvalue_reference_t>; template - using ref_align_t = ::std::conditional_t< - ::std::is_lvalue_reference_v, - ::std::add_lvalue_reference_t, // clang-format off - ::std::conditional_t<::std::is_rvalue_reference_v, ::std::add_rvalue_reference_t, U> + using ref_align_t = std::conditional_t< + std::is_lvalue_reference_v, + std::add_lvalue_reference_t, // clang-format off + std::conditional_t, std::add_rvalue_reference_t, U> >; // clang-format on template - using const_align_t = ::std::conditional_t< - ::std::is_const_v<::std::remove_reference_t>, - ::std::add_const_t, // clang-format off + using const_align_t = std::conditional_t< + std::is_const_v>, + std::add_const_t, // clang-format off U >; // clang-format on @@ -138,7 +139,7 @@ namespace stdsharp using const_ref_align_t = ref_align_t>; template - using constant = ::std::integral_constant; + using constant = std::integral_constant; template using constant_value_type = constant::value_type; @@ -155,33 +156,29 @@ namespace stdsharp template concept constant_value = cpp_is_constexpr(T::value); - template<::std::size_t I> - using index_constant = ::std::integral_constant<::std::size_t, I>; + template + using index_constant = std::integral_constant; template - using persist_t = - ::std::conditional_t<::std::is_rvalue_reference_v, ::std::remove_reference_t, T&>; - - template - struct basic_type_constant : ::std::type_identity + struct basic_type_constant : std::type_identity { private: template [[nodiscard]] friend constexpr bool operator==(const basic_type_constant, const basic_type_constant) noexcept { - return ::std::same_as; + return std::same_as; } }; template - basic_type_constant(::std::type_identity) -> basic_type_constant; + basic_type_constant(std::type_identity) -> basic_type_constant; template using type_constant = adl_proof_t; template - struct deduction> + struct deduction> { using type = type_constant; }; @@ -197,7 +194,7 @@ namespace stdsharp { [[nodiscard]] static constexpr auto size() noexcept { return sizeof...(T); } - template typename Converter = ::std::type_identity> + template typename Converter = std::type_identity> requires requires { regular_value_sequence{}...>{}; } using convert_to_value_sequence = regular_value_sequence{}...>; }; @@ -207,7 +204,7 @@ namespace stdsharp { [[nodiscard]] static constexpr auto size() noexcept { return 1; } - template typename Converter = ::std::type_identity> + template typename Converter = std::type_identity> requires requires { regular_value_sequence{}>{}; } using convert_to_value_sequence = regular_value_sequence{}>; }; @@ -229,13 +226,13 @@ namespace stdsharp [] typename Inner, auto... V>(const Inner&) // { return regular_type_sequence...>{}; // - }(::std::declval()) + }(std::declval()) ); template struct regular_value_sequence { - [[nodiscard]] static constexpr ::std::size_t size() noexcept { return sizeof...(V); } + [[nodiscard]] static constexpr std::size_t size() noexcept { return sizeof...(V); } template typename Converter = constant> requires requires { regular_type_sequence...>{}; } @@ -245,7 +242,7 @@ namespace stdsharp template struct regular_value_sequence : constant { - [[nodiscard]] static constexpr ::std::size_t size() noexcept { return 1; } + [[nodiscard]] static constexpr std::size_t size() noexcept { return 1; } template typename Converter = constant> requires requires { regular_type_sequence>{}; } @@ -255,19 +252,19 @@ namespace stdsharp template typename Converter = constant> using convert_from_type_sequence = decltype( // [] typename Inner, auto... V> // - (const ::std::type_identity...>>) // + (const std::type_identity...>>) // { return regular_value_sequence{}; // - }(::std::type_identity{}) + }(std::type_identity{}) ); - template<::std::integral T, T First, ::std::same_as auto... V> - struct regular_value_sequence : ::std::integer_sequence + template auto... V> + struct regular_value_sequence : std::integer_sequence { }; template - regular_value_sequence(::std::integer_sequence) -> regular_value_sequence; + regular_value_sequence(std::integer_sequence) -> regular_value_sequence; namespace details { @@ -276,50 +273,50 @@ namespace stdsharp template consteval regular_value_sequence - to_regular_value_sequence(::std::integer_sequence); + to_regular_value_sequence(std::integer_sequence); - template - requires requires { regular_value_sequence<::std::invoke(PlusF, From, I)...>{}; } - consteval regular_value_sequence<::std::invoke(PlusF, From, I)...> - make_value_sequence(::std::index_sequence) noexcept; + template + requires requires { regular_value_sequence{}; } + consteval regular_value_sequence + make_value_sequence(std::index_sequence) noexcept; - template<::std::array Array, ::std::size_t... Index> + template requires nttp_able consteval regular_value_sequence<(Array[Index])...> - array_to_sequence(::std::index_sequence); + array_to_sequence(std::index_sequence); template< constant_value T, typename Range = decltype(T::value), - nttp_able ValueType = ::std::ranges::range_value_t // clang-format off + nttp_able ValueType = std::ranges::range_value_t // clang-format off > // clang-format on requires requires // { - index_constant<::std::ranges::size(T::value)>{}; - ::std::array{}; - requires ::std::copyable; + index_constant{}; + std::array{}; + requires std::copyable; } struct rng_to_sequence { static constexpr auto rng = T::value; - static constexpr auto size = ::std::ranges::size(rng); + static constexpr auto size = std::ranges::size(rng); static constexpr auto array = [] { if constexpr( // - requires { array_to_sequence(::std::make_index_sequence{}); } + requires { array_to_sequence(std::make_index_sequence{}); } ) return rng; else { - ::std::array array{}; - ::std::ranges::copy(rng, array.begin()); + std::array array{}; + std::ranges::copy(rng, array.begin()); return array; } }(); using type = - decltype(array_to_sequence(::std::make_index_sequence{})); + decltype(array_to_sequence(std::make_index_sequence{})); }; template typename Inner, typename... U> @@ -328,17 +325,17 @@ namespace stdsharp template using to_regular_value_sequence = - decltype(details::to_regular_value_sequence(::std::declval())); + decltype(details::to_regular_value_sequence(std::declval())); template - using make_integer_sequence = to_regular_value_sequence<::std::make_integer_sequence>; + using make_integer_sequence = to_regular_value_sequence>; - template<::std::size_t N> - using make_index_sequence = make_integer_sequence<::std::size_t, N>; + template + using make_index_sequence = make_integer_sequence; - template + template using make_value_sequence_t = decltype( // - details::make_value_sequence(::std::make_index_sequence{}) + details::make_value_sequence(std::make_index_sequence{}) ); template @@ -356,9 +353,9 @@ namespace stdsharp ttp_expend() = default; template - requires(::std::constructible_from, Us> && ...) + requires(std::constructible_from, Us> && ...) constexpr ttp_expend(Us&&... us) // - noexcept((::std::is_nothrow_constructible_v, Us> && ...)): + noexcept((std::is_nothrow_constructible_v, Us> && ...)): T(cpp_forward(us))... { } @@ -372,8 +369,8 @@ namespace stdsharp decltype( // [] typename Inner, typename... U>(const Inner&) { - return ::std::type_identity>{}; // - }(::std::declval()) + return std::type_identity>{}; // + }(std::declval()) ) // clang-format off >; // clang-format on @@ -383,9 +380,9 @@ namespace stdsharp nttp_expend() = default; template - requires(::std::constructible_from, Us> && ...) + requires(std::constructible_from, Us> && ...) constexpr nttp_expend(Us&&... us) // - noexcept((::std::is_nothrow_constructible_v, Us> && ...)): + noexcept((std::is_nothrow_constructible_v, Us> && ...)): T(cpp_forward(us))... { } @@ -394,18 +391,17 @@ namespace stdsharp template typename T, decltype(auto)... V> nttp_expend(T...) -> nttp_expend; - template typename T, ::std::size_t Size> + template typename T, std::size_t Size> using make_nttp_expend = decltype( // [] typename Inner, decltype(auto)... V>(const Inner) // { - return ::std::type_identity>{}; // + return std::type_identity>{}; // }(make_index_sequence{}) ); template - requires requires { details::template_rebind_impl(::std::declval