[libcxx-commits] [libcxx] 5aa03b6 - [libc++][NFC] Apply clang-format on large parts of the code base
Louis Dionne via libcxx-commits
libcxx-commits at lists.llvm.org
Mon Jun 19 08:20:10 PDT 2023
Author: Louis Dionne
Date: 2023-06-19T11:19:51-04:00
New Revision: 5aa03b648b827128d439f705cd7d57d59673741d
URL: https://github.com/llvm/llvm-project/commit/5aa03b648b827128d439f705cd7d57d59673741d
DIFF: https://github.com/llvm/llvm-project/commit/5aa03b648b827128d439f705cd7d57d59673741d.diff
LOG: [libc++][NFC] Apply clang-format on large parts of the code base
This commit does a pass of clang-format over files in libc++ that
don't require major changes to conform to our style guide, or for
which we're not overly concerned about conflicting with in-flight
patches or hindering the git blame.
This roughly covers:
- benchmarks
- range algorithms
- concepts
- type traits
I did a manual verification of all the changes, and in particular I
applied clang-format on/off annotations in a few places where the
result was less readable after than before. This was not necessary
in a lot of places, however I did find that clang-format had pretty
bad taste when it comes to formatting concepts.
Differential Revision: https://reviews.llvm.org/D153140
Added:
Modified:
libcxx/benchmarks/CartesianBenchmarks.h
libcxx/benchmarks/ContainerBenchmarks.h
libcxx/benchmarks/GenerateInput.h
libcxx/benchmarks/Utilities.h
libcxx/benchmarks/VariantBenchmarks.h
libcxx/benchmarks/algorithms.partition_point.bench.cpp
libcxx/benchmarks/algorithms/common.h
libcxx/benchmarks/algorithms/lower_bound.bench.cpp
libcxx/benchmarks/algorithms/make_heap.bench.cpp
libcxx/benchmarks/algorithms/make_heap_then_sort_heap.bench.cpp
libcxx/benchmarks/algorithms/pop_heap.bench.cpp
libcxx/benchmarks/algorithms/push_heap.bench.cpp
libcxx/benchmarks/algorithms/ranges_make_heap.bench.cpp
libcxx/benchmarks/algorithms/ranges_make_heap_then_sort_heap.bench.cpp
libcxx/benchmarks/algorithms/ranges_pop_heap.bench.cpp
libcxx/benchmarks/algorithms/ranges_push_heap.bench.cpp
libcxx/benchmarks/algorithms/ranges_sort.bench.cpp
libcxx/benchmarks/algorithms/ranges_sort_heap.bench.cpp
libcxx/benchmarks/algorithms/ranges_stable_sort.bench.cpp
libcxx/benchmarks/algorithms/sort.bench.cpp
libcxx/benchmarks/algorithms/sort_heap.bench.cpp
libcxx/benchmarks/algorithms/stable_sort.bench.cpp
libcxx/benchmarks/allocation.bench.cpp
libcxx/benchmarks/deque.bench.cpp
libcxx/benchmarks/filesystem.bench.cpp
libcxx/benchmarks/format_to.bench.cpp
libcxx/benchmarks/format_to_n.bench.cpp
libcxx/benchmarks/formatter_float.bench.cpp
libcxx/benchmarks/formatter_int.bench.cpp
libcxx/benchmarks/function.bench.cpp
libcxx/benchmarks/map.bench.cpp
libcxx/benchmarks/ordered_set.bench.cpp
libcxx/benchmarks/random.bench.cpp
libcxx/benchmarks/string.bench.cpp
libcxx/benchmarks/stringstream.bench.cpp
libcxx/benchmarks/unordered_set_operations.bench.cpp
libcxx/benchmarks/vector_operations.bench.cpp
libcxx/include/__algorithm/ranges_adjacent_find.h
libcxx/include/__algorithm/ranges_all_of.h
libcxx/include/__algorithm/ranges_any_of.h
libcxx/include/__algorithm/ranges_binary_search.h
libcxx/include/__algorithm/ranges_clamp.h
libcxx/include/__algorithm/ranges_copy.h
libcxx/include/__algorithm/ranges_copy_backward.h
libcxx/include/__algorithm/ranges_copy_if.h
libcxx/include/__algorithm/ranges_copy_n.h
libcxx/include/__algorithm/ranges_count.h
libcxx/include/__algorithm/ranges_count_if.h
libcxx/include/__algorithm/ranges_equal.h
libcxx/include/__algorithm/ranges_equal_range.h
libcxx/include/__algorithm/ranges_fill.h
libcxx/include/__algorithm/ranges_fill_n.h
libcxx/include/__algorithm/ranges_find.h
libcxx/include/__algorithm/ranges_find_end.h
libcxx/include/__algorithm/ranges_find_first_of.h
libcxx/include/__algorithm/ranges_find_if.h
libcxx/include/__algorithm/ranges_find_if_not.h
libcxx/include/__algorithm/ranges_for_each.h
libcxx/include/__algorithm/ranges_for_each_n.h
libcxx/include/__algorithm/ranges_generate.h
libcxx/include/__algorithm/ranges_generate_n.h
libcxx/include/__algorithm/ranges_includes.h
libcxx/include/__algorithm/ranges_inplace_merge.h
libcxx/include/__algorithm/ranges_is_heap.h
libcxx/include/__algorithm/ranges_is_heap_until.h
libcxx/include/__algorithm/ranges_is_partitioned.h
libcxx/include/__algorithm/ranges_is_permutation.h
libcxx/include/__algorithm/ranges_is_sorted.h
libcxx/include/__algorithm/ranges_is_sorted_until.h
libcxx/include/__algorithm/ranges_lexicographical_compare.h
libcxx/include/__algorithm/ranges_lower_bound.h
libcxx/include/__algorithm/ranges_make_heap.h
libcxx/include/__algorithm/ranges_max.h
libcxx/include/__algorithm/ranges_max_element.h
libcxx/include/__algorithm/ranges_merge.h
libcxx/include/__algorithm/ranges_min.h
libcxx/include/__algorithm/ranges_min_element.h
libcxx/include/__algorithm/ranges_minmax.h
libcxx/include/__algorithm/ranges_minmax_element.h
libcxx/include/__algorithm/ranges_mismatch.h
libcxx/include/__algorithm/ranges_move.h
libcxx/include/__algorithm/ranges_move_backward.h
libcxx/include/__algorithm/ranges_none_of.h
libcxx/include/__algorithm/ranges_nth_element.h
libcxx/include/__algorithm/ranges_partial_sort.h
libcxx/include/__algorithm/ranges_partial_sort_copy.h
libcxx/include/__algorithm/ranges_partition.h
libcxx/include/__algorithm/ranges_partition_copy.h
libcxx/include/__algorithm/ranges_partition_point.h
libcxx/include/__algorithm/ranges_pop_heap.h
libcxx/include/__algorithm/ranges_prev_permutation.h
libcxx/include/__algorithm/ranges_push_heap.h
libcxx/include/__algorithm/ranges_remove.h
libcxx/include/__algorithm/ranges_remove_copy.h
libcxx/include/__algorithm/ranges_remove_copy_if.h
libcxx/include/__algorithm/ranges_remove_if.h
libcxx/include/__algorithm/ranges_replace.h
libcxx/include/__algorithm/ranges_replace_copy.h
libcxx/include/__algorithm/ranges_replace_copy_if.h
libcxx/include/__algorithm/ranges_replace_if.h
libcxx/include/__algorithm/ranges_reverse.h
libcxx/include/__algorithm/ranges_reverse_copy.h
libcxx/include/__algorithm/ranges_rotate.h
libcxx/include/__algorithm/ranges_rotate_copy.h
libcxx/include/__algorithm/ranges_sample.h
libcxx/include/__algorithm/ranges_search.h
libcxx/include/__algorithm/ranges_search_n.h
libcxx/include/__algorithm/ranges_set_difference.h
libcxx/include/__algorithm/ranges_set_intersection.h
libcxx/include/__algorithm/ranges_set_symmetric_difference.h
libcxx/include/__algorithm/ranges_set_union.h
libcxx/include/__algorithm/ranges_shuffle.h
libcxx/include/__algorithm/ranges_sort.h
libcxx/include/__algorithm/ranges_sort_heap.h
libcxx/include/__algorithm/ranges_stable_partition.h
libcxx/include/__algorithm/ranges_stable_sort.h
libcxx/include/__algorithm/ranges_swap_ranges.h
libcxx/include/__algorithm/ranges_transform.h
libcxx/include/__algorithm/ranges_unique.h
libcxx/include/__algorithm/ranges_unique_copy.h
libcxx/include/__algorithm/ranges_upper_bound.h
libcxx/include/__concepts/arithmetic.h
libcxx/include/__concepts/assignable.h
libcxx/include/__concepts/boolean_testable.h
libcxx/include/__concepts/class_or_enum.h
libcxx/include/__concepts/common_reference_with.h
libcxx/include/__concepts/common_with.h
libcxx/include/__concepts/constructible.h
libcxx/include/__concepts/convertible_to.h
libcxx/include/__concepts/copyable.h
libcxx/include/__concepts/derived_from.h
libcxx/include/__concepts/destructible.h
libcxx/include/__concepts/different_from.h
libcxx/include/__concepts/equality_comparable.h
libcxx/include/__concepts/invocable.h
libcxx/include/__concepts/movable.h
libcxx/include/__concepts/predicate.h
libcxx/include/__concepts/regular.h
libcxx/include/__concepts/relation.h
libcxx/include/__concepts/same_as.h
libcxx/include/__concepts/semiregular.h
libcxx/include/__concepts/swappable.h
libcxx/include/__concepts/totally_ordered.h
libcxx/include/__type_traits/add_const.h
libcxx/include/__type_traits/add_cv.h
libcxx/include/__type_traits/add_lvalue_reference.h
libcxx/include/__type_traits/add_pointer.h
libcxx/include/__type_traits/add_volatile.h
libcxx/include/__type_traits/aligned_storage.h
libcxx/include/__type_traits/aligned_union.h
libcxx/include/__type_traits/alignment_of.h
libcxx/include/__type_traits/can_extract_key.h
libcxx/include/__type_traits/common_reference.h
libcxx/include/__type_traits/common_type.h
libcxx/include/__type_traits/copy_cv.h
libcxx/include/__type_traits/copy_cvref.h
libcxx/include/__type_traits/decay.h
libcxx/include/__type_traits/enable_if.h
libcxx/include/__type_traits/extent.h
libcxx/include/__type_traits/has_unique_object_representation.h
libcxx/include/__type_traits/has_virtual_destructor.h
libcxx/include/__type_traits/integral_constant.h
libcxx/include/__type_traits/invoke.h
libcxx/include/__type_traits/is_abstract.h
libcxx/include/__type_traits/is_aggregate.h
libcxx/include/__type_traits/is_allocator.h
libcxx/include/__type_traits/is_always_bitcastable.h
libcxx/include/__type_traits/is_arithmetic.h
libcxx/include/__type_traits/is_array.h
libcxx/include/__type_traits/is_assignable.h
libcxx/include/__type_traits/is_base_of.h
libcxx/include/__type_traits/is_bounded_array.h
libcxx/include/__type_traits/is_callable.h
libcxx/include/__type_traits/is_class.h
libcxx/include/__type_traits/is_compound.h
libcxx/include/__type_traits/is_const.h
libcxx/include/__type_traits/is_constant_evaluated.h
libcxx/include/__type_traits/is_constructible.h
libcxx/include/__type_traits/is_convertible.h
libcxx/include/__type_traits/is_copy_assignable.h
libcxx/include/__type_traits/is_copy_constructible.h
libcxx/include/__type_traits/is_core_convertible.h
libcxx/include/__type_traits/is_default_constructible.h
libcxx/include/__type_traits/is_destructible.h
libcxx/include/__type_traits/is_empty.h
libcxx/include/__type_traits/is_enum.h
libcxx/include/__type_traits/is_final.h
libcxx/include/__type_traits/is_floating_point.h
libcxx/include/__type_traits/is_fundamental.h
libcxx/include/__type_traits/is_implicitly_default_constructible.h
libcxx/include/__type_traits/is_integral.h
libcxx/include/__type_traits/is_literal_type.h
libcxx/include/__type_traits/is_member_function_pointer.h
libcxx/include/__type_traits/is_member_object_pointer.h
libcxx/include/__type_traits/is_member_pointer.h
libcxx/include/__type_traits/is_move_assignable.h
libcxx/include/__type_traits/is_move_constructible.h
libcxx/include/__type_traits/is_nothrow_assignable.h
libcxx/include/__type_traits/is_nothrow_constructible.h
libcxx/include/__type_traits/is_nothrow_convertible.h
libcxx/include/__type_traits/is_nothrow_copy_assignable.h
libcxx/include/__type_traits/is_nothrow_copy_constructible.h
libcxx/include/__type_traits/is_nothrow_default_constructible.h
libcxx/include/__type_traits/is_nothrow_destructible.h
libcxx/include/__type_traits/is_nothrow_move_assignable.h
libcxx/include/__type_traits/is_nothrow_move_constructible.h
libcxx/include/__type_traits/is_null_pointer.h
libcxx/include/__type_traits/is_object.h
libcxx/include/__type_traits/is_pod.h
libcxx/include/__type_traits/is_pointer.h
libcxx/include/__type_traits/is_polymorphic.h
libcxx/include/__type_traits/is_primary_template.h
libcxx/include/__type_traits/is_reference.h
libcxx/include/__type_traits/is_reference_wrapper.h
libcxx/include/__type_traits/is_same.h
libcxx/include/__type_traits/is_scalar.h
libcxx/include/__type_traits/is_scoped_enum.h
libcxx/include/__type_traits/is_signed.h
libcxx/include/__type_traits/is_signed_integer.h
libcxx/include/__type_traits/is_standard_layout.h
libcxx/include/__type_traits/is_swappable.h
libcxx/include/__type_traits/is_trivial.h
libcxx/include/__type_traits/is_trivially_assignable.h
libcxx/include/__type_traits/is_trivially_constructible.h
libcxx/include/__type_traits/is_trivially_copy_assignable.h
libcxx/include/__type_traits/is_trivially_copy_constructible.h
libcxx/include/__type_traits/is_trivially_copyable.h
libcxx/include/__type_traits/is_trivially_default_constructible.h
libcxx/include/__type_traits/is_trivially_destructible.h
libcxx/include/__type_traits/is_unbounded_array.h
libcxx/include/__type_traits/is_union.h
libcxx/include/__type_traits/is_unsigned.h
libcxx/include/__type_traits/is_unsigned_integer.h
libcxx/include/__type_traits/is_valid_expansion.h
libcxx/include/__type_traits/is_void.h
libcxx/include/__type_traits/is_volatile.h
libcxx/include/__type_traits/lazy.h
libcxx/include/__type_traits/make_32_64_or_128_bit.h
libcxx/include/__type_traits/make_const_lvalue_ref.h
libcxx/include/__type_traits/make_signed.h
libcxx/include/__type_traits/make_unsigned.h
libcxx/include/__type_traits/maybe_const.h
libcxx/include/__type_traits/nat.h
libcxx/include/__type_traits/negation.h
libcxx/include/__type_traits/noexcept_move_assign_container.h
libcxx/include/__type_traits/promote.h
libcxx/include/__type_traits/rank.h
libcxx/include/__type_traits/remove_all_extents.h
libcxx/include/__type_traits/remove_const.h
libcxx/include/__type_traits/remove_cv.h
libcxx/include/__type_traits/remove_cvref.h
libcxx/include/__type_traits/remove_extent.h
libcxx/include/__type_traits/remove_pointer.h
libcxx/include/__type_traits/remove_reference.h
libcxx/include/__type_traits/remove_volatile.h
libcxx/include/__type_traits/result_of.h
libcxx/include/__type_traits/strip_signature.h
libcxx/include/__type_traits/type_identity.h
libcxx/include/__type_traits/type_list.h
libcxx/include/__type_traits/underlying_type.h
libcxx/include/__type_traits/unwrap_ref.h
libcxx/include/__type_traits/void_t.h
libcxx/utils/data/ignore_format.txt
Removed:
################################################################################
diff --git a/libcxx/benchmarks/CartesianBenchmarks.h b/libcxx/benchmarks/CartesianBenchmarks.h
index 2eea156819330..eca4e15cd009b 100644
--- a/libcxx/benchmarks/CartesianBenchmarks.h
+++ b/libcxx/benchmarks/CartesianBenchmarks.h
@@ -6,7 +6,6 @@
//
//===----------------------------------------------------------------------===//
-
#include <string>
#include <tuple>
#include <type_traits>
@@ -22,7 +21,7 @@ struct EnumValue : std::integral_constant<E, static_cast<E>(I)> {
static std::string name() { return std::string("_") + D::Names[I]; }
};
-template <class D, class E, size_t ...Idxs>
+template <class D, class E, size_t... Idxs>
constexpr auto makeEnumValueTuple(std::index_sequence<Idxs...>) {
return std::make_tuple(EnumValue<D, E, Idxs>{}...);
}
@@ -41,8 +40,7 @@ void makeBenchmarkFromValuesImpl(const Args& A, std::index_sequence<Is...>) {
for (auto& V : A) {
B Bench{std::get<Is>(V)...};
if (!internal::skip(Bench, 0)) {
- benchmark::RegisterBenchmark(Bench.name().c_str(),
- [=](benchmark::State& S) { Bench.run(S); });
+ benchmark::RegisterBenchmark(Bench.name().c_str(), [=](benchmark::State& S) { Bench.run(S); });
}
}
}
@@ -57,10 +55,8 @@ void makeBenchmarkImpl(const Args& A, std::tuple<U...> t) {
makeBenchmarkFromValues<B<U...> >(A);
}
-template <template <class...> class B, class Args, class... U,
- class... T, class... Tuples>
-void makeBenchmarkImpl(const Args& A, std::tuple<U...>, std::tuple<T...>,
- Tuples... rest) {
+template <template <class...> class B, class Args, class... U, class... T, class... Tuples>
+void makeBenchmarkImpl(const Args& A, std::tuple<U...>, std::tuple<T...>, Tuples... rest) {
(internal::makeBenchmarkImpl<B>(A, std::tuple<U..., T>(), rest...), ...);
}
@@ -70,15 +66,13 @@ void allValueCombinations(R& Result, const T& Final) {
}
template <class R, class T, class V, class... Vs>
-void allValueCombinations(R& Result, const T& Prev, const V& Value,
- const Vs&... Values) {
+void allValueCombinations(R& Result, const T& Prev, const V& Value, const Vs&... Values) {
for (const auto& E : Value) {
- allValueCombinations(Result, std::tuple_cat(Prev, std::make_tuple(E)),
- Values...);
+ allValueCombinations(Result, std::tuple_cat(Prev, std::make_tuple(E)), Values...);
}
}
-} // namespace internal
+} // namespace internal
// CRTP class that enables using enum types as a dimension for
// makeCartesianProductBenchmark below.
@@ -93,8 +87,7 @@ void allValueCombinations(R& Result, const T& Prev, const V& Value,
// };
template <class Derived, class EnumType, size_t NumLabels>
using EnumValuesAsTuple =
- decltype(internal::makeEnumValueTuple<Derived, EnumType>(
- std::make_index_sequence<NumLabels>{}));
+ decltype(internal::makeEnumValueTuple<Derived, EnumType>(std::make_index_sequence<NumLabels>{}));
// Instantiates B<T0, T1, ..., TN> where <Ti...> are the combinations in the
// cartesian product of `Tuples...`, and pass (arg0, ..., argN) as constructor
@@ -128,6 +121,7 @@ int makeCartesianProductBenchmark(const Args&... A) {
// It returns `value`.
template <class T>
TEST_ALWAYS_INLINE inline T maybeOpaque(T value, bool opaque) {
- if (opaque) benchmark::DoNotOptimize(value);
+ if (opaque)
+ benchmark::DoNotOptimize(value);
return value;
}
diff --git a/libcxx/benchmarks/ContainerBenchmarks.h b/libcxx/benchmarks/ContainerBenchmarks.h
index 4dae95748077f..bf027f5f41469 100644
--- a/libcxx/benchmarks/ContainerBenchmarks.h
+++ b/libcxx/benchmarks/ContainerBenchmarks.h
@@ -59,116 +59,114 @@ void BM_ConstructSizeValue(benchmark::State& st, Container, typename Container::
template <class Container, class GenInputs>
void BM_ConstructIterIter(benchmark::State& st, Container, GenInputs gen) {
- auto in = gen(st.range(0));
- const auto begin = in.begin();
- const auto end = in.end();
- benchmark::DoNotOptimize(&in);
- while (st.KeepRunning()) {
- Container c(begin, end);
- DoNotOptimizeData(c);
- }
+ auto in = gen(st.range(0));
+ const auto begin = in.begin();
+ const auto end = in.end();
+ benchmark::DoNotOptimize(&in);
+ while (st.KeepRunning()) {
+ Container c(begin, end);
+ DoNotOptimizeData(c);
+ }
}
template <class Container, class GenInputs>
void BM_InsertValue(benchmark::State& st, Container c, GenInputs gen) {
- auto in = gen(st.range(0));
- const auto end = in.end();
- while (st.KeepRunning()) {
- c.clear();
- for (auto it = in.begin(); it != end; ++it) {
- benchmark::DoNotOptimize(&(*c.insert(*it).first));
- }
- benchmark::ClobberMemory();
+ auto in = gen(st.range(0));
+ const auto end = in.end();
+ while (st.KeepRunning()) {
+ c.clear();
+ for (auto it = in.begin(); it != end; ++it) {
+ benchmark::DoNotOptimize(&(*c.insert(*it).first));
}
+ benchmark::ClobberMemory();
+ }
}
template <class Container, class GenInputs>
void BM_InsertValueRehash(benchmark::State& st, Container c, GenInputs gen) {
- auto in = gen(st.range(0));
- const auto end = in.end();
- while (st.KeepRunning()) {
- c.clear();
- c.rehash(16);
- for (auto it = in.begin(); it != end; ++it) {
- benchmark::DoNotOptimize(&(*c.insert(*it).first));
- }
- benchmark::ClobberMemory();
+ auto in = gen(st.range(0));
+ const auto end = in.end();
+ while (st.KeepRunning()) {
+ c.clear();
+ c.rehash(16);
+ for (auto it = in.begin(); it != end; ++it) {
+ benchmark::DoNotOptimize(&(*c.insert(*it).first));
}
+ benchmark::ClobberMemory();
+ }
}
-
template <class Container, class GenInputs>
void BM_InsertDuplicate(benchmark::State& st, Container c, GenInputs gen) {
- auto in = gen(st.range(0));
- const auto end = in.end();
- c.insert(in.begin(), in.end());
- benchmark::DoNotOptimize(&c);
- benchmark::DoNotOptimize(&in);
- while (st.KeepRunning()) {
- for (auto it = in.begin(); it != end; ++it) {
- benchmark::DoNotOptimize(&(*c.insert(*it).first));
- }
- benchmark::ClobberMemory();
+ auto in = gen(st.range(0));
+ const auto end = in.end();
+ c.insert(in.begin(), in.end());
+ benchmark::DoNotOptimize(&c);
+ benchmark::DoNotOptimize(&in);
+ while (st.KeepRunning()) {
+ for (auto it = in.begin(); it != end; ++it) {
+ benchmark::DoNotOptimize(&(*c.insert(*it).first));
}
+ benchmark::ClobberMemory();
+ }
}
-
template <class Container, class GenInputs>
void BM_EmplaceDuplicate(benchmark::State& st, Container c, GenInputs gen) {
- auto in = gen(st.range(0));
- const auto end = in.end();
- c.insert(in.begin(), in.end());
- benchmark::DoNotOptimize(&c);
- benchmark::DoNotOptimize(&in);
- while (st.KeepRunning()) {
- for (auto it = in.begin(); it != end; ++it) {
- benchmark::DoNotOptimize(&(*c.emplace(*it).first));
- }
- benchmark::ClobberMemory();
+ auto in = gen(st.range(0));
+ const auto end = in.end();
+ c.insert(in.begin(), in.end());
+ benchmark::DoNotOptimize(&c);
+ benchmark::DoNotOptimize(&in);
+ while (st.KeepRunning()) {
+ for (auto it = in.begin(); it != end; ++it) {
+ benchmark::DoNotOptimize(&(*c.emplace(*it).first));
}
+ benchmark::ClobberMemory();
+ }
}
template <class Container, class GenInputs>
static void BM_Find(benchmark::State& st, Container c, GenInputs gen) {
- auto in = gen(st.range(0));
- c.insert(in.begin(), in.end());
- benchmark::DoNotOptimize(&(*c.begin()));
- const auto end = in.data() + in.size();
- while (st.KeepRunning()) {
- for (auto it = in.data(); it != end; ++it) {
- benchmark::DoNotOptimize(&(*c.find(*it)));
- }
- benchmark::ClobberMemory();
+ auto in = gen(st.range(0));
+ c.insert(in.begin(), in.end());
+ benchmark::DoNotOptimize(&(*c.begin()));
+ const auto end = in.data() + in.size();
+ while (st.KeepRunning()) {
+ for (auto it = in.data(); it != end; ++it) {
+ benchmark::DoNotOptimize(&(*c.find(*it)));
}
+ benchmark::ClobberMemory();
+ }
}
template <class Container, class GenInputs>
static void BM_FindRehash(benchmark::State& st, Container c, GenInputs gen) {
- c.rehash(8);
- auto in = gen(st.range(0));
- c.insert(in.begin(), in.end());
- benchmark::DoNotOptimize(&(*c.begin()));
- const auto end = in.data() + in.size();
- while (st.KeepRunning()) {
- for (auto it = in.data(); it != end; ++it) {
- benchmark::DoNotOptimize(&(*c.find(*it)));
- }
- benchmark::ClobberMemory();
+ c.rehash(8);
+ auto in = gen(st.range(0));
+ c.insert(in.begin(), in.end());
+ benchmark::DoNotOptimize(&(*c.begin()));
+ const auto end = in.data() + in.size();
+ while (st.KeepRunning()) {
+ for (auto it = in.data(); it != end; ++it) {
+ benchmark::DoNotOptimize(&(*c.find(*it)));
}
+ benchmark::ClobberMemory();
+ }
}
template <class Container, class GenInputs>
static void BM_Rehash(benchmark::State& st, Container c, GenInputs gen) {
- auto in = gen(st.range(0));
- c.max_load_factor(3.0);
- c.insert(in.begin(), in.end());
- benchmark::DoNotOptimize(c);
- const auto bucket_count = c.bucket_count();
- while (st.KeepRunning()) {
- c.rehash(bucket_count + 1);
- c.rehash(bucket_count);
- benchmark::ClobberMemory();
- }
+ auto in = gen(st.range(0));
+ c.max_load_factor(3.0);
+ c.insert(in.begin(), in.end());
+ benchmark::DoNotOptimize(c);
+ const auto bucket_count = c.bucket_count();
+ while (st.KeepRunning()) {
+ c.rehash(bucket_count + 1);
+ c.rehash(bucket_count);
+ benchmark::ClobberMemory();
+ }
}
} // end namespace ContainerBenchmarks
diff --git a/libcxx/benchmarks/GenerateInput.h b/libcxx/benchmarks/GenerateInput.h
index 3e63f8413303f..3980b1e15aee2 100644
--- a/libcxx/benchmarks/GenerateInput.h
+++ b/libcxx/benchmarks/GenerateInput.h
@@ -2,142 +2,133 @@
#define BENCHMARK_GENERATE_INPUT_H
#include <algorithm>
-#include <random>
-#include <vector>
-#include <string>
#include <climits>
#include <cstddef>
+#include <random>
+#include <string>
+#include <vector>
static const char Letters[] = {
- '0','1','2','3','4',
- '5','6','7','8','9',
- 'A','B','C','D','E','F',
- 'G','H','I','J','K',
- 'L','M','N','O','P',
- 'Q','R','S','T','U',
- 'V','W','X','Y','Z',
- 'a','b','c','d','e','f',
- 'g','h','i','j','k',
- 'l','m','n','o','p',
- 'q','r','s','t','u',
- 'v','w','x','y','z'
-};
+ '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K',
+ 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 'a', 'b', 'c', 'd', 'e', 'f',
+ 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'};
static const std::size_t LettersSize = sizeof(Letters);
inline std::default_random_engine& getRandomEngine() {
- static std::default_random_engine RandEngine(std::random_device{}());
- return RandEngine;
+ static std::default_random_engine RandEngine(std::random_device{}());
+ return RandEngine;
}
-
inline char getRandomChar() {
- std::uniform_int_distribution<> LettersDist(0, LettersSize-1);
- return Letters[LettersDist(getRandomEngine())];
+ std::uniform_int_distribution<> LettersDist(0, LettersSize - 1);
+ return Letters[LettersDist(getRandomEngine())];
}
template <class IntT>
inline IntT getRandomInteger(IntT Min, IntT Max) {
- std::uniform_int_distribution<unsigned long long> dist(Min, Max);
- return static_cast<IntT>(dist(getRandomEngine()));
+ std::uniform_int_distribution<unsigned long long> dist(Min, Max);
+ return static_cast<IntT>(dist(getRandomEngine()));
}
inline std::string getRandomString(std::size_t Len) {
- std::string str(Len, 0);
- std::generate_n(str.begin(), Len, &getRandomChar);
- return str;
+ std::string str(Len, 0);
+ std::generate_n(str.begin(), Len, &getRandomChar);
+ return str;
}
template <class IntT>
inline std::vector<IntT> getDuplicateIntegerInputs(size_t N) {
- std::vector<IntT> inputs(N, static_cast<IntT>(-1));
- return inputs;
+ std::vector<IntT> inputs(N, static_cast<IntT>(-1));
+ return inputs;
}
template <class IntT>
inline std::vector<IntT> getSortedIntegerInputs(size_t N) {
- std::vector<IntT> inputs;
- for (size_t i=0; i < N; i += 1)
- inputs.push_back(i);
- return inputs;
+ std::vector<IntT> inputs;
+ for (size_t i = 0; i < N; i += 1)
+ inputs.push_back(i);
+ return inputs;
}
template <class IntT>
std::vector<IntT> getSortedLargeIntegerInputs(size_t N) {
- std::vector<IntT> inputs;
- for (size_t i=0; i < N; ++i) {
- inputs.push_back(i + N);
- }
- return inputs;
+ std::vector<IntT> inputs;
+ for (size_t i = 0; i < N; ++i) {
+ inputs.push_back(i + N);
+ }
+ return inputs;
}
template <class IntT>
std::vector<IntT> getSortedTopBitsIntegerInputs(size_t N) {
- std::vector<IntT> inputs = getSortedIntegerInputs<IntT>(N);
- for (auto& E : inputs) E <<= ((sizeof(IntT) / 2) * CHAR_BIT);
- return inputs;
+ std::vector<IntT> inputs = getSortedIntegerInputs<IntT>(N);
+ for (auto& E : inputs)
+ E <<= ((sizeof(IntT) / 2) * CHAR_BIT);
+ return inputs;
}
template <class IntT>
inline std::vector<IntT> getReverseSortedIntegerInputs(size_t N) {
- std::vector<IntT> inputs;
- std::size_t i = N;
- while (i > 0) {
- --i;
- inputs.push_back(i);
- }
- return inputs;
+ std::vector<IntT> inputs;
+ std::size_t i = N;
+ while (i > 0) {
+ --i;
+ inputs.push_back(i);
+ }
+ return inputs;
}
template <class IntT>
std::vector<IntT> getPipeOrganIntegerInputs(size_t N) {
- std::vector<IntT> v; v.reserve(N);
- for (size_t i = 0; i < N/2; ++i) v.push_back(i);
- for (size_t i = N/2; i < N; ++i) v.push_back(N - i);
- return v;
+ std::vector<IntT> v;
+ v.reserve(N);
+ for (size_t i = 0; i < N / 2; ++i)
+ v.push_back(i);
+ for (size_t i = N / 2; i < N; ++i)
+ v.push_back(N - i);
+ return v;
}
-
template <class IntT>
std::vector<IntT> getRandomIntegerInputs(size_t N) {
- std::vector<IntT> inputs;
- for (size_t i=0; i < N; ++i) {
- inputs.push_back(getRandomInteger<IntT>(0, std::numeric_limits<IntT>::max()));
- }
- return inputs;
+ std::vector<IntT> inputs;
+ for (size_t i = 0; i < N; ++i) {
+ inputs.push_back(getRandomInteger<IntT>(0, std::numeric_limits<IntT>::max()));
+ }
+ return inputs;
}
inline std::vector<std::string> getDuplicateStringInputs(size_t N) {
- std::vector<std::string> inputs(N, getRandomString(1024));
- return inputs;
+ std::vector<std::string> inputs(N, getRandomString(1024));
+ return inputs;
}
inline std::vector<std::string> getRandomStringInputs(size_t N) {
- std::vector<std::string> inputs;
- for (size_t i=0; i < N; ++i) {
- inputs.push_back(getRandomString(1024));
- }
- return inputs;
+ std::vector<std::string> inputs;
+ for (size_t i = 0; i < N; ++i) {
+ inputs.push_back(getRandomString(1024));
+ }
+ return inputs;
}
inline std::vector<std::string> getSortedStringInputs(size_t N) {
- std::vector<std::string> inputs = getRandomStringInputs(N);
- std::sort(inputs.begin(), inputs.end());
- return inputs;
+ std::vector<std::string> inputs = getRandomStringInputs(N);
+ std::sort(inputs.begin(), inputs.end());
+ return inputs;
}
inline std::vector<std::string> getReverseSortedStringInputs(size_t N) {
- std::vector<std::string> inputs = getSortedStringInputs(N);
- std::reverse(inputs.begin(), inputs.end());
- return inputs;
+ std::vector<std::string> inputs = getSortedStringInputs(N);
+ std::reverse(inputs.begin(), inputs.end());
+ return inputs;
}
inline std::vector<const char*> getRandomCStringInputs(size_t N) {
- static std::vector<std::string> inputs = getRandomStringInputs(N);
- std::vector<const char*> cinputs;
- for (auto const& str : inputs)
- cinputs.push_back(str.c_str());
- return cinputs;
+ static std::vector<std::string> inputs = getRandomStringInputs(N);
+ std::vector<const char*> cinputs;
+ for (auto const& str : inputs)
+ cinputs.push_back(str.c_str());
+ return cinputs;
}
-
#endif // BENCHMARK_GENERATE_INPUT_H
diff --git a/libcxx/benchmarks/Utilities.h b/libcxx/benchmarks/Utilities.h
index 9ad2a58796ea3..fed16ba51f995 100644
--- a/libcxx/benchmarks/Utilities.h
+++ b/libcxx/benchmarks/Utilities.h
@@ -16,18 +16,22 @@
#include "benchmark/benchmark.h"
namespace UtilitiesInternal {
- template <class Container>
- auto HaveDataImpl(int) -> decltype((std::declval<Container&>().data(), std::true_type{}));
- template <class Container>
- auto HaveDataImpl(long) -> std::false_type;
- template <class T>
- using HasData = decltype(HaveDataImpl<T>(0));
+template <class Container>
+auto HaveDataImpl(int) -> decltype((std::declval<Container&>().data(), std::true_type{}));
+template <class Container>
+auto HaveDataImpl(long) -> std::false_type;
+template <class T>
+using HasData = decltype(HaveDataImpl<T>(0));
} // namespace UtilitiesInternal
template <class Container, std::enable_if_t<UtilitiesInternal::HasData<Container>::value>* = nullptr>
-void DoNotOptimizeData(Container &c) { benchmark::DoNotOptimize(c.data()); }
-template <class Container, std::enable_if_t<!UtilitiesInternal::HasData<Container>::value>* = nullptr>
-void DoNotOptimizeData(Container &c) { benchmark::DoNotOptimize(&c); }
+void DoNotOptimizeData(Container& c) {
+ benchmark::DoNotOptimize(c.data());
+}
+template <class Container, std::enable_if_t<!UtilitiesInternal::HasData<Container>::value>* = nullptr>
+void DoNotOptimizeData(Container& c) {
+ benchmark::DoNotOptimize(&c);
+}
#endif // BENCHMARK_UTILITIES_H
diff --git a/libcxx/benchmarks/VariantBenchmarks.h b/libcxx/benchmarks/VariantBenchmarks.h
index 2feaeab51b97e..a8e9c9febd728 100644
--- a/libcxx/benchmarks/VariantBenchmarks.h
+++ b/libcxx/benchmarks/VariantBenchmarks.h
@@ -29,8 +29,8 @@ struct S {
template <std::size_t N, std::size_t... Is>
static auto genVariants(std::index_sequence<Is...>) {
- using V = std::variant<S<Is>...>;
- using F = V (*)();
+ using V = std::variant<S<Is>...>;
+ using F = V (*)();
static constexpr F fs[] = {[] { return V(std::in_place_index<Is>); }...};
std::array<V, N> result = {};
@@ -45,11 +45,8 @@ template <std::size_t N, std::size_t Alts>
static void BM_Visit(benchmark::State& state) {
auto args = genVariants<N>(std::make_index_sequence<Alts>{});
for (auto _ : state) {
- benchmark::DoNotOptimize(std::apply(
- [](auto... vs) {
- return std::visit([](auto... is) { return (is.v + ... + 0); }, vs...);
- },
- args));
+ benchmark::DoNotOptimize(
+ std::apply([](auto... vs) { return std::visit([](auto... is) { return (is.v + ... + 0); }, vs...); }, args));
}
}
diff --git a/libcxx/benchmarks/algorithms.partition_point.bench.cpp b/libcxx/benchmarks/algorithms.partition_point.bench.cpp
index 8192f97206d9b..77115175fa540 100644
--- a/libcxx/benchmarks/algorithms.partition_point.bench.cpp
+++ b/libcxx/benchmarks/algorithms.partition_point.bench.cpp
@@ -1,5 +1,5 @@
-#include <array>
#include <algorithm>
+#include <array>
#include <cassert>
#include <cstdint>
#include <tuple>
@@ -29,8 +29,7 @@ template <class IntT>
struct TestIntBase {
static std::vector<IntT> generateInput(size_t size) {
std::vector<IntT> Res(size);
- std::generate(Res.begin(), Res.end(),
- [] { return getRandomInteger<IntT>(0, std::numeric_limits<IntT>::max()); });
+ std::generate(Res.begin(), Res.end(), [] { return getRandomInteger<IntT>(0, std::numeric_limits<IntT>::max()); });
return Res;
}
};
@@ -48,7 +47,7 @@ struct TestUint32 : TestIntBase<std::uint32_t> {
};
struct TestMediumString {
- static constexpr const char* Name = "TestMediumString";
+ static constexpr const char* Name = "TestMediumString";
static constexpr size_t StringSize = 32;
static std::vector<std::string> generateInput(size_t size) {
@@ -94,8 +93,7 @@ struct PartitionPointBench {
size_t Quantity;
std::string name() const {
- return std::string("PartitionPointBench_") + Alg::Name + "_" +
- TestType::Name + '/' + std::to_string(Quantity);
+ return std::string("PartitionPointBench_") + Alg::Name + "_" + TestType::Name + '/' + std::to_string(Quantity);
}
void run(benchmark::State& state) const {
@@ -118,7 +116,6 @@ int main(int argc, char** argv) {
return 1;
const std::vector<size_t> Quantities = {1 << 8, 1 << 10, 1 << 20};
- makeCartesianProductBenchmark<PartitionPointBench, AllAlgs, AllTestTypes>(
- Quantities);
+ makeCartesianProductBenchmark<PartitionPointBench, AllAlgs, AllTestTypes>(Quantities);
benchmark::RunSpecifiedBenchmarks();
}
diff --git a/libcxx/benchmarks/algorithms/common.h b/libcxx/benchmarks/algorithms/common.h
index ffa39e26be54b..43131a4c9c922 100644
--- a/libcxx/benchmarks/algorithms/common.h
+++ b/libcxx/benchmarks/algorithms/common.h
@@ -19,12 +19,17 @@
enum class ValueType { Uint32, Uint64, Pair, Tuple, String, Float };
struct AllValueTypes : EnumValuesAsTuple<AllValueTypes, ValueType, 6> {
- static constexpr const char* Names[] = {"uint32", "uint64", "pair<uint32, uint32>", "tuple<uint32, uint64, uint32>",
- "string", "float"};
+ static constexpr const char* Names[] = {
+ "uint32", "uint64", "pair<uint32, uint32>", "tuple<uint32, uint64, uint32>", "string", "float"};
};
-using Types = std::tuple< uint32_t, uint64_t, std::pair<uint32_t, uint32_t>, std::tuple<uint32_t, uint64_t, uint32_t>,
- std::string, float >;
+using Types =
+ std::tuple<uint32_t,
+ uint64_t,
+ std::pair<uint32_t, uint32_t>,
+ std::tuple<uint32_t, uint64_t, uint32_t>,
+ std::string,
+ float>;
template <class V>
using Value = std::tuple_element_t<(int)V::value, Types>;
@@ -39,10 +44,8 @@ enum class Order {
QuickSortAdversary,
};
struct AllOrders : EnumValuesAsTuple<AllOrders, Order, 7> {
- static constexpr const char* Names[] = {"Random", "Ascending",
- "Descending", "SingleElement",
- "PipeOrgan", "Heap",
- "QuickSortAdversary"};
+ static constexpr const char* Names[] = {
+ "Random", "Ascending", "Descending", "SingleElement", "PipeOrgan", "Heap", "QuickSortAdversary"};
};
// fillAdversarialQuickSortInput fills the input vector with N int-like values.
@@ -64,7 +67,7 @@ void fillAdversarialQuickSortInput(T& V, size_t N) {
}
// Candidate for the pivot position.
int candidate = 0;
- int nsolid = 0;
+ int nsolid = 0;
// Populate all positions in the generated input to gas.
std::vector<int> ascVals(V.size());
// Fill up with ascending values from 0 to V.size()-1. These will act as
@@ -185,8 +188,7 @@ constexpr size_t TestSetElements =
#endif
template <class ValueType>
-std::vector<std::vector<Value<ValueType> > > makeOrderedValues(size_t N,
- Order O) {
+std::vector<std::vector<Value<ValueType> > > makeOrderedValues(size_t N, Order O) {
std::vector<std::vector<Value<ValueType> > > Ret;
const size_t NumCopies = std::max(size_t{1}, TestSetElements / N);
Ret.resize(NumCopies);
@@ -198,8 +200,7 @@ std::vector<std::vector<Value<ValueType> > > makeOrderedValues(size_t N,
}
template <class T, class U>
-TEST_ALWAYS_INLINE void resetCopies(benchmark::State& state, T& Copies,
- U& Orig) {
+TEST_ALWAYS_INLINE void resetCopies(benchmark::State& state, T& Copies, U& Orig) {
state.PauseTiming();
for (auto& Copy : Copies)
Copy = Orig;
@@ -212,14 +213,11 @@ enum class BatchSize {
};
template <class ValueType, class F>
-void runOpOnCopies(benchmark::State& state, size_t Quantity, Order O,
- BatchSize Count, F Body) {
+void runOpOnCopies(benchmark::State& state, size_t Quantity, Order O, BatchSize Count, F Body) {
auto Copies = makeOrderedValues<ValueType>(Quantity, O);
- auto Orig = Copies;
+ auto Orig = Copies;
- const size_t Batch = Count == BatchSize::CountElements
- ? Copies.size() * Quantity
- : Copies.size();
+ const size_t Batch = Count == BatchSize::CountElements ? Copies.size() * Quantity : Copies.size();
while (state.KeepRunningBatch(Batch)) {
for (auto& Copy : Copies) {
Body(Copy);
@@ -231,13 +229,18 @@ void runOpOnCopies(benchmark::State& state, size_t Quantity, Order O,
}
}
-
-const std::vector<size_t> Quantities = {1 << 0, 1 << 2, 1 << 4, 1 << 6,
- 1 << 8, 1 << 10, 1 << 14,
- // Running each benchmark in parallel consumes too much memory with MSAN
- // and can lead to the test process being killed.
+const std::vector<size_t> Quantities = {
+ 1 << 0,
+ 1 << 2,
+ 1 << 4,
+ 1 << 6,
+ 1 << 8,
+ 1 << 10,
+ 1 << 14,
+// Running each benchmark in parallel consumes too much memory with MSAN
+// and can lead to the test process being killed.
#if !TEST_HAS_FEATURE(memory_sanitizer)
- 1 << 18
+ 1 << 18
#endif
};
diff --git a/libcxx/benchmarks/algorithms/lower_bound.bench.cpp b/libcxx/benchmarks/algorithms/lower_bound.bench.cpp
index ce366d5e9d4a0..3be5010f5bdf2 100644
--- a/libcxx/benchmarks/algorithms/lower_bound.bench.cpp
+++ b/libcxx/benchmarks/algorithms/lower_bound.bench.cpp
@@ -18,7 +18,7 @@ template <class ValueType>
struct LowerBound {
size_t Quantity;
- mutable std::mt19937_64 rng { std::random_device{}() };
+ mutable std::mt19937_64 rng{std::random_device{}()};
void run(benchmark::State& state) const {
runOpOnCopies<ValueType>(state, Quantity, Order::Ascending, BatchSize::CountBatch, [&](auto& Copy) {
@@ -27,9 +27,7 @@ struct LowerBound {
});
}
- std::string name() const {
- return "BM_LowerBound" + ValueType::name() + "_" + std::to_string(Quantity);
- }
+ std::string name() const { return "BM_LowerBound" + ValueType::name() + "_" + std::to_string(Quantity); }
};
} // namespace
diff --git a/libcxx/benchmarks/algorithms/make_heap.bench.cpp b/libcxx/benchmarks/algorithms/make_heap.bench.cpp
index e2caf84d137ac..dade7b8273107 100644
--- a/libcxx/benchmarks/algorithms/make_heap.bench.cpp
+++ b/libcxx/benchmarks/algorithms/make_heap.bench.cpp
@@ -16,14 +16,13 @@ struct MakeHeap {
size_t Quantity;
void run(benchmark::State& state) const {
- runOpOnCopies<ValueType>(
- state, Quantity, Order(), BatchSize::CountElements,
- [](auto& Copy) { std::make_heap(Copy.begin(), Copy.end()); });
+ runOpOnCopies<ValueType>(state, Quantity, Order(), BatchSize::CountElements, [](auto& Copy) {
+ std::make_heap(Copy.begin(), Copy.end());
+ });
}
std::string name() const {
- return "BM_MakeHeap" + ValueType::name() + Order::name() + "_" +
- std::to_string(Quantity);
+ return "BM_MakeHeap" + ValueType::name() + Order::name() + "_" + std::to_string(Quantity);
};
};
} // namespace
diff --git a/libcxx/benchmarks/algorithms/make_heap_then_sort_heap.bench.cpp b/libcxx/benchmarks/algorithms/make_heap_then_sort_heap.bench.cpp
index 5254c261e3ec1..48f34f8651b97 100644
--- a/libcxx/benchmarks/algorithms/make_heap_then_sort_heap.bench.cpp
+++ b/libcxx/benchmarks/algorithms/make_heap_then_sort_heap.bench.cpp
@@ -16,16 +16,14 @@ struct MakeThenSortHeap {
size_t Quantity;
void run(benchmark::State& state) const {
- runOpOnCopies<ValueType>(state, Quantity, Order(), BatchSize::CountElements,
- [](auto& Copy) {
- std::make_heap(Copy.begin(), Copy.end());
- std::sort_heap(Copy.begin(), Copy.end());
- });
+ runOpOnCopies<ValueType>(state, Quantity, Order(), BatchSize::CountElements, [](auto& Copy) {
+ std::make_heap(Copy.begin(), Copy.end());
+ std::sort_heap(Copy.begin(), Copy.end());
+ });
}
std::string name() const {
- return "BM_MakeThenSortHeap" + ValueType::name() + Order::name() + "_" +
- std::to_string(Quantity);
+ return "BM_MakeThenSortHeap" + ValueType::name() + Order::name() + "_" + std::to_string(Quantity);
};
};
} // namespace
diff --git a/libcxx/benchmarks/algorithms/pop_heap.bench.cpp b/libcxx/benchmarks/algorithms/pop_heap.bench.cpp
index ef6e5a669740e..26cdd25cce90d 100644
--- a/libcxx/benchmarks/algorithms/pop_heap.bench.cpp
+++ b/libcxx/benchmarks/algorithms/pop_heap.bench.cpp
@@ -16,17 +16,14 @@ struct PopHeap {
size_t Quantity;
void run(benchmark::State& state) const {
- runOpOnCopies<ValueType>(
- state, Quantity, Order(), BatchSize::CountElements, [](auto& Copy) {
- for (auto B = Copy.begin(), I = Copy.end(); I != B; --I) {
- std::pop_heap(B, I);
- }
- });
+ runOpOnCopies<ValueType>(state, Quantity, Order(), BatchSize::CountElements, [](auto& Copy) {
+ for (auto B = Copy.begin(), I = Copy.end(); I != B; --I) {
+ std::pop_heap(B, I);
+ }
+ });
}
- std::string name() const {
- return "BM_PopHeap" + ValueType::name() + "_" + std::to_string(Quantity);
- };
+ std::string name() const { return "BM_PopHeap" + ValueType::name() + "_" + std::to_string(Quantity); };
};
} // namespace
diff --git a/libcxx/benchmarks/algorithms/push_heap.bench.cpp b/libcxx/benchmarks/algorithms/push_heap.bench.cpp
index 8c333240f7caf..ba96fa1469e60 100644
--- a/libcxx/benchmarks/algorithms/push_heap.bench.cpp
+++ b/libcxx/benchmarks/algorithms/push_heap.bench.cpp
@@ -16,19 +16,17 @@ struct PushHeap {
size_t Quantity;
void run(benchmark::State& state) const {
- runOpOnCopies<ValueType>(
- state, Quantity, Order(), BatchSize::CountElements, [](auto& Copy) {
- for (auto I = Copy.begin(), E = Copy.end(); I != E; ++I) {
- std::push_heap(Copy.begin(), I + 1);
- }
- });
+ runOpOnCopies<ValueType>(state, Quantity, Order(), BatchSize::CountElements, [](auto& Copy) {
+ for (auto I = Copy.begin(), E = Copy.end(); I != E; ++I) {
+ std::push_heap(Copy.begin(), I + 1);
+ }
+ });
}
bool skip() const { return Order() == ::Order::Heap; }
std::string name() const {
- return "BM_PushHeap" + ValueType::name() + Order::name() + "_" +
- std::to_string(Quantity);
+ return "BM_PushHeap" + ValueType::name() + Order::name() + "_" + std::to_string(Quantity);
};
};
} // namespace
diff --git a/libcxx/benchmarks/algorithms/ranges_make_heap.bench.cpp b/libcxx/benchmarks/algorithms/ranges_make_heap.bench.cpp
index b5b6132382d69..66a8335a8710c 100644
--- a/libcxx/benchmarks/algorithms/ranges_make_heap.bench.cpp
+++ b/libcxx/benchmarks/algorithms/ranges_make_heap.bench.cpp
@@ -16,14 +16,13 @@ struct RangesMakeHeap {
size_t Quantity;
void run(benchmark::State& state) const {
- runOpOnCopies<ValueType>(
- state, Quantity, Order(), BatchSize::CountElements,
- [](auto& Copy) { std::ranges::make_heap(Copy); });
+ runOpOnCopies<ValueType>(state, Quantity, Order(), BatchSize::CountElements, [](auto& Copy) {
+ std::ranges::make_heap(Copy);
+ });
}
std::string name() const {
- return "BM_RangesMakeHeap" + ValueType::name() + Order::name() + "_" +
- std::to_string(Quantity);
+ return "BM_RangesMakeHeap" + ValueType::name() + Order::name() + "_" + std::to_string(Quantity);
};
};
} // namespace
diff --git a/libcxx/benchmarks/algorithms/ranges_make_heap_then_sort_heap.bench.cpp b/libcxx/benchmarks/algorithms/ranges_make_heap_then_sort_heap.bench.cpp
index f28695135304a..01632c807c178 100644
--- a/libcxx/benchmarks/algorithms/ranges_make_heap_then_sort_heap.bench.cpp
+++ b/libcxx/benchmarks/algorithms/ranges_make_heap_then_sort_heap.bench.cpp
@@ -16,16 +16,14 @@ struct RangesMakeThenSortHeap {
size_t Quantity;
void run(benchmark::State& state) const {
- runOpOnCopies<ValueType>(state, Quantity, Order(), BatchSize::CountElements,
- [](auto& Copy) {
- std::ranges::make_heap(Copy);
- std::ranges::sort_heap(Copy);
- });
+ runOpOnCopies<ValueType>(state, Quantity, Order(), BatchSize::CountElements, [](auto& Copy) {
+ std::ranges::make_heap(Copy);
+ std::ranges::sort_heap(Copy);
+ });
}
std::string name() const {
- return "BM_RangesMakeThenSortHeap" + ValueType::name() + Order::name() + "_" +
- std::to_string(Quantity);
+ return "BM_RangesMakeThenSortHeap" + ValueType::name() + Order::name() + "_" + std::to_string(Quantity);
};
};
} // namespace
diff --git a/libcxx/benchmarks/algorithms/ranges_pop_heap.bench.cpp b/libcxx/benchmarks/algorithms/ranges_pop_heap.bench.cpp
index b26ccdd97a7d7..bcc7a834a655a 100644
--- a/libcxx/benchmarks/algorithms/ranges_pop_heap.bench.cpp
+++ b/libcxx/benchmarks/algorithms/ranges_pop_heap.bench.cpp
@@ -16,17 +16,14 @@ struct RangesPopHeap {
size_t Quantity;
void run(benchmark::State& state) const {
- runOpOnCopies<ValueType>(
- state, Quantity, Order(), BatchSize::CountElements, [](auto& Copy) {
- for (auto B = Copy.begin(), I = Copy.end(); I != B; --I) {
- std::ranges::pop_heap(B, I);
- }
- });
+ runOpOnCopies<ValueType>(state, Quantity, Order(), BatchSize::CountElements, [](auto& Copy) {
+ for (auto B = Copy.begin(), I = Copy.end(); I != B; --I) {
+ std::ranges::pop_heap(B, I);
+ }
+ });
}
- std::string name() const {
- return "BM_RangesPopHeap" + ValueType::name() + "_" + std::to_string(Quantity);
- };
+ std::string name() const { return "BM_RangesPopHeap" + ValueType::name() + "_" + std::to_string(Quantity); };
};
} // namespace
diff --git a/libcxx/benchmarks/algorithms/ranges_push_heap.bench.cpp b/libcxx/benchmarks/algorithms/ranges_push_heap.bench.cpp
index 28ccf41b96488..902f481228e46 100644
--- a/libcxx/benchmarks/algorithms/ranges_push_heap.bench.cpp
+++ b/libcxx/benchmarks/algorithms/ranges_push_heap.bench.cpp
@@ -16,19 +16,17 @@ struct RangesPushHeap {
size_t Quantity;
void run(benchmark::State& state) const {
- runOpOnCopies<ValueType>(
- state, Quantity, Order(), BatchSize::CountElements, [](auto& Copy) {
- for (auto I = Copy.begin(), E = Copy.end(); I != E; ++I) {
- std::ranges::push_heap(Copy.begin(), I + 1);
- }
- });
+ runOpOnCopies<ValueType>(state, Quantity, Order(), BatchSize::CountElements, [](auto& Copy) {
+ for (auto I = Copy.begin(), E = Copy.end(); I != E; ++I) {
+ std::ranges::push_heap(Copy.begin(), I + 1);
+ }
+ });
}
bool skip() const { return Order() == ::Order::Heap; }
std::string name() const {
- return "BM_RangesPushHeap" + ValueType::name() + Order::name() + "_" +
- std::to_string(Quantity);
+ return "BM_RangesPushHeap" + ValueType::name() + Order::name() + "_" + std::to_string(Quantity);
};
};
} // namespace
diff --git a/libcxx/benchmarks/algorithms/ranges_sort.bench.cpp b/libcxx/benchmarks/algorithms/ranges_sort.bench.cpp
index b9299d3fe1449..aeb2aedd34af3 100644
--- a/libcxx/benchmarks/algorithms/ranges_sort.bench.cpp
+++ b/libcxx/benchmarks/algorithms/ranges_sort.bench.cpp
@@ -16,16 +16,15 @@ struct Sort {
size_t Quantity;
void run(benchmark::State& state) const {
- runOpOnCopies<ValueType>(
- state, Quantity, Order(), BatchSize::CountElements,
- [](auto& Copy) { std::ranges::sort(Copy); });
+ runOpOnCopies<ValueType>(state, Quantity, Order(), BatchSize::CountElements, [](auto& Copy) {
+ std::ranges::sort(Copy);
+ });
}
bool skip() const { return Order() == ::Order::Heap; }
std::string name() const {
- return "BM_RangesSort" + ValueType::name() + Order::name() + "_" +
- std::to_string(Quantity);
+ return "BM_RangesSort" + ValueType::name() + Order::name() + "_" + std::to_string(Quantity);
}
};
} // namespace
diff --git a/libcxx/benchmarks/algorithms/ranges_sort_heap.bench.cpp b/libcxx/benchmarks/algorithms/ranges_sort_heap.bench.cpp
index 12828a029582f..62c607cf7a5ed 100644
--- a/libcxx/benchmarks/algorithms/ranges_sort_heap.bench.cpp
+++ b/libcxx/benchmarks/algorithms/ranges_sort_heap.bench.cpp
@@ -16,14 +16,12 @@ struct RangesSortHeap {
size_t Quantity;
void run(benchmark::State& state) const {
- runOpOnCopies<ValueType>(
- state, Quantity, Order::Heap, BatchSize::CountElements,
- [](auto& Copy) { std::ranges::sort_heap(Copy); });
+ runOpOnCopies<ValueType>(state, Quantity, Order::Heap, BatchSize::CountElements, [](auto& Copy) {
+ std::ranges::sort_heap(Copy);
+ });
}
- std::string name() const {
- return "BM_RangesSortHeap" + ValueType::name() + "_" + std::to_string(Quantity);
- };
+ std::string name() const { return "BM_RangesSortHeap" + ValueType::name() + "_" + std::to_string(Quantity); };
};
} // namespace
diff --git a/libcxx/benchmarks/algorithms/ranges_stable_sort.bench.cpp b/libcxx/benchmarks/algorithms/ranges_stable_sort.bench.cpp
index 94f80032afcb1..88327483cf43c 100644
--- a/libcxx/benchmarks/algorithms/ranges_stable_sort.bench.cpp
+++ b/libcxx/benchmarks/algorithms/ranges_stable_sort.bench.cpp
@@ -16,16 +16,15 @@ struct StableSort {
size_t Quantity;
void run(benchmark::State& state) const {
- runOpOnCopies<ValueType>(
- state, Quantity, Order(), BatchSize::CountElements,
- [](auto& Copy) { std::ranges::stable_sort(Copy); });
+ runOpOnCopies<ValueType>(state, Quantity, Order(), BatchSize::CountElements, [](auto& Copy) {
+ std::ranges::stable_sort(Copy);
+ });
}
bool skip() const { return Order() == ::Order::Heap; }
std::string name() const {
- return "BM_RangesStableSort" + ValueType::name() + Order::name() + "_" +
- std::to_string(Quantity);
+ return "BM_RangesStableSort" + ValueType::name() + Order::name() + "_" + std::to_string(Quantity);
}
};
} // namespace
diff --git a/libcxx/benchmarks/algorithms/sort.bench.cpp b/libcxx/benchmarks/algorithms/sort.bench.cpp
index 6f8b12efe4531..f87434b779712 100644
--- a/libcxx/benchmarks/algorithms/sort.bench.cpp
+++ b/libcxx/benchmarks/algorithms/sort.bench.cpp
@@ -16,17 +16,14 @@ struct Sort {
size_t Quantity;
void run(benchmark::State& state) const {
- runOpOnCopies<ValueType>(
- state, Quantity, Order(), BatchSize::CountElements,
- [](auto& Copy) { std::sort(Copy.begin(), Copy.end()); });
+ runOpOnCopies<ValueType>(state, Quantity, Order(), BatchSize::CountElements, [](auto& Copy) {
+ std::sort(Copy.begin(), Copy.end());
+ });
}
bool skip() const { return Order() == ::Order::Heap; }
- std::string name() const {
- return "BM_Sort" + ValueType::name() + Order::name() + "_" +
- std::to_string(Quantity);
- };
+ std::string name() const { return "BM_Sort" + ValueType::name() + Order::name() + "_" + std::to_string(Quantity); };
};
} // namespace
diff --git a/libcxx/benchmarks/algorithms/sort_heap.bench.cpp b/libcxx/benchmarks/algorithms/sort_heap.bench.cpp
index a217211a2f8ee..1372b4d5c9ab7 100644
--- a/libcxx/benchmarks/algorithms/sort_heap.bench.cpp
+++ b/libcxx/benchmarks/algorithms/sort_heap.bench.cpp
@@ -16,14 +16,12 @@ struct SortHeap {
size_t Quantity;
void run(benchmark::State& state) const {
- runOpOnCopies<ValueType>(
- state, Quantity, Order::Heap, BatchSize::CountElements,
- [](auto& Copy) { std::sort_heap(Copy.begin(), Copy.end()); });
+ runOpOnCopies<ValueType>(state, Quantity, Order::Heap, BatchSize::CountElements, [](auto& Copy) {
+ std::sort_heap(Copy.begin(), Copy.end());
+ });
}
- std::string name() const {
- return "BM_SortHeap" + ValueType::name() + "_" + std::to_string(Quantity);
- };
+ std::string name() const { return "BM_SortHeap" + ValueType::name() + "_" + std::to_string(Quantity); };
};
} // namespace
diff --git a/libcxx/benchmarks/algorithms/stable_sort.bench.cpp b/libcxx/benchmarks/algorithms/stable_sort.bench.cpp
index 1ef55ce9fe956..fe88d01dd66f8 100644
--- a/libcxx/benchmarks/algorithms/stable_sort.bench.cpp
+++ b/libcxx/benchmarks/algorithms/stable_sort.bench.cpp
@@ -16,16 +16,15 @@ struct StableSort {
size_t Quantity;
void run(benchmark::State& state) const {
- runOpOnCopies<ValueType>(
- state, Quantity, Order(), BatchSize::CountElements,
- [](auto& Copy) { std::stable_sort(Copy.begin(), Copy.end()); });
+ runOpOnCopies<ValueType>(state, Quantity, Order(), BatchSize::CountElements, [](auto& Copy) {
+ std::stable_sort(Copy.begin(), Copy.end());
+ });
}
bool skip() const { return Order() == ::Order::Heap; }
std::string name() const {
- return "BM_StableSort" + ValueType::name() + Order::name() + "_" +
- std::to_string(Quantity);
+ return "BM_StableSort" + ValueType::name() + Order::name() + "_" + std::to_string(Quantity);
};
};
} // namespace
diff --git a/libcxx/benchmarks/allocation.bench.cpp b/libcxx/benchmarks/allocation.bench.cpp
index ad962de5bf1fb..16be2b17fb70e 100644
--- a/libcxx/benchmarks/allocation.bench.cpp
+++ b/libcxx/benchmarks/allocation.bench.cpp
@@ -8,59 +8,34 @@
#include "benchmark/benchmark.h"
+#include <cassert>
#include <new>
#include <vector>
-#include <cassert>
struct PointerList {
PointerList* Next = nullptr;
};
struct MallocWrapper {
- __attribute__((always_inline))
- static void* Allocate(size_t N) {
- return std::malloc(N);
- }
- __attribute__((always_inline))
- static void Deallocate(void* P, size_t) {
- std::free(P);
- }
+ __attribute__((always_inline)) static void* Allocate(size_t N) { return std::malloc(N); }
+ __attribute__((always_inline)) static void Deallocate(void* P, size_t) { std::free(P); }
};
struct NewWrapper {
- __attribute__((always_inline))
- static void* Allocate(size_t N) {
- return ::operator new(N);
- }
- __attribute__((always_inline))
- static void Deallocate(void* P, size_t) {
- ::operator delete(P);
- }
+ __attribute__((always_inline)) static void* Allocate(size_t N) { return ::operator new(N); }
+ __attribute__((always_inline)) static void Deallocate(void* P, size_t) { ::operator delete(P); }
};
struct BuiltinNewWrapper {
- __attribute__((always_inline))
- static void* Allocate(size_t N) {
- return __builtin_operator_new(N);
- }
- __attribute__((always_inline))
- static void Deallocate(void* P, size_t) {
- __builtin_operator_delete(P);
- }
+ __attribute__((always_inline)) static void* Allocate(size_t N) { return __builtin_operator_new(N); }
+ __attribute__((always_inline)) static void Deallocate(void* P, size_t) { __builtin_operator_delete(P); }
};
struct BuiltinSizedNewWrapper {
- __attribute__((always_inline))
- static void* Allocate(size_t N) {
- return __builtin_operator_new(N);
- }
- __attribute__((always_inline))
- static void Deallocate(void* P, size_t N) {
- __builtin_operator_delete(P, N);
- }
+ __attribute__((always_inline)) static void* Allocate(size_t N) { return __builtin_operator_new(N); }
+ __attribute__((always_inline)) static void Deallocate(void* P, size_t N) { __builtin_operator_delete(P, N); }
};
-
template <class AllocWrapper>
static void BM_AllocateAndDeallocate(benchmark::State& st) {
const size_t alloc_size = st.range(0);
@@ -71,23 +46,22 @@ static void BM_AllocateAndDeallocate(benchmark::State& st) {
}
}
-
template <class AllocWrapper>
static void BM_AllocateOnly(benchmark::State& st) {
const size_t alloc_size = st.range(0);
- PointerList *Start = nullptr;
+ PointerList* Start = nullptr;
while (st.KeepRunning()) {
PointerList* p = (PointerList*)AllocWrapper::Allocate(alloc_size);
benchmark::DoNotOptimize(p);
p->Next = Start;
- Start = p;
+ Start = p;
}
- PointerList *Next = Start;
+ PointerList* Next = Start;
while (Next) {
- PointerList *Tmp = Next;
- Next = Tmp->Next;
+ PointerList* Tmp = Next;
+ Next = Tmp->Next;
AllocWrapper::Deallocate(Tmp, alloc_size);
}
}
@@ -95,14 +69,14 @@ static void BM_AllocateOnly(benchmark::State& st) {
template <class AllocWrapper>
static void BM_DeallocateOnly(benchmark::State& st) {
const size_t alloc_size = st.range(0);
- const auto NumAllocs = st.max_iterations;
+ const auto NumAllocs = st.max_iterations;
std::vector<void*> Pointers(NumAllocs);
for (auto& p : Pointers) {
p = AllocWrapper::Allocate(alloc_size);
}
- void** Data = Pointers.data();
+ void** Data = Pointers.data();
void** const End = Pointers.data() + Pointers.size();
while (st.KeepRunning()) {
AllocWrapper::Deallocate(*Data, alloc_size);
@@ -112,7 +86,7 @@ static void BM_DeallocateOnly(benchmark::State& st) {
}
static int RegisterAllocBenchmarks() {
- using FnType = void(*)(benchmark::State&);
+ using FnType = void (*)(benchmark::State&);
struct {
const char* name;
FnType func;
diff --git a/libcxx/benchmarks/deque.bench.cpp b/libcxx/benchmarks/deque.bench.cpp
index 61b45cbf4ecd7..ced2ba230f6c8 100644
--- a/libcxx/benchmarks/deque.bench.cpp
+++ b/libcxx/benchmarks/deque.bench.cpp
@@ -17,30 +17,17 @@ using namespace ContainerBenchmarks;
constexpr std::size_t TestNumInputs = 1024;
-BENCHMARK_CAPTURE(BM_ConstructSize,
- deque_byte,
- std::deque<unsigned char>{})->Arg(5140480);
+BENCHMARK_CAPTURE(BM_ConstructSize, deque_byte, std::deque<unsigned char>{})->Arg(5140480);
-BENCHMARK_CAPTURE(BM_ConstructSizeValue,
- deque_byte,
- std::deque<unsigned char>{}, 0)->Arg(5140480);
-
-BENCHMARK_CAPTURE(BM_ConstructIterIter,
- deque_char,
- std::deque<char>{},
- getRandomIntegerInputs<char>)->Arg(TestNumInputs);
-
-BENCHMARK_CAPTURE(BM_ConstructIterIter,
- deque_size_t,
- std::deque<size_t>{},
- getRandomIntegerInputs<size_t>)->Arg(TestNumInputs);
-
-BENCHMARK_CAPTURE(BM_ConstructIterIter,
- deque_string,
- std::deque<std::string>{},
- getRandomStringInputs)->Arg(TestNumInputs);
+BENCHMARK_CAPTURE(BM_ConstructSizeValue, deque_byte, std::deque<unsigned char>{}, 0)->Arg(5140480);
+BENCHMARK_CAPTURE(BM_ConstructIterIter, deque_char, std::deque<char>{}, getRandomIntegerInputs<char>)
+ ->Arg(TestNumInputs);
+BENCHMARK_CAPTURE(BM_ConstructIterIter, deque_size_t, std::deque<size_t>{}, getRandomIntegerInputs<size_t>)
+ ->Arg(TestNumInputs);
+BENCHMARK_CAPTURE(BM_ConstructIterIter, deque_string, std::deque<std::string>{}, getRandomStringInputs)
+ ->Arg(TestNumInputs);
BENCHMARK_MAIN();
diff --git a/libcxx/benchmarks/filesystem.bench.cpp b/libcxx/benchmarks/filesystem.bench.cpp
index 4fe4fc503ca13..44200fb3cab08 100644
--- a/libcxx/benchmarks/filesystem.bench.cpp
+++ b/libcxx/benchmarks/filesystem.bench.cpp
@@ -1,13 +1,12 @@
-#include "benchmark/benchmark.h"
#include "GenerateInput.h"
-#include "test_iterators.h"
+#include "benchmark/benchmark.h"
#include "filesystem_include.h"
+#include "test_iterators.h"
static const size_t TestNumInputs = 1024;
-
template <class GenInputs>
-void BM_PathConstructString(benchmark::State &st, GenInputs gen) {
+void BM_PathConstructString(benchmark::State& st, GenInputs gen) {
using fs::path;
const auto in = gen(st.range(0));
path PP;
@@ -20,12 +19,10 @@ void BM_PathConstructString(benchmark::State &st, GenInputs gen) {
}
st.SetComplexityN(st.range(0));
}
-BENCHMARK_CAPTURE(BM_PathConstructString, large_string,
- getRandomStringInputs)->Range(8, TestNumInputs)->Complexity();
-
+BENCHMARK_CAPTURE(BM_PathConstructString, large_string, getRandomStringInputs)->Range(8, TestNumInputs)->Complexity();
template <class GenInputs>
-void BM_PathConstructCStr(benchmark::State &st, GenInputs gen) {
+void BM_PathConstructCStr(benchmark::State& st, GenInputs gen) {
using fs::path;
const auto in = gen(st.range(0));
path PP;
@@ -37,20 +34,18 @@ void BM_PathConstructCStr(benchmark::State &st, GenInputs gen) {
benchmark::DoNotOptimize(P.native().data());
}
}
-BENCHMARK_CAPTURE(BM_PathConstructCStr, large_string,
- getRandomStringInputs)->Arg(TestNumInputs);
-
+BENCHMARK_CAPTURE(BM_PathConstructCStr, large_string, getRandomStringInputs)->Arg(TestNumInputs);
template <template <class...> class ItType, class GenInputs>
-void BM_PathConstructIter(benchmark::State &st, GenInputs gen) {
+void BM_PathConstructIter(benchmark::State& st, GenInputs gen) {
using fs::path;
- using Iter = ItType<std::string::const_iterator>;
+ using Iter = ItType<std::string::const_iterator>;
const auto in = gen(st.range(0));
path PP;
for (auto& Part : in)
PP /= Part;
auto Start = Iter(PP.native().begin());
- auto End = Iter(PP.native().end());
+ auto End = Iter(PP.native().end());
benchmark::DoNotOptimize(PP.native().data());
benchmark::DoNotOptimize(Start);
benchmark::DoNotOptimize(End);
@@ -61,21 +56,22 @@ void BM_PathConstructIter(benchmark::State &st, GenInputs gen) {
st.SetComplexityN(st.range(0));
}
template <class GenInputs>
-void BM_PathConstructInputIter(benchmark::State &st, GenInputs gen) {
+void BM_PathConstructInputIter(benchmark::State& st, GenInputs gen) {
BM_PathConstructIter<cpp17_input_iterator>(st, gen);
}
template <class GenInputs>
-void BM_PathConstructForwardIter(benchmark::State &st, GenInputs gen) {
+void BM_PathConstructForwardIter(benchmark::State& st, GenInputs gen) {
BM_PathConstructIter<forward_iterator>(st, gen);
}
-BENCHMARK_CAPTURE(BM_PathConstructInputIter, large_string,
- getRandomStringInputs)->Range(8, TestNumInputs)->Complexity();
-BENCHMARK_CAPTURE(BM_PathConstructForwardIter, large_string,
- getRandomStringInputs)->Range(8, TestNumInputs)->Complexity();
-
+BENCHMARK_CAPTURE(BM_PathConstructInputIter, large_string, getRandomStringInputs)
+ ->Range(8, TestNumInputs)
+ ->Complexity();
+BENCHMARK_CAPTURE(BM_PathConstructForwardIter, large_string, getRandomStringInputs)
+ ->Range(8, TestNumInputs)
+ ->Complexity();
template <class GenInputs>
-void BM_PathIterateMultipleTimes(benchmark::State &st, GenInputs gen) {
+void BM_PathIterateMultipleTimes(benchmark::State& st, GenInputs gen) {
using fs::path;
const auto in = gen(st.range(0));
path PP;
@@ -90,12 +86,12 @@ void BM_PathIterateMultipleTimes(benchmark::State &st, GenInputs gen) {
}
st.SetComplexityN(st.range(0));
}
-BENCHMARK_CAPTURE(BM_PathIterateMultipleTimes, iterate_elements,
- getRandomStringInputs)->Range(8, TestNumInputs)->Complexity();
-
+BENCHMARK_CAPTURE(BM_PathIterateMultipleTimes, iterate_elements, getRandomStringInputs)
+ ->Range(8, TestNumInputs)
+ ->Complexity();
template <class GenInputs>
-void BM_PathIterateOnce(benchmark::State &st, GenInputs gen) {
+void BM_PathIterateOnce(benchmark::State& st, GenInputs gen) {
using fs::path;
const auto in = gen(st.range(0));
path PP;
@@ -111,11 +107,10 @@ void BM_PathIterateOnce(benchmark::State &st, GenInputs gen) {
}
st.SetComplexityN(st.range(0));
}
-BENCHMARK_CAPTURE(BM_PathIterateOnce, iterate_elements,
- getRandomStringInputs)->Range(8, TestNumInputs)->Complexity();
+BENCHMARK_CAPTURE(BM_PathIterateOnce, iterate_elements, getRandomStringInputs)->Range(8, TestNumInputs)->Complexity();
template <class GenInputs>
-void BM_PathIterateOnceBackwards(benchmark::State &st, GenInputs gen) {
+void BM_PathIterateOnceBackwards(benchmark::State& st, GenInputs gen) {
using fs::path;
const auto in = gen(st.range(0));
path PP;
@@ -125,7 +120,7 @@ void BM_PathIterateOnceBackwards(benchmark::State &st, GenInputs gen) {
while (st.KeepRunning()) {
const path P = PP.native();
const auto B = P.begin();
- auto I = P.end();
+ auto I = P.end();
while (I != B) {
--I;
benchmark::DoNotOptimize(*I);
@@ -133,8 +128,7 @@ void BM_PathIterateOnceBackwards(benchmark::State &st, GenInputs gen) {
benchmark::DoNotOptimize(*I);
}
}
-BENCHMARK_CAPTURE(BM_PathIterateOnceBackwards, iterate_elements,
- getRandomStringInputs)->Arg(TestNumInputs);
+BENCHMARK_CAPTURE(BM_PathIterateOnceBackwards, iterate_elements, getRandomStringInputs)->Arg(TestNumInputs);
static fs::path getRandomPaths(int NumParts, int PathLen) {
fs::path Result;
@@ -146,7 +140,7 @@ static fs::path getRandomPaths(int NumParts, int PathLen) {
}
template <class GenInput>
-void BM_LexicallyNormal(benchmark::State &st, GenInput gen, size_t PathLen) {
+void BM_LexicallyNormal(benchmark::State& st, GenInput gen, size_t PathLen) {
using fs::path;
auto In = gen(st.range(0), PathLen);
benchmark::DoNotOptimize(&In);
@@ -155,9 +149,13 @@ void BM_LexicallyNormal(benchmark::State &st, GenInput gen, size_t PathLen) {
}
st.SetComplexityN(st.range(0));
}
-BENCHMARK_CAPTURE(BM_LexicallyNormal, small_path,
- getRandomPaths, /*PathLen*/5)->RangeMultiplier(2)->Range(2, 256)->Complexity();
-BENCHMARK_CAPTURE(BM_LexicallyNormal, large_path,
- getRandomPaths, /*PathLen*/32)->RangeMultiplier(2)->Range(2, 256)->Complexity();
+BENCHMARK_CAPTURE(BM_LexicallyNormal, small_path, getRandomPaths, /*PathLen*/ 5)
+ ->RangeMultiplier(2)
+ ->Range(2, 256)
+ ->Complexity();
+BENCHMARK_CAPTURE(BM_LexicallyNormal, large_path, getRandomPaths, /*PathLen*/ 32)
+ ->RangeMultiplier(2)
+ ->Range(2, 256)
+ ->Complexity();
BENCHMARK_MAIN();
diff --git a/libcxx/benchmarks/format_to.bench.cpp b/libcxx/benchmarks/format_to.bench.cpp
index 4d6489786b928..4e6041d448f50 100644
--- a/libcxx/benchmarks/format_to.bench.cpp
+++ b/libcxx/benchmarks/format_to.bench.cpp
@@ -7,9 +7,9 @@
#include <format>
-#include <iterator>
#include <algorithm>
#include <array>
+#include <iterator>
#include <list>
#include <span>
#include <string>
@@ -26,7 +26,7 @@ template <class Container>
static void BM_format_to_string_back_inserter(benchmark::State& state) {
using CharT = typename Container::value_type;
size_t size = state.range(0);
- auto str = std::basic_string<CharT>(size, CharT('*'));
+ auto str = std::basic_string<CharT>(size, CharT('*'));
for (auto _ : state) {
Container output;
@@ -41,7 +41,7 @@ template <class Container>
static void BM_format_to_string_begin(benchmark::State& state) {
using CharT = typename Container::value_type;
size_t size = state.range(0);
- auto str = std::basic_string<CharT>(size, CharT('*'));
+ auto str = std::basic_string<CharT>(size, CharT('*'));
Container output(size, CharT('-'));
for (auto _ : state)
@@ -55,7 +55,7 @@ static void BM_format_to_string_begin(benchmark::State& state) {
template <class CharT>
static void BM_format_to_string_span(benchmark::State& state) {
size_t size = state.range(0);
- auto str = std::basic_string<CharT>(size, CharT('*'));
+ auto str = std::basic_string<CharT>(size, CharT('*'));
auto buffer = std::basic_string<CharT>(size, CharT('-'));
std::span<CharT> output{buffer};
@@ -68,9 +68,9 @@ static void BM_format_to_string_span(benchmark::State& state) {
template <class CharT>
static void BM_format_to_string_pointer(benchmark::State& state) {
size_t size = state.range(0);
- auto str = std::basic_string<CharT>(size, CharT('*'));
+ auto str = std::basic_string<CharT>(size, CharT('*'));
- auto buffer = std::basic_string<CharT>(size, CharT('-'));
+ auto buffer = std::basic_string<CharT>(size, CharT('-'));
CharT* output = buffer.data();
for (auto _ : state)
benchmark::DoNotOptimize(std::format_to(output, CSTR("{}"), str));
diff --git a/libcxx/benchmarks/format_to_n.bench.cpp b/libcxx/benchmarks/format_to_n.bench.cpp
index c1e52b0104b32..f5816d49f6dd5 100644
--- a/libcxx/benchmarks/format_to_n.bench.cpp
+++ b/libcxx/benchmarks/format_to_n.bench.cpp
@@ -7,9 +7,9 @@
#include <format>
-#include <iterator>
#include <algorithm>
#include <array>
+#include <iterator>
#include <list>
#include <span>
#include <string>
@@ -26,7 +26,7 @@ template <class Container>
static void BM_format_to_n_string_back_inserter(benchmark::State& state) {
using CharT = typename Container::value_type;
size_t size = state.range(0);
- auto str = std::basic_string<CharT>(2 * size, CharT('*'));
+ auto str = std::basic_string<CharT>(2 * size, CharT('*'));
for (auto _ : state) {
Container output;
@@ -41,7 +41,7 @@ template <class Container>
static void BM_format_to_n_string_begin(benchmark::State& state) {
using CharT = typename Container::value_type;
size_t size = state.range(0);
- auto str = std::basic_string<CharT>(2 * size, CharT('*'));
+ auto str = std::basic_string<CharT>(2 * size, CharT('*'));
Container output(size, CharT('-'));
for (auto _ : state)
@@ -55,7 +55,7 @@ static void BM_format_to_n_string_begin(benchmark::State& state) {
template <class CharT>
static void BM_format_to_n_string_span(benchmark::State& state) {
size_t size = state.range(0);
- auto str = std::basic_string<CharT>(2 * size, CharT('*'));
+ auto str = std::basic_string<CharT>(2 * size, CharT('*'));
auto buffer = std::basic_string<CharT>(size, CharT('-'));
std::span<CharT> output{buffer};
@@ -68,9 +68,9 @@ static void BM_format_to_n_string_span(benchmark::State& state) {
template <class CharT>
static void BM_format_to_n_string_pointer(benchmark::State& state) {
size_t size = state.range(0);
- auto str = std::basic_string<CharT>(2 * size, CharT('*'));
+ auto str = std::basic_string<CharT>(2 * size, CharT('*'));
- auto buffer = std::basic_string<CharT>(size, CharT('-'));
+ auto buffer = std::basic_string<CharT>(size, CharT('-'));
CharT* output = buffer.data();
for (auto _ : state)
benchmark::DoNotOptimize(std::format_to_n(output, size, CSTR("{}"), str));
diff --git a/libcxx/benchmarks/formatter_float.bench.cpp b/libcxx/benchmarks/formatter_float.bench.cpp
index 09963b6108feb..e7a673bb5d655 100644
--- a/libcxx/benchmarks/formatter_float.bench.cpp
+++ b/libcxx/benchmarks/formatter_float.bench.cpp
@@ -107,8 +107,8 @@ enum class DisplayTypeE {
General,
};
struct AllDisplayTypes : EnumValuesAsTuple<AllDisplayTypes, DisplayTypeE, 5> {
- static constexpr const char* Names[] = {"DisplayDefault", "DisplayHex", "DisplayScientific", "DisplayFixed",
- "DisplayGeneral"};
+ static constexpr const char* Names[] = {
+ "DisplayDefault", "DisplayHex", "DisplayScientific", "DisplayFixed", "DisplayGeneral"};
};
template <DisplayTypeE E>
@@ -142,8 +142,8 @@ struct DisplayType<DisplayTypeE::General> {
// *** Alignment ***
enum class AlignmentE { None, Left, Center, Right, ZeroPadding };
struct AllAlignments : EnumValuesAsTuple<AllAlignments, AlignmentE, 5> {
- static constexpr const char* Names[] = {"AlignNone", "AlignmentLeft", "AlignmentCenter", "AlignmentRight",
- "ZeroPadding"};
+ static constexpr const char* Names[] = {
+ "AlignNone", "AlignmentLeft", "AlignmentCenter", "AlignmentRight", "ZeroPadding"};
};
template <AlignmentE E>
@@ -244,7 +244,12 @@ int main(int argc, char** argv) {
if (benchmark::ReportUnrecognizedArguments(argc, argv))
return 1;
- makeCartesianProductBenchmark<FloatingPoint, AllLocalizations, AllDisplayTypes, AllTypes, AllValues, AllAlignments,
+ makeCartesianProductBenchmark<FloatingPoint,
+ AllLocalizations,
+ AllDisplayTypes,
+ AllTypes,
+ AllValues,
+ AllAlignments,
AllPrecisions>();
benchmark::RunSpecifiedBenchmarks();
diff --git a/libcxx/benchmarks/formatter_int.bench.cpp b/libcxx/benchmarks/formatter_int.bench.cpp
index a42d96491a2b3..7cd794a4d4d66 100644
--- a/libcxx/benchmarks/formatter_int.bench.cpp
+++ b/libcxx/benchmarks/formatter_int.bench.cpp
@@ -9,14 +9,13 @@
#include <format>
#include <random>
-#include "benchmark/benchmark.h"
#include "CartesianBenchmarks.h"
+#include "benchmark/benchmark.h"
// Tests the full range of the value.
template <class T>
-static std::array<T, 1000>
-generate(std::uniform_int_distribution<T> distribution = std::uniform_int_distribution<T>{
- std::numeric_limits<T>::min(), std::numeric_limits<T>::max()}) {
+static std::array<T, 1000> generate(std::uniform_int_distribution<T> distribution = std::uniform_int_distribution<T>{
+ std::numeric_limits<T>::min(), std::numeric_limits<T>::max()}) {
std::mt19937 generator;
std::array<T, 1000> result;
std::generate_n(result.begin(), result.size(), [&] { return distribution(generator); });
diff --git a/libcxx/benchmarks/function.bench.cpp b/libcxx/benchmarks/function.bench.cpp
index 7fabc937dd930..dd397bcfa5b07 100644
--- a/libcxx/benchmarks/function.bench.cpp
+++ b/libcxx/benchmarks/function.bench.cpp
@@ -29,14 +29,15 @@ enum class FunctionType {
};
struct AllFunctionTypes : EnumValuesAsTuple<AllFunctionTypes, FunctionType, 8> {
- static constexpr const char* Names[] = {"Null",
- "FuncPtr",
- "MemFuncPtr",
- "MemPtr",
- "SmallTrivialFunctor",
- "SmallNonTrivialFunctor",
- "LargeTrivialFunctor",
- "LargeNonTrivialFunctor"};
+ static constexpr const char* Names[] = {
+ "Null",
+ "FuncPtr",
+ "MemFuncPtr",
+ "MemPtr",
+ "SmallTrivialFunctor",
+ "SmallNonTrivialFunctor",
+ "LargeTrivialFunctor",
+ "LargeNonTrivialFunctor"};
};
enum class Opacity { kOpaque, kTransparent };
@@ -63,7 +64,7 @@ struct SmallNonTrivialFunctor {
};
struct LargeTrivialFunctor {
LargeTrivialFunctor() {
- // Do not spend time initializing the padding.
+ // Do not spend time initializing the padding.
}
int padding[16];
int operator()(const S*) const { return 0; }
@@ -71,7 +72,7 @@ struct LargeTrivialFunctor {
struct LargeNonTrivialFunctor {
int padding[16];
LargeNonTrivialFunctor() {
- // Do not spend time initializing the padding.
+ // Do not spend time initializing the padding.
}
LargeNonTrivialFunctor(const LargeNonTrivialFunctor&) {}
~LargeNonTrivialFunctor() {}
@@ -83,22 +84,22 @@ using Function = std::function<int(const S*)>;
TEST_ALWAYS_INLINE
inline Function MakeFunction(FunctionType type, bool opaque = false) {
switch (type) {
- case FunctionType::Null:
- return nullptr;
- case FunctionType::FunctionPointer:
- return maybeOpaque(FunctionWithS, opaque);
- case FunctionType::MemberFunctionPointer:
- return maybeOpaque(&S::function, opaque);
- case FunctionType::MemberPointer:
- return maybeOpaque(&S::field, opaque);
- case FunctionType::SmallTrivialFunctor:
- return maybeOpaque(SmallTrivialFunctor{}, opaque);
- case FunctionType::SmallNonTrivialFunctor:
- return maybeOpaque(SmallNonTrivialFunctor{}, opaque);
- case FunctionType::LargeTrivialFunctor:
- return maybeOpaque(LargeTrivialFunctor{}, opaque);
- case FunctionType::LargeNonTrivialFunctor:
- return maybeOpaque(LargeNonTrivialFunctor{}, opaque);
+ case FunctionType::Null:
+ return nullptr;
+ case FunctionType::FunctionPointer:
+ return maybeOpaque(FunctionWithS, opaque);
+ case FunctionType::MemberFunctionPointer:
+ return maybeOpaque(&S::function, opaque);
+ case FunctionType::MemberPointer:
+ return maybeOpaque(&S::field, opaque);
+ case FunctionType::SmallTrivialFunctor:
+ return maybeOpaque(SmallTrivialFunctor{}, opaque);
+ case FunctionType::SmallNonTrivialFunctor:
+ return maybeOpaque(SmallNonTrivialFunctor{}, opaque);
+ case FunctionType::LargeTrivialFunctor:
+ return maybeOpaque(LargeTrivialFunctor{}, opaque);
+ case FunctionType::LargeNonTrivialFunctor:
+ return maybeOpaque(LargeNonTrivialFunctor{}, opaque);
}
}
@@ -114,9 +115,7 @@ struct ConstructAndDestroy {
}
}
- static std::string name() {
- return "BM_ConstructAndDestroy" + FunctionType::name() + Opacity::name();
- }
+ static std::string name() { return "BM_ConstructAndDestroy" + FunctionType::name() + Opacity::name(); }
};
template <class FunctionType>
@@ -125,7 +124,7 @@ struct Copy {
auto value = MakeFunction(FunctionType());
for (auto _ : state) {
benchmark::DoNotOptimize(value);
- auto copy = value; // NOLINT
+ auto copy = value; // NOLINT
benchmark::DoNotOptimize(copy);
}
}
@@ -137,7 +136,7 @@ template <class FunctionType>
struct Move {
static void run(benchmark::State& state) {
Function values[2] = {MakeFunction(FunctionType())};
- int i = 0;
+ int i = 0;
for (auto _ : state) {
benchmark::DoNotOptimize(values);
benchmark::DoNotOptimize(values[i ^ 1] = std::move(values[i]));
@@ -145,9 +144,7 @@ struct Move {
}
}
- static std::string name() {
- return "BM_Move" + FunctionType::name();
- }
+ static std::string name() { return "BM_Move" + FunctionType::name(); }
};
template <class Function1, class Function2>
@@ -162,9 +159,7 @@ struct Swap {
static bool skip() { return Function1() > Function2(); }
- static std::string name() {
- return "BM_Swap" + Function1::name() + Function2::name();
- }
+ static std::string name() { return "BM_Swap" + Function1::name() + Function2::name(); }
};
template <class FunctionType>
@@ -207,20 +202,17 @@ struct InvokeInlined {
static bool skip() { return FunctionType() == ::FunctionType::Null; }
- static std::string name() {
- return "BM_InvokeInlined" + FunctionType::name();
- }
+ static std::string name() { return "BM_InvokeInlined" + FunctionType::name(); }
};
-} // namespace
+} // namespace
int main(int argc, char** argv) {
benchmark::Initialize(&argc, argv);
if (benchmark::ReportUnrecognizedArguments(argc, argv))
return 1;
- makeCartesianProductBenchmark<ConstructAndDestroy, AllOpacity,
- AllFunctionTypes>();
+ makeCartesianProductBenchmark<ConstructAndDestroy, AllOpacity, AllFunctionTypes>();
makeCartesianProductBenchmark<Copy, AllFunctionTypes>();
makeCartesianProductBenchmark<Move, AllFunctionTypes>();
makeCartesianProductBenchmark<Swap, AllFunctionTypes, AllFunctionTypes>();
diff --git a/libcxx/benchmarks/map.bench.cpp b/libcxx/benchmarks/map.bench.cpp
index dd1884f65032e..255164b22aa80 100644
--- a/libcxx/benchmarks/map.bench.cpp
+++ b/libcxx/benchmarks/map.bench.cpp
@@ -21,7 +21,7 @@
// exists. To avoid errors in the benchmark these operations have a validation
// mode to test the benchmark. Since they are not meant to be benchmarked the
// number of sizes tested is limited to 1.
-//#define VALIDATE
+// #define VALIDATE
namespace {
@@ -50,15 +50,12 @@ struct AllOrders : EnumValuesAsTuple<AllOrders, Order, 2> {
struct TestSets {
std::vector<uint64_t> Keys;
std::vector<std::map<uint64_t, int64_t> > Maps;
- std::vector<
- std::vector<typename std::map<uint64_t, int64_t>::const_iterator> >
- Hints;
+ std::vector<std::vector<typename std::map<uint64_t, int64_t>::const_iterator> > Hints;
};
enum class Shuffle { None, Keys, Hints };
-TestSets makeTestingSets(size_t MapSize, Mode mode, Shuffle shuffle,
- size_t max_maps) {
+TestSets makeTestingSets(size_t MapSize, Mode mode, Shuffle shuffle, size_t max_maps) {
/*
* The shuffle does not retain the random number generator to use the same
* set of random numbers for every iteration.
@@ -74,7 +71,7 @@ TestSets makeTestingSets(size_t MapSize, Mode mode, Shuffle shuffle,
std::shuffle(R.Keys.begin(), R.Keys.end(), std::mt19937());
for (int M = 0; M < MapCount; ++M) {
- auto& map = R.Maps.emplace_back();
+ auto& map = R.Maps.emplace_back();
auto& hints = R.Hints.emplace_back();
for (uint64_t I = 0; I < MapSize; ++I) {
hints.push_back(map.insert(std::make_pair(2 * I + 2, 0)).first);
@@ -115,8 +112,7 @@ struct ConstructorIterator : Base {
auto& Map = Data.Maps.front();
while (State.KeepRunningBatch(MapSize)) {
#ifndef VALIDATE
- benchmark::DoNotOptimize(
- std::map<uint64_t, int64_t>(Map.begin(), Map.end()));
+ benchmark::DoNotOptimize(std::map<uint64_t, int64_t>(Map.begin(), Map.end()));
#else
std::map<uint64_t, int64_t> M{Map.begin(), Map.end()};
if (M != Map)
@@ -238,9 +234,7 @@ struct Insert : Base {
using Base::Base;
void run(benchmark::State& State) const {
- auto Data = makeTestingSets(
- MapSize, Mode(),
- Order::value == ::Order::Random ? Shuffle::Keys : Shuffle::None, 1000);
+ auto Data = makeTestingSets(MapSize, Mode(), Order::value == ::Order::Random ? Shuffle::Keys : Shuffle::None, 1000);
while (State.KeepRunningBatch(MapSize * Data.Maps.size())) {
for (auto& Map : Data.Maps) {
for (auto K : Data.Keys) {
@@ -260,17 +254,12 @@ struct Insert : Base {
}
State.PauseTiming();
- Data = makeTestingSets(MapSize, Mode(),
- Order::value == ::Order::Random ? Shuffle::Keys
- : Shuffle::None,
- 1000);
+ Data = makeTestingSets(MapSize, Mode(), Order::value == ::Order::Random ? Shuffle::Keys : Shuffle::None, 1000);
State.ResumeTiming();
}
}
- std::string name() const {
- return "BM_Insert" + baseName() + Mode::name() + Order::name();
- }
+ std::string name() const { return "BM_Insert" + baseName() + Mode::name() + Order::name(); }
};
template <class Mode, class Hint>
@@ -278,13 +267,12 @@ struct InsertHint : Base {
using Base::Base;
template < ::Hint hint>
- typename std::enable_if<hint == ::Hint::Correct>::type
- run(benchmark::State& State) const {
+ typename std::enable_if<hint == ::Hint::Correct>::type run(benchmark::State& State) const {
auto Data = makeTestingSets(MapSize, Mode(), Shuffle::None, 1000);
while (State.KeepRunningBatch(MapSize * Data.Maps.size())) {
for (size_t I = 0; I < Data.Maps.size(); ++I) {
auto& Map = Data.Maps[I];
- auto H = Data.Hints[I].begin();
+ auto H = Data.Hints[I].begin();
for (auto K : Data.Keys) {
#ifndef VALIDATE
benchmark::DoNotOptimize(Map.insert(*H, std::make_pair(K, 1)));
@@ -309,17 +297,14 @@ struct InsertHint : Base {
}
template < ::Hint hint>
- typename std::enable_if<hint != ::Hint::Correct>::type
- run(benchmark::State& State) const {
+ typename std::enable_if<hint != ::Hint::Correct>::type run(benchmark::State& State) const {
auto Data = makeTestingSets(MapSize, Mode(), Shuffle::None, 1000);
while (State.KeepRunningBatch(MapSize * Data.Maps.size())) {
for (size_t I = 0; I < Data.Maps.size(); ++I) {
- auto& Map = Data.Maps[I];
+ auto& Map = Data.Maps[I];
auto Third = *(Data.Hints[I].begin() + 2);
for (auto K : Data.Keys) {
- auto Itor = hint == ::Hint::Begin
- ? Map.begin()
- : hint == ::Hint::Third ? Third : Map.end();
+ auto Itor = hint == ::Hint::Begin ? Map.begin() : hint == ::Hint::Third ? Third : Map.end();
#ifndef VALIDATE
benchmark::DoNotOptimize(Map.insert(Itor, std::make_pair(K, 1)));
#else
@@ -347,9 +332,7 @@ struct InsertHint : Base {
run<h>(State);
}
- std::string name() const {
- return "BM_InsertHint" + baseName() + Mode::name() + Hint::name();
- }
+ std::string name() const { return "BM_InsertHint" + baseName() + Mode::name() + Hint::name(); }
};
template <class Mode, class Order>
@@ -357,9 +340,7 @@ struct InsertAssign : Base {
using Base::Base;
void run(benchmark::State& State) const {
- auto Data = makeTestingSets(
- MapSize, Mode(),
- Order::value == ::Order::Random ? Shuffle::Keys : Shuffle::None, 1000);
+ auto Data = makeTestingSets(MapSize, Mode(), Order::value == ::Order::Random ? Shuffle::Keys : Shuffle::None, 1000);
while (State.KeepRunningBatch(MapSize * Data.Maps.size())) {
for (auto& Map : Data.Maps) {
for (auto K : Data.Keys) {
@@ -379,17 +360,12 @@ struct InsertAssign : Base {
}
State.PauseTiming();
- Data = makeTestingSets(MapSize, Mode(),
- Order::value == ::Order::Random ? Shuffle::Keys
- : Shuffle::None,
- 1000);
+ Data = makeTestingSets(MapSize, Mode(), Order::value == ::Order::Random ? Shuffle::Keys : Shuffle::None, 1000);
State.ResumeTiming();
}
}
- std::string name() const {
- return "BM_InsertAssign" + baseName() + Mode::name() + Order::name();
- }
+ std::string name() const { return "BM_InsertAssign" + baseName() + Mode::name() + Order::name(); }
};
template <class Mode, class Hint>
@@ -397,13 +373,12 @@ struct InsertAssignHint : Base {
using Base::Base;
template < ::Hint hint>
- typename std::enable_if<hint == ::Hint::Correct>::type
- run(benchmark::State& State) const {
+ typename std::enable_if<hint == ::Hint::Correct>::type run(benchmark::State& State) const {
auto Data = makeTestingSets(MapSize, Mode(), Shuffle::None, 1000);
while (State.KeepRunningBatch(MapSize * Data.Maps.size())) {
for (size_t I = 0; I < Data.Maps.size(); ++I) {
auto& Map = Data.Maps[I];
- auto H = Data.Hints[I].begin();
+ auto H = Data.Hints[I].begin();
for (auto K : Data.Keys) {
#ifndef VALIDATE
benchmark::DoNotOptimize(Map.insert_or_assign(*H, K, 1));
@@ -428,17 +403,14 @@ struct InsertAssignHint : Base {
}
template < ::Hint hint>
- typename std::enable_if<hint != ::Hint::Correct>::type
- run(benchmark::State& State) const {
+ typename std::enable_if<hint != ::Hint::Correct>::type run(benchmark::State& State) const {
auto Data = makeTestingSets(MapSize, Mode(), Shuffle::None, 1000);
while (State.KeepRunningBatch(MapSize * Data.Maps.size())) {
for (size_t I = 0; I < Data.Maps.size(); ++I) {
- auto& Map = Data.Maps[I];
+ auto& Map = Data.Maps[I];
auto Third = *(Data.Hints[I].begin() + 2);
for (auto K : Data.Keys) {
- auto Itor = hint == ::Hint::Begin
- ? Map.begin()
- : hint == ::Hint::Third ? Third : Map.end();
+ auto Itor = hint == ::Hint::Begin ? Map.begin() : hint == ::Hint::Third ? Third : Map.end();
#ifndef VALIDATE
benchmark::DoNotOptimize(Map.insert_or_assign(Itor, K, 1));
#else
@@ -466,9 +438,7 @@ struct InsertAssignHint : Base {
run<h>(State);
}
- std::string name() const {
- return "BM_InsertAssignHint" + baseName() + Mode::name() + Hint::name();
- }
+ std::string name() const { return "BM_InsertAssignHint" + baseName() + Mode::name() + Hint::name(); }
};
template <class Mode, class Order>
@@ -476,10 +446,7 @@ struct Emplace : Base {
using Base::Base;
void run(benchmark::State& State) const {
-
- auto Data = makeTestingSets(
- MapSize, Mode(),
- Order::value == ::Order::Random ? Shuffle::Keys : Shuffle::None, 1000);
+ auto Data = makeTestingSets(MapSize, Mode(), Order::value == ::Order::Random ? Shuffle::Keys : Shuffle::None, 1000);
while (State.KeepRunningBatch(MapSize * Data.Maps.size())) {
for (auto& Map : Data.Maps) {
for (auto K : Data.Keys) {
@@ -499,17 +466,12 @@ struct Emplace : Base {
}
State.PauseTiming();
- Data = makeTestingSets(MapSize, Mode(),
- Order::value == ::Order::Random ? Shuffle::Keys
- : Shuffle::None,
- 1000);
+ Data = makeTestingSets(MapSize, Mode(), Order::value == ::Order::Random ? Shuffle::Keys : Shuffle::None, 1000);
State.ResumeTiming();
}
}
- std::string name() const {
- return "BM_Emplace" + baseName() + Mode::name() + Order::name();
- }
+ std::string name() const { return "BM_Emplace" + baseName() + Mode::name() + Order::name(); }
};
template <class Mode, class Hint>
@@ -517,13 +479,12 @@ struct EmplaceHint : Base {
using Base::Base;
template < ::Hint hint>
- typename std::enable_if<hint == ::Hint::Correct>::type
- run(benchmark::State& State) const {
+ typename std::enable_if<hint == ::Hint::Correct>::type run(benchmark::State& State) const {
auto Data = makeTestingSets(MapSize, Mode(), Shuffle::None, 1000);
while (State.KeepRunningBatch(MapSize * Data.Maps.size())) {
for (size_t I = 0; I < Data.Maps.size(); ++I) {
auto& Map = Data.Maps[I];
- auto H = Data.Hints[I].begin();
+ auto H = Data.Hints[I].begin();
for (auto K : Data.Keys) {
#ifndef VALIDATE
benchmark::DoNotOptimize(Map.emplace_hint(*H, K, 1));
@@ -548,17 +509,14 @@ struct EmplaceHint : Base {
}
template < ::Hint hint>
- typename std::enable_if<hint != ::Hint::Correct>::type
- run(benchmark::State& State) const {
+ typename std::enable_if<hint != ::Hint::Correct>::type run(benchmark::State& State) const {
auto Data = makeTestingSets(MapSize, Mode(), Shuffle::None, 1000);
while (State.KeepRunningBatch(MapSize * Data.Maps.size())) {
for (size_t I = 0; I < Data.Maps.size(); ++I) {
- auto& Map = Data.Maps[I];
+ auto& Map = Data.Maps[I];
auto Third = *(Data.Hints[I].begin() + 2);
for (auto K : Data.Keys) {
- auto Itor = hint == ::Hint::Begin
- ? Map.begin()
- : hint == ::Hint::Third ? Third : Map.end();
+ auto Itor = hint == ::Hint::Begin ? Map.begin() : hint == ::Hint::Third ? Third : Map.end();
#ifndef VALIDATE
benchmark::DoNotOptimize(Map.emplace_hint(Itor, K, 1));
#else
@@ -586,9 +544,7 @@ struct EmplaceHint : Base {
run<h>(State);
}
- std::string name() const {
- return "BM_EmplaceHint" + baseName() + Mode::name() + Hint::name();
- }
+ std::string name() const { return "BM_EmplaceHint" + baseName() + Mode::name() + Hint::name(); }
};
template <class Mode, class Order>
@@ -596,10 +552,7 @@ struct TryEmplace : Base {
using Base::Base;
void run(benchmark::State& State) const {
-
- auto Data = makeTestingSets(
- MapSize, Mode(),
- Order::value == ::Order::Random ? Shuffle::Keys : Shuffle::None, 1000);
+ auto Data = makeTestingSets(MapSize, Mode(), Order::value == ::Order::Random ? Shuffle::Keys : Shuffle::None, 1000);
while (State.KeepRunningBatch(MapSize * Data.Maps.size())) {
for (auto& Map : Data.Maps) {
for (auto K : Data.Keys) {
@@ -619,17 +572,12 @@ struct TryEmplace : Base {
}
State.PauseTiming();
- Data = makeTestingSets(MapSize, Mode(),
- Order::value == ::Order::Random ? Shuffle::Keys
- : Shuffle::None,
- 1000);
+ Data = makeTestingSets(MapSize, Mode(), Order::value == ::Order::Random ? Shuffle::Keys : Shuffle::None, 1000);
State.ResumeTiming();
}
}
- std::string name() const {
- return "BM_TryEmplace" + baseName() + Mode::name() + Order::name();
- }
+ std::string name() const { return "BM_TryEmplace" + baseName() + Mode::name() + Order::name(); }
};
template <class Mode, class Hint>
@@ -637,13 +585,12 @@ struct TryEmplaceHint : Base {
using Base::Base;
template < ::Hint hint>
- typename std::enable_if<hint == ::Hint::Correct>::type
- run(benchmark::State& State) const {
+ typename std::enable_if<hint == ::Hint::Correct>::type run(benchmark::State& State) const {
auto Data = makeTestingSets(MapSize, Mode(), Shuffle::None, 1000);
while (State.KeepRunningBatch(MapSize * Data.Maps.size())) {
for (size_t I = 0; I < Data.Maps.size(); ++I) {
auto& Map = Data.Maps[I];
- auto H = Data.Hints[I].begin();
+ auto H = Data.Hints[I].begin();
for (auto K : Data.Keys) {
#ifndef VALIDATE
benchmark::DoNotOptimize(Map.try_emplace(*H, K, 1));
@@ -668,17 +615,14 @@ struct TryEmplaceHint : Base {
}
template < ::Hint hint>
- typename std::enable_if<hint != ::Hint::Correct>::type
- run(benchmark::State& State) const {
+ typename std::enable_if<hint != ::Hint::Correct>::type run(benchmark::State& State) const {
auto Data = makeTestingSets(MapSize, Mode(), Shuffle::None, 1000);
while (State.KeepRunningBatch(MapSize * Data.Maps.size())) {
for (size_t I = 0; I < Data.Maps.size(); ++I) {
- auto& Map = Data.Maps[I];
+ auto& Map = Data.Maps[I];
auto Third = *(Data.Hints[I].begin() + 2);
for (auto K : Data.Keys) {
- auto Itor = hint == ::Hint::Begin
- ? Map.begin()
- : hint == ::Hint::Third ? Third : Map.end();
+ auto Itor = hint == ::Hint::Begin ? Map.begin() : hint == ::Hint::Third ? Third : Map.end();
#ifndef VALIDATE
benchmark::DoNotOptimize(Map.try_emplace(Itor, K, 1));
#else
@@ -706,9 +650,7 @@ struct TryEmplaceHint : Base {
run<h>(State);
}
- std::string name() const {
- return "BM_TryEmplaceHint" + baseName() + Mode::name() + Hint::name();
- }
+ std::string name() const { return "BM_TryEmplaceHint" + baseName() + Mode::name() + Hint::name(); }
};
template <class Mode, class Order>
@@ -716,9 +658,7 @@ struct Erase : Base {
using Base::Base;
void run(benchmark::State& State) const {
- auto Data = makeTestingSets(
- MapSize, Mode(),
- Order::value == ::Order::Random ? Shuffle::Keys : Shuffle::None, 1000);
+ auto Data = makeTestingSets(MapSize, Mode(), Order::value == ::Order::Random ? Shuffle::Keys : Shuffle::None, 1000);
while (State.KeepRunningBatch(MapSize * Data.Maps.size())) {
for (auto& Map : Data.Maps) {
for (auto K : Data.Keys) {
@@ -738,17 +678,12 @@ struct Erase : Base {
}
State.PauseTiming();
- Data = makeTestingSets(MapSize, Mode(),
- Order::value == ::Order::Random ? Shuffle::Keys
- : Shuffle::None,
- 1000);
+ Data = makeTestingSets(MapSize, Mode(), Order::value == ::Order::Random ? Shuffle::Keys : Shuffle::None, 1000);
State.ResumeTiming();
}
}
- std::string name() const {
- return "BM_Erase" + baseName() + Mode::name() + Order::name();
- }
+ std::string name() const { return "BM_Erase" + baseName() + Mode::name() + Order::name(); }
};
template <class Order>
@@ -756,9 +691,8 @@ struct EraseIterator : Base {
using Base::Base;
void run(benchmark::State& State) const {
- auto Data = makeTestingSets(
- MapSize, Mode::Hit,
- Order::value == ::Order::Random ? Shuffle::Hints : Shuffle::None, 1000);
+ auto Data =
+ makeTestingSets(MapSize, Mode::Hit, Order::value == ::Order::Random ? Shuffle::Hints : Shuffle::None, 1000);
while (State.KeepRunningBatch(MapSize * Data.Maps.size())) {
for (size_t I = 0; I < Data.Maps.size(); ++I) {
auto& Map = Data.Maps[I];
@@ -772,17 +706,13 @@ struct EraseIterator : Base {
}
State.PauseTiming();
- Data = makeTestingSets(MapSize, Mode::Hit,
- Order::value == ::Order::Random ? Shuffle::Hints
- : Shuffle::None,
- 1000);
+ Data =
+ makeTestingSets(MapSize, Mode::Hit, Order::value == ::Order::Random ? Shuffle::Hints : Shuffle::None, 1000);
State.ResumeTiming();
}
}
- std::string name() const {
- return "BM_EraseIterator" + baseName() + Order::name();
- }
+ std::string name() const { return "BM_EraseIterator" + baseName() + Order::name(); }
};
struct EraseRange : Base {
@@ -819,9 +749,7 @@ struct Count : Base {
using Base::Base;
void run(benchmark::State& State) const {
- auto Data = makeTestingSets(
- MapSize, Mode(),
- Order::value == ::Order::Random ? Shuffle::Keys : Shuffle::None, 1);
+ auto Data = makeTestingSets(MapSize, Mode(), Order::value == ::Order::Random ? Shuffle::Keys : Shuffle::None, 1);
auto& Map = Data.Maps.front();
while (State.KeepRunningBatch(MapSize)) {
for (auto K : Data.Keys) {
@@ -841,9 +769,7 @@ struct Count : Base {
}
}
- std::string name() const {
- return "BM_Count" + baseName() + Mode::name() + Order::name();
- }
+ std::string name() const { return "BM_Count" + baseName() + Mode::name() + Order::name(); }
};
template <class Mode, class Order>
@@ -851,9 +777,7 @@ struct Find : Base {
using Base::Base;
void run(benchmark::State& State) const {
- auto Data = makeTestingSets(
- MapSize, Mode(),
- Order::value == ::Order::Random ? Shuffle::Keys : Shuffle::None, 1);
+ auto Data = makeTestingSets(MapSize, Mode(), Order::value == ::Order::Random ? Shuffle::Keys : Shuffle::None, 1);
auto& Map = Data.Maps.front();
while (State.KeepRunningBatch(MapSize)) {
for (auto K : Data.Keys) {
@@ -873,9 +797,7 @@ struct Find : Base {
}
}
- std::string name() const {
- return "BM_Find" + baseName() + Mode::name() + Order::name();
- }
+ std::string name() const { return "BM_Find" + baseName() + Mode::name() + Order::name(); }
};
template <class Mode, class Order>
@@ -883,9 +805,7 @@ struct EqualRange : Base {
using Base::Base;
void run(benchmark::State& State) const {
- auto Data = makeTestingSets(
- MapSize, Mode(),
- Order::value == ::Order::Random ? Shuffle::Keys : Shuffle::None, 1);
+ auto Data = makeTestingSets(MapSize, Mode(), Order::value == ::Order::Random ? Shuffle::Keys : Shuffle::None, 1);
auto& Map = Data.Maps.front();
while (State.KeepRunningBatch(MapSize)) {
for (auto K : Data.Keys) {
@@ -900,12 +820,12 @@ struct EqualRange : Base {
--Range.second;
Key -= 2;
}
- if (Range.first == Map.end() || Range.first->first != K ||
- Range.second == Map.end() || Range.second->first - 2 != Key)
+ if (Range.first == Map.end() || Range.first->first != K || Range.second == Map.end() ||
+ Range.second->first - 2 != Key)
State.SkipWithError("Did not find the existing element");
} else {
- if (Range.first == Map.end() || Range.first->first - 1 != K ||
- Range.second == Map.end() || Range.second->first - 1 != K)
+ if (Range.first == Map.end() || Range.first->first - 1 != K || Range.second == Map.end() ||
+ Range.second->first - 1 != K)
State.SkipWithError("Did find the non-existing element");
}
#endif
@@ -913,9 +833,7 @@ struct EqualRange : Base {
}
}
- std::string name() const {
- return "BM_EqualRange" + baseName() + Mode::name() + Order::name();
- }
+ std::string name() const { return "BM_EqualRange" + baseName() + Mode::name() + Order::name(); }
};
template <class Mode, class Order>
@@ -923,9 +841,7 @@ struct LowerBound : Base {
using Base::Base;
void run(benchmark::State& State) const {
- auto Data = makeTestingSets(
- MapSize, Mode(),
- Order::value == ::Order::Random ? Shuffle::Keys : Shuffle::None, 1);
+ auto Data = makeTestingSets(MapSize, Mode(), Order::value == ::Order::Random ? Shuffle::Keys : Shuffle::None, 1);
auto& Map = Data.Maps.front();
while (State.KeepRunningBatch(MapSize)) {
for (auto K : Data.Keys) {
@@ -945,9 +861,7 @@ struct LowerBound : Base {
}
}
- std::string name() const {
- return "BM_LowerBound" + baseName() + Mode::name() + Order::name();
- }
+ std::string name() const { return "BM_LowerBound" + baseName() + Mode::name() + Order::name(); }
};
template <class Mode, class Order>
@@ -955,9 +869,7 @@ struct UpperBound : Base {
using Base::Base;
void run(benchmark::State& State) const {
- auto Data = makeTestingSets(
- MapSize, Mode(),
- Order::value == ::Order::Random ? Shuffle::Keys : Shuffle::None, 1);
+ auto Data = makeTestingSets(MapSize, Mode(), Order::value == ::Order::Random ? Shuffle::Keys : Shuffle::None, 1);
auto& Map = Data.Maps.front();
while (State.KeepRunningBatch(MapSize)) {
for (auto K : Data.Keys) {
@@ -983,9 +895,7 @@ struct UpperBound : Base {
}
}
- std::string name() const {
- return "BM_UpperBound" + baseName() + Mode::name() + Order::name();
- }
+ std::string name() const { return "BM_UpperBound" + baseName() + Mode::name() + Order::name(); }
};
} // namespace
diff --git a/libcxx/benchmarks/ordered_set.bench.cpp b/libcxx/benchmarks/ordered_set.bench.cpp
index a9d9c929ac64d..22540d8ab7e0c 100644
--- a/libcxx/benchmarks/ordered_set.bench.cpp
+++ b/libcxx/benchmarks/ordered_set.bench.cpp
@@ -28,8 +28,7 @@ struct AllHitTypes : EnumValuesAsTuple<AllHitTypes, HitType, 2> {
enum class AccessPattern { Ordered, Random };
-struct AllAccessPattern
- : EnumValuesAsTuple<AllAccessPattern, AccessPattern, 2> {
+struct AllAccessPattern : EnumValuesAsTuple<AllAccessPattern, AccessPattern, 2> {
static constexpr const char* Names[] = {"Ordered", "Random"};
};
@@ -46,8 +45,7 @@ struct TestSets {
std::vector<uint64_t> Keys;
};
-TestSets makeTestingSets(size_t TableSize, size_t NumTables, HitType Hit,
- AccessPattern Access) {
+TestSets makeTestingSets(size_t TableSize, size_t NumTables, HitType Hit, AccessPattern Access) {
TestSets R;
R.Sets.resize(1);
@@ -72,8 +70,7 @@ struct Base {
}
std::string baseName() const {
- return "_TableSize" + std::to_string(TableSize) + "_NumTables" +
- std::to_string(NumTables);
+ return "_TableSize" + std::to_string(TableSize) + "_NumTables" + std::to_string(NumTables);
}
};
@@ -96,9 +93,7 @@ struct Create : Base {
}
}
- std::string name() const {
- return "BM_Create" + Access::name() + baseName();
- }
+ std::string name() const { return "BM_Create" + Access::name() + baseName(); }
};
template <class Hit, class Access>
@@ -117,9 +112,7 @@ struct Find : Base {
}
}
- std::string name() const {
- return "BM_Find" + Hit::name() + Access::name() + baseName();
- }
+ std::string name() const { return "BM_Find" + Hit::name() + Access::name() + baseName(); }
};
template <class Hit, class Access>
@@ -138,9 +131,7 @@ struct FindNeEnd : Base {
}
}
- std::string name() const {
- return "BM_FindNeEnd" + Hit::name() + Access::name() + baseName();
- }
+ std::string name() const { return "BM_FindNeEnd" + Hit::name() + Access::name() + baseName(); }
};
template <class Access>
@@ -159,9 +150,7 @@ struct InsertHit : Base {
}
}
- std::string name() const {
- return "BM_InsertHit" + Access::name() + baseName();
- }
+ std::string name() const { return "BM_InsertHit" + Access::name() + baseName(); }
};
template <class Access>
@@ -180,17 +169,14 @@ struct InsertMissAndErase : Base {
}
}
- std::string name() const {
- return "BM_InsertMissAndErase" + Access::name() + baseName();
- }
+ std::string name() const { return "BM_InsertMissAndErase" + Access::name() + baseName(); }
};
struct IterateRangeFor : Base {
using Base::Base;
void run(benchmark::State& State) const {
- auto Data = makeTestingSets(TableSize, NumTables, HitType::Miss,
- AccessPattern::Ordered);
+ auto Data = makeTestingSets(TableSize, NumTables, HitType::Miss, AccessPattern::Ordered);
while (State.KeepRunningBatch(TableSize * NumTables)) {
for (auto& Set : Data.Sets) {
@@ -208,8 +194,7 @@ struct IterateBeginEnd : Base {
using Base::Base;
void run(benchmark::State& State) const {
- auto Data = makeTestingSets(TableSize, NumTables, HitType::Miss,
- AccessPattern::Ordered);
+ auto Data = makeTestingSets(TableSize, NumTables, HitType::Miss, AccessPattern::Ordered);
while (State.KeepRunningBatch(TableSize * NumTables)) {
for (auto& Set : Data.Sets) {
@@ -223,7 +208,7 @@ struct IterateBeginEnd : Base {
std::string name() const { return "BM_IterateBeginEnd" + baseName(); }
};
-} // namespace
+} // namespace
int main(int argc, char** argv) {
benchmark::Initialize(&argc, argv);
@@ -234,14 +219,10 @@ int main(int argc, char** argv) {
const std::vector<size_t> NumTables{1, 10, 100, 1000, 10000, 100000, 1000000};
makeCartesianProductBenchmark<Create, AllAccessPattern>(TableSize, NumTables);
- makeCartesianProductBenchmark<Find, AllHitTypes, AllAccessPattern>(
- TableSize, NumTables);
- makeCartesianProductBenchmark<FindNeEnd, AllHitTypes, AllAccessPattern>(
- TableSize, NumTables);
- makeCartesianProductBenchmark<InsertHit, AllAccessPattern>(
- TableSize, NumTables);
- makeCartesianProductBenchmark<InsertMissAndErase, AllAccessPattern>(
- TableSize, NumTables);
+ makeCartesianProductBenchmark<Find, AllHitTypes, AllAccessPattern>(TableSize, NumTables);
+ makeCartesianProductBenchmark<FindNeEnd, AllHitTypes, AllAccessPattern>(TableSize, NumTables);
+ makeCartesianProductBenchmark<InsertHit, AllAccessPattern>(TableSize, NumTables);
+ makeCartesianProductBenchmark<InsertMissAndErase, AllAccessPattern>(TableSize, NumTables);
makeCartesianProductBenchmark<IterateRangeFor>(TableSize, NumTables);
makeCartesianProductBenchmark<IterateBeginEnd>(TableSize, NumTables);
benchmark::RunSpecifiedBenchmarks();
diff --git a/libcxx/benchmarks/random.bench.cpp b/libcxx/benchmarks/random.bench.cpp
index e437849321da0..fe2eb6672ae79 100644
--- a/libcxx/benchmarks/random.bench.cpp
+++ b/libcxx/benchmarks/random.bench.cpp
@@ -14,7 +14,7 @@
#include "benchmark/benchmark.h"
constexpr std::size_t MAX_BUFFER_LEN = 256;
-constexpr std::size_t MAX_SEED_LEN = 16;
+constexpr std::size_t MAX_SEED_LEN = 16;
static void BM_SeedSeq_Generate(benchmark::State& state) {
std::array<std::uint32_t, MAX_BUFFER_LEN> buffer;
diff --git a/libcxx/benchmarks/string.bench.cpp b/libcxx/benchmarks/string.bench.cpp
index e43ad3212fff5..92018b0e48f53 100644
--- a/libcxx/benchmarks/string.bench.cpp
+++ b/libcxx/benchmarks/string.bench.cpp
@@ -11,7 +11,7 @@
constexpr std::size_t MAX_STRING_LEN = 8 << 14;
// Benchmark when there is no match.
-static void BM_StringFindNoMatch(benchmark::State &state) {
+static void BM_StringFindNoMatch(benchmark::State& state) {
std::string s1(state.range(0), '-');
std::string s2(8, '*');
for (auto _ : state)
@@ -20,7 +20,7 @@ static void BM_StringFindNoMatch(benchmark::State &state) {
BENCHMARK(BM_StringFindNoMatch)->Range(10, MAX_STRING_LEN);
// Benchmark when the string matches first time.
-static void BM_StringFindAllMatch(benchmark::State &state) {
+static void BM_StringFindAllMatch(benchmark::State& state) {
std::string s1(MAX_STRING_LEN, '-');
std::string s2(state.range(0), '-');
for (auto _ : state)
@@ -29,7 +29,7 @@ static void BM_StringFindAllMatch(benchmark::State &state) {
BENCHMARK(BM_StringFindAllMatch)->Range(1, MAX_STRING_LEN);
// Benchmark when the string matches somewhere in the end.
-static void BM_StringFindMatch1(benchmark::State &state) {
+static void BM_StringFindMatch1(benchmark::State& state) {
std::string s1(MAX_STRING_LEN / 2, '*');
s1 += std::string(state.range(0), '-');
std::string s2(state.range(0), '-');
@@ -39,7 +39,7 @@ static void BM_StringFindMatch1(benchmark::State &state) {
BENCHMARK(BM_StringFindMatch1)->Range(1, MAX_STRING_LEN / 4);
// Benchmark when the string matches somewhere from middle to the end.
-static void BM_StringFindMatch2(benchmark::State &state) {
+static void BM_StringFindMatch2(benchmark::State& state) {
std::string s1(MAX_STRING_LEN / 2, '*');
s1 += std::string(state.range(0), '-');
s1 += std::string(state.range(0), '*');
@@ -49,7 +49,7 @@ static void BM_StringFindMatch2(benchmark::State &state) {
}
BENCHMARK(BM_StringFindMatch2)->Range(1, MAX_STRING_LEN / 4);
-static void BM_StringCtorDefault(benchmark::State &state) {
+static void BM_StringCtorDefault(benchmark::State& state) {
for (auto _ : state) {
std::string Default;
benchmark::DoNotOptimize(Default);
@@ -69,40 +69,38 @@ struct AllOpacity : EnumValuesAsTuple<AllOpacity, Opacity, 2> {
enum class DiffType { Control, ChangeFirst, ChangeMiddle, ChangeLast };
struct AllDiffTypes : EnumValuesAsTuple<AllDiffTypes, DiffType, 4> {
- static constexpr const char* Names[] = {"Control", "ChangeFirst",
- "ChangeMiddle", "ChangeLast"};
+ static constexpr const char* Names[] = {"Control", "ChangeFirst", "ChangeMiddle", "ChangeLast"};
};
static constexpr char SmallStringLiteral[] = "012345678";
TEST_ALWAYS_INLINE const char* getSmallString(DiffType D) {
switch (D) {
- case DiffType::Control:
- return SmallStringLiteral;
- case DiffType::ChangeFirst:
- return "-12345678";
- case DiffType::ChangeMiddle:
- return "0123-5678";
- case DiffType::ChangeLast:
- return "01234567-";
+ case DiffType::Control:
+ return SmallStringLiteral;
+ case DiffType::ChangeFirst:
+ return "-12345678";
+ case DiffType::ChangeMiddle:
+ return "0123-5678";
+ case DiffType::ChangeLast:
+ return "01234567-";
}
}
-static constexpr char LargeStringLiteral[] =
- "012345678901234567890123456789012345678901234567890123456789012";
+static constexpr char LargeStringLiteral[] = "012345678901234567890123456789012345678901234567890123456789012";
TEST_ALWAYS_INLINE const char* getLargeString(DiffType D) {
#define LARGE_STRING_FIRST "123456789012345678901234567890"
#define LARGE_STRING_SECOND "234567890123456789012345678901"
switch (D) {
- case DiffType::Control:
- return "0" LARGE_STRING_FIRST "1" LARGE_STRING_SECOND "2";
- case DiffType::ChangeFirst:
- return "-" LARGE_STRING_FIRST "1" LARGE_STRING_SECOND "2";
- case DiffType::ChangeMiddle:
- return "0" LARGE_STRING_FIRST "-" LARGE_STRING_SECOND "2";
- case DiffType::ChangeLast:
- return "0" LARGE_STRING_FIRST "1" LARGE_STRING_SECOND "-";
+ case DiffType::Control:
+ return "0" LARGE_STRING_FIRST "1" LARGE_STRING_SECOND "2";
+ case DiffType::ChangeFirst:
+ return "-" LARGE_STRING_FIRST "1" LARGE_STRING_SECOND "2";
+ case DiffType::ChangeMiddle:
+ return "0" LARGE_STRING_FIRST "-" LARGE_STRING_SECOND "2";
+ case DiffType::ChangeLast:
+ return "0" LARGE_STRING_FIRST "1" LARGE_STRING_SECOND "-";
}
}
@@ -113,19 +111,18 @@ TEST_ALWAYS_INLINE const char* getHugeString(DiffType D) {
#define HUGE_STRING3 HUGE_STRING2 HUGE_STRING2 HUGE_STRING2 HUGE_STRING2
#define HUGE_STRING4 HUGE_STRING3 HUGE_STRING3 HUGE_STRING3 HUGE_STRING3
switch (D) {
- case DiffType::Control:
- return "0123456789" HUGE_STRING4 "0123456789" HUGE_STRING4 "0123456789";
- case DiffType::ChangeFirst:
- return "-123456789" HUGE_STRING4 "0123456789" HUGE_STRING4 "0123456789";
- case DiffType::ChangeMiddle:
- return "0123456789" HUGE_STRING4 "01234-6789" HUGE_STRING4 "0123456789";
- case DiffType::ChangeLast:
- return "0123456789" HUGE_STRING4 "0123456789" HUGE_STRING4 "012345678-";
+ case DiffType::Control:
+ return "0123456789" HUGE_STRING4 "0123456789" HUGE_STRING4 "0123456789";
+ case DiffType::ChangeFirst:
+ return "-123456789" HUGE_STRING4 "0123456789" HUGE_STRING4 "0123456789";
+ case DiffType::ChangeMiddle:
+ return "0123456789" HUGE_STRING4 "01234-6789" HUGE_STRING4 "0123456789";
+ case DiffType::ChangeLast:
+ return "0123456789" HUGE_STRING4 "0123456789" HUGE_STRING4 "012345678-";
}
}
-TEST_ALWAYS_INLINE const char* getString(Length L,
- DiffType D = DiffType::Control) {
+TEST_ALWAYS_INLINE const char* getString(Length L, DiffType D = DiffType::Control) {
switch (L) {
case Length::Empty:
return "";
@@ -138,9 +135,7 @@ TEST_ALWAYS_INLINE const char* getString(Length L,
}
}
-TEST_ALWAYS_INLINE std::string makeString(Length L,
- DiffType D = DiffType::Control,
- Opacity O = Opacity::Transparent) {
+TEST_ALWAYS_INLINE std::string makeString(Length L, DiffType D = DiffType::Control, Opacity O = Opacity::Transparent) {
switch (L) {
case Length::Empty:
return maybeOpaque("", O == Opacity::Opaque);
@@ -157,20 +152,17 @@ template <class Length, class Opaque>
struct StringConstructDestroyCStr {
static void run(benchmark::State& state) {
for (auto _ : state) {
- benchmark::DoNotOptimize(
- makeString(Length(), DiffType::Control, Opaque()));
+ benchmark::DoNotOptimize(makeString(Length(), DiffType::Control, Opaque()));
}
}
- static std::string name() {
- return "BM_StringConstructDestroyCStr" + Length::name() + Opaque::name();
- }
+ static std::string name() { return "BM_StringConstructDestroyCStr" + Length::name() + Opaque::name(); }
};
template <class Length, bool MeasureCopy, bool MeasureDestroy>
static void StringCopyAndDestroy(benchmark::State& state) {
static constexpr size_t NumStrings = 1024;
- auto Orig = makeString(Length());
+ auto Orig = makeString(Length());
std::aligned_storage<sizeof(std::string)>::type Storage[NumStrings];
while (state.KeepRunningBatch(NumStrings)) {
@@ -194,18 +186,14 @@ static void StringCopyAndDestroy(benchmark::State& state) {
template <class Length>
struct StringCopy {
- static void run(benchmark::State& state) {
- StringCopyAndDestroy<Length, true, false>(state);
- }
+ static void run(benchmark::State& state) { StringCopyAndDestroy<Length, true, false>(state); }
static std::string name() { return "BM_StringCopy" + Length::name(); }
};
template <class Length>
struct StringDestroy {
- static void run(benchmark::State& state) {
- StringCopyAndDestroy<Length, false, true>(state);
- }
+ static void run(benchmark::State& state) { StringCopyAndDestroy<Length, false, true>(state); }
static std::string name() { return "BM_StringDestroy" + Length::name(); }
};
@@ -215,15 +203,15 @@ struct StringMove {
static void run(benchmark::State& state) {
// Keep two object locations and move construct back and forth.
std::aligned_storage<sizeof(std::string), alignof(std::string)>::type Storage[2];
- using S = std::string;
+ using S = std::string;
size_t I = 0;
- S *newS = new (static_cast<void*>(Storage)) std::string(makeString(Length()));
+ S* newS = new (static_cast<void*>(Storage)) std::string(makeString(Length()));
for (auto _ : state) {
// Switch locations.
I ^= 1;
benchmark::DoNotOptimize(Storage);
// Move construct into the new location,
- S *tmpS = new (static_cast<void*>(Storage + I)) S(std::move(*newS));
+ S* tmpS = new (static_cast<void*>(Storage + I)) S(std::move(*newS));
// then destroy the old one.
newS->~S();
newS = tmpS;
@@ -237,9 +225,9 @@ struct StringMove {
template <class Length, class Opaque>
struct StringResizeDefaultInit {
static void run(benchmark::State& state) {
- constexpr bool opaque = Opaque{} == Opacity::Opaque;
+ constexpr bool opaque = Opaque{} == Opacity::Opaque;
constexpr int kNumStrings = 4 << 10;
- size_t length = makeString(Length()).size();
+ size_t length = makeString(Length()).size();
std::string strings[kNumStrings];
while (state.KeepRunningBatch(kNumStrings)) {
state.PauseTiming();
@@ -254,17 +242,15 @@ struct StringResizeDefaultInit {
}
}
- static std::string name() {
- return "BM_StringResizeDefaultInit" + Length::name() + Opaque::name();
- }
+ static std::string name() { return "BM_StringResizeDefaultInit" + Length::name() + Opaque::name(); }
};
template <class Length, class Opaque>
struct StringAssignStr {
static void run(benchmark::State& state) {
- constexpr bool opaque = Opaque{} == Opacity::Opaque;
+ constexpr bool opaque = Opaque{} == Opacity::Opaque;
constexpr int kNumStrings = 4 << 10;
- std::string src = makeString(Length());
+ std::string src = makeString(Length());
std::string strings[kNumStrings];
while (state.KeepRunningBatch(kNumStrings)) {
state.PauseTiming();
@@ -279,15 +265,13 @@ struct StringAssignStr {
}
}
- static std::string name() {
- return "BM_StringAssignStr" + Length::name() + Opaque::name();
- }
+ static std::string name() { return "BM_StringAssignStr" + Length::name() + Opaque::name(); }
};
template <class Length, class Opaque>
struct StringAssignAsciiz {
static void run(benchmark::State& state) {
- constexpr bool opaque = Opaque{} == Opacity::Opaque;
+ constexpr bool opaque = Opaque{} == Opacity::Opaque;
constexpr int kNumStrings = 4 << 10;
std::string strings[kNumStrings];
while (state.KeepRunningBatch(kNumStrings)) {
@@ -303,15 +287,13 @@ struct StringAssignAsciiz {
}
}
- static std::string name() {
- return "BM_StringAssignAsciiz" + Length::name() + Opaque::name();
- }
+ static std::string name() { return "BM_StringAssignAsciiz" + Length::name() + Opaque::name(); }
};
template <class Length, class Opaque>
struct StringEraseToEnd {
static void run(benchmark::State& state) {
- constexpr bool opaque = Opaque{} == Opacity::Opaque;
+ constexpr bool opaque = Opaque{} == Opacity::Opaque;
constexpr int kNumStrings = 4 << 10;
std::string strings[kNumStrings];
const int mid = makeString(Length()).size() / 2;
@@ -323,24 +305,21 @@ struct StringEraseToEnd {
benchmark::DoNotOptimize(strings);
state.ResumeTiming();
for (int i = 0; i < kNumStrings; ++i) {
- strings[i].erase(maybeOpaque(mid, opaque),
- maybeOpaque(std::string::npos, opaque));
+ strings[i].erase(maybeOpaque(mid, opaque), maybeOpaque(std::string::npos, opaque));
}
}
}
- static std::string name() {
- return "BM_StringEraseToEnd" + Length::name() + Opaque::name();
- }
+ static std::string name() { return "BM_StringEraseToEnd" + Length::name() + Opaque::name(); }
};
template <class Length, class Opaque>
struct StringEraseWithMove {
static void run(benchmark::State& state) {
- constexpr bool opaque = Opaque{} == Opacity::Opaque;
+ constexpr bool opaque = Opaque{} == Opacity::Opaque;
constexpr int kNumStrings = 4 << 10;
std::string strings[kNumStrings];
- const int n = makeString(Length()).size() / 2;
+ const int n = makeString(Length()).size() / 2;
const int pos = n / 2;
while (state.KeepRunningBatch(kNumStrings)) {
state.PauseTiming();
@@ -355,16 +334,14 @@ struct StringEraseWithMove {
}
}
- static std::string name() {
- return "BM_StringEraseWithMove" + Length::name() + Opaque::name();
- }
+ static std::string name() { return "BM_StringEraseWithMove" + Length::name() + Opaque::name(); }
};
template <class Opaque>
struct StringAssignAsciizMix {
static void run(benchmark::State& state) {
- constexpr auto O = Opaque{};
- constexpr auto D = DiffType::Control;
+ constexpr auto O = Opaque{};
+ constexpr auto D = DiffType::Control;
constexpr int kNumStrings = 4 << 10;
std::string strings[kNumStrings];
while (state.KeepRunningBatch(kNumStrings)) {
@@ -387,9 +364,7 @@ struct StringAssignAsciizMix {
}
}
- static std::string name() {
- return "BM_StringAssignAsciizMix" + Opaque::name();
- }
+ static std::string name() { return "BM_StringAssignAsciizMix" + Opaque::name(); }
};
enum class Relation { Eq, Less, Compare };
@@ -433,8 +408,7 @@ struct StringRelational {
}
static std::string name() {
- return "BM_StringRelational" + Rel::name() + LHLength::name() +
- RHLength::name() + DiffType::name();
+ return "BM_StringRelational" + Rel::name() + LHLength::name() + RHLength::name() + DiffType::name();
}
};
@@ -444,11 +418,11 @@ struct StringRelationalLiteral {
auto Lhs = makeString(LHLength(), DiffType());
for (auto _ : state) {
benchmark::DoNotOptimize(Lhs);
- constexpr const char* Literal = RHLength::value == Length::Empty
- ? ""
- : RHLength::value == Length::Small
- ? SmallStringLiteral
- : LargeStringLiteral;
+ constexpr const char* Literal =
+ RHLength::value == Length::Empty ? ""
+ : RHLength::value == Length::Small
+ ? SmallStringLiteral
+ : LargeStringLiteral;
switch (Rel()) {
case Relation::Eq:
benchmark::DoNotOptimize(Lhs == Literal);
@@ -474,8 +448,7 @@ struct StringRelationalLiteral {
}
static std::string name() {
- return "BM_StringRelationalLiteral" + Rel::name() + LHLength::name() +
- RHLength::name() + DiffType::name();
+ return "BM_StringRelationalLiteral" + Rel::name() + LHLength::name() + RHLength::name() + DiffType::name();
}
};
@@ -493,25 +466,22 @@ template <class Temperature, class Depth, class Length>
struct StringRead {
void run(benchmark::State& state) const {
static constexpr size_t NumStrings =
- Temperature() == ::Temperature::Hot
- ? 1 << 10
- : /* Enough strings to overflow the cache */ 1 << 20;
- static_assert((NumStrings & (NumStrings - 1)) == 0,
- "NumStrings should be a power of two to reduce overhead.");
+ Temperature() == ::Temperature::Hot ? 1 << 10 : /* Enough strings to overflow the cache */ 1 << 20;
+ static_assert((NumStrings & (NumStrings - 1)) == 0, "NumStrings should be a power of two to reduce overhead.");
std::vector<std::string> Values(NumStrings, makeString(Length()));
size_t I = 0;
for (auto _ : state) {
// Jump long enough to defeat cache locality, and use a value that is
// coprime with NumStrings to ensure we visit every element.
- I = (I + 17) % NumStrings;
+ I = (I + 17) % NumStrings;
const auto& V = Values[I];
// Read everything first. Escaping data() through DoNotOptimize might
// cause the compiler to have to recalculate information about `V` due to
// aliasing.
const char* const Data = V.data();
- const size_t Size = V.size();
+ const size_t Size = V.size();
benchmark::DoNotOptimize(Data);
benchmark::DoNotOptimize(Size);
if (Depth() == ::Depth::Deep) {
@@ -530,25 +500,21 @@ struct StringRead {
return false;
}
- std::string name() const {
- return "BM_StringRead" + Temperature::name() + Depth::name() +
- Length::name();
- }
+ std::string name() const { return "BM_StringRead" + Temperature::name() + Depth::name() + Length::name(); }
};
void sanityCheckGeneratedStrings() {
for (auto Lhs : {Length::Empty, Length::Small, Length::Large, Length::Huge}) {
const auto LhsString = makeString(Lhs);
- for (auto Rhs :
- {Length::Empty, Length::Small, Length::Large, Length::Huge}) {
+ for (auto Rhs : {Length::Empty, Length::Small, Length::Large, Length::Huge}) {
if (Lhs > Rhs)
continue;
const auto RhsString = makeString(Rhs);
// The smaller one must be a prefix of the larger one.
if (RhsString.find(LhsString) != 0) {
- fprintf(stderr, "Invalid autogenerated strings for sizes (%d,%d).\n",
- static_cast<int>(Lhs), static_cast<int>(Rhs));
+ fprintf(
+ stderr, "Invalid autogenerated strings for sizes (%d,%d).\n", static_cast<int>(Lhs), static_cast<int>(Rhs));
std::abort();
}
}
@@ -556,15 +522,14 @@ void sanityCheckGeneratedStrings() {
// Verify the autogenerated
diff s
for (auto L : {Length::Small, Length::Large, Length::Huge}) {
const auto Control = makeString(L);
- const auto Verify = [&](std::string Exp, size_t Pos) {
+ const auto Verify = [&](std::string Exp, size_t Pos) {
// Only change on the Pos char.
if (Control[Pos] != Exp[Pos]) {
Exp[Pos] = Control[Pos];
if (Control == Exp)
return;
}
- fprintf(stderr, "Invalid autogenerated
diff with size %d\n",
- static_cast<int>(L));
+ fprintf(stderr, "Invalid autogenerated
diff with size %d\n", static_cast<int>(L));
std::abort();
};
Verify(makeString(L, DiffType::ChangeFirst), 0);
@@ -574,20 +539,12 @@ void sanityCheckGeneratedStrings() {
}
// Some small codegen thunks to easily see generated code.
-bool StringEqString(const std::string& a, const std::string& b) {
- return a == b;
-}
+bool StringEqString(const std::string& a, const std::string& b) { return a == b; }
bool StringEqCStr(const std::string& a, const char* b) { return a == b; }
bool CStrEqString(const char* a, const std::string& b) { return a == b; }
-bool StringEqCStrLiteralEmpty(const std::string& a) {
- return a == "";
-}
-bool StringEqCStrLiteralSmall(const std::string& a) {
- return a == SmallStringLiteral;
-}
-bool StringEqCStrLiteralLarge(const std::string& a) {
- return a == LargeStringLiteral;
-}
+bool StringEqCStrLiteralEmpty(const std::string& a) { return a == ""; }
+bool StringEqCStrLiteralSmall(const std::string& a) { return a == SmallStringLiteral; }
+bool StringEqCStrLiteralLarge(const std::string& a) { return a == LargeStringLiteral; }
int main(int argc, char** argv) {
benchmark::Initialize(&argc, argv);
@@ -596,8 +553,7 @@ int main(int argc, char** argv) {
sanityCheckGeneratedStrings();
- makeCartesianProductBenchmark<StringConstructDestroyCStr, AllLengths,
- AllOpacity>();
+ makeCartesianProductBenchmark<StringConstructDestroyCStr, AllLengths, AllOpacity>();
makeCartesianProductBenchmark<StringAssignStr, AllLengths, AllOpacity>();
makeCartesianProductBenchmark<StringAssignAsciiz, AllLengths, AllOpacity>();
@@ -606,23 +562,23 @@ int main(int argc, char** argv) {
makeCartesianProductBenchmark<StringCopy, AllLengths>();
makeCartesianProductBenchmark<StringMove, AllLengths>();
makeCartesianProductBenchmark<StringDestroy, AllLengths>();
- makeCartesianProductBenchmark<StringResizeDefaultInit, AllLengths,
- AllOpacity>();
+ makeCartesianProductBenchmark<StringResizeDefaultInit, AllLengths, AllOpacity>();
makeCartesianProductBenchmark<StringEraseToEnd, AllLengths, AllOpacity>();
makeCartesianProductBenchmark<StringEraseWithMove, AllLengths, AllOpacity>();
- makeCartesianProductBenchmark<StringRelational, AllRelations, AllLengths,
- AllLengths, AllDiffTypes>();
- makeCartesianProductBenchmark<StringRelationalLiteral, AllRelations,
- AllLengths, AllLengths, AllDiffTypes>();
- makeCartesianProductBenchmark<StringRead, AllTemperatures, AllDepths,
- AllLengths>();
+ makeCartesianProductBenchmark<StringRelational, AllRelations, AllLengths, AllLengths, AllDiffTypes>();
+ makeCartesianProductBenchmark<StringRelationalLiteral, AllRelations, AllLengths, AllLengths, AllDiffTypes>();
+ makeCartesianProductBenchmark<StringRead, AllTemperatures, AllDepths, AllLengths>();
benchmark::RunSpecifiedBenchmarks();
if (argc < 0) {
// ODR-use the functions to force them being generated in the binary.
auto functions = std::make_tuple(
- StringEqString, StringEqCStr, CStrEqString, StringEqCStrLiteralEmpty,
- StringEqCStrLiteralSmall, StringEqCStrLiteralLarge);
+ StringEqString,
+ StringEqCStr,
+ CStrEqString,
+ StringEqCStrLiteralEmpty,
+ StringEqCStrLiteralSmall,
+ StringEqCStrLiteralLarge);
printf("%p", &functions);
}
}
diff --git a/libcxx/benchmarks/stringstream.bench.cpp b/libcxx/benchmarks/stringstream.bench.cpp
index 828ef4b405f47..ea602557ccd77 100644
--- a/libcxx/benchmarks/stringstream.bench.cpp
+++ b/libcxx/benchmarks/stringstream.bench.cpp
@@ -6,31 +6,21 @@
TEST_NOINLINE double istream_numbers();
double istream_numbers() {
- const char *a[] = {
- "-6 69 -71 2.4882e-02 -100 101 -2.00005 5000000 -50000000",
- "-25 71 7 -9.3262e+01 -100 101 -2.00005 5000000 -50000000",
- "-14 53 46 -6.7026e-02 -100 101 -2.00005 5000000 -50000000"
- };
+ const char* a[] = {"-6 69 -71 2.4882e-02 -100 101 -2.00005 5000000 -50000000",
+ "-25 71 7 -9.3262e+01 -100 101 -2.00005 5000000 -50000000",
+ "-14 53 46 -6.7026e-02 -100 101 -2.00005 5000000 -50000000"};
int a1, a2, a3, a4, a5, a6, a7;
double f1 = 0.0, f2 = 0.0, q = 0.0;
- for (int i=0; i < 3; i++) {
+ for (int i = 0; i < 3; i++) {
std::istringstream s(a[i]);
- s >> a1
- >> a2
- >> a3
- >> f1
- >> a4
- >> a5
- >> f2
- >> a6
- >> a7;
- q += (a1 + a2 + a3 + a4 + a5 + a6 + a7 + f1 + f2)/1000000;
+ s >> a1 >> a2 >> a3 >> f1 >> a4 >> a5 >> f2 >> a6 >> a7;
+ q += (a1 + a2 + a3 + a4 + a5 + a6 + a7 + f1 + f2) / 1000000;
}
return q;
}
-static void BM_Istream_numbers(benchmark::State &state) {
+static void BM_Istream_numbers(benchmark::State& state) {
double i = 0;
while (state.KeepRunning())
benchmark::DoNotOptimize(i += istream_numbers());
diff --git a/libcxx/benchmarks/unordered_set_operations.bench.cpp b/libcxx/benchmarks/unordered_set_operations.bench.cpp
index acabc73f30fb3..775caeb6078b8 100644
--- a/libcxx/benchmarks/unordered_set_operations.bench.cpp
+++ b/libcxx/benchmarks/unordered_set_operations.bench.cpp
@@ -1,9 +1,9 @@
-#include <unordered_set>
-#include <vector>
-#include <functional>
#include <cstdint>
#include <cstdlib>
#include <cstring>
+#include <functional>
+#include <unordered_set>
+#include <vector>
#include "benchmark/benchmark.h"
@@ -16,91 +16,81 @@ using namespace ContainerBenchmarks;
constexpr std::size_t TestNumInputs = 1024;
template <class _Size>
-inline TEST_ALWAYS_INLINE
-_Size loadword(const void* __p) {
- _Size __r;
- std::memcpy(&__r, __p, sizeof(__r));
- return __r;
+inline TEST_ALWAYS_INLINE _Size loadword(const void* __p) {
+ _Size __r;
+ std::memcpy(&__r, __p, sizeof(__r));
+ return __r;
}
-inline TEST_ALWAYS_INLINE
-std::size_t rotate_by_at_least_1(std::size_t __val, int __shift) {
- return (__val >> __shift) | (__val << (64 - __shift));
+inline TEST_ALWAYS_INLINE std::size_t rotate_by_at_least_1(std::size_t __val, int __shift) {
+ return (__val >> __shift) | (__val << (64 - __shift));
}
-inline TEST_ALWAYS_INLINE
-std::size_t hash_len_16(std::size_t __u, std::size_t __v) {
- const std::size_t __mul = 0x9ddfea08eb382d69ULL;
- std::size_t __a = (__u ^ __v) * __mul;
- __a ^= (__a >> 47);
- std::size_t __b = (__v ^ __a) * __mul;
- __b ^= (__b >> 47);
- __b *= __mul;
- return __b;
+inline TEST_ALWAYS_INLINE std::size_t hash_len_16(std::size_t __u, std::size_t __v) {
+ const std::size_t __mul = 0x9ddfea08eb382d69ULL;
+ std::size_t __a = (__u ^ __v) * __mul;
+ __a ^= (__a >> 47);
+ std::size_t __b = (__v ^ __a) * __mul;
+ __b ^= (__b >> 47);
+ __b *= __mul;
+ return __b;
}
-
template <std::size_t _Len>
-inline TEST_ALWAYS_INLINE
-std::size_t hash_len_0_to_8(const char* __s) {
- static_assert(_Len == 4 || _Len == 8, "");
- const uint64_t __a = loadword<uint32_t>(__s);
- const uint64_t __b = loadword<uint32_t>(__s + _Len - 4);
- return hash_len_16(_Len + (__a << 3), __b);
+inline TEST_ALWAYS_INLINE std::size_t hash_len_0_to_8(const char* __s) {
+ static_assert(_Len == 4 || _Len == 8, "");
+ const uint64_t __a = loadword<uint32_t>(__s);
+ const uint64_t __b = loadword<uint32_t>(__s + _Len - 4);
+ return hash_len_16(_Len + (__a << 3), __b);
}
struct UInt32Hash {
UInt32Hash() = default;
- inline TEST_ALWAYS_INLINE
- std::size_t operator()(uint32_t data) const {
- return hash_len_0_to_8<4>(reinterpret_cast<const char*>(&data));
+ inline TEST_ALWAYS_INLINE std::size_t operator()(uint32_t data) const {
+ return hash_len_0_to_8<4>(reinterpret_cast<const char*>(&data));
}
};
struct UInt64Hash {
UInt64Hash() = default;
- inline TEST_ALWAYS_INLINE
- std::size_t operator()(uint64_t data) const {
- return hash_len_0_to_8<8>(reinterpret_cast<const char*>(&data));
+ inline TEST_ALWAYS_INLINE std::size_t operator()(uint64_t data) const {
+ return hash_len_0_to_8<8>(reinterpret_cast<const char*>(&data));
}
};
struct UInt128Hash {
UInt128Hash() = default;
- inline TEST_ALWAYS_INLINE
- std::size_t operator()(__uint128_t data) const {
- const __uint128_t __mask = static_cast<std::size_t>(-1);
- const std::size_t __a = (std::size_t)(data & __mask);
- const std::size_t __b = (std::size_t)((data & (__mask << 64)) >> 64);
- return hash_len_16(__a, rotate_by_at_least_1(__b + 16, 16)) ^ __b;
+ inline TEST_ALWAYS_INLINE std::size_t operator()(__uint128_t data) const {
+ const __uint128_t __mask = static_cast<std::size_t>(-1);
+ const std::size_t __a = (std::size_t)(data & __mask);
+ const std::size_t __b = (std::size_t)((data & (__mask << 64)) >> 64);
+ return hash_len_16(__a, rotate_by_at_least_1(__b + 16, 16)) ^ __b;
}
};
struct UInt32Hash2 {
UInt32Hash2() = default;
- inline TEST_ALWAYS_INLINE
- std::size_t operator()(uint32_t data) const {
- const uint32_t __m = 0x5bd1e995;
- const uint32_t __r = 24;
- uint32_t __h = 4;
- uint32_t __k = data;
- __k *= __m;
- __k ^= __k >> __r;
- __k *= __m;
- __h *= __m;
- __h ^= __k;
- __h ^= __h >> 13;
- __h *= __m;
- __h ^= __h >> 15;
+ inline TEST_ALWAYS_INLINE std::size_t operator()(uint32_t data) const {
+ const uint32_t __m = 0x5bd1e995;
+ const uint32_t __r = 24;
+ uint32_t __h = 4;
+ uint32_t __k = data;
+ __k *= __m;
+ __k ^= __k >> __r;
+ __k *= __m;
+ __h *= __m;
+ __h ^= __k;
+ __h ^= __h >> 13;
+ __h *= __m;
+ __h ^= __h >> 15;
return __h;
}
};
struct UInt64Hash2 {
UInt64Hash2() = default;
- inline TEST_ALWAYS_INLINE
- std::size_t operator()(uint64_t data) const {
- return hash_len_0_to_8<8>(reinterpret_cast<const char*>(&data));
+ inline TEST_ALWAYS_INLINE std::size_t operator()(uint64_t data) const {
+ return hash_len_0_to_8<8>(reinterpret_cast<const char*>(&data));
}
};
@@ -113,15 +103,15 @@ struct UInt64Hash2 {
// of equal length in BM_Rehash.
struct SlowStringEq {
SlowStringEq() = default;
- inline TEST_ALWAYS_INLINE
- bool operator()(const std::string& lhs, const std::string& rhs) const {
- if (lhs.size() != rhs.size()) return false;
-
- bool eq = true;
- for (size_t i = 0; i < lhs.size(); ++i) {
- eq &= lhs[i] == rhs[i];
- }
- return eq;
+ inline TEST_ALWAYS_INLINE bool operator()(const std::string& lhs, const std::string& rhs) const {
+ if (lhs.size() != rhs.size())
+ return false;
+
+ bool eq = true;
+ for (size_t i = 0; i < lhs.size(); ++i) {
+ eq &= lhs[i] == rhs[i];
+ }
+ return eq;
}
};
@@ -131,212 +121,181 @@ struct SlowStringEq {
template <class HashFn, class GenInputs>
void BM_Hash(benchmark::State& st, HashFn fn, GenInputs gen) {
- auto in = gen(st.range(0));
- const auto end = in.data() + in.size();
- std::size_t last_hash = 0;
- benchmark::DoNotOptimize(&last_hash);
- while (st.KeepRunning()) {
- for (auto it = in.data(); it != end; ++it) {
- benchmark::DoNotOptimize(last_hash += fn(*it));
- }
- benchmark::ClobberMemory();
+ auto in = gen(st.range(0));
+ const auto end = in.data() + in.size();
+ std::size_t last_hash = 0;
+ benchmark::DoNotOptimize(&last_hash);
+ while (st.KeepRunning()) {
+ for (auto it = in.data(); it != end; ++it) {
+ benchmark::DoNotOptimize(last_hash += fn(*it));
}
+ benchmark::ClobberMemory();
+ }
}
-BENCHMARK_CAPTURE(BM_Hash,
- uint32_random_std_hash,
- std::hash<uint32_t>{},
- getRandomIntegerInputs<uint32_t>) -> Arg(TestNumInputs);
+BENCHMARK_CAPTURE(BM_Hash, uint32_random_std_hash, std::hash<uint32_t>{}, getRandomIntegerInputs<uint32_t>)
+ ->Arg(TestNumInputs);
-BENCHMARK_CAPTURE(BM_Hash,
- uint32_random_custom_hash,
- UInt32Hash{},
- getRandomIntegerInputs<uint32_t>) -> Arg(TestNumInputs);
+BENCHMARK_CAPTURE(BM_Hash, uint32_random_custom_hash, UInt32Hash{}, getRandomIntegerInputs<uint32_t>)
+ ->Arg(TestNumInputs);
-BENCHMARK_CAPTURE(BM_Hash,
- uint32_top_std_hash,
- std::hash<uint32_t>{},
- getSortedTopBitsIntegerInputs<uint32_t>) -> Arg(TestNumInputs);
-
-BENCHMARK_CAPTURE(BM_Hash,
- uint32_top_custom_hash,
- UInt32Hash{},
- getSortedTopBitsIntegerInputs<uint32_t>) -> Arg(TestNumInputs);
+BENCHMARK_CAPTURE(BM_Hash, uint32_top_std_hash, std::hash<uint32_t>{}, getSortedTopBitsIntegerInputs<uint32_t>)
+ ->Arg(TestNumInputs);
+BENCHMARK_CAPTURE(BM_Hash, uint32_top_custom_hash, UInt32Hash{}, getSortedTopBitsIntegerInputs<uint32_t>)
+ ->Arg(TestNumInputs);
//----------------------------------------------------------------------------//
// BM_InsertValue
// ---------------------------------------------------------------------------//
-
// Sorted Ascending //
-BENCHMARK_CAPTURE(BM_InsertValue,
- unordered_set_uint32,
- std::unordered_set<uint32_t>{},
- getRandomIntegerInputs<uint32_t>)->Arg(TestNumInputs);
+BENCHMARK_CAPTURE(
+ BM_InsertValue, unordered_set_uint32, std::unordered_set<uint32_t>{}, getRandomIntegerInputs<uint32_t>)
+ ->Arg(TestNumInputs);
-BENCHMARK_CAPTURE(BM_InsertValue,
- unordered_set_uint32_sorted,
- std::unordered_set<uint32_t>{},
- getSortedIntegerInputs<uint32_t>)->Arg(TestNumInputs);
+BENCHMARK_CAPTURE(
+ BM_InsertValue, unordered_set_uint32_sorted, std::unordered_set<uint32_t>{}, getSortedIntegerInputs<uint32_t>)
+ ->Arg(TestNumInputs);
// Top Bytes //
BENCHMARK_CAPTURE(BM_InsertValue,
- unordered_set_top_bits_uint32,
- std::unordered_set<uint32_t>{},
- getSortedTopBitsIntegerInputs<uint32_t>)->Arg(TestNumInputs);
+ unordered_set_top_bits_uint32,
+ std::unordered_set<uint32_t>{},
+ getSortedTopBitsIntegerInputs<uint32_t>)
+ ->Arg(TestNumInputs);
BENCHMARK_CAPTURE(BM_InsertValueRehash,
- unordered_set_top_bits_uint32,
- std::unordered_set<uint32_t, UInt32Hash>{},
- getSortedTopBitsIntegerInputs<uint32_t>)->Arg(TestNumInputs);
+ unordered_set_top_bits_uint32,
+ std::unordered_set<uint32_t, UInt32Hash>{},
+ getSortedTopBitsIntegerInputs<uint32_t>)
+ ->Arg(TestNumInputs);
// String //
-BENCHMARK_CAPTURE(BM_InsertValue,
- unordered_set_string,
- std::unordered_set<std::string>{},
- getRandomStringInputs)->Arg(TestNumInputs);
+BENCHMARK_CAPTURE(BM_InsertValue, unordered_set_string, std::unordered_set<std::string>{}, getRandomStringInputs)
+ ->Arg(TestNumInputs);
-BENCHMARK_CAPTURE(BM_InsertValueRehash,
- unordered_set_string,
- std::unordered_set<std::string>{},
- getRandomStringInputs)->Arg(TestNumInputs);
+BENCHMARK_CAPTURE(BM_InsertValueRehash, unordered_set_string, std::unordered_set<std::string>{}, getRandomStringInputs)
+ ->Arg(TestNumInputs);
//----------------------------------------------------------------------------//
// BM_Find
// ---------------------------------------------------------------------------//
// Random //
-BENCHMARK_CAPTURE(BM_Find,
- unordered_set_random_uint64,
- std::unordered_set<uint64_t>{},
- getRandomIntegerInputs<uint64_t>)->Arg(TestNumInputs);
+BENCHMARK_CAPTURE(
+ BM_Find, unordered_set_random_uint64, std::unordered_set<uint64_t>{}, getRandomIntegerInputs<uint64_t>)
+ ->Arg(TestNumInputs);
BENCHMARK_CAPTURE(BM_FindRehash,
- unordered_set_random_uint64,
- std::unordered_set<uint64_t, UInt64Hash>{},
- getRandomIntegerInputs<uint64_t>)->Arg(TestNumInputs);
+ unordered_set_random_uint64,
+ std::unordered_set<uint64_t, UInt64Hash>{},
+ getRandomIntegerInputs<uint64_t>)
+ ->Arg(TestNumInputs);
// Sorted //
-BENCHMARK_CAPTURE(BM_Find,
- unordered_set_sorted_uint64,
- std::unordered_set<uint64_t>{},
- getSortedIntegerInputs<uint64_t>)->Arg(TestNumInputs);
+BENCHMARK_CAPTURE(
+ BM_Find, unordered_set_sorted_uint64, std::unordered_set<uint64_t>{}, getSortedIntegerInputs<uint64_t>)
+ ->Arg(TestNumInputs);
BENCHMARK_CAPTURE(BM_FindRehash,
- unordered_set_sorted_uint64,
- std::unordered_set<uint64_t, UInt64Hash>{},
- getSortedIntegerInputs<uint64_t>)->Arg(TestNumInputs);
-
+ unordered_set_sorted_uint64,
+ std::unordered_set<uint64_t, UInt64Hash>{},
+ getSortedIntegerInputs<uint64_t>)
+ ->Arg(TestNumInputs);
// Sorted //
#if 1
BENCHMARK_CAPTURE(BM_Find,
- unordered_set_sorted_uint128,
- std::unordered_set<__uint128_t, UInt128Hash>{},
- getSortedTopBitsIntegerInputs<__uint128_t>)->Arg(TestNumInputs);
+ unordered_set_sorted_uint128,
+ std::unordered_set<__uint128_t, UInt128Hash>{},
+ getSortedTopBitsIntegerInputs<__uint128_t>)
+ ->Arg(TestNumInputs);
BENCHMARK_CAPTURE(BM_FindRehash,
- unordered_set_sorted_uint128,
- std::unordered_set<__uint128_t, UInt128Hash>{},
- getSortedTopBitsIntegerInputs<__uint128_t>)->Arg(TestNumInputs);
+ unordered_set_sorted_uint128,
+ std::unordered_set<__uint128_t, UInt128Hash>{},
+ getSortedTopBitsIntegerInputs<__uint128_t>)
+ ->Arg(TestNumInputs);
#endif
// Sorted //
-BENCHMARK_CAPTURE(BM_Find,
- unordered_set_sorted_uint32,
- std::unordered_set<uint32_t>{},
- getSortedIntegerInputs<uint32_t>)->Arg(TestNumInputs);
+BENCHMARK_CAPTURE(
+ BM_Find, unordered_set_sorted_uint32, std::unordered_set<uint32_t>{}, getSortedIntegerInputs<uint32_t>)
+ ->Arg(TestNumInputs);
BENCHMARK_CAPTURE(BM_FindRehash,
- unordered_set_sorted_uint32,
- std::unordered_set<uint32_t, UInt32Hash2>{},
- getSortedIntegerInputs<uint32_t>)->Arg(TestNumInputs);
+ unordered_set_sorted_uint32,
+ std::unordered_set<uint32_t, UInt32Hash2>{},
+ getSortedIntegerInputs<uint32_t>)
+ ->Arg(TestNumInputs);
// Sorted Ascending //
-BENCHMARK_CAPTURE(BM_Find,
- unordered_set_sorted_large_uint64,
- std::unordered_set<uint64_t>{},
- getSortedLargeIntegerInputs<uint64_t>)->Arg(TestNumInputs);
+BENCHMARK_CAPTURE(
+ BM_Find, unordered_set_sorted_large_uint64, std::unordered_set<uint64_t>{}, getSortedLargeIntegerInputs<uint64_t>)
+ ->Arg(TestNumInputs);
BENCHMARK_CAPTURE(BM_FindRehash,
- unordered_set_sorted_large_uint64,
- std::unordered_set<uint64_t, UInt64Hash>{},
- getSortedLargeIntegerInputs<uint64_t>)->Arg(TestNumInputs);
-
+ unordered_set_sorted_large_uint64,
+ std::unordered_set<uint64_t, UInt64Hash>{},
+ getSortedLargeIntegerInputs<uint64_t>)
+ ->Arg(TestNumInputs);
// Top Bits //
-BENCHMARK_CAPTURE(BM_Find,
- unordered_set_top_bits_uint64,
- std::unordered_set<uint64_t>{},
- getSortedTopBitsIntegerInputs<uint64_t>)->Arg(TestNumInputs);
+BENCHMARK_CAPTURE(
+ BM_Find, unordered_set_top_bits_uint64, std::unordered_set<uint64_t>{}, getSortedTopBitsIntegerInputs<uint64_t>)
+ ->Arg(TestNumInputs);
BENCHMARK_CAPTURE(BM_FindRehash,
- unordered_set_top_bits_uint64,
- std::unordered_set<uint64_t, UInt64Hash>{},
- getSortedTopBitsIntegerInputs<uint64_t>)->Arg(TestNumInputs);
+ unordered_set_top_bits_uint64,
+ std::unordered_set<uint64_t, UInt64Hash>{},
+ getSortedTopBitsIntegerInputs<uint64_t>)
+ ->Arg(TestNumInputs);
// String //
-BENCHMARK_CAPTURE(BM_Find,
- unordered_set_string,
- std::unordered_set<std::string>{},
- getRandomStringInputs)->Arg(TestNumInputs);
+BENCHMARK_CAPTURE(BM_Find, unordered_set_string, std::unordered_set<std::string>{}, getRandomStringInputs)
+ ->Arg(TestNumInputs);
-BENCHMARK_CAPTURE(BM_FindRehash,
- unordered_set_string,
- std::unordered_set<std::string>{},
- getRandomStringInputs)->Arg(TestNumInputs);
+BENCHMARK_CAPTURE(BM_FindRehash, unordered_set_string, std::unordered_set<std::string>{}, getRandomStringInputs)
+ ->Arg(TestNumInputs);
//----------------------------------------------------------------------------//
// BM_Rehash
// ---------------------------------------------------------------------------//
BENCHMARK_CAPTURE(BM_Rehash,
- unordered_set_string_arg,
- std::unordered_set<std::string, std::hash<std::string>, SlowStringEq>{},
- getRandomStringInputs)->Arg(TestNumInputs);
+ unordered_set_string_arg,
+ std::unordered_set<std::string, std::hash<std::string>, SlowStringEq>{},
+ getRandomStringInputs)
+ ->Arg(TestNumInputs);
-BENCHMARK_CAPTURE(BM_Rehash,
- unordered_set_int_arg,
- std::unordered_set<int>{},
- getRandomIntegerInputs<int>)->Arg(TestNumInputs);
+BENCHMARK_CAPTURE(BM_Rehash, unordered_set_int_arg, std::unordered_set<int>{}, getRandomIntegerInputs<int>)
+ ->Arg(TestNumInputs);
///////////////////////////////////////////////////////////////////////////////
-BENCHMARK_CAPTURE(BM_InsertDuplicate,
- unordered_set_int,
- std::unordered_set<int>{},
- getRandomIntegerInputs<int>)->Arg(TestNumInputs);
-BENCHMARK_CAPTURE(BM_InsertDuplicate,
- unordered_set_string,
- std::unordered_set<std::string>{},
- getRandomStringInputs)->Arg(TestNumInputs);
-
-BENCHMARK_CAPTURE(BM_EmplaceDuplicate,
- unordered_set_int,
- std::unordered_set<int>{},
- getRandomIntegerInputs<int>)->Arg(TestNumInputs);
-BENCHMARK_CAPTURE(BM_EmplaceDuplicate,
- unordered_set_string,
- std::unordered_set<std::string>{},
- getRandomStringInputs)->Arg(TestNumInputs);
-
-BENCHMARK_CAPTURE(BM_InsertDuplicate,
- unordered_set_int_insert_arg,
- std::unordered_set<int>{},
- getRandomIntegerInputs<int>)->Arg(TestNumInputs);
-BENCHMARK_CAPTURE(BM_InsertDuplicate,
- unordered_set_string_insert_arg,
- std::unordered_set<std::string>{},
- getRandomStringInputs)->Arg(TestNumInputs);
-
-BENCHMARK_CAPTURE(BM_EmplaceDuplicate,
- unordered_set_int_insert_arg,
- std::unordered_set<int>{},
- getRandomIntegerInputs<unsigned>)->Arg(TestNumInputs);
-
-BENCHMARK_CAPTURE(BM_EmplaceDuplicate,
- unordered_set_string_arg,
- std::unordered_set<std::string>{},
- getRandomCStringInputs)->Arg(TestNumInputs);
+BENCHMARK_CAPTURE(BM_InsertDuplicate, unordered_set_int, std::unordered_set<int>{}, getRandomIntegerInputs<int>)
+ ->Arg(TestNumInputs);
+BENCHMARK_CAPTURE(BM_InsertDuplicate, unordered_set_string, std::unordered_set<std::string>{}, getRandomStringInputs)
+ ->Arg(TestNumInputs);
+
+BENCHMARK_CAPTURE(BM_EmplaceDuplicate, unordered_set_int, std::unordered_set<int>{}, getRandomIntegerInputs<int>)
+ ->Arg(TestNumInputs);
+BENCHMARK_CAPTURE(BM_EmplaceDuplicate, unordered_set_string, std::unordered_set<std::string>{}, getRandomStringInputs)
+ ->Arg(TestNumInputs);
+
+BENCHMARK_CAPTURE(
+ BM_InsertDuplicate, unordered_set_int_insert_arg, std::unordered_set<int>{}, getRandomIntegerInputs<int>)
+ ->Arg(TestNumInputs);
+BENCHMARK_CAPTURE(
+ BM_InsertDuplicate, unordered_set_string_insert_arg, std::unordered_set<std::string>{}, getRandomStringInputs)
+ ->Arg(TestNumInputs);
+
+BENCHMARK_CAPTURE(
+ BM_EmplaceDuplicate, unordered_set_int_insert_arg, std::unordered_set<int>{}, getRandomIntegerInputs<unsigned>)
+ ->Arg(TestNumInputs);
+
+BENCHMARK_CAPTURE(
+ BM_EmplaceDuplicate, unordered_set_string_arg, std::unordered_set<std::string>{}, getRandomCStringInputs)
+ ->Arg(TestNumInputs);
BENCHMARK_MAIN();
diff --git a/libcxx/benchmarks/vector_operations.bench.cpp b/libcxx/benchmarks/vector_operations.bench.cpp
index 2e707c0a1b3c5..e02f0ee0c11ca 100644
--- a/libcxx/benchmarks/vector_operations.bench.cpp
+++ b/libcxx/benchmarks/vector_operations.bench.cpp
@@ -1,8 +1,8 @@
-#include <vector>
-#include <functional>
#include <cstdint>
#include <cstdlib>
#include <cstring>
+#include <functional>
+#include <vector>
#include "benchmark/benchmark.h"
@@ -13,36 +13,21 @@ using namespace ContainerBenchmarks;
constexpr std::size_t TestNumInputs = 1024;
-BENCHMARK_CAPTURE(BM_ConstructSize,
- vector_byte,
- std::vector<unsigned char>{})->Arg(5140480);
-
-BENCHMARK_CAPTURE(BM_CopyConstruct,
- vector_int,
- std::vector<int>{})->Arg(5140480);
+BENCHMARK_CAPTURE(BM_ConstructSize, vector_byte, std::vector<unsigned char>{})->Arg(5140480);
-BENCHMARK_CAPTURE(BM_Assignment,
- vector_int,
- std::vector<int>{})->Arg(5140480);
+BENCHMARK_CAPTURE(BM_CopyConstruct, vector_int, std::vector<int>{})->Arg(5140480);
-BENCHMARK_CAPTURE(BM_ConstructSizeValue,
- vector_byte,
- std::vector<unsigned char>{}, 0)->Arg(5140480);
+BENCHMARK_CAPTURE(BM_Assignment, vector_int, std::vector<int>{})->Arg(5140480);
-BENCHMARK_CAPTURE(BM_ConstructIterIter,
- vector_char,
- std::vector<char>{},
- getRandomIntegerInputs<char>)->Arg(TestNumInputs);
+BENCHMARK_CAPTURE(BM_ConstructSizeValue, vector_byte, std::vector<unsigned char>{}, 0)->Arg(5140480);
-BENCHMARK_CAPTURE(BM_ConstructIterIter,
- vector_size_t,
- std::vector<size_t>{},
- getRandomIntegerInputs<size_t>)->Arg(TestNumInputs);
+BENCHMARK_CAPTURE(BM_ConstructIterIter, vector_char, std::vector<char>{}, getRandomIntegerInputs<char>)
+ ->Arg(TestNumInputs);
-BENCHMARK_CAPTURE(BM_ConstructIterIter,
- vector_string,
- std::vector<std::string>{},
- getRandomStringInputs)->Arg(TestNumInputs);
+BENCHMARK_CAPTURE(BM_ConstructIterIter, vector_size_t, std::vector<size_t>{}, getRandomIntegerInputs<size_t>)
+ ->Arg(TestNumInputs);
+BENCHMARK_CAPTURE(BM_ConstructIterIter, vector_string, std::vector<std::string>{}, getRandomStringInputs)
+ ->Arg(TestNumInputs);
BENCHMARK_MAIN();
diff --git a/libcxx/include/__algorithm/ranges_adjacent_find.h b/libcxx/include/__algorithm/ranges_adjacent_find.h
index e3de36bbc28d0..5f33192666ae9 100644
--- a/libcxx/include/__algorithm/ranges_adjacent_find.h
+++ b/libcxx/include/__algorithm/ranges_adjacent_find.h
@@ -31,10 +31,9 @@ _LIBCPP_BEGIN_NAMESPACE_STD
namespace ranges {
namespace __adjacent_find {
struct __fn {
-
template <class _Iter, class _Sent, class _Proj, class _Pred>
- _LIBCPP_HIDE_FROM_ABI constexpr static
- _Iter __adjacent_find_impl(_Iter __first, _Sent __last, _Pred& __pred, _Proj& __proj) {
+ _LIBCPP_HIDE_FROM_ABI constexpr static _Iter
+ __adjacent_find_impl(_Iter __first, _Sent __last, _Pred& __pred, _Proj& __proj) {
if (__first == __last)
return __first;
@@ -47,27 +46,28 @@ struct __fn {
return __i;
}
- template <forward_iterator _Iter, sentinel_for<_Iter> _Sent,
- class _Proj = identity,
+ template <forward_iterator _Iter,
+ sentinel_for<_Iter> _Sent,
+ class _Proj = identity,
indirect_binary_predicate<projected<_Iter, _Proj>, projected<_Iter, _Proj>> _Pred = ranges::equal_to>
- _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr
- _Iter operator()(_Iter __first, _Sent __last, _Pred __pred = {}, _Proj __proj = {}) const {
+ _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr _Iter
+ operator()(_Iter __first, _Sent __last, _Pred __pred = {}, _Proj __proj = {}) const {
return __adjacent_find_impl(std::move(__first), std::move(__last), __pred, __proj);
}
template <forward_range _Range,
class _Proj = identity,
- indirect_binary_predicate<projected<iterator_t<_Range>, _Proj>,
- projected<iterator_t<_Range>, _Proj>> _Pred = ranges::equal_to>
- _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr
- borrowed_iterator_t<_Range> operator()(_Range&& __range, _Pred __pred = {}, _Proj __proj = {}) const {
+ indirect_binary_predicate<projected<iterator_t<_Range>, _Proj>, projected<iterator_t<_Range>, _Proj>>
+ _Pred = ranges::equal_to>
+ _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr borrowed_iterator_t<_Range>
+ operator()(_Range&& __range, _Pred __pred = {}, _Proj __proj = {}) const {
return __adjacent_find_impl(ranges::begin(__range), ranges::end(__range), __pred, __proj);
}
};
} // namespace __adjacent_find
inline namespace __cpo {
- inline constexpr auto adjacent_find = __adjacent_find::__fn{};
+inline constexpr auto adjacent_find = __adjacent_find::__fn{};
} // namespace __cpo
} // namespace ranges
diff --git a/libcxx/include/__algorithm/ranges_all_of.h b/libcxx/include/__algorithm/ranges_all_of.h
index 494a77d74c7ea..39a2ae4de01e9 100644
--- a/libcxx/include/__algorithm/ranges_all_of.h
+++ b/libcxx/include/__algorithm/ranges_all_of.h
@@ -29,10 +29,8 @@ _LIBCPP_BEGIN_NAMESPACE_STD
namespace ranges {
namespace __all_of {
struct __fn {
-
template <class _Iter, class _Sent, class _Proj, class _Pred>
- _LIBCPP_HIDE_FROM_ABI constexpr static
- bool __all_of_impl(_Iter __first, _Sent __last, _Pred& __pred, _Proj& __proj) {
+ _LIBCPP_HIDE_FROM_ABI constexpr static bool __all_of_impl(_Iter __first, _Sent __last, _Pred& __pred, _Proj& __proj) {
for (; __first != __last; ++__first) {
if (!std::invoke(__pred, std::invoke(__proj, *__first)))
return false;
@@ -40,24 +38,27 @@ struct __fn {
return true;
}
- template <input_iterator _Iter, sentinel_for<_Iter> _Sent, class _Proj = identity,
+ template <input_iterator _Iter,
+ sentinel_for<_Iter> _Sent,
+ class _Proj = identity,
indirect_unary_predicate<projected<_Iter, _Proj>> _Pred>
- _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr
- bool operator()(_Iter __first, _Sent __last, _Pred __pred, _Proj __proj = {}) const {
+ _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr bool
+ operator()(_Iter __first, _Sent __last, _Pred __pred, _Proj __proj = {}) const {
return __all_of_impl(std::move(__first), std::move(__last), __pred, __proj);
}
- template <input_range _Range, class _Proj = identity,
+ template <input_range _Range,
+ class _Proj = identity,
indirect_unary_predicate<projected<iterator_t<_Range>, _Proj>> _Pred>
- _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr
- bool operator()(_Range&& __range, _Pred __pred, _Proj __proj = {}) const {
+ _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr bool
+ operator()(_Range&& __range, _Pred __pred, _Proj __proj = {}) const {
return __all_of_impl(ranges::begin(__range), ranges::end(__range), __pred, __proj);
}
};
} // namespace __all_of
inline namespace __cpo {
- inline constexpr auto all_of = __all_of::__fn{};
+inline constexpr auto all_of = __all_of::__fn{};
} // namespace __cpo
} // namespace ranges
diff --git a/libcxx/include/__algorithm/ranges_any_of.h b/libcxx/include/__algorithm/ranges_any_of.h
index eb102bd858b00..2ca8531102eac 100644
--- a/libcxx/include/__algorithm/ranges_any_of.h
+++ b/libcxx/include/__algorithm/ranges_any_of.h
@@ -29,10 +29,8 @@ _LIBCPP_BEGIN_NAMESPACE_STD
namespace ranges {
namespace __any_of {
struct __fn {
-
template <class _Iter, class _Sent, class _Proj, class _Pred>
- _LIBCPP_HIDE_FROM_ABI constexpr static
- bool __any_of_impl(_Iter __first, _Sent __last, _Pred& __pred, _Proj& __proj) {
+ _LIBCPP_HIDE_FROM_ABI constexpr static bool __any_of_impl(_Iter __first, _Sent __last, _Pred& __pred, _Proj& __proj) {
for (; __first != __last; ++__first) {
if (std::invoke(__pred, std::invoke(__proj, *__first)))
return true;
@@ -40,24 +38,27 @@ struct __fn {
return false;
}
- template <input_iterator _Iter, sentinel_for<_Iter> _Sent, class _Proj = identity,
+ template <input_iterator _Iter,
+ sentinel_for<_Iter> _Sent,
+ class _Proj = identity,
indirect_unary_predicate<projected<_Iter, _Proj>> _Pred>
- _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr
- bool operator()(_Iter __first, _Sent __last, _Pred __pred = {}, _Proj __proj = {}) const {
+ _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr bool
+ operator()(_Iter __first, _Sent __last, _Pred __pred = {}, _Proj __proj = {}) const {
return __any_of_impl(std::move(__first), std::move(__last), __pred, __proj);
}
- template <input_range _Range, class _Proj = identity,
+ template <input_range _Range,
+ class _Proj = identity,
indirect_unary_predicate<projected<iterator_t<_Range>, _Proj>> _Pred>
- _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr
- bool operator()(_Range&& __range, _Pred __pred, _Proj __proj = {}) const {
+ _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr bool
+ operator()(_Range&& __range, _Pred __pred, _Proj __proj = {}) const {
return __any_of_impl(ranges::begin(__range), ranges::end(__range), __pred, __proj);
}
};
} // namespace __any_of
inline namespace __cpo {
- inline constexpr auto any_of = __any_of::__fn{};
+inline constexpr auto any_of = __any_of::__fn{};
} // namespace __cpo
} // namespace ranges
diff --git a/libcxx/include/__algorithm/ranges_binary_search.h b/libcxx/include/__algorithm/ranges_binary_search.h
index 728eb8b68ef76..22008e0f1bc8f 100644
--- a/libcxx/include/__algorithm/ranges_binary_search.h
+++ b/libcxx/include/__algorithm/ranges_binary_search.h
@@ -31,28 +31,33 @@ _LIBCPP_BEGIN_NAMESPACE_STD
namespace ranges {
namespace __binary_search {
struct __fn {
- template <forward_iterator _Iter, sentinel_for<_Iter> _Sent, class _Type, class _Proj = identity,
+ template <forward_iterator _Iter,
+ sentinel_for<_Iter> _Sent,
+ class _Type,
+ class _Proj = identity,
indirect_strict_weak_order<const _Type*, projected<_Iter, _Proj>> _Comp = ranges::less>
- _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr
- bool operator()(_Iter __first, _Sent __last, const _Type& __value, _Comp __comp = {}, _Proj __proj = {}) const {
+ _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr bool
+ operator()(_Iter __first, _Sent __last, const _Type& __value, _Comp __comp = {}, _Proj __proj = {}) const {
auto __ret = std::__lower_bound<_RangeAlgPolicy>(__first, __last, __value, __comp, __proj);
return __ret != __last && !std::invoke(__comp, __value, std::invoke(__proj, *__ret));
}
- template <forward_range _Range, class _Type, class _Proj = identity,
+ template <forward_range _Range,
+ class _Type,
+ class _Proj = identity,
indirect_strict_weak_order<const _Type*, projected<iterator_t<_Range>, _Proj>> _Comp = ranges::less>
- _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr
- bool operator()(_Range&& __r, const _Type& __value, _Comp __comp = {}, _Proj __proj = {}) const {
+ _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr bool
+ operator()(_Range&& __r, const _Type& __value, _Comp __comp = {}, _Proj __proj = {}) const {
auto __first = ranges::begin(__r);
- auto __last = ranges::end(__r);
- auto __ret = std::__lower_bound<_RangeAlgPolicy>(__first, __last, __value, __comp, __proj);
+ auto __last = ranges::end(__r);
+ auto __ret = std::__lower_bound<_RangeAlgPolicy>(__first, __last, __value, __comp, __proj);
return __ret != __last && !std::invoke(__comp, __value, std::invoke(__proj, *__ret));
}
};
} // namespace __binary_search
inline namespace __cpo {
- inline constexpr auto binary_search = __binary_search::__fn{};
+inline constexpr auto binary_search = __binary_search::__fn{};
} // namespace __cpo
} // namespace ranges
diff --git a/libcxx/include/__algorithm/ranges_clamp.h b/libcxx/include/__algorithm/ranges_clamp.h
index 45a8464c98a23..45bbebb97ef87 100644
--- a/libcxx/include/__algorithm/ranges_clamp.h
+++ b/libcxx/include/__algorithm/ranges_clamp.h
@@ -29,16 +29,11 @@ _LIBCPP_BEGIN_NAMESPACE_STD
namespace ranges {
namespace __clamp {
struct __fn {
-
template <class _Type,
- class _Proj = identity,
+ class _Proj = identity,
indirect_strict_weak_order<projected<const _Type*, _Proj>> _Comp = ranges::less>
- _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr
- const _Type& operator()(const _Type& __value,
- const _Type& __low,
- const _Type& __high,
- _Comp __comp = {},
- _Proj __proj = {}) const {
+ _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr const _Type& operator()(
+ const _Type& __value, const _Type& __low, const _Type& __high, _Comp __comp = {}, _Proj __proj = {}) const {
_LIBCPP_ASSERT(!bool(std::invoke(__comp, std::invoke(__proj, __high), std::invoke(__proj, __low))),
"Bad bounds passed to std::ranges::clamp");
@@ -49,12 +44,11 @@ struct __fn {
else
return __value;
}
-
};
} // namespace __clamp
inline namespace __cpo {
- inline constexpr auto clamp = __clamp::__fn{};
+inline constexpr auto clamp = __clamp::__fn{};
} // namespace __cpo
} // namespace ranges
diff --git a/libcxx/include/__algorithm/ranges_copy.h b/libcxx/include/__algorithm/ranges_copy.h
index f5700c3d3c000..1c87f074e7cab 100644
--- a/libcxx/include/__algorithm/ranges_copy.h
+++ b/libcxx/include/__algorithm/ranges_copy.h
@@ -36,19 +36,18 @@ using copy_result = in_out_result<_InIter, _OutIter>;
namespace __copy {
struct __fn {
-
template <input_iterator _InIter, sentinel_for<_InIter> _Sent, weakly_incrementable _OutIter>
requires indirectly_copyable<_InIter, _OutIter>
- _LIBCPP_HIDE_FROM_ABI constexpr
- copy_result<_InIter, _OutIter> operator()(_InIter __first, _Sent __last, _OutIter __result) const {
+ _LIBCPP_HIDE_FROM_ABI constexpr copy_result<_InIter, _OutIter>
+ operator()(_InIter __first, _Sent __last, _OutIter __result) const {
auto __ret = std::__copy<_RangeAlgPolicy>(std::move(__first), std::move(__last), std::move(__result));
return {std::move(__ret.first), std::move(__ret.second)};
}
template <input_range _Range, weakly_incrementable _OutIter>
requires indirectly_copyable<iterator_t<_Range>, _OutIter>
- _LIBCPP_HIDE_FROM_ABI constexpr
- copy_result<borrowed_iterator_t<_Range>, _OutIter> operator()(_Range&& __r, _OutIter __result) const {
+ _LIBCPP_HIDE_FROM_ABI constexpr copy_result<borrowed_iterator_t<_Range>, _OutIter>
+ operator()(_Range&& __r, _OutIter __result) const {
auto __ret = std::__copy<_RangeAlgPolicy>(ranges::begin(__r), ranges::end(__r), std::move(__result));
return {std::move(__ret.first), std::move(__ret.second)};
}
@@ -56,7 +55,7 @@ struct __fn {
} // namespace __copy
inline namespace __cpo {
- inline constexpr auto copy = __copy::__fn{};
+inline constexpr auto copy = __copy::__fn{};
} // namespace __cpo
} // namespace ranges
diff --git a/libcxx/include/__algorithm/ranges_copy_backward.h b/libcxx/include/__algorithm/ranges_copy_backward.h
index b7b5b88792b3f..865e944d4384d 100644
--- a/libcxx/include/__algorithm/ranges_copy_backward.h
+++ b/libcxx/include/__algorithm/ranges_copy_backward.h
@@ -29,24 +29,23 @@ _LIBCPP_BEGIN_NAMESPACE_STD
namespace ranges {
-template<class _Ip, class _Op>
+template <class _Ip, class _Op>
using copy_backward_result = in_out_result<_Ip, _Op>;
namespace __copy_backward {
struct __fn {
-
template <bidirectional_iterator _InIter1, sentinel_for<_InIter1> _Sent1, bidirectional_iterator _InIter2>
requires indirectly_copyable<_InIter1, _InIter2>
- _LIBCPP_HIDE_FROM_ABI constexpr
- copy_backward_result<_InIter1, _InIter2> operator()(_InIter1 __first, _Sent1 __last, _InIter2 __result) const {
+ _LIBCPP_HIDE_FROM_ABI constexpr copy_backward_result<_InIter1, _InIter2>
+ operator()(_InIter1 __first, _Sent1 __last, _InIter2 __result) const {
auto __ret = std::__copy_backward<_RangeAlgPolicy>(std::move(__first), std::move(__last), std::move(__result));
return {std::move(__ret.first), std::move(__ret.second)};
}
template <bidirectional_range _Range, bidirectional_iterator _Iter>
requires indirectly_copyable<iterator_t<_Range>, _Iter>
- _LIBCPP_HIDE_FROM_ABI constexpr
- copy_backward_result<borrowed_iterator_t<_Range>, _Iter> operator()(_Range&& __r, _Iter __result) const {
+ _LIBCPP_HIDE_FROM_ABI constexpr copy_backward_result<borrowed_iterator_t<_Range>, _Iter>
+ operator()(_Range&& __r, _Iter __result) const {
auto __ret = std::__copy_backward<_RangeAlgPolicy>(ranges::begin(__r), ranges::end(__r), std::move(__result));
return {std::move(__ret.first), std::move(__ret.second)};
}
@@ -54,7 +53,7 @@ struct __fn {
} // namespace __copy_backward
inline namespace __cpo {
- inline constexpr auto copy_backward = __copy_backward::__fn{};
+inline constexpr auto copy_backward = __copy_backward::__fn{};
} // namespace __cpo
} // namespace ranges
diff --git a/libcxx/include/__algorithm/ranges_copy_if.h b/libcxx/include/__algorithm/ranges_copy_if.h
index b714e4cd1979b..b77dbd37fcee3 100644
--- a/libcxx/include/__algorithm/ranges_copy_if.h
+++ b/libcxx/include/__algorithm/ranges_copy_if.h
@@ -30,15 +30,13 @@ _LIBCPP_BEGIN_NAMESPACE_STD
namespace ranges {
-template<class _Ip, class _Op>
+template <class _Ip, class _Op>
using copy_if_result = in_out_result<_Ip, _Op>;
namespace __copy_if {
struct __fn {
-
template <class _InIter, class _Sent, class _OutIter, class _Proj, class _Pred>
- _LIBCPP_HIDE_FROM_ABI static constexpr
- copy_if_result <_InIter, _OutIter>
+ _LIBCPP_HIDE_FROM_ABI static constexpr copy_if_result<_InIter, _OutIter>
__copy_if_impl(_InIter __first, _Sent __last, _OutIter __result, _Pred& __pred, _Proj& __proj) {
for (; __first != __last; ++__first) {
if (std::invoke(__pred, std::invoke(__proj, *__first))) {
@@ -49,20 +47,23 @@ struct __fn {
return {std::move(__first), std::move(__result)};
}
- template <input_iterator _Iter, sentinel_for<_Iter> _Sent, weakly_incrementable _OutIter, class _Proj = identity,
+ template <input_iterator _Iter,
+ sentinel_for<_Iter> _Sent,
+ weakly_incrementable _OutIter,
+ class _Proj = identity,
indirect_unary_predicate<projected<_Iter, _Proj>> _Pred>
requires indirectly_copyable<_Iter, _OutIter>
- _LIBCPP_HIDE_FROM_ABI constexpr
- copy_if_result<_Iter, _OutIter>
+ _LIBCPP_HIDE_FROM_ABI constexpr copy_if_result<_Iter, _OutIter>
operator()(_Iter __first, _Sent __last, _OutIter __result, _Pred __pred, _Proj __proj = {}) const {
return __copy_if_impl(std::move(__first), std::move(__last), std::move(__result), __pred, __proj);
}
- template <input_range _Range, weakly_incrementable _OutIter, class _Proj = identity,
+ template <input_range _Range,
+ weakly_incrementable _OutIter,
+ class _Proj = identity,
indirect_unary_predicate<projected<iterator_t<_Range>, _Proj>> _Pred>
requires indirectly_copyable<iterator_t<_Range>, _OutIter>
- _LIBCPP_HIDE_FROM_ABI constexpr
- copy_if_result<borrowed_iterator_t<_Range>, _OutIter>
+ _LIBCPP_HIDE_FROM_ABI constexpr copy_if_result<borrowed_iterator_t<_Range>, _OutIter>
operator()(_Range&& __r, _OutIter __result, _Pred __pred, _Proj __proj = {}) const {
return __copy_if_impl(ranges::begin(__r), ranges::end(__r), std::move(__result), __pred, __proj);
}
@@ -70,7 +71,7 @@ struct __fn {
} // namespace __copy_if
inline namespace __cpo {
- inline constexpr auto copy_if = __copy_if::__fn{};
+inline constexpr auto copy_if = __copy_if::__fn{};
} // namespace __cpo
} // namespace ranges
diff --git a/libcxx/include/__algorithm/ranges_copy_n.h b/libcxx/include/__algorithm/ranges_copy_n.h
index 30ee019ac9bce..99e8eee14d0f8 100644
--- a/libcxx/include/__algorithm/ranges_copy_n.h
+++ b/libcxx/include/__algorithm/ranges_copy_n.h
@@ -36,10 +36,9 @@ using copy_n_result = in_out_result<_Ip, _Op>;
namespace __copy_n {
struct __fn {
-
template <class _InIter, class _DiffType, class _OutIter>
- _LIBCPP_HIDE_FROM_ABI constexpr static
- copy_n_result<_InIter, _OutIter> __go(_InIter __first, _DiffType __n, _OutIter __result) {
+ _LIBCPP_HIDE_FROM_ABI constexpr static copy_n_result<_InIter, _OutIter>
+ __go(_InIter __first, _DiffType __n, _OutIter __result) {
while (__n != 0) {
*__result = *__first;
++__first;
@@ -50,23 +49,23 @@ struct __fn {
}
template <random_access_iterator _InIter, class _DiffType, random_access_iterator _OutIter>
- _LIBCPP_HIDE_FROM_ABI constexpr static
- copy_n_result<_InIter, _OutIter> __go(_InIter __first, _DiffType __n, _OutIter __result) {
+ _LIBCPP_HIDE_FROM_ABI constexpr static copy_n_result<_InIter, _OutIter>
+ __go(_InIter __first, _DiffType __n, _OutIter __result) {
auto __ret = std::__copy<_RangeAlgPolicy>(__first, __first + __n, __result);
return {__ret.first, __ret.second};
}
template <input_iterator _Ip, weakly_incrementable _Op>
requires indirectly_copyable<_Ip, _Op>
- _LIBCPP_HIDE_FROM_ABI constexpr
- copy_n_result<_Ip, _Op> operator()(_Ip __first, iter_
diff erence_t<_Ip> __n, _Op __result) const {
+ _LIBCPP_HIDE_FROM_ABI constexpr copy_n_result<_Ip, _Op>
+ operator()(_Ip __first, iter_
diff erence_t<_Ip> __n, _Op __result) const {
return __go(std::move(__first), __n, std::move(__result));
}
};
} // namespace __copy_n
inline namespace __cpo {
- inline constexpr auto copy_n = __copy_n::__fn{};
+inline constexpr auto copy_n = __copy_n::__fn{};
} // namespace __cpo
} // namespace ranges
diff --git a/libcxx/include/__algorithm/ranges_count.h b/libcxx/include/__algorithm/ranges_count.h
index 677ee38185fab..82f54567561f2 100644
--- a/libcxx/include/__algorithm/ranges_count.h
+++ b/libcxx/include/__algorithm/ranges_count.h
@@ -34,16 +34,16 @@ namespace __count {
struct __fn {
template <input_iterator _Iter, sentinel_for<_Iter> _Sent, class _Type, class _Proj = identity>
requires indirect_binary_predicate<ranges::equal_to, projected<_Iter, _Proj>, const _Type*>
- _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr
- iter_
diff erence_t<_Iter> operator()(_Iter __first, _Sent __last, const _Type& __value, _Proj __proj = {}) const {
+ _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr iter_
diff erence_t<_Iter>
+ operator()(_Iter __first, _Sent __last, const _Type& __value, _Proj __proj = {}) const {
auto __pred = [&](auto&& __e) { return __e == __value; };
return ranges::__count_if_impl(std::move(__first), std::move(__last), __pred, __proj);
}
template <input_range _Range, class _Type, class _Proj = identity>
requires indirect_binary_predicate<ranges::equal_to, projected<iterator_t<_Range>, _Proj>, const _Type*>
- _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr
- range_
diff erence_t<_Range> operator()(_Range&& __r, const _Type& __value, _Proj __proj = {}) const {
+ _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr range_
diff erence_t<_Range>
+ operator()(_Range&& __r, const _Type& __value, _Proj __proj = {}) const {
auto __pred = [&](auto&& __e) { return __e == __value; };
return ranges::__count_if_impl(ranges::begin(__r), ranges::end(__r), __pred, __proj);
}
@@ -51,7 +51,7 @@ struct __fn {
} // namespace __count
inline namespace __cpo {
- inline constexpr auto count = __count::__fn{};
+inline constexpr auto count = __count::__fn{};
} // namespace __cpo
} // namespace ranges
diff --git a/libcxx/include/__algorithm/ranges_count_if.h b/libcxx/include/__algorithm/ranges_count_if.h
index 48c4370eb288e..92f37d049e0c4 100644
--- a/libcxx/include/__algorithm/ranges_count_if.h
+++ b/libcxx/include/__algorithm/ranges_count_if.h
@@ -31,9 +31,8 @@ _LIBCPP_BEGIN_NAMESPACE_STD
namespace ranges {
template <class _Iter, class _Sent, class _Proj, class _Pred>
-_LIBCPP_HIDE_FROM_ABI constexpr
-iter_
diff erence_t<_Iter> __count_if_impl(_Iter __first, _Sent __last,
- _Pred& __pred, _Proj& __proj) {
+_LIBCPP_HIDE_FROM_ABI constexpr iter_
diff erence_t<_Iter>
+__count_if_impl(_Iter __first, _Sent __last, _Pred& __pred, _Proj& __proj) {
iter_
diff erence_t<_Iter> __counter(0);
for (; __first != __last; ++__first) {
if (std::invoke(__pred, std::invoke(__proj, *__first)))
@@ -44,24 +43,27 @@ iter_
diff erence_t<_Iter> __count_if_impl(_Iter __first, _Sent __last,
namespace __count_if {
struct __fn {
- template <input_iterator _Iter, sentinel_for<_Iter> _Sent, class _Proj = identity,
+ template <input_iterator _Iter,
+ sentinel_for<_Iter> _Sent,
+ class _Proj = identity,
indirect_unary_predicate<projected<_Iter, _Proj>> _Predicate>
- _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr
- iter_
diff erence_t<_Iter> operator()(_Iter __first, _Sent __last, _Predicate __pred, _Proj __proj = {}) const {
+ _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr iter_
diff erence_t<_Iter>
+ operator()(_Iter __first, _Sent __last, _Predicate __pred, _Proj __proj = {}) const {
return ranges::__count_if_impl(std::move(__first), std::move(__last), __pred, __proj);
}
- template <input_range _Range, class _Proj = identity,
+ template <input_range _Range,
+ class _Proj = identity,
indirect_unary_predicate<projected<iterator_t<_Range>, _Proj>> _Predicate>
- _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr
- range_
diff erence_t<_Range> operator()(_Range&& __r, _Predicate __pred, _Proj __proj = {}) const {
+ _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr range_
diff erence_t<_Range>
+ operator()(_Range&& __r, _Predicate __pred, _Proj __proj = {}) const {
return ranges::__count_if_impl(ranges::begin(__r), ranges::end(__r), __pred, __proj);
}
};
} // namespace __count_if
inline namespace __cpo {
- inline constexpr auto count_if = __count_if::__fn{};
+inline constexpr auto count_if = __count_if::__fn{};
} // namespace __cpo
} // namespace ranges
diff --git a/libcxx/include/__algorithm/ranges_equal.h b/libcxx/include/__algorithm/ranges_equal.h
index 87544531c70bc..4cb1f7df1952e 100644
--- a/libcxx/include/__algorithm/ranges_equal.h
+++ b/libcxx/include/__algorithm/ranges_equal.h
@@ -33,61 +33,67 @@ _LIBCPP_BEGIN_NAMESPACE_STD
namespace ranges {
namespace __equal {
struct __fn {
- template <input_iterator _Iter1, sentinel_for<_Iter1> _Sent1,
- input_iterator _Iter2, sentinel_for<_Iter2> _Sent2,
- class _Pred = ranges::equal_to,
+ template <input_iterator _Iter1,
+ sentinel_for<_Iter1> _Sent1,
+ input_iterator _Iter2,
+ sentinel_for<_Iter2> _Sent2,
+ class _Pred = ranges::equal_to,
class _Proj1 = identity,
class _Proj2 = identity>
requires indirectly_comparable<_Iter1, _Iter2, _Pred, _Proj1, _Proj2>
- _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr
- bool operator()(_Iter1 __first1, _Sent1 __last1,
- _Iter2 __first2, _Sent2 __last2,
- _Pred __pred = {},
- _Proj1 __proj1 = {},
- _Proj2 __proj2 = {}) const {
+ _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr bool operator()(
+ _Iter1 __first1,
+ _Sent1 __last1,
+ _Iter2 __first2,
+ _Sent2 __last2,
+ _Pred __pred = {},
+ _Proj1 __proj1 = {},
+ _Proj2 __proj2 = {}) const {
if constexpr (sized_sentinel_for<_Sent1, _Iter1> && sized_sentinel_for<_Sent2, _Iter2>) {
if (__last1 - __first1 != __last2 - __first2)
return false;
}
auto __unwrapped1 = std::__unwrap_range(std::move(__first1), std::move(__last1));
auto __unwrapped2 = std::__unwrap_range(std::move(__first2), std::move(__last2));
- return std::__equal_impl(std::move(__unwrapped1.first), std::move(__unwrapped1.second),
- std::move(__unwrapped2.first), std::move(__unwrapped2.second),
- __pred,
- __proj1,
- __proj2);
+ return std::__equal_impl(
+ std::move(__unwrapped1.first),
+ std::move(__unwrapped1.second),
+ std::move(__unwrapped2.first),
+ std::move(__unwrapped2.second),
+ __pred,
+ __proj1,
+ __proj2);
}
template <input_range _Range1,
input_range _Range2,
- class _Pred = ranges::equal_to,
+ class _Pred = ranges::equal_to,
class _Proj1 = identity,
class _Proj2 = identity>
requires indirectly_comparable<iterator_t<_Range1>, iterator_t<_Range2>, _Pred, _Proj1, _Proj2>
- _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr
- bool operator()(_Range1&& __range1,
- _Range2&& __range2,
- _Pred __pred = {},
- _Proj1 __proj1 = {},
- _Proj2 __proj2 = {}) const {
+ _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr bool operator()(
+ _Range1&& __range1, _Range2&& __range2, _Pred __pred = {}, _Proj1 __proj1 = {}, _Proj2 __proj2 = {}) const {
if constexpr (sized_range<_Range1> && sized_range<_Range2>) {
if (ranges::distance(__range1) != ranges::distance(__range2))
return false;
}
auto __unwrapped1 = std::__unwrap_range(ranges::begin(__range1), ranges::end(__range1));
auto __unwrapped2 = std::__unwrap_range(ranges::begin(__range2), ranges::end(__range2));
- return std::__equal_impl(std::move(__unwrapped1.first), std::move(__unwrapped1.second),
- std::move(__unwrapped2.first), std::move(__unwrapped2.second),
- __pred,
- __proj1,
- __proj2);
+ return std::__equal_impl(
+ std::move(__unwrapped1.first),
+ std::move(__unwrapped1.second),
+ std::move(__unwrapped2.first),
+ std::move(__unwrapped2.second),
+ __pred,
+ __proj1,
+ __proj2);
return false;
}
};
} // namespace __equal
inline namespace __cpo {
- inline constexpr auto equal = __equal::__fn{};
+inline constexpr auto equal = __equal::__fn{};
} // namespace __cpo
} // namespace ranges
diff --git a/libcxx/include/__algorithm/ranges_equal_range.h b/libcxx/include/__algorithm/ranges_equal_range.h
index 075634ae9dd89..ed78cf312c6b2 100644
--- a/libcxx/include/__algorithm/ranges_equal_range.h
+++ b/libcxx/include/__algorithm/ranges_equal_range.h
@@ -38,28 +38,25 @@ namespace ranges {
namespace __equal_range {
struct __fn {
- template <
- forward_iterator _Iter,
- sentinel_for<_Iter> _Sent,
- class _Tp,
- class _Proj = identity,
- indirect_strict_weak_order<const _Tp*, projected<_Iter, _Proj>> _Comp = ranges::less>
+ template <forward_iterator _Iter,
+ sentinel_for<_Iter> _Sent,
+ class _Tp,
+ class _Proj = identity,
+ indirect_strict_weak_order<const _Tp*, projected<_Iter, _Proj>> _Comp = ranges::less>
_LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr subrange<_Iter>
operator()(_Iter __first, _Sent __last, const _Tp& __value, _Comp __comp = {}, _Proj __proj = {}) const {
- auto __ret = std::__equal_range<_RangeAlgPolicy>(
- std::move(__first), std::move(__last), __value, __comp, __proj);
+ auto __ret = std::__equal_range<_RangeAlgPolicy>(std::move(__first), std::move(__last), __value, __comp, __proj);
return {std::move(__ret.first), std::move(__ret.second)};
}
- template <
- forward_range _Range,
- class _Tp,
- class _Proj = identity,
- indirect_strict_weak_order<const _Tp*, projected<iterator_t<_Range>, _Proj>> _Comp = ranges::less>
+ template <forward_range _Range,
+ class _Tp,
+ class _Proj = identity,
+ indirect_strict_weak_order<const _Tp*, projected<iterator_t<_Range>, _Proj>> _Comp = ranges::less>
_LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr borrowed_subrange_t<_Range>
operator()(_Range&& __range, const _Tp& __value, _Comp __comp = {}, _Proj __proj = {}) const {
- auto __ret = std::__equal_range<_RangeAlgPolicy>(
- ranges::begin(__range), ranges::end(__range), __value, __comp, __proj);
+ auto __ret =
+ std::__equal_range<_RangeAlgPolicy>(ranges::begin(__range), ranges::end(__range), __value, __comp, __proj);
return {std::move(__ret.first), std::move(__ret.second)};
}
};
@@ -67,7 +64,7 @@ struct __fn {
} // namespace __equal_range
inline namespace __cpo {
- inline constexpr auto equal_range = __equal_range::__fn{};
+inline constexpr auto equal_range = __equal_range::__fn{};
} // namespace __cpo
} // namespace ranges
diff --git a/libcxx/include/__algorithm/ranges_fill.h b/libcxx/include/__algorithm/ranges_fill.h
index 4e0594c6d2d7f..88a892f5c2786 100644
--- a/libcxx/include/__algorithm/ranges_fill.h
+++ b/libcxx/include/__algorithm/ranges_fill.h
@@ -28,9 +28,8 @@ namespace ranges {
namespace __fill {
struct __fn {
template <class _Type, output_iterator<const _Type&> _Iter, sentinel_for<_Iter> _Sent>
- _LIBCPP_HIDE_FROM_ABI constexpr
- _Iter operator()(_Iter __first, _Sent __last, const _Type& __value) const {
- if constexpr(random_access_iterator<_Iter> && sized_sentinel_for<_Sent, _Iter>) {
+ _LIBCPP_HIDE_FROM_ABI constexpr _Iter operator()(_Iter __first, _Sent __last, const _Type& __value) const {
+ if constexpr (random_access_iterator<_Iter> && sized_sentinel_for<_Sent, _Iter>) {
return ranges::fill_n(__first, __last - __first, __value);
} else {
for (; __first != __last; ++__first)
@@ -40,15 +39,14 @@ struct __fn {
}
template <class _Type, output_range<const _Type&> _Range>
- _LIBCPP_HIDE_FROM_ABI constexpr
- borrowed_iterator_t<_Range> operator()(_Range&& __range, const _Type& __value) const {
+ _LIBCPP_HIDE_FROM_ABI constexpr borrowed_iterator_t<_Range> operator()(_Range&& __range, const _Type& __value) const {
return (*this)(ranges::begin(__range), ranges::end(__range), __value);
}
};
} // namespace __fill
inline namespace __cpo {
- inline constexpr auto fill = __fill::__fn{};
+inline constexpr auto fill = __fill::__fn{};
} // namespace __cpo
} // namespace ranges
diff --git a/libcxx/include/__algorithm/ranges_fill_n.h b/libcxx/include/__algorithm/ranges_fill_n.h
index c5f7e6eadf098..dbd8ec27aef9f 100644
--- a/libcxx/include/__algorithm/ranges_fill_n.h
+++ b/libcxx/include/__algorithm/ranges_fill_n.h
@@ -25,8 +25,8 @@ namespace ranges {
namespace __fill_n {
struct __fn {
template <class _Type, output_iterator<const _Type&> _Iter>
- _LIBCPP_HIDE_FROM_ABI constexpr
- _Iter operator()(_Iter __first, iter_
diff erence_t<_Iter> __n, const _Type& __value) const {
+ _LIBCPP_HIDE_FROM_ABI constexpr _Iter
+ operator()(_Iter __first, iter_
diff erence_t<_Iter> __n, const _Type& __value) const {
for (; __n != 0; --__n) {
*__first = __value;
++__first;
@@ -37,7 +37,7 @@ struct __fn {
} // namespace __fill_n
inline namespace __cpo {
- inline constexpr auto fill_n = __fill_n::__fn{};
+inline constexpr auto fill_n = __fill_n::__fn{};
} // namespace __cpo
} // namespace ranges
diff --git a/libcxx/include/__algorithm/ranges_find.h b/libcxx/include/__algorithm/ranges_find.h
index 084cdfff0c9c6..de870e381184c 100644
--- a/libcxx/include/__algorithm/ranges_find.h
+++ b/libcxx/include/__algorithm/ranges_find.h
@@ -49,22 +49,22 @@ struct __fn {
template <input_iterator _Ip, sentinel_for<_Ip> _Sp, class _Tp, class _Proj = identity>
requires indirect_binary_predicate<ranges::equal_to, projected<_Ip, _Proj>, const _Tp*>
- _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr
- _Ip operator()(_Ip __first, _Sp __last, const _Tp& __value, _Proj __proj = {}) const {
+ _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr _Ip
+ operator()(_Ip __first, _Sp __last, const _Tp& __value, _Proj __proj = {}) const {
return __find_unwrap(std::move(__first), std::move(__last), __value, __proj);
}
template <input_range _Rp, class _Tp, class _Proj = identity>
requires indirect_binary_predicate<ranges::equal_to, projected<iterator_t<_Rp>, _Proj>, const _Tp*>
- _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr
- borrowed_iterator_t<_Rp> operator()(_Rp&& __r, const _Tp& __value, _Proj __proj = {}) const {
+ _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr borrowed_iterator_t<_Rp>
+ operator()(_Rp&& __r, const _Tp& __value, _Proj __proj = {}) const {
return __find_unwrap(ranges::begin(__r), ranges::end(__r), __value, __proj);
}
};
} // namespace __find
inline namespace __cpo {
- inline constexpr auto find = __find::__fn{};
+inline constexpr auto find = __find::__fn{};
} // namespace __cpo
} // namespace ranges
diff --git a/libcxx/include/__algorithm/ranges_find_end.h b/libcxx/include/__algorithm/ranges_find_end.h
index 2d46e8c38c6e2..2c57ad424bfde 100644
--- a/libcxx/include/__algorithm/ranges_find_end.h
+++ b/libcxx/include/__algorithm/ranges_find_end.h
@@ -34,18 +34,22 @@ _LIBCPP_BEGIN_NAMESPACE_STD
namespace ranges {
namespace __find_end {
struct __fn {
- template <forward_iterator _Iter1, sentinel_for<_Iter1> _Sent1,
- forward_iterator _Iter2, sentinel_for<_Iter2> _Sent2,
- class _Pred = ranges::equal_to,
+ template <forward_iterator _Iter1,
+ sentinel_for<_Iter1> _Sent1,
+ forward_iterator _Iter2,
+ sentinel_for<_Iter2> _Sent2,
+ class _Pred = ranges::equal_to,
class _Proj1 = identity,
class _Proj2 = identity>
requires indirectly_comparable<_Iter1, _Iter2, _Pred, _Proj1, _Proj2>
- _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr
- subrange<_Iter1> operator()(_Iter1 __first1, _Sent1 __last1,
- _Iter2 __first2, _Sent2 __last2,
- _Pred __pred = {},
- _Proj1 __proj1 = {},
- _Proj2 __proj2 = {}) const {
+ _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr subrange<_Iter1> operator()(
+ _Iter1 __first1,
+ _Sent1 __last1,
+ _Iter2 __first2,
+ _Sent2 __last2,
+ _Pred __pred = {},
+ _Proj1 __proj1 = {},
+ _Proj2 __proj2 = {}) const {
auto __ret = std::__find_end_impl<_RangeAlgPolicy>(
__first1,
__last1,
@@ -61,16 +65,12 @@ struct __fn {
template <forward_range _Range1,
forward_range _Range2,
- class _Pred = ranges::equal_to,
+ class _Pred = ranges::equal_to,
class _Proj1 = identity,
class _Proj2 = identity>
requires indirectly_comparable<iterator_t<_Range1>, iterator_t<_Range2>, _Pred, _Proj1, _Proj2>
- _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr
- borrowed_subrange_t<_Range1> operator()(_Range1&& __range1,
- _Range2&& __range2,
- _Pred __pred = {},
- _Proj1 __proj1 = {},
- _Proj2 __proj2 = {}) const {
+ _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr borrowed_subrange_t<_Range1> operator()(
+ _Range1&& __range1, _Range2&& __range2, _Pred __pred = {}, _Proj1 __proj1 = {}, _Proj2 __proj2 = {}) const {
auto __ret = std::__find_end_impl<_RangeAlgPolicy>(
ranges::begin(__range1),
ranges::end(__range1),
@@ -87,7 +87,7 @@ struct __fn {
} // namespace __find_end
inline namespace __cpo {
- inline constexpr auto find_end = __find_end::__fn{};
+inline constexpr auto find_end = __find_end::__fn{};
} // namespace __cpo
} // namespace ranges
diff --git a/libcxx/include/__algorithm/ranges_find_first_of.h b/libcxx/include/__algorithm/ranges_find_first_of.h
index 5699583ba408e..ec6d52c63250b 100644
--- a/libcxx/include/__algorithm/ranges_find_first_of.h
+++ b/libcxx/include/__algorithm/ranges_find_first_of.h
@@ -31,14 +31,15 @@ _LIBCPP_BEGIN_NAMESPACE_STD
namespace ranges {
namespace __find_first_of {
struct __fn {
-
template <class _Iter1, class _Sent1, class _Iter2, class _Sent2, class _Pred, class _Proj1, class _Proj2>
- _LIBCPP_HIDE_FROM_ABI constexpr static
- _Iter1 __find_first_of_impl(_Iter1 __first1, _Sent1 __last1,
- _Iter2 __first2, _Sent2 __last2,
- _Pred& __pred,
- _Proj1& __proj1,
- _Proj2& __proj2) {
+ _LIBCPP_HIDE_FROM_ABI constexpr static _Iter1 __find_first_of_impl(
+ _Iter1 __first1,
+ _Sent1 __last1,
+ _Iter2 __first2,
+ _Sent2 __last2,
+ _Pred& __pred,
+ _Proj1& __proj1,
+ _Proj2& __proj2) {
for (; __first1 != __last1; ++__first1) {
for (auto __j = __first2; __j != __last2; ++__j) {
if (std::invoke(__pred, std::invoke(__proj1, *__first1), std::invoke(__proj2, *__j)))
@@ -48,49 +49,48 @@ struct __fn {
return __first1;
}
- template <input_iterator _Iter1, sentinel_for<_Iter1> _Sent1,
- forward_iterator _Iter2, sentinel_for<_Iter2> _Sent2,
- class _Pred = ranges::equal_to,
+ template <input_iterator _Iter1,
+ sentinel_for<_Iter1> _Sent1,
+ forward_iterator _Iter2,
+ sentinel_for<_Iter2> _Sent2,
+ class _Pred = ranges::equal_to,
class _Proj1 = identity,
class _Proj2 = identity>
requires indirectly_comparable<_Iter1, _Iter2, _Pred, _Proj1, _Proj2>
- _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr
- _Iter1 operator()(_Iter1 __first1, _Sent1 __last1,
- _Iter2 __first2, _Sent2 __last2,
- _Pred __pred = {},
- _Proj1 __proj1 = {},
- _Proj2 __proj2 = {}) const {
- return __find_first_of_impl(std::move(__first1), std::move(__last1),
- std::move(__first2), std::move(__last2),
- __pred,
- __proj1,
- __proj2);
+ _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr _Iter1 operator()(
+ _Iter1 __first1,
+ _Sent1 __last1,
+ _Iter2 __first2,
+ _Sent2 __last2,
+ _Pred __pred = {},
+ _Proj1 __proj1 = {},
+ _Proj2 __proj2 = {}) const {
+ return __find_first_of_impl(
+ std::move(__first1), std::move(__last1), std::move(__first2), std::move(__last2), __pred, __proj1, __proj2);
}
template <input_range _Range1,
forward_range _Range2,
- class _Pred = ranges::equal_to,
+ class _Pred = ranges::equal_to,
class _Proj1 = identity,
class _Proj2 = identity>
requires indirectly_comparable<iterator_t<_Range1>, iterator_t<_Range2>, _Pred, _Proj1, _Proj2>
- _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr
- borrowed_iterator_t<_Range1> operator()(_Range1&& __range1,
- _Range2&& __range2,
- _Pred __pred = {},
- _Proj1 __proj1 = {},
- _Proj2 __proj2 = {}) const {
- return __find_first_of_impl(ranges::begin(__range1), ranges::end(__range1),
- ranges::begin(__range2), ranges::end(__range2),
- __pred,
- __proj1,
- __proj2);
+ _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr borrowed_iterator_t<_Range1> operator()(
+ _Range1&& __range1, _Range2&& __range2, _Pred __pred = {}, _Proj1 __proj1 = {}, _Proj2 __proj2 = {}) const {
+ return __find_first_of_impl(
+ ranges::begin(__range1),
+ ranges::end(__range1),
+ ranges::begin(__range2),
+ ranges::end(__range2),
+ __pred,
+ __proj1,
+ __proj2);
}
-
};
} // namespace __find_first_of
inline namespace __cpo {
- inline constexpr auto find_first_of = __find_first_of::__fn{};
+inline constexpr auto find_first_of = __find_first_of::__fn{};
} // namespace __cpo
} // namespace ranges
diff --git a/libcxx/include/__algorithm/ranges_find_if.h b/libcxx/include/__algorithm/ranges_find_if.h
index 6e2bd4c3ddd4a..af54a5007ee25 100644
--- a/libcxx/include/__algorithm/ranges_find_if.h
+++ b/libcxx/include/__algorithm/ranges_find_if.h
@@ -31,8 +31,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD
namespace ranges {
template <class _Ip, class _Sp, class _Pred, class _Proj>
-_LIBCPP_HIDE_FROM_ABI constexpr
-_Ip __find_if_impl(_Ip __first, _Sp __last, _Pred& __pred, _Proj& __proj) {
+_LIBCPP_HIDE_FROM_ABI constexpr _Ip __find_if_impl(_Ip __first, _Sp __last, _Pred& __pred, _Proj& __proj) {
for (; __first != __last; ++__first) {
if (std::invoke(__pred, std::invoke(__proj, *__first)))
break;
@@ -42,25 +41,25 @@ _Ip __find_if_impl(_Ip __first, _Sp __last, _Pred& __pred, _Proj& __proj) {
namespace __find_if {
struct __fn {
-
- template <input_iterator _Ip, sentinel_for<_Ip> _Sp, class _Proj = identity,
+ template <input_iterator _Ip,
+ sentinel_for<_Ip> _Sp,
+ class _Proj = identity,
indirect_unary_predicate<projected<_Ip, _Proj>> _Pred>
- _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr
- _Ip operator()(_Ip __first, _Sp __last, _Pred __pred, _Proj __proj = {}) const {
+ _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr _Ip
+ operator()(_Ip __first, _Sp __last, _Pred __pred, _Proj __proj = {}) const {
return ranges::__find_if_impl(std::move(__first), std::move(__last), __pred, __proj);
}
- template <input_range _Rp, class _Proj = identity,
- indirect_unary_predicate<projected<iterator_t<_Rp>, _Proj>> _Pred>
- _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr
- borrowed_iterator_t<_Rp> operator()(_Rp&& __r, _Pred __pred, _Proj __proj = {}) const {
+ template <input_range _Rp, class _Proj = identity, indirect_unary_predicate<projected<iterator_t<_Rp>, _Proj>> _Pred>
+ _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr borrowed_iterator_t<_Rp>
+ operator()(_Rp&& __r, _Pred __pred, _Proj __proj = {}) const {
return ranges::__find_if_impl(ranges::begin(__r), ranges::end(__r), __pred, __proj);
}
};
} // namespace __find_if
inline namespace __cpo {
- inline constexpr auto find_if = __find_if::__fn{};
+inline constexpr auto find_if = __find_if::__fn{};
} // namespace __cpo
} // namespace ranges
diff --git a/libcxx/include/__algorithm/ranges_find_if_not.h b/libcxx/include/__algorithm/ranges_find_if_not.h
index e60ee2b49cffa..6beade1462e09 100644
--- a/libcxx/include/__algorithm/ranges_find_if_not.h
+++ b/libcxx/include/__algorithm/ranges_find_if_not.h
@@ -33,18 +33,19 @@ _LIBCPP_BEGIN_NAMESPACE_STD
namespace ranges {
namespace __find_if_not {
struct __fn {
- template <input_iterator _Ip, sentinel_for<_Ip> _Sp, class _Proj = identity,
+ template <input_iterator _Ip,
+ sentinel_for<_Ip> _Sp,
+ class _Proj = identity,
indirect_unary_predicate<projected<_Ip, _Proj>> _Pred>
- _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr
- _Ip operator()(_Ip __first, _Sp __last, _Pred __pred, _Proj __proj = {}) const {
+ _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr _Ip
+ operator()(_Ip __first, _Sp __last, _Pred __pred, _Proj __proj = {}) const {
auto __pred2 = [&](auto&& __e) { return !std::invoke(__pred, std::forward<decltype(__e)>(__e)); };
return ranges::__find_if_impl(std::move(__first), std::move(__last), __pred2, __proj);
}
- template <input_range _Rp, class _Proj = identity,
- indirect_unary_predicate<projected<iterator_t<_Rp>, _Proj>> _Pred>
- _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr
- borrowed_iterator_t<_Rp> operator()(_Rp&& __r, _Pred __pred, _Proj __proj = {}) const {
+ template <input_range _Rp, class _Proj = identity, indirect_unary_predicate<projected<iterator_t<_Rp>, _Proj>> _Pred>
+ _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr borrowed_iterator_t<_Rp>
+ operator()(_Rp&& __r, _Pred __pred, _Proj __proj = {}) const {
auto __pred2 = [&](auto&& __e) { return !std::invoke(__pred, std::forward<decltype(__e)>(__e)); };
return ranges::__find_if_impl(ranges::begin(__r), ranges::end(__r), __pred2, __proj);
}
@@ -52,7 +53,7 @@ struct __fn {
} // namespace __find_if_not
inline namespace __cpo {
- inline constexpr auto find_if_not = __find_if_not::__fn{};
+inline constexpr auto find_if_not = __find_if_not::__fn{};
} // namespace __cpo
} // namespace ranges
diff --git a/libcxx/include/__algorithm/ranges_for_each.h b/libcxx/include/__algorithm/ranges_for_each.h
index a72f77963759f..7878ed26709fb 100644
--- a/libcxx/include/__algorithm/ranges_for_each.h
+++ b/libcxx/include/__algorithm/ranges_for_each.h
@@ -37,37 +37,35 @@ namespace __for_each {
struct __fn {
private:
template <class _Iter, class _Sent, class _Proj, class _Func>
- _LIBCPP_HIDE_FROM_ABI constexpr static
- for_each_result<_Iter, _Func> __for_each_impl(_Iter __first, _Sent __last, _Func& __func, _Proj& __proj) {
+ _LIBCPP_HIDE_FROM_ABI constexpr static for_each_result<_Iter, _Func>
+ __for_each_impl(_Iter __first, _Sent __last, _Func& __func, _Proj& __proj) {
for (; __first != __last; ++__first)
std::invoke(__func, std::invoke(__proj, *__first));
return {std::move(__first), std::move(__func)};
}
public:
- template <input_iterator _Iter, sentinel_for<_Iter> _Sent,
+ template <input_iterator _Iter,
+ sentinel_for<_Iter> _Sent,
class _Proj = identity,
indirectly_unary_invocable<projected<_Iter, _Proj>> _Func>
- _LIBCPP_HIDE_FROM_ABI constexpr
- for_each_result<_Iter, _Func> operator()(_Iter __first, _Sent __last, _Func __func, _Proj __proj = {}) const {
+ _LIBCPP_HIDE_FROM_ABI constexpr for_each_result<_Iter, _Func>
+ operator()(_Iter __first, _Sent __last, _Func __func, _Proj __proj = {}) const {
return __for_each_impl(std::move(__first), std::move(__last), __func, __proj);
}
template <input_range _Range,
class _Proj = identity,
indirectly_unary_invocable<projected<iterator_t<_Range>, _Proj>> _Func>
- _LIBCPP_HIDE_FROM_ABI constexpr
- for_each_result<borrowed_iterator_t<_Range>, _Func> operator()(_Range&& __range,
- _Func __func,
- _Proj __proj = {}) const {
+ _LIBCPP_HIDE_FROM_ABI constexpr for_each_result<borrowed_iterator_t<_Range>, _Func>
+ operator()(_Range&& __range, _Func __func, _Proj __proj = {}) const {
return __for_each_impl(ranges::begin(__range), ranges::end(__range), __func, __proj);
}
-
};
} // namespace __for_each
inline namespace __cpo {
- inline constexpr auto for_each = __for_each::__fn{};
+inline constexpr auto for_each = __for_each::__fn{};
} // namespace __cpo
} // namespace ranges
diff --git a/libcxx/include/__algorithm/ranges_for_each_n.h b/libcxx/include/__algorithm/ranges_for_each_n.h
index daf0a5d828299..53ccb9a6035a4 100644
--- a/libcxx/include/__algorithm/ranges_for_each_n.h
+++ b/libcxx/include/__algorithm/ranges_for_each_n.h
@@ -35,27 +35,20 @@ using for_each_n_result = in_fun_result<_Iter, _Func>;
namespace __for_each_n {
struct __fn {
-
- template <input_iterator _Iter,
- class _Proj = identity,
- indirectly_unary_invocable<projected<_Iter, _Proj>> _Func>
- _LIBCPP_HIDE_FROM_ABI constexpr
- for_each_n_result<_Iter, _Func> operator()(_Iter __first,
- iter_
diff erence_t<_Iter> __count,
- _Func __func,
- _Proj __proj = {}) const {
+ template <input_iterator _Iter, class _Proj = identity, indirectly_unary_invocable<projected<_Iter, _Proj>> _Func>
+ _LIBCPP_HIDE_FROM_ABI constexpr for_each_n_result<_Iter, _Func>
+ operator()(_Iter __first, iter_
diff erence_t<_Iter> __count, _Func __func, _Proj __proj = {}) const {
while (__count-- > 0) {
std::invoke(__func, std::invoke(__proj, *__first));
++__first;
}
return {std::move(__first), std::move(__func)};
}
-
};
} // namespace __for_each_n
inline namespace __cpo {
- inline constexpr auto for_each_n = __for_each_n::__fn{};
+inline constexpr auto for_each_n = __for_each_n::__fn{};
} // namespace __cpo
} // namespace ranges
diff --git a/libcxx/include/__algorithm/ranges_generate.h b/libcxx/include/__algorithm/ranges_generate.h
index de0db1665f1e0..3ff1e13c42209 100644
--- a/libcxx/include/__algorithm/ranges_generate.h
+++ b/libcxx/include/__algorithm/ranges_generate.h
@@ -32,10 +32,8 @@ namespace ranges {
namespace __generate {
struct __fn {
-
template <class _OutIter, class _Sent, class _Func>
- _LIBCPP_HIDE_FROM_ABI constexpr
- static _OutIter __generate_fn_impl(_OutIter __first, _Sent __last, _Func& __gen) {
+ _LIBCPP_HIDE_FROM_ABI constexpr static _OutIter __generate_fn_impl(_OutIter __first, _Sent __last, _Func& __gen) {
for (; __first != __last; ++__first) {
*__first = __gen();
}
@@ -44,25 +42,22 @@ struct __fn {
}
template <input_or_output_iterator _OutIter, sentinel_for<_OutIter> _Sent, copy_constructible _Func>
- requires invocable<_Func&> && indirectly_writable<_OutIter, invoke_result_t<_Func&>>
- _LIBCPP_HIDE_FROM_ABI constexpr
- _OutIter operator()(_OutIter __first, _Sent __last, _Func __gen) const {
+ requires invocable<_Func&> && indirectly_writable<_OutIter, invoke_result_t<_Func&>>
+ _LIBCPP_HIDE_FROM_ABI constexpr _OutIter operator()(_OutIter __first, _Sent __last, _Func __gen) const {
return __generate_fn_impl(std::move(__first), std::move(__last), __gen);
}
template <class _Range, copy_constructible _Func>
- requires invocable<_Func&> && output_range<_Range, invoke_result_t<_Func&>>
- _LIBCPP_HIDE_FROM_ABI constexpr
- borrowed_iterator_t<_Range> operator()(_Range&& __range, _Func __gen) const {
+ requires invocable<_Func&> && output_range<_Range, invoke_result_t<_Func&>>
+ _LIBCPP_HIDE_FROM_ABI constexpr borrowed_iterator_t<_Range> operator()(_Range&& __range, _Func __gen) const {
return __generate_fn_impl(ranges::begin(__range), ranges::end(__range), __gen);
}
-
};
} // namespace __generate
inline namespace __cpo {
- inline constexpr auto generate = __generate::__fn{};
+inline constexpr auto generate = __generate::__fn{};
} // namespace __cpo
} // namespace ranges
diff --git a/libcxx/include/__algorithm/ranges_generate_n.h b/libcxx/include/__algorithm/ranges_generate_n.h
index 122cd8db79494..c025c621a191c 100644
--- a/libcxx/include/__algorithm/ranges_generate_n.h
+++ b/libcxx/include/__algorithm/ranges_generate_n.h
@@ -33,11 +33,10 @@ namespace ranges {
namespace __generate_n {
struct __fn {
-
template <input_or_output_iterator _OutIter, copy_constructible _Func>
- requires invocable<_Func&> && indirectly_writable<_OutIter, invoke_result_t<_Func&>>
- _LIBCPP_HIDE_FROM_ABI constexpr
- _OutIter operator()(_OutIter __first, iter_
diff erence_t<_OutIter> __n, _Func __gen) const {
+ requires invocable<_Func&> && indirectly_writable<_OutIter, invoke_result_t<_Func&>>
+ _LIBCPP_HIDE_FROM_ABI constexpr _OutIter
+ operator()(_OutIter __first, iter_
diff erence_t<_OutIter> __n, _Func __gen) const {
for (; __n > 0; --__n) {
*__first = __gen();
++__first;
@@ -45,13 +44,12 @@ struct __fn {
return __first;
}
-
};
} // namespace __generate_n
inline namespace __cpo {
- inline constexpr auto generate_n = __generate_n::__fn{};
+inline constexpr auto generate_n = __generate_n::__fn{};
} // namespace __cpo
} // namespace ranges
diff --git a/libcxx/include/__algorithm/ranges_includes.h b/libcxx/include/__algorithm/ranges_includes.h
index 314a923771f33..aa35080c8cfd4 100644
--- a/libcxx/include/__algorithm/ranges_includes.h
+++ b/libcxx/include/__algorithm/ranges_includes.h
@@ -35,14 +35,13 @@ namespace ranges {
namespace __includes {
struct __fn {
- template <
- input_iterator _Iter1,
- sentinel_for<_Iter1> _Sent1,
- input_iterator _Iter2,
- sentinel_for<_Iter2> _Sent2,
- class _Proj1 = identity,
- class _Proj2 = identity,
- indirect_strict_weak_order<projected<_Iter1, _Proj1>, projected<_Iter2, _Proj2>> _Comp = ranges::less>
+ template <input_iterator _Iter1,
+ sentinel_for<_Iter1> _Sent1,
+ input_iterator _Iter2,
+ sentinel_for<_Iter2> _Sent2,
+ class _Proj1 = identity,
+ class _Proj2 = identity,
+ indirect_strict_weak_order<projected<_Iter1, _Proj1>, projected<_Iter2, _Proj2>> _Comp = ranges::less>
_LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr bool operator()(
_Iter1 __first1,
_Sent1 __last1,
@@ -61,13 +60,12 @@ struct __fn {
std::move(__proj2));
}
- template <
- input_range _Range1,
- input_range _Range2,
- class _Proj1 = identity,
- class _Proj2 = identity,
- indirect_strict_weak_order<projected<iterator_t<_Range1>, _Proj1>, projected<iterator_t<_Range2>, _Proj2>>
- _Comp = ranges::less>
+ template <input_range _Range1,
+ input_range _Range2,
+ class _Proj1 = identity,
+ class _Proj2 = identity,
+ indirect_strict_weak_order<projected<iterator_t<_Range1>, _Proj1>, projected<iterator_t<_Range2>, _Proj2>>
+ _Comp = ranges::less>
_LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr bool operator()(
_Range1&& __range1, _Range2&& __range2, _Comp __comp = {}, _Proj1 __proj1 = {}, _Proj2 __proj2 = {}) const {
return std::__includes(
@@ -84,7 +82,7 @@ struct __fn {
} // namespace __includes
inline namespace __cpo {
- inline constexpr auto includes = __includes::__fn{};
+inline constexpr auto includes = __includes::__fn{};
} // namespace __cpo
} // namespace ranges
diff --git a/libcxx/include/__algorithm/ranges_inplace_merge.h b/libcxx/include/__algorithm/ranges_inplace_merge.h
index 8f78975d78977..86001b003d5ca 100644
--- a/libcxx/include/__algorithm/ranges_inplace_merge.h
+++ b/libcxx/include/__algorithm/ranges_inplace_merge.h
@@ -38,43 +38,37 @@ _LIBCPP_BEGIN_NAMESPACE_STD
namespace ranges {
namespace __inplace_merge {
- struct __fn {
- template <class _Iter, class _Sent, class _Comp, class _Proj>
- _LIBCPP_HIDE_FROM_ABI static constexpr auto
- __inplace_merge_impl(_Iter __first, _Iter __middle, _Sent __last, _Comp&& __comp, _Proj&& __proj) {
- auto __last_iter = ranges::next(__middle, __last);
- std::__inplace_merge<_RangeAlgPolicy>(
- std::move(__first), std::move(__middle), __last_iter, std::__make_projected(__comp, __proj));
- return __last_iter;
- }
+struct __fn {
+ template <class _Iter, class _Sent, class _Comp, class _Proj>
+ _LIBCPP_HIDE_FROM_ABI static constexpr auto
+ __inplace_merge_impl(_Iter __first, _Iter __middle, _Sent __last, _Comp&& __comp, _Proj&& __proj) {
+ auto __last_iter = ranges::next(__middle, __last);
+ std::__inplace_merge<_RangeAlgPolicy>(
+ std::move(__first), std::move(__middle), __last_iter, std::__make_projected(__comp, __proj));
+ return __last_iter;
+ }
- template <
- bidirectional_iterator _Iter,
- sentinel_for<_Iter> _Sent,
- class _Comp = ranges::less,
- class _Proj = identity>
- requires sortable<_Iter, _Comp, _Proj>
- _LIBCPP_HIDE_FROM_ABI _Iter
- operator()(_Iter __first, _Iter __middle, _Sent __last, _Comp __comp = {}, _Proj __proj = {}) const {
- return __inplace_merge_impl(
- std::move(__first), std::move(__middle), std::move(__last), std::move(__comp), std::move(__proj));
- }
+ template <bidirectional_iterator _Iter, sentinel_for<_Iter> _Sent, class _Comp = ranges::less, class _Proj = identity>
+ requires sortable<_Iter, _Comp, _Proj>
+ _LIBCPP_HIDE_FROM_ABI _Iter
+ operator()(_Iter __first, _Iter __middle, _Sent __last, _Comp __comp = {}, _Proj __proj = {}) const {
+ return __inplace_merge_impl(
+ std::move(__first), std::move(__middle), std::move(__last), std::move(__comp), std::move(__proj));
+ }
- template <bidirectional_range _Range, class _Comp = ranges::less, class _Proj = identity>
- requires sortable<
- iterator_t<_Range>,
- _Comp,
- _Proj> _LIBCPP_HIDE_FROM_ABI borrowed_iterator_t<_Range>
- operator()(_Range&& __range, iterator_t<_Range> __middle, _Comp __comp = {}, _Proj __proj = {}) const {
- return __inplace_merge_impl(
- ranges::begin(__range), std::move(__middle), ranges::end(__range), std::move(__comp), std::move(__proj));
- }
- };
+ template <bidirectional_range _Range, class _Comp = ranges::less, class _Proj = identity>
+ requires sortable<iterator_t<_Range>, _Comp, _Proj>
+ _LIBCPP_HIDE_FROM_ABI borrowed_iterator_t<_Range>
+ operator()(_Range&& __range, iterator_t<_Range> __middle, _Comp __comp = {}, _Proj __proj = {}) const {
+ return __inplace_merge_impl(
+ ranges::begin(__range), std::move(__middle), ranges::end(__range), std::move(__comp), std::move(__proj));
+ }
+};
} // namespace __inplace_merge
inline namespace __cpo {
- inline constexpr auto inplace_merge = __inplace_merge::__fn{};
+inline constexpr auto inplace_merge = __inplace_merge::__fn{};
} // namespace __cpo
} // namespace ranges
diff --git a/libcxx/include/__algorithm/ranges_is_heap.h b/libcxx/include/__algorithm/ranges_is_heap.h
index 9c77e0c3f0717..f298c347b747a 100644
--- a/libcxx/include/__algorithm/ranges_is_heap.h
+++ b/libcxx/include/__algorithm/ranges_is_heap.h
@@ -34,28 +34,30 @@ namespace ranges {
namespace __is_heap {
struct __fn {
-
template <class _Iter, class _Sent, class _Proj, class _Comp>
- _LIBCPP_HIDE_FROM_ABI constexpr
- static bool __is_heap_fn_impl(_Iter __first, _Sent __last, _Comp& __comp, _Proj& __proj) {
- auto __last_iter = ranges::next(__first, __last);
+ _LIBCPP_HIDE_FROM_ABI constexpr static bool
+ __is_heap_fn_impl(_Iter __first, _Sent __last, _Comp& __comp, _Proj& __proj) {
+ auto __last_iter = ranges::next(__first, __last);
auto&& __projected_comp = std::__make_projected(__comp, __proj);
auto __result = std::__is_heap_until(std::move(__first), std::move(__last_iter), __projected_comp);
return __result == __last;
}
- template <random_access_iterator _Iter, sentinel_for<_Iter> _Sent, class _Proj = identity,
+ template <random_access_iterator _Iter,
+ sentinel_for<_Iter> _Sent,
+ class _Proj = identity,
indirect_strict_weak_order<projected<_Iter, _Proj>> _Comp = ranges::less>
- _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr
- bool operator()(_Iter __first, _Sent __last, _Comp __comp = {}, _Proj __proj = {}) const {
+ _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr bool
+ operator()(_Iter __first, _Sent __last, _Comp __comp = {}, _Proj __proj = {}) const {
return __is_heap_fn_impl(std::move(__first), std::move(__last), __comp, __proj);
}
- template <random_access_range _Range, class _Proj = identity,
+ template <random_access_range _Range,
+ class _Proj = identity,
indirect_strict_weak_order<projected<iterator_t<_Range>, _Proj>> _Comp = ranges::less>
- _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr
- bool operator()(_Range&& __range, _Comp __comp = {}, _Proj __proj = {}) const {
+ _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr bool
+ operator()(_Range&& __range, _Comp __comp = {}, _Proj __proj = {}) const {
return __is_heap_fn_impl(ranges::begin(__range), ranges::end(__range), __comp, __proj);
}
};
@@ -63,7 +65,7 @@ struct __fn {
} // namespace __is_heap
inline namespace __cpo {
- inline constexpr auto is_heap = __is_heap::__fn{};
+inline constexpr auto is_heap = __is_heap::__fn{};
} // namespace __cpo
} // namespace ranges
diff --git a/libcxx/include/__algorithm/ranges_is_heap_until.h b/libcxx/include/__algorithm/ranges_is_heap_until.h
index 3b1fec758fa64..73f13fb50440e 100644
--- a/libcxx/include/__algorithm/ranges_is_heap_until.h
+++ b/libcxx/include/__algorithm/ranges_is_heap_until.h
@@ -35,36 +35,37 @@ namespace ranges {
namespace __is_heap_until {
struct __fn {
-
template <class _Iter, class _Sent, class _Proj, class _Comp>
- _LIBCPP_HIDE_FROM_ABI constexpr
- static _Iter __is_heap_until_fn_impl(_Iter __first, _Sent __last, _Comp& __comp, _Proj& __proj) {
- auto __last_iter = ranges::next(__first, __last);
+ _LIBCPP_HIDE_FROM_ABI constexpr static _Iter
+ __is_heap_until_fn_impl(_Iter __first, _Sent __last, _Comp& __comp, _Proj& __proj) {
+ auto __last_iter = ranges::next(__first, __last);
auto&& __projected_comp = std::__make_projected(__comp, __proj);
return std::__is_heap_until(std::move(__first), std::move(__last_iter), __projected_comp);
}
- template <random_access_iterator _Iter, sentinel_for<_Iter> _Sent, class _Proj = identity,
+ template <random_access_iterator _Iter,
+ sentinel_for<_Iter> _Sent,
+ class _Proj = identity,
indirect_strict_weak_order<projected<_Iter, _Proj>> _Comp = ranges::less>
- _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr
- _Iter operator()(_Iter __first, _Sent __last, _Comp __comp = {}, _Proj __proj = {}) const {
+ _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr _Iter
+ operator()(_Iter __first, _Sent __last, _Comp __comp = {}, _Proj __proj = {}) const {
return __is_heap_until_fn_impl(std::move(__first), std::move(__last), __comp, __proj);
}
- template <random_access_range _Range, class _Proj = identity,
+ template <random_access_range _Range,
+ class _Proj = identity,
indirect_strict_weak_order<projected<iterator_t<_Range>, _Proj>> _Comp = ranges::less>
- _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr
- borrowed_iterator_t<_Range> operator()(_Range&& __range, _Comp __comp = {}, _Proj __proj = {}) const {
+ _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr borrowed_iterator_t<_Range>
+ operator()(_Range&& __range, _Comp __comp = {}, _Proj __proj = {}) const {
return __is_heap_until_fn_impl(ranges::begin(__range), ranges::end(__range), __comp, __proj);
}
-
};
} // namespace __is_heap_until
inline namespace __cpo {
- inline constexpr auto is_heap_until = __is_heap_until::__fn{};
+inline constexpr auto is_heap_until = __is_heap_until::__fn{};
} // namespace __cpo
} // namespace ranges
diff --git a/libcxx/include/__algorithm/ranges_is_partitioned.h b/libcxx/include/__algorithm/ranges_is_partitioned.h
index 6782717ccacad..f81c9c311a5b5 100644
--- a/libcxx/include/__algorithm/ranges_is_partitioned.h
+++ b/libcxx/include/__algorithm/ranges_is_partitioned.h
@@ -30,10 +30,9 @@ _LIBCPP_BEGIN_NAMESPACE_STD
namespace ranges {
namespace __is_partitioned {
struct __fn {
-
template <class _Iter, class _Sent, class _Proj, class _Pred>
- _LIBCPP_HIDE_FROM_ABI constexpr static
- bool __is_parititioned_impl(_Iter __first, _Sent __last, _Pred& __pred, _Proj& __proj) {
+ _LIBCPP_HIDE_FROM_ABI constexpr static bool
+ __is_parititioned_impl(_Iter __first, _Sent __last, _Pred& __pred, _Proj& __proj) {
for (; __first != __last; ++__first) {
if (!std::invoke(__pred, std::invoke(__proj, *__first)))
break;
@@ -51,26 +50,27 @@ struct __fn {
return true;
}
- template <input_iterator _Iter, sentinel_for<_Iter> _Sent,
+ template <input_iterator _Iter,
+ sentinel_for<_Iter> _Sent,
class _Proj = identity,
indirect_unary_predicate<projected<_Iter, _Proj>> _Pred>
- _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr
- bool operator()(_Iter __first, _Sent __last, _Pred __pred, _Proj __proj = {}) const {
+ _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr bool
+ operator()(_Iter __first, _Sent __last, _Pred __pred, _Proj __proj = {}) const {
return __is_parititioned_impl(std::move(__first), std::move(__last), __pred, __proj);
}
template <input_range _Range,
class _Proj = identity,
indirect_unary_predicate<projected<iterator_t<_Range>, _Proj>> _Pred>
- _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr
- bool operator()(_Range&& __range, _Pred __pred, _Proj __proj = {}) const {
+ _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr bool
+ operator()(_Range&& __range, _Pred __pred, _Proj __proj = {}) const {
return __is_parititioned_impl(ranges::begin(__range), ranges::end(__range), __pred, __proj);
}
};
} // namespace __is_partitioned
inline namespace __cpo {
- inline constexpr auto is_partitioned = __is_partitioned::__fn{};
+inline constexpr auto is_partitioned = __is_partitioned::__fn{};
} // namespace __cpo
} // namespace ranges
diff --git a/libcxx/include/__algorithm/ranges_is_permutation.h b/libcxx/include/__algorithm/ranges_is_permutation.h
index 95a0a82514304..2b99839bc66fa 100644
--- a/libcxx/include/__algorithm/ranges_is_permutation.h
+++ b/libcxx/include/__algorithm/ranges_is_permutation.h
@@ -32,53 +32,66 @@ _LIBCPP_BEGIN_NAMESPACE_STD
namespace ranges {
namespace __is_permutation {
struct __fn {
-
- template <class _Iter1, class _Sent1, class _Iter2, class _Sent2,
- class _Proj1, class _Proj2, class _Pred>
- _LIBCPP_HIDE_FROM_ABI constexpr static
- bool __is_permutation_func_impl(_Iter1 __first1, _Sent1 __last1, _Iter2 __first2, _Sent2 __last2,
- _Pred& __pred, _Proj1& __proj1, _Proj2& __proj2) {
+ template <class _Iter1, class _Sent1, class _Iter2, class _Sent2, class _Proj1, class _Proj2, class _Pred>
+ _LIBCPP_HIDE_FROM_ABI constexpr static bool __is_permutation_func_impl(
+ _Iter1 __first1,
+ _Sent1 __last1,
+ _Iter2 __first2,
+ _Sent2 __last2,
+ _Pred& __pred,
+ _Proj1& __proj1,
+ _Proj2& __proj2) {
return std::__is_permutation<_RangeAlgPolicy>(
- std::move(__first1), std::move(__last1), std::move(__first2), std::move(__last2),
- __pred, __proj1, __proj2);
+ std::move(__first1), std::move(__last1), std::move(__first2), std::move(__last2), __pred, __proj1, __proj2);
}
- template <forward_iterator _Iter1, sentinel_for<_Iter1> _Sent1,
- forward_iterator _Iter2, sentinel_for<_Iter2> _Sent2,
- class _Proj1 = identity,
- class _Proj2 = identity,
- indirect_equivalence_relation<projected<_Iter1, _Proj1>,
- projected<_Iter2, _Proj2>> _Pred = ranges::equal_to>
- _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr
- bool operator()(_Iter1 __first1, _Sent1 __last1, _Iter2 __first2, _Sent2 __last2,
- _Pred __pred = {}, _Proj1 __proj1 = {}, _Proj2 __proj2 = {}) const {
+ template <
+ forward_iterator _Iter1,
+ sentinel_for<_Iter1> _Sent1,
+ forward_iterator _Iter2,
+ sentinel_for<_Iter2> _Sent2,
+ class _Proj1 = identity,
+ class _Proj2 = identity,
+ indirect_equivalence_relation<projected<_Iter1, _Proj1>, projected<_Iter2, _Proj2>> _Pred = ranges::equal_to>
+ _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr bool operator()(
+ _Iter1 __first1,
+ _Sent1 __last1,
+ _Iter2 __first2,
+ _Sent2 __last2,
+ _Pred __pred = {},
+ _Proj1 __proj1 = {},
+ _Proj2 __proj2 = {}) const {
return __is_permutation_func_impl(
- std::move(__first1), std::move(__last1), std::move(__first2), std::move(__last2),
- __pred, __proj1, __proj2);
+ std::move(__first1), std::move(__last1), std::move(__first2), std::move(__last2), __pred, __proj1, __proj2);
}
template <forward_range _Range1,
forward_range _Range2,
- class _Proj1 = identity,
- class _Proj2 = identity,
- indirect_equivalence_relation<projected<iterator_t<_Range1>, _Proj1>, projected<iterator_t<_Range2>, _Proj2>> _Pred = ranges::equal_to>
- _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr
- bool operator()(_Range1&& __range1, _Range2&& __range2,
- _Pred __pred = {}, _Proj1 __proj1 = {}, _Proj2 __proj2 = {}) const {
+ class _Proj1 = identity,
+ class _Proj2 = identity,
+ indirect_equivalence_relation<projected<iterator_t<_Range1>, _Proj1>,
+ projected<iterator_t<_Range2>, _Proj2>> _Pred = ranges::equal_to>
+ _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr bool operator()(
+ _Range1&& __range1, _Range2&& __range2, _Pred __pred = {}, _Proj1 __proj1 = {}, _Proj2 __proj2 = {}) const {
if constexpr (sized_range<_Range1> && sized_range<_Range2>) {
if (ranges::distance(__range1) != ranges::distance(__range2))
return false;
}
return __is_permutation_func_impl(
- ranges::begin(__range1), ranges::end(__range1), ranges::begin(__range2), ranges::end(__range2),
- __pred, __proj1, __proj2);
+ ranges::begin(__range1),
+ ranges::end(__range1),
+ ranges::begin(__range2),
+ ranges::end(__range2),
+ __pred,
+ __proj1,
+ __proj2);
}
};
} // namespace __is_permutation
inline namespace __cpo {
- inline constexpr auto is_permutation = __is_permutation::__fn{};
+inline constexpr auto is_permutation = __is_permutation::__fn{};
} // namespace __cpo
} // namespace ranges
diff --git a/libcxx/include/__algorithm/ranges_is_sorted.h b/libcxx/include/__algorithm/ranges_is_sorted.h
index 50c97baa83c32..3eb2c768d66a2 100644
--- a/libcxx/include/__algorithm/ranges_is_sorted.h
+++ b/libcxx/include/__algorithm/ranges_is_sorted.h
@@ -30,19 +30,20 @@ _LIBCPP_BEGIN_NAMESPACE_STD
namespace ranges {
namespace __is_sorted {
struct __fn {
- template <forward_iterator _Iter, sentinel_for<_Iter> _Sent,
- class _Proj = identity,
+ template <forward_iterator _Iter,
+ sentinel_for<_Iter> _Sent,
+ class _Proj = identity,
indirect_strict_weak_order<projected<_Iter, _Proj>> _Comp = ranges::less>
- _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr
- bool operator()(_Iter __first, _Sent __last, _Comp __comp = {}, _Proj __proj = {}) const {
+ _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr bool
+ operator()(_Iter __first, _Sent __last, _Comp __comp = {}, _Proj __proj = {}) const {
return ranges::__is_sorted_until_impl(std::move(__first), __last, __comp, __proj) == __last;
}
template <forward_range _Range,
- class _Proj = identity,
+ class _Proj = identity,
indirect_strict_weak_order<projected<iterator_t<_Range>, _Proj>> _Comp = ranges::less>
- _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr
- bool operator()(_Range&& __range, _Comp __comp = {}, _Proj __proj = {}) const {
+ _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr bool
+ operator()(_Range&& __range, _Comp __comp = {}, _Proj __proj = {}) const {
auto __last = ranges::end(__range);
return ranges::__is_sorted_until_impl(ranges::begin(__range), __last, __comp, __proj) == __last;
}
@@ -50,7 +51,7 @@ struct __fn {
} // namespace __is_sorted
inline namespace __cpo {
- inline constexpr auto is_sorted = __is_sorted::__fn{};
+inline constexpr auto is_sorted = __is_sorted::__fn{};
} // namespace __cpo
} // namespace ranges
diff --git a/libcxx/include/__algorithm/ranges_is_sorted_until.h b/libcxx/include/__algorithm/ranges_is_sorted_until.h
index f139d0391de91..19e9875d2757d 100644
--- a/libcxx/include/__algorithm/ranges_is_sorted_until.h
+++ b/libcxx/include/__algorithm/ranges_is_sorted_until.h
@@ -31,8 +31,8 @@ _LIBCPP_BEGIN_NAMESPACE_STD
namespace ranges {
template <class _Iter, class _Sent, class _Proj, class _Comp>
-_LIBCPP_HIDE_FROM_ABI constexpr
-_Iter __is_sorted_until_impl(_Iter __first, _Sent __last, _Comp& __comp, _Proj& __proj) {
+_LIBCPP_HIDE_FROM_ABI constexpr _Iter
+__is_sorted_until_impl(_Iter __first, _Sent __last, _Comp& __comp, _Proj& __proj) {
if (__first == __last)
return __first;
auto __i = __first;
@@ -46,26 +46,27 @@ _Iter __is_sorted_until_impl(_Iter __first, _Sent __last, _Comp& __comp, _Proj&
namespace __is_sorted_until {
struct __fn {
- template <forward_iterator _Iter, sentinel_for<_Iter> _Sent,
- class _Proj = identity,
+ template <forward_iterator _Iter,
+ sentinel_for<_Iter> _Sent,
+ class _Proj = identity,
indirect_strict_weak_order<projected<_Iter, _Proj>> _Comp = ranges::less>
- _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr
- _Iter operator()(_Iter __first, _Sent __last, _Comp __comp = {}, _Proj __proj = {}) const {
+ _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr _Iter
+ operator()(_Iter __first, _Sent __last, _Comp __comp = {}, _Proj __proj = {}) const {
return ranges::__is_sorted_until_impl(std::move(__first), std::move(__last), __comp, __proj);
}
template <forward_range _Range,
- class _Proj = identity,
+ class _Proj = identity,
indirect_strict_weak_order<projected<iterator_t<_Range>, _Proj>> _Comp = ranges::less>
- _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr
- borrowed_iterator_t<_Range> operator()(_Range&& __range, _Comp __comp = {}, _Proj __proj = {}) const {
+ _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr borrowed_iterator_t<_Range>
+ operator()(_Range&& __range, _Comp __comp = {}, _Proj __proj = {}) const {
return ranges::__is_sorted_until_impl(ranges::begin(__range), ranges::end(__range), __comp, __proj);
}
};
} // namespace __is_sorted_until
inline namespace __cpo {
- inline constexpr auto is_sorted_until = __is_sorted_until::__fn{};
+inline constexpr auto is_sorted_until = __is_sorted_until::__fn{};
} // namespace __cpo
} // namespace ranges
diff --git a/libcxx/include/__algorithm/ranges_lexicographical_compare.h b/libcxx/include/__algorithm/ranges_lexicographical_compare.h
index c51f4d7e5ca0c..5b843dfd7b313 100644
--- a/libcxx/include/__algorithm/ranges_lexicographical_compare.h
+++ b/libcxx/include/__algorithm/ranges_lexicographical_compare.h
@@ -30,17 +30,17 @@ _LIBCPP_BEGIN_NAMESPACE_STD
namespace ranges {
namespace __lexicographical_compare {
struct __fn {
-
template <class _Iter1, class _Sent1, class _Iter2, class _Sent2, class _Proj1, class _Proj2, class _Comp>
- _LIBCPP_HIDE_FROM_ABI constexpr static
- bool __lexicographical_compare_impl(_Iter1 __first1, _Sent1 __last1,
- _Iter2 __first2, _Sent2 __last2,
- _Comp& __comp,
- _Proj1& __proj1,
- _Proj2& __proj2) {
+ _LIBCPP_HIDE_FROM_ABI constexpr static bool __lexicographical_compare_impl(
+ _Iter1 __first1,
+ _Sent1 __last1,
+ _Iter2 __first2,
+ _Sent2 __last2,
+ _Comp& __comp,
+ _Proj1& __proj1,
+ _Proj2& __proj2) {
while (__first2 != __last2) {
- if (__first1 == __last1
- || std::invoke(__comp, std::invoke(__proj1, *__first1), std::invoke(__proj2, *__first2)))
+ if (__first1 == __last1 || std::invoke(__comp, std::invoke(__proj1, *__first1), std::invoke(__proj2, *__first2)))
return true;
if (std::invoke(__comp, std::invoke(__proj2, *__first2), std::invoke(__proj1, *__first1)))
return false;
@@ -50,44 +50,47 @@ struct __fn {
return false;
}
- template <input_iterator _Iter1, sentinel_for<_Iter1> _Sent1,
- input_iterator _Iter2, sentinel_for<_Iter2> _Sent2,
- class _Proj1 = identity,
- class _Proj2 = identity,
+ template <input_iterator _Iter1,
+ sentinel_for<_Iter1> _Sent1,
+ input_iterator _Iter2,
+ sentinel_for<_Iter2> _Sent2,
+ class _Proj1 = identity,
+ class _Proj2 = identity,
indirect_strict_weak_order<projected<_Iter1, _Proj1>, projected<_Iter2, _Proj2>> _Comp = ranges::less>
- _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr
- bool operator()(_Iter1 __first1, _Sent1 __last1,
- _Iter2 __first2, _Sent2 __last2,
- _Comp __comp = {},
- _Proj1 __proj1 = {},
- _Proj2 __proj2 = {}) const {
- return __lexicographical_compare_impl(std::move(__first1), std::move(__last1),
- std::move(__first2), std::move(__last2),
- __comp,
- __proj1,
- __proj2);
+ _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr bool operator()(
+ _Iter1 __first1,
+ _Sent1 __last1,
+ _Iter2 __first2,
+ _Sent2 __last2,
+ _Comp __comp = {},
+ _Proj1 __proj1 = {},
+ _Proj2 __proj2 = {}) const {
+ return __lexicographical_compare_impl(
+ std::move(__first1), std::move(__last1), std::move(__first2), std::move(__last2), __comp, __proj1, __proj2);
}
template <input_range _Range1,
input_range _Range2,
class _Proj1 = identity,
class _Proj2 = identity,
- indirect_strict_weak_order<projected<iterator_t<_Range1>, _Proj1>,
- projected<iterator_t<_Range2>, _Proj2>> _Comp = ranges::less>
- _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr
- bool operator()(_Range1&& __range1, _Range2&& __range2, _Comp __comp = {}, _Proj1 __proj1 = {}, _Proj2 __proj2 = {}) const {
- return __lexicographical_compare_impl(ranges::begin(__range1), ranges::end(__range1),
- ranges::begin(__range2), ranges::end(__range2),
- __comp,
- __proj1,
- __proj2);
+ indirect_strict_weak_order<projected<iterator_t<_Range1>, _Proj1>, projected<iterator_t<_Range2>, _Proj2>>
+ _Comp = ranges::less>
+ _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr bool operator()(
+ _Range1&& __range1, _Range2&& __range2, _Comp __comp = {}, _Proj1 __proj1 = {}, _Proj2 __proj2 = {}) const {
+ return __lexicographical_compare_impl(
+ ranges::begin(__range1),
+ ranges::end(__range1),
+ ranges::begin(__range2),
+ ranges::end(__range2),
+ __comp,
+ __proj1,
+ __proj2);
}
-
};
} // namespace __lexicographical_compare
inline namespace __cpo {
- inline constexpr auto lexicographical_compare = __lexicographical_compare::__fn{};
+inline constexpr auto lexicographical_compare = __lexicographical_compare::__fn{};
} // namespace __cpo
} // namespace ranges
diff --git a/libcxx/include/__algorithm/ranges_lower_bound.h b/libcxx/include/__algorithm/ranges_lower_bound.h
index 3293886fda4db..58b3f815b96a4 100644
--- a/libcxx/include/__algorithm/ranges_lower_bound.h
+++ b/libcxx/include/__algorithm/ranges_lower_bound.h
@@ -35,27 +35,29 @@ namespace ranges {
namespace __lower_bound {
struct __fn {
- template <forward_iterator _Iter, sentinel_for<_Iter> _Sent, class _Type, class _Proj = identity,
+ template <forward_iterator _Iter,
+ sentinel_for<_Iter> _Sent,
+ class _Type,
+ class _Proj = identity,
indirect_strict_weak_order<const _Type*, projected<_Iter, _Proj>> _Comp = ranges::less>
- _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr
- _Iter operator()(_Iter __first, _Sent __last, const _Type& __value, _Comp __comp = {}, _Proj __proj = {}) const {
+ _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr _Iter
+ operator()(_Iter __first, _Sent __last, const _Type& __value, _Comp __comp = {}, _Proj __proj = {}) const {
return std::__lower_bound<_RangeAlgPolicy>(__first, __last, __value, __comp, __proj);
}
- template <forward_range _Range, class _Type, class _Proj = identity,
+ template <forward_range _Range,
+ class _Type,
+ class _Proj = identity,
indirect_strict_weak_order<const _Type*, projected<iterator_t<_Range>, _Proj>> _Comp = ranges::less>
- _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr
- borrowed_iterator_t<_Range> operator()(_Range&& __r,
- const _Type& __value,
- _Comp __comp = {},
- _Proj __proj = {}) const {
+ _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr borrowed_iterator_t<_Range>
+ operator()(_Range&& __r, const _Type& __value, _Comp __comp = {}, _Proj __proj = {}) const {
return std::__lower_bound<_RangeAlgPolicy>(ranges::begin(__r), ranges::end(__r), __value, __comp, __proj);
}
};
} // namespace __lower_bound
inline namespace __cpo {
- inline constexpr auto lower_bound = __lower_bound::__fn{};
+inline constexpr auto lower_bound = __lower_bound::__fn{};
} // namespace __cpo
} // namespace ranges
diff --git a/libcxx/include/__algorithm/ranges_make_heap.h b/libcxx/include/__algorithm/ranges_make_heap.h
index 7f92fa3104371..f17eabff43d2a 100644
--- a/libcxx/include/__algorithm/ranges_make_heap.h
+++ b/libcxx/include/__algorithm/ranges_make_heap.h
@@ -41,8 +41,8 @@ namespace __make_heap {
struct __fn {
template <class _Iter, class _Sent, class _Comp, class _Proj>
- _LIBCPP_HIDE_FROM_ABI constexpr static
- _Iter __make_heap_fn_impl(_Iter __first, _Sent __last, _Comp& __comp, _Proj& __proj) {
+ _LIBCPP_HIDE_FROM_ABI constexpr static _Iter
+ __make_heap_fn_impl(_Iter __first, _Sent __last, _Comp& __comp, _Proj& __proj) {
auto __last_iter = ranges::next(__first, __last);
auto&& __projected_comp = std::__make_projected(__comp, __proj);
@@ -53,15 +53,15 @@ struct __fn {
template <random_access_iterator _Iter, sentinel_for<_Iter> _Sent, class _Comp = ranges::less, class _Proj = identity>
requires sortable<_Iter, _Comp, _Proj>
- _LIBCPP_HIDE_FROM_ABI constexpr
- _Iter operator()(_Iter __first, _Sent __last, _Comp __comp = {}, _Proj __proj = {}) const {
+ _LIBCPP_HIDE_FROM_ABI constexpr _Iter
+ operator()(_Iter __first, _Sent __last, _Comp __comp = {}, _Proj __proj = {}) const {
return __make_heap_fn_impl(std::move(__first), std::move(__last), __comp, __proj);
}
template <random_access_range _Range, class _Comp = ranges::less, class _Proj = identity>
requires sortable<iterator_t<_Range>, _Comp, _Proj>
- _LIBCPP_HIDE_FROM_ABI constexpr
- borrowed_iterator_t<_Range> operator()(_Range&& __r, _Comp __comp = {}, _Proj __proj = {}) const {
+ _LIBCPP_HIDE_FROM_ABI constexpr borrowed_iterator_t<_Range>
+ operator()(_Range&& __r, _Comp __comp = {}, _Proj __proj = {}) const {
return __make_heap_fn_impl(ranges::begin(__r), ranges::end(__r), __comp, __proj);
}
};
@@ -69,7 +69,7 @@ struct __fn {
} // namespace __make_heap
inline namespace __cpo {
- inline constexpr auto make_heap = __make_heap::__fn{};
+inline constexpr auto make_heap = __make_heap::__fn{};
} // namespace __cpo
} // namespace ranges
diff --git a/libcxx/include/__algorithm/ranges_max.h b/libcxx/include/__algorithm/ranges_max.h
index 2fd2970bbf35d..321cac56e29b0 100644
--- a/libcxx/include/__algorithm/ranges_max.h
+++ b/libcxx/include/__algorithm/ranges_max.h
@@ -31,40 +31,43 @@
#if _LIBCPP_STD_VER >= 20
_LIBCPP_PUSH_MACROS
-#include <__undef_macros>
+# include <__undef_macros>
_LIBCPP_BEGIN_NAMESPACE_STD
namespace ranges {
namespace __max {
struct __fn {
- template <class _Tp, class _Proj = identity,
+ template <class _Tp,
+ class _Proj = identity,
indirect_strict_weak_order<projected<const _Tp*, _Proj>> _Comp = ranges::less>
- _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr
- const _Tp& operator()(_LIBCPP_LIFETIMEBOUND const _Tp& __a,
- _LIBCPP_LIFETIMEBOUND const _Tp& __b,
- _Comp __comp = {},
- _Proj __proj = {}) const {
+ _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr const _Tp&
+ operator()(_LIBCPP_LIFETIMEBOUND const _Tp& __a,
+ _LIBCPP_LIFETIMEBOUND const _Tp& __b,
+ _Comp __comp = {},
+ _Proj __proj = {}) const {
return std::invoke(__comp, std::invoke(__proj, __a), std::invoke(__proj, __b)) ? __b : __a;
}
- template <copyable _Tp, class _Proj = identity,
+ template <copyable _Tp,
+ class _Proj = identity,
indirect_strict_weak_order<projected<const _Tp*, _Proj>> _Comp = ranges::less>
- _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr
- _Tp operator()(initializer_list<_Tp> __il, _Comp __comp = {}, _Proj __proj = {}) const {
+ _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr _Tp
+ operator()(initializer_list<_Tp> __il, _Comp __comp = {}, _Proj __proj = {}) const {
_LIBCPP_ASSERT(__il.begin() != __il.end(), "initializer_list must contain at least one element");
auto __comp_lhs_rhs_swapped = [&](auto&& __lhs, auto&& __rhs) { return std::invoke(__comp, __rhs, __lhs); };
return *ranges::__min_element_impl(__il.begin(), __il.end(), __comp_lhs_rhs_swapped, __proj);
}
- template <input_range _Rp, class _Proj = identity,
+ template <input_range _Rp,
+ class _Proj = identity,
indirect_strict_weak_order<projected<iterator_t<_Rp>, _Proj>> _Comp = ranges::less>
requires indirectly_copyable_storable<iterator_t<_Rp>, range_value_t<_Rp>*>
- _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr
- range_value_t<_Rp> operator()(_Rp&& __r, _Comp __comp = {}, _Proj __proj = {}) const {
+ _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr range_value_t<_Rp>
+ operator()(_Rp&& __r, _Comp __comp = {}, _Proj __proj = {}) const {
auto __first = ranges::begin(__r);
- auto __last = ranges::end(__r);
+ auto __last = ranges::end(__r);
_LIBCPP_ASSERT(__first != __last, "range must contain at least one element");
@@ -84,7 +87,7 @@ struct __fn {
} // namespace __max
inline namespace __cpo {
- inline constexpr auto max = __max::__fn{};
+inline constexpr auto max = __max::__fn{};
} // namespace __cpo
} // namespace ranges
diff --git a/libcxx/include/__algorithm/ranges_max_element.h b/libcxx/include/__algorithm/ranges_max_element.h
index 39e86d3b9a60c..2d92661c81099 100644
--- a/libcxx/include/__algorithm/ranges_max_element.h
+++ b/libcxx/include/__algorithm/ranges_max_element.h
@@ -31,18 +31,21 @@ _LIBCPP_BEGIN_NAMESPACE_STD
namespace ranges {
namespace __max_element {
struct __fn {
- template <forward_iterator _Ip, sentinel_for<_Ip> _Sp, class _Proj = identity,
+ template <forward_iterator _Ip,
+ sentinel_for<_Ip> _Sp,
+ class _Proj = identity,
indirect_strict_weak_order<projected<_Ip, _Proj>> _Comp = ranges::less>
- _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr
- _Ip operator()(_Ip __first, _Sp __last, _Comp __comp = {}, _Proj __proj = {}) const {
+ _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr _Ip
+ operator()(_Ip __first, _Sp __last, _Comp __comp = {}, _Proj __proj = {}) const {
auto __comp_lhs_rhs_swapped = [&](auto&& __lhs, auto&& __rhs) { return std::invoke(__comp, __rhs, __lhs); };
return ranges::__min_element_impl(__first, __last, __comp_lhs_rhs_swapped, __proj);
}
- template <forward_range _Rp, class _Proj = identity,
+ template <forward_range _Rp,
+ class _Proj = identity,
indirect_strict_weak_order<projected<iterator_t<_Rp>, _Proj>> _Comp = ranges::less>
- _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr
- borrowed_iterator_t<_Rp> operator()(_Rp&& __r, _Comp __comp = {}, _Proj __proj = {}) const {
+ _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr borrowed_iterator_t<_Rp>
+ operator()(_Rp&& __r, _Comp __comp = {}, _Proj __proj = {}) const {
auto __comp_lhs_rhs_swapped = [&](auto&& __lhs, auto&& __rhs) { return std::invoke(__comp, __rhs, __lhs); };
return ranges::__min_element_impl(ranges::begin(__r), ranges::end(__r), __comp_lhs_rhs_swapped, __proj);
}
@@ -50,7 +53,7 @@ struct __fn {
} // namespace __max_element
inline namespace __cpo {
- inline constexpr auto max_element = __max_element::__fn{};
+inline constexpr auto max_element = __max_element::__fn{};
} // namespace __cpo
} // namespace ranges
diff --git a/libcxx/include/__algorithm/ranges_merge.h b/libcxx/include/__algorithm/ranges_merge.h
index c5797b0e71bdd..7f49154ec9221 100644
--- a/libcxx/include/__algorithm/ranges_merge.h
+++ b/libcxx/include/__algorithm/ranges_merge.h
@@ -38,25 +38,25 @@ using merge_result = in_in_out_result<_InIter1, _InIter2, _OutIter>;
namespace __merge {
-template <
- class _InIter1,
- class _Sent1,
- class _InIter2,
- class _Sent2,
- class _OutIter,
- class _Comp,
- class _Proj1,
- class _Proj2>
-_LIBCPP_HIDE_FROM_ABI constexpr merge_result<__remove_cvref_t<_InIter1>, __remove_cvref_t<_InIter2>, __remove_cvref_t<_OutIter>>
-__merge_impl(
- _InIter1&& __first1,
- _Sent1&& __last1,
- _InIter2&& __first2,
- _Sent2&& __last2,
- _OutIter&& __result,
- _Comp&& __comp,
- _Proj1&& __proj1,
- _Proj2&& __proj2) {
+template < class _InIter1,
+ class _Sent1,
+ class _InIter2,
+ class _Sent2,
+ class _OutIter,
+ class _Comp,
+ class _Proj1,
+ class _Proj2>
+_LIBCPP_HIDE_FROM_ABI constexpr merge_result<__remove_cvref_t<_InIter1>,
+ __remove_cvref_t<_InIter2>,
+ __remove_cvref_t<_OutIter>>
+__merge_impl(_InIter1&& __first1,
+ _Sent1&& __last1,
+ _InIter2&& __first2,
+ _Sent2&& __last2,
+ _OutIter&& __result,
+ _Comp&& __comp,
+ _Proj1&& __proj1,
+ _Proj2&& __proj2) {
for (; __first1 != __last1 && __first2 != __last2; ++__result) {
if (std::invoke(__comp, std::invoke(__proj2, *__first2), std::invoke(__proj1, *__first1))) {
*__result = *__first2;
@@ -72,15 +72,14 @@ __merge_impl(
}
struct __fn {
- template <
- input_iterator _InIter1,
- sentinel_for<_InIter1> _Sent1,
- input_iterator _InIter2,
- sentinel_for<_InIter2> _Sent2,
- weakly_incrementable _OutIter,
- class _Comp = less,
- class _Proj1 = identity,
- class _Proj2 = identity>
+ template <input_iterator _InIter1,
+ sentinel_for<_InIter1> _Sent1,
+ input_iterator _InIter2,
+ sentinel_for<_InIter2> _Sent2,
+ weakly_incrementable _OutIter,
+ class _Comp = less,
+ class _Proj1 = identity,
+ class _Proj2 = identity>
requires mergeable<_InIter1, _InIter2, _OutIter, _Comp, _Proj1, _Proj2>
_LIBCPP_HIDE_FROM_ABI constexpr merge_result<_InIter1, _InIter2, _OutIter> operator()(
_InIter1 __first1,
@@ -94,28 +93,20 @@ struct __fn {
return __merge::__merge_impl(__first1, __last1, __first2, __last2, __result, __comp, __proj1, __proj2);
}
- template <
- input_range _Range1,
- input_range _Range2,
- weakly_incrementable _OutIter,
- class _Comp = less,
- class _Proj1 = identity,
- class _Proj2 = identity>
- requires mergeable<
- iterator_t<_Range1>,
- iterator_t<_Range2>,
- _OutIter,
- _Comp,
- _Proj1,
- _Proj2>
+ template <input_range _Range1,
+ input_range _Range2,
+ weakly_incrementable _OutIter,
+ class _Comp = less,
+ class _Proj1 = identity,
+ class _Proj2 = identity>
+ requires mergeable<iterator_t<_Range1>, iterator_t<_Range2>, _OutIter, _Comp, _Proj1, _Proj2>
_LIBCPP_HIDE_FROM_ABI constexpr merge_result<borrowed_iterator_t<_Range1>, borrowed_iterator_t<_Range2>, _OutIter>
- operator()(
- _Range1&& __range1,
- _Range2&& __range2,
- _OutIter __result,
- _Comp __comp = {},
- _Proj1 __proj1 = {},
- _Proj2 __proj2 = {}) const {
+ operator()(_Range1&& __range1,
+ _Range2&& __range2,
+ _OutIter __result,
+ _Comp __comp = {},
+ _Proj1 __proj1 = {},
+ _Proj2 __proj2 = {}) const {
return __merge::__merge_impl(
ranges::begin(__range1),
ranges::end(__range1),
@@ -131,7 +122,7 @@ struct __fn {
} // namespace __merge
inline namespace __cpo {
- inline constexpr auto merge = __merge::__fn{};
+inline constexpr auto merge = __merge::__fn{};
} // namespace __cpo
} // namespace ranges
diff --git a/libcxx/include/__algorithm/ranges_min.h b/libcxx/include/__algorithm/ranges_min.h
index 5e941a1db06a8..63161396d9097 100644
--- a/libcxx/include/__algorithm/ranges_min.h
+++ b/libcxx/include/__algorithm/ranges_min.h
@@ -30,38 +30,41 @@
#if _LIBCPP_STD_VER >= 20
_LIBCPP_PUSH_MACROS
-#include <__undef_macros>
+# include <__undef_macros>
_LIBCPP_BEGIN_NAMESPACE_STD
namespace ranges {
namespace __min {
struct __fn {
- template <class _Tp, class _Proj = identity,
+ template <class _Tp,
+ class _Proj = identity,
indirect_strict_weak_order<projected<const _Tp*, _Proj>> _Comp = ranges::less>
- _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr
- const _Tp& operator()(_LIBCPP_LIFETIMEBOUND const _Tp& __a,
- _LIBCPP_LIFETIMEBOUND const _Tp& __b,
- _Comp __comp = {},
- _Proj __proj = {}) const {
+ _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr const _Tp&
+ operator()(_LIBCPP_LIFETIMEBOUND const _Tp& __a,
+ _LIBCPP_LIFETIMEBOUND const _Tp& __b,
+ _Comp __comp = {},
+ _Proj __proj = {}) const {
return std::invoke(__comp, std::invoke(__proj, __b), std::invoke(__proj, __a)) ? __b : __a;
}
- template <copyable _Tp, class _Proj = identity,
+ template <copyable _Tp,
+ class _Proj = identity,
indirect_strict_weak_order<projected<const _Tp*, _Proj>> _Comp = ranges::less>
- _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr
- _Tp operator()(initializer_list<_Tp> __il, _Comp __comp = {}, _Proj __proj = {}) const {
+ _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr _Tp
+ operator()(initializer_list<_Tp> __il, _Comp __comp = {}, _Proj __proj = {}) const {
_LIBCPP_ASSERT(__il.begin() != __il.end(), "initializer_list must contain at least one element");
return *ranges::__min_element_impl(__il.begin(), __il.end(), __comp, __proj);
}
- template <input_range _Rp, class _Proj = identity,
+ template <input_range _Rp,
+ class _Proj = identity,
indirect_strict_weak_order<projected<iterator_t<_Rp>, _Proj>> _Comp = ranges::less>
requires indirectly_copyable_storable<iterator_t<_Rp>, range_value_t<_Rp>*>
- _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr
- range_value_t<_Rp> operator()(_Rp&& __r, _Comp __comp = {}, _Proj __proj = {}) const {
+ _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr range_value_t<_Rp>
+ operator()(_Rp&& __r, _Comp __comp = {}, _Proj __proj = {}) const {
auto __first = ranges::begin(__r);
- auto __last = ranges::end(__r);
+ auto __last = ranges::end(__r);
_LIBCPP_ASSERT(__first != __last, "range must contain at least one element");
if constexpr (forward_range<_Rp> && !__is_cheap_to_copy<range_value_t<_Rp>>) {
return *ranges::__min_element_impl(__first, __last, __comp, __proj);
@@ -78,7 +81,7 @@ struct __fn {
} // namespace __min
inline namespace __cpo {
- inline constexpr auto min = __min::__fn{};
+inline constexpr auto min = __min::__fn{};
} // namespace __cpo
} // namespace ranges
diff --git a/libcxx/include/__algorithm/ranges_min_element.h b/libcxx/include/__algorithm/ranges_min_element.h
index 4c58adb3119f8..07826a0e6b817 100644
--- a/libcxx/include/__algorithm/ranges_min_element.h
+++ b/libcxx/include/__algorithm/ranges_min_element.h
@@ -32,8 +32,7 @@ namespace ranges {
// TODO(ranges): `ranges::min_element` can now simply delegate to `std::__min_element`.
template <class _Ip, class _Sp, class _Proj, class _Comp>
-_LIBCPP_HIDE_FROM_ABI constexpr
-_Ip __min_element_impl(_Ip __first, _Sp __last, _Comp& __comp, _Proj& __proj) {
+_LIBCPP_HIDE_FROM_ABI constexpr _Ip __min_element_impl(_Ip __first, _Sp __last, _Comp& __comp, _Proj& __proj) {
if (__first == __last)
return __first;
@@ -46,24 +45,27 @@ _Ip __min_element_impl(_Ip __first, _Sp __last, _Comp& __comp, _Proj& __proj) {
namespace __min_element {
struct __fn {
- template <forward_iterator _Ip, sentinel_for<_Ip> _Sp, class _Proj = identity,
+ template <forward_iterator _Ip,
+ sentinel_for<_Ip> _Sp,
+ class _Proj = identity,
indirect_strict_weak_order<projected<_Ip, _Proj>> _Comp = ranges::less>
- _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr
- _Ip operator()(_Ip __first, _Sp __last, _Comp __comp = {}, _Proj __proj = {}) const {
+ _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr _Ip
+ operator()(_Ip __first, _Sp __last, _Comp __comp = {}, _Proj __proj = {}) const {
return ranges::__min_element_impl(__first, __last, __comp, __proj);
}
- template <forward_range _Rp, class _Proj = identity,
+ template <forward_range _Rp,
+ class _Proj = identity,
indirect_strict_weak_order<projected<iterator_t<_Rp>, _Proj>> _Comp = ranges::less>
- _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr
- borrowed_iterator_t<_Rp> operator()(_Rp&& __r, _Comp __comp = {}, _Proj __proj = {}) const {
+ _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr borrowed_iterator_t<_Rp>
+ operator()(_Rp&& __r, _Comp __comp = {}, _Proj __proj = {}) const {
return ranges::__min_element_impl(ranges::begin(__r), ranges::end(__r), __comp, __proj);
}
};
} // namespace __min_element
inline namespace __cpo {
- inline constexpr auto min_element = __min_element::__fn{};
+inline constexpr auto min_element = __min_element::__fn{};
} // namespace __cpo
} // namespace ranges
diff --git a/libcxx/include/__algorithm/ranges_minmax.h b/libcxx/include/__algorithm/ranges_minmax.h
index 2a966bbee84fd..9a8bd9b10d636 100644
--- a/libcxx/include/__algorithm/ranges_minmax.h
+++ b/libcxx/include/__algorithm/ranges_minmax.h
@@ -37,7 +37,7 @@
#if _LIBCPP_STD_VER >= 20
_LIBCPP_PUSH_MACROS
-#include <__undef_macros>
+# include <__undef_macros>
_LIBCPP_BEGIN_NAMESPACE_STD
@@ -47,7 +47,8 @@ using minmax_result = min_max_result<_T1>;
namespace __minmax {
struct __fn {
- template <class _Type, class _Proj = identity,
+ template <class _Type,
+ class _Proj = identity,
indirect_strict_weak_order<projected<const _Type*, _Proj>> _Comp = ranges::less>
_LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr ranges::minmax_result<const _Type&>
operator()(_LIBCPP_LIFETIMEBOUND const _Type& __a,
@@ -59,22 +60,24 @@ struct __fn {
return {__a, __b};
}
- template <copyable _Type, class _Proj = identity,
+ template <copyable _Type,
+ class _Proj = identity,
indirect_strict_weak_order<projected<const _Type*, _Proj>> _Comp = ranges::less>
- _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr
- ranges::minmax_result<_Type> operator()(initializer_list<_Type> __il, _Comp __comp = {}, _Proj __proj = {}) const {
+ _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr ranges::minmax_result<_Type>
+ operator()(initializer_list<_Type> __il, _Comp __comp = {}, _Proj __proj = {}) const {
_LIBCPP_ASSERT(__il.begin() != __il.end(), "initializer_list has to contain at least one element");
auto __iters = std::__minmax_element_impl(__il.begin(), __il.end(), __comp, __proj);
- return ranges::minmax_result<_Type> { *__iters.first, *__iters.second };
+ return ranges::minmax_result<_Type>{*__iters.first, *__iters.second};
}
- template <input_range _Range, class _Proj = identity,
+ template <input_range _Range,
+ class _Proj = identity,
indirect_strict_weak_order<projected<iterator_t<_Range>, _Proj>> _Comp = ranges::less>
requires indirectly_copyable_storable<iterator_t<_Range>, range_value_t<_Range>*>
- _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr
- ranges::minmax_result<range_value_t<_Range>> operator()(_Range&& __r, _Comp __comp = {}, _Proj __proj = {}) const {
- auto __first = ranges::begin(__r);
- auto __last = ranges::end(__r);
+ _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr ranges::minmax_result<range_value_t<_Range>>
+ operator()(_Range&& __r, _Comp __comp = {}, _Proj __proj = {}) const {
+ auto __first = ranges::begin(__r);
+ auto __last = ranges::end(__r);
using _ValueT = range_value_t<_Range>;
_LIBCPP_ASSERT(__first != __last, "range has to contain at least one element");
@@ -98,8 +101,9 @@ struct __fn {
// input_iterators can't be copied, so the implementation for input_iterators has to store
// the values instead of a pointer to the correct values
auto __less = [&](auto&& __a, auto&& __b) -> bool {
- return std::invoke(__comp, std::invoke(__proj, std::forward<decltype(__a)>(__a)),
- std::invoke(__proj, std::forward<decltype(__b)>(__b)));
+ return std::invoke(__comp,
+ std::invoke(__proj, std::forward<decltype(__a)>(__a)),
+ std::invoke(__proj, std::forward<decltype(__b)>(__b)));
};
// During initialization, members are allowed to refer to already initialized members
@@ -142,7 +146,7 @@ struct __fn {
} // namespace __minmax
inline namespace __cpo {
- inline constexpr auto minmax = __minmax::__fn{};
+inline constexpr auto minmax = __minmax::__fn{};
} // namespace __cpo
} // namespace ranges
diff --git a/libcxx/include/__algorithm/ranges_minmax_element.h b/libcxx/include/__algorithm/ranges_minmax_element.h
index cbf350557948f..a52319f6b5d3f 100644
--- a/libcxx/include/__algorithm/ranges_minmax_element.h
+++ b/libcxx/include/__algorithm/ranges_minmax_element.h
@@ -39,18 +39,20 @@ using minmax_element_result = min_max_result<_T1>;
namespace __minmax_element {
struct __fn {
- template <forward_iterator _Ip, sentinel_for<_Ip> _Sp, class _Proj = identity,
+ template <forward_iterator _Ip,
+ sentinel_for<_Ip> _Sp,
+ class _Proj = identity,
indirect_strict_weak_order<projected<_Ip, _Proj>> _Comp = ranges::less>
- _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr
- ranges::minmax_element_result<_Ip> operator()(_Ip __first, _Sp __last, _Comp __comp = {}, _Proj __proj = {}) const {
+ _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr ranges::minmax_element_result<_Ip>
+ operator()(_Ip __first, _Sp __last, _Comp __comp = {}, _Proj __proj = {}) const {
auto __ret = std::__minmax_element_impl(std::move(__first), std::move(__last), __comp, __proj);
return {__ret.first, __ret.second};
}
- template <forward_range _Rp, class _Proj = identity,
+ template <forward_range _Rp,
+ class _Proj = identity,
indirect_strict_weak_order<projected<iterator_t<_Rp>, _Proj>> _Comp = ranges::less>
- _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr
- ranges::minmax_element_result<borrowed_iterator_t<_Rp>>
+ _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr ranges::minmax_element_result<borrowed_iterator_t<_Rp>>
operator()(_Rp&& __r, _Comp __comp = {}, _Proj __proj = {}) const {
auto __ret = std::__minmax_element_impl(ranges::begin(__r), ranges::end(__r), __comp, __proj);
return {__ret.first, __ret.second};
@@ -59,7 +61,7 @@ struct __fn {
} // namespace __minmax_element
inline namespace __cpo {
- inline constexpr auto minmax_element = __minmax_element::__fn{};
+inline constexpr auto minmax_element = __minmax_element::__fn{};
} // namespace __cpo
} // namespace ranges
diff --git a/libcxx/include/__algorithm/ranges_mismatch.h b/libcxx/include/__algorithm/ranges_mismatch.h
index 098c4151cf38e..db9bfc8e87db6 100644
--- a/libcxx/include/__algorithm/ranges_mismatch.h
+++ b/libcxx/include/__algorithm/ranges_mismatch.h
@@ -36,12 +36,9 @@ using mismatch_result = in_in_result<_I1, _I2>;
namespace __mismatch {
struct __fn {
- template <class _I1, class _S1, class _I2, class _S2,
- class _Pred, class _Proj1, class _Proj2>
- static _LIBCPP_HIDE_FROM_ABI constexpr
- mismatch_result<_I1, _I2>
- __go(_I1 __first1, _S1 __last1, _I2 __first2, _S2 __last2,
- _Pred& __pred, _Proj1& __proj1, _Proj2& __proj2) {
+ template <class _I1, class _S1, class _I2, class _S2, class _Pred, class _Proj1, class _Proj2>
+ static _LIBCPP_HIDE_FROM_ABI constexpr mismatch_result<_I1, _I2>
+ __go(_I1 __first1, _S1 __last1, _I2 __first2, _S2 __last2, _Pred& __pred, _Proj1& __proj1, _Proj2& __proj2) {
while (__first1 != __last1 && __first2 != __last2) {
if (!std::invoke(__pred, std::invoke(__proj1, *__first1), std::invoke(__proj2, *__first2)))
break;
@@ -51,30 +48,37 @@ struct __fn {
return {std::move(__first1), std::move(__first2)};
}
- template <input_iterator _I1, sentinel_for<_I1> _S1,
- input_iterator _I2, sentinel_for<_I2> _S2,
- class _Pred = ranges::equal_to, class _Proj1 = identity, class _Proj2 = identity>
+ template <input_iterator _I1,
+ sentinel_for<_I1> _S1,
+ input_iterator _I2,
+ sentinel_for<_I2> _S2,
+ class _Pred = ranges::equal_to,
+ class _Proj1 = identity,
+ class _Proj2 = identity>
requires indirectly_comparable<_I1, _I2, _Pred, _Proj1, _Proj2>
- _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr
- mismatch_result<_I1, _I2> operator()(_I1 __first1, _S1 __last1, _I2 __first2, _S2 __last2,
- _Pred __pred = {}, _Proj1 __proj1 = {}, _Proj2 __proj2 = {}) const {
+ _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr mismatch_result<_I1, _I2> operator()(
+ _I1 __first1, _S1 __last1, _I2 __first2, _S2 __last2, _Pred __pred = {}, _Proj1 __proj1 = {}, _Proj2 __proj2 = {})
+ const {
return __go(std::move(__first1), __last1, std::move(__first2), __last2, __pred, __proj1, __proj2);
}
- template <input_range _R1, input_range _R2,
- class _Pred = ranges::equal_to, class _Proj1 = identity, class _Proj2 = identity>
+ template <input_range _R1,
+ input_range _R2,
+ class _Pred = ranges::equal_to,
+ class _Proj1 = identity,
+ class _Proj2 = identity>
requires indirectly_comparable<iterator_t<_R1>, iterator_t<_R2>, _Pred, _Proj1, _Proj2>
- _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr
- mismatch_result<borrowed_iterator_t<_R1>, borrowed_iterator_t<_R2>>
+ _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr mismatch_result<borrowed_iterator_t<_R1>,
+ borrowed_iterator_t<_R2>>
operator()(_R1&& __r1, _R2&& __r2, _Pred __pred = {}, _Proj1 __proj1 = {}, _Proj2 __proj2 = {}) const {
- return __go(ranges::begin(__r1), ranges::end(__r1), ranges::begin(__r2), ranges::end(__r2),
- __pred, __proj1, __proj2);
+ return __go(
+ ranges::begin(__r1), ranges::end(__r1), ranges::begin(__r2), ranges::end(__r2), __pred, __proj1, __proj2);
}
};
} // namespace __mismatch
inline namespace __cpo {
- constexpr inline auto mismatch = __mismatch::__fn{};
+constexpr inline auto mismatch = __mismatch::__fn{};
} // namespace __cpo
} // namespace ranges
diff --git a/libcxx/include/__algorithm/ranges_move.h b/libcxx/include/__algorithm/ranges_move.h
index 5e06e903f7295..8bd2409f891c0 100644
--- a/libcxx/include/__algorithm/ranges_move.h
+++ b/libcxx/include/__algorithm/ranges_move.h
@@ -34,33 +34,31 @@ using move_result = in_out_result<_InIter, _OutIter>;
namespace __move {
struct __fn {
-
template <class _InIter, class _Sent, class _OutIter>
- _LIBCPP_HIDE_FROM_ABI constexpr static
- move_result<_InIter, _OutIter> __move_impl(_InIter __first, _Sent __last, _OutIter __result) {
+ _LIBCPP_HIDE_FROM_ABI constexpr static move_result<_InIter, _OutIter>
+ __move_impl(_InIter __first, _Sent __last, _OutIter __result) {
auto __ret = std::__move<_RangeAlgPolicy>(std::move(__first), std::move(__last), std::move(__result));
return {std::move(__ret.first), std::move(__ret.second)};
}
template <input_iterator _InIter, sentinel_for<_InIter> _Sent, weakly_incrementable _OutIter>
requires indirectly_movable<_InIter, _OutIter>
- _LIBCPP_HIDE_FROM_ABI constexpr
- move_result<_InIter, _OutIter> operator()(_InIter __first, _Sent __last, _OutIter __result) const {
+ _LIBCPP_HIDE_FROM_ABI constexpr move_result<_InIter, _OutIter>
+ operator()(_InIter __first, _Sent __last, _OutIter __result) const {
return __move_impl(std::move(__first), std::move(__last), std::move(__result));
}
template <input_range _Range, weakly_incrementable _OutIter>
requires indirectly_movable<iterator_t<_Range>, _OutIter>
- _LIBCPP_HIDE_FROM_ABI constexpr
- move_result<borrowed_iterator_t<_Range>, _OutIter> operator()(_Range&& __range, _OutIter __result) const {
+ _LIBCPP_HIDE_FROM_ABI constexpr move_result<borrowed_iterator_t<_Range>, _OutIter>
+ operator()(_Range&& __range, _OutIter __result) const {
return __move_impl(ranges::begin(__range), ranges::end(__range), std::move(__result));
}
-
};
} // namespace __move
inline namespace __cpo {
- inline constexpr auto move = __move::__fn{};
+inline constexpr auto move = __move::__fn{};
} // namespace __cpo
} // namespace ranges
diff --git a/libcxx/include/__algorithm/ranges_move_backward.h b/libcxx/include/__algorithm/ranges_move_backward.h
index 95c2c6612ecd1..ee390a40e489a 100644
--- a/libcxx/include/__algorithm/ranges_move_backward.h
+++ b/libcxx/include/__algorithm/ranges_move_backward.h
@@ -36,33 +36,31 @@ using move_backward_result = in_out_result<_InIter, _OutIter>;
namespace __move_backward {
struct __fn {
-
template <class _InIter, class _Sent, class _OutIter>
- _LIBCPP_HIDE_FROM_ABI constexpr static
- move_backward_result<_InIter, _OutIter> __move_backward_impl(_InIter __first, _Sent __last, _OutIter __result) {
+ _LIBCPP_HIDE_FROM_ABI constexpr static move_backward_result<_InIter, _OutIter>
+ __move_backward_impl(_InIter __first, _Sent __last, _OutIter __result) {
auto __ret = std::__move_backward<_RangeAlgPolicy>(std::move(__first), std::move(__last), std::move(__result));
return {std::move(__ret.first), std::move(__ret.second)};
}
template <bidirectional_iterator _InIter, sentinel_for<_InIter> _Sent, bidirectional_iterator _OutIter>
requires indirectly_movable<_InIter, _OutIter>
- _LIBCPP_HIDE_FROM_ABI constexpr
- move_backward_result<_InIter, _OutIter> operator()(_InIter __first, _Sent __last, _OutIter __result) const {
+ _LIBCPP_HIDE_FROM_ABI constexpr move_backward_result<_InIter, _OutIter>
+ operator()(_InIter __first, _Sent __last, _OutIter __result) const {
return __move_backward_impl(std::move(__first), std::move(__last), std::move(__result));
}
template <bidirectional_range _Range, bidirectional_iterator _Iter>
requires indirectly_movable<iterator_t<_Range>, _Iter>
- _LIBCPP_HIDE_FROM_ABI constexpr
- move_backward_result<borrowed_iterator_t<_Range>, _Iter> operator()(_Range&& __range, _Iter __result) const {
+ _LIBCPP_HIDE_FROM_ABI constexpr move_backward_result<borrowed_iterator_t<_Range>, _Iter>
+ operator()(_Range&& __range, _Iter __result) const {
return __move_backward_impl(ranges::begin(__range), ranges::end(__range), std::move(__result));
}
-
};
} // namespace __move_backward
inline namespace __cpo {
- inline constexpr auto move_backward = __move_backward::__fn{};
+inline constexpr auto move_backward = __move_backward::__fn{};
} // namespace __cpo
} // namespace ranges
diff --git a/libcxx/include/__algorithm/ranges_none_of.h b/libcxx/include/__algorithm/ranges_none_of.h
index 39940adbb9a65..b0d363895e000 100644
--- a/libcxx/include/__algorithm/ranges_none_of.h
+++ b/libcxx/include/__algorithm/ranges_none_of.h
@@ -29,10 +29,9 @@ _LIBCPP_BEGIN_NAMESPACE_STD
namespace ranges {
namespace __none_of {
struct __fn {
-
template <class _Iter, class _Sent, class _Proj, class _Pred>
- _LIBCPP_HIDE_FROM_ABI constexpr static
- bool __none_of_impl(_Iter __first, _Sent __last, _Pred& __pred, _Proj& __proj) {
+ _LIBCPP_HIDE_FROM_ABI constexpr static bool
+ __none_of_impl(_Iter __first, _Sent __last, _Pred& __pred, _Proj& __proj) {
for (; __first != __last; ++__first) {
if (std::invoke(__pred, std::invoke(__proj, *__first)))
return false;
@@ -40,24 +39,27 @@ struct __fn {
return true;
}
- template <input_iterator _Iter, sentinel_for<_Iter> _Sent, class _Proj = identity,
+ template <input_iterator _Iter,
+ sentinel_for<_Iter> _Sent,
+ class _Proj = identity,
indirect_unary_predicate<projected<_Iter, _Proj>> _Pred>
- _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr
- bool operator()(_Iter __first, _Sent __last, _Pred __pred = {}, _Proj __proj = {}) const {
+ _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr bool
+ operator()(_Iter __first, _Sent __last, _Pred __pred = {}, _Proj __proj = {}) const {
return __none_of_impl(std::move(__first), std::move(__last), __pred, __proj);
}
- template <input_range _Range, class _Proj = identity,
+ template <input_range _Range,
+ class _Proj = identity,
indirect_unary_predicate<projected<iterator_t<_Range>, _Proj>> _Pred>
- _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr
- bool operator()(_Range&& __range, _Pred __pred, _Proj __proj = {}) const {
+ _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr bool
+ operator()(_Range&& __range, _Pred __pred, _Proj __proj = {}) const {
return __none_of_impl(ranges::begin(__range), ranges::end(__range), __pred, __proj);
}
};
} // namespace __none_of
inline namespace __cpo {
- inline constexpr auto none_of = __none_of::__fn{};
+inline constexpr auto none_of = __none_of::__fn{};
} // namespace __cpo
} // namespace ranges
diff --git a/libcxx/include/__algorithm/ranges_nth_element.h b/libcxx/include/__algorithm/ranges_nth_element.h
index 96bf33b079674..7abdbd0889e0c 100644
--- a/libcxx/include/__algorithm/ranges_nth_element.h
+++ b/libcxx/include/__algorithm/ranges_nth_element.h
@@ -40,8 +40,8 @@ namespace __nth_element {
struct __fn {
template <class _Iter, class _Sent, class _Comp, class _Proj>
- _LIBCPP_HIDE_FROM_ABI constexpr static
- _Iter __nth_element_fn_impl(_Iter __first, _Iter __nth, _Sent __last, _Comp& __comp, _Proj& __proj) {
+ _LIBCPP_HIDE_FROM_ABI constexpr static _Iter
+ __nth_element_fn_impl(_Iter __first, _Iter __nth, _Sent __last, _Comp& __comp, _Proj& __proj) {
auto __last_iter = ranges::next(__first, __last);
auto&& __projected_comp = std::__make_projected(__comp, __proj);
@@ -52,16 +52,15 @@ struct __fn {
template <random_access_iterator _Iter, sentinel_for<_Iter> _Sent, class _Comp = ranges::less, class _Proj = identity>
requires sortable<_Iter, _Comp, _Proj>
- _LIBCPP_HIDE_FROM_ABI constexpr
- _Iter operator()(_Iter __first, _Iter __nth, _Sent __last, _Comp __comp = {}, _Proj __proj = {}) const {
+ _LIBCPP_HIDE_FROM_ABI constexpr _Iter
+ operator()(_Iter __first, _Iter __nth, _Sent __last, _Comp __comp = {}, _Proj __proj = {}) const {
return __nth_element_fn_impl(std::move(__first), std::move(__nth), std::move(__last), __comp, __proj);
}
template <random_access_range _Range, class _Comp = ranges::less, class _Proj = identity>
requires sortable<iterator_t<_Range>, _Comp, _Proj>
- _LIBCPP_HIDE_FROM_ABI constexpr
- borrowed_iterator_t<_Range> operator()(_Range&& __r, iterator_t<_Range> __nth, _Comp __comp = {},
- _Proj __proj = {}) const {
+ _LIBCPP_HIDE_FROM_ABI constexpr borrowed_iterator_t<_Range>
+ operator()(_Range&& __r, iterator_t<_Range> __nth, _Comp __comp = {}, _Proj __proj = {}) const {
return __nth_element_fn_impl(ranges::begin(__r), std::move(__nth), ranges::end(__r), __comp, __proj);
}
};
@@ -69,7 +68,7 @@ struct __fn {
} // namespace __nth_element
inline namespace __cpo {
- inline constexpr auto nth_element = __nth_element::__fn{};
+inline constexpr auto nth_element = __nth_element::__fn{};
} // namespace __cpo
} // namespace ranges
diff --git a/libcxx/include/__algorithm/ranges_partial_sort.h b/libcxx/include/__algorithm/ranges_partial_sort.h
index 4562c35443e69..9ec8882097d78 100644
--- a/libcxx/include/__algorithm/ranges_partial_sort.h
+++ b/libcxx/include/__algorithm/ranges_partial_sort.h
@@ -42,24 +42,23 @@ namespace __partial_sort {
struct __fn {
template <class _Iter, class _Sent, class _Comp, class _Proj>
- _LIBCPP_HIDE_FROM_ABI constexpr static
- _Iter __partial_sort_fn_impl(_Iter __first, _Iter __middle, _Sent __last, _Comp& __comp, _Proj& __proj) {
+ _LIBCPP_HIDE_FROM_ABI constexpr static _Iter
+ __partial_sort_fn_impl(_Iter __first, _Iter __middle, _Sent __last, _Comp& __comp, _Proj& __proj) {
auto&& __projected_comp = std::__make_projected(__comp, __proj);
return std::__partial_sort<_RangeAlgPolicy>(std::move(__first), std::move(__middle), __last, __projected_comp);
}
template <random_access_iterator _Iter, sentinel_for<_Iter> _Sent, class _Comp = ranges::less, class _Proj = identity>
requires sortable<_Iter, _Comp, _Proj>
- _LIBCPP_HIDE_FROM_ABI constexpr
- _Iter operator()(_Iter __first, _Iter __middle, _Sent __last, _Comp __comp = {}, _Proj __proj = {}) const {
+ _LIBCPP_HIDE_FROM_ABI constexpr _Iter
+ operator()(_Iter __first, _Iter __middle, _Sent __last, _Comp __comp = {}, _Proj __proj = {}) const {
return __partial_sort_fn_impl(std::move(__first), std::move(__middle), std::move(__last), __comp, __proj);
}
template <random_access_range _Range, class _Comp = ranges::less, class _Proj = identity>
requires sortable<iterator_t<_Range>, _Comp, _Proj>
- _LIBCPP_HIDE_FROM_ABI constexpr
- borrowed_iterator_t<_Range> operator()(_Range&& __r, iterator_t<_Range> __middle, _Comp __comp = {},
- _Proj __proj = {}) const {
+ _LIBCPP_HIDE_FROM_ABI constexpr borrowed_iterator_t<_Range>
+ operator()(_Range&& __r, iterator_t<_Range> __middle, _Comp __comp = {}, _Proj __proj = {}) const {
return __partial_sort_fn_impl(ranges::begin(__r), std::move(__middle), ranges::end(__r), __comp, __proj);
}
};
@@ -67,7 +66,7 @@ struct __fn {
} // namespace __partial_sort
inline namespace __cpo {
- inline constexpr auto partial_sort = __partial_sort::__fn{};
+inline constexpr auto partial_sort = __partial_sort::__fn{};
} // namespace __cpo
} // namespace ranges
diff --git a/libcxx/include/__algorithm/ranges_partial_sort_copy.h b/libcxx/include/__algorithm/ranges_partial_sort_copy.h
index 5401a374ec28a..eba7d9ac41657 100644
--- a/libcxx/include/__algorithm/ranges_partial_sort_copy.h
+++ b/libcxx/include/__algorithm/ranges_partial_sort_copy.h
@@ -42,46 +42,63 @@ using partial_sort_copy_result = in_out_result<_InIter, _OutIter>;
namespace __partial_sort_copy {
struct __fn {
-
- template <input_iterator _Iter1, sentinel_for<_Iter1> _Sent1,
- random_access_iterator _Iter2, sentinel_for<_Iter2> _Sent2,
- class _Comp = ranges::less, class _Proj1 = identity, class _Proj2 = identity>
- requires indirectly_copyable<_Iter1, _Iter2> && sortable<_Iter2, _Comp, _Proj2> &&
- indirect_strict_weak_order<_Comp, projected<_Iter1, _Proj1>, projected<_Iter2, _Proj2>>
- _LIBCPP_HIDE_FROM_ABI constexpr
- partial_sort_copy_result<_Iter1, _Iter2>
- operator()(_Iter1 __first, _Sent1 __last, _Iter2 __result_first, _Sent2 __result_last,
- _Comp __comp = {}, _Proj1 __proj1 = {}, _Proj2 __proj2 = {}) const {
+ template <input_iterator _Iter1,
+ sentinel_for<_Iter1> _Sent1,
+ random_access_iterator _Iter2,
+ sentinel_for<_Iter2> _Sent2,
+ class _Comp = ranges::less,
+ class _Proj1 = identity,
+ class _Proj2 = identity>
+ requires indirectly_copyable<_Iter1, _Iter2> && sortable<_Iter2, _Comp, _Proj2> &&
+ indirect_strict_weak_order<_Comp, projected<_Iter1, _Proj1>, projected<_Iter2, _Proj2>>
+ _LIBCPP_HIDE_FROM_ABI constexpr partial_sort_copy_result<_Iter1, _Iter2> operator()(
+ _Iter1 __first,
+ _Sent1 __last,
+ _Iter2 __result_first,
+ _Sent2 __result_last,
+ _Comp __comp = {},
+ _Proj1 __proj1 = {},
+ _Proj2 __proj2 = {}) const {
auto __result = std::__partial_sort_copy<_RangeAlgPolicy>(
- std::move(__first), std::move(__last), std::move(__result_first), std::move(__result_last),
- __comp, __proj1, __proj2
- );
+ std::move(__first),
+ std::move(__last),
+ std::move(__result_first),
+ std::move(__result_last),
+ __comp,
+ __proj1,
+ __proj2);
return {std::move(__result.first), std::move(__result.second)};
}
- template <input_range _Range1, random_access_range _Range2, class _Comp = ranges::less,
- class _Proj1 = identity, class _Proj2 = identity>
- requires indirectly_copyable<iterator_t<_Range1>, iterator_t<_Range2>> &&
- sortable<iterator_t<_Range2>, _Comp, _Proj2> &&
- indirect_strict_weak_order<_Comp, projected<iterator_t<_Range1>, _Proj1>,
- projected<iterator_t<_Range2>, _Proj2>>
- _LIBCPP_HIDE_FROM_ABI constexpr
- partial_sort_copy_result<borrowed_iterator_t<_Range1>, borrowed_iterator_t<_Range2>>
- operator()(_Range1&& __range, _Range2&& __result_range, _Comp __comp = {},
- _Proj1 __proj1 = {}, _Proj2 __proj2 = {}) const {
+ template <input_range _Range1,
+ random_access_range _Range2,
+ class _Comp = ranges::less,
+ class _Proj1 = identity,
+ class _Proj2 = identity>
+ requires indirectly_copyable<iterator_t<_Range1>, iterator_t<_Range2>> &&
+ sortable<iterator_t<_Range2>, _Comp, _Proj2> &&
+ indirect_strict_weak_order<_Comp,
+ projected<iterator_t<_Range1>, _Proj1>,
+ projected<iterator_t<_Range2>, _Proj2>>
+ _LIBCPP_HIDE_FROM_ABI constexpr partial_sort_copy_result<borrowed_iterator_t<_Range1>, borrowed_iterator_t<_Range2>>
+ operator()(
+ _Range1&& __range, _Range2&& __result_range, _Comp __comp = {}, _Proj1 __proj1 = {}, _Proj2 __proj2 = {}) const {
auto __result = std::__partial_sort_copy<_RangeAlgPolicy>(
- ranges::begin(__range), ranges::end(__range), ranges::begin(__result_range), ranges::end(__result_range),
- __comp, __proj1, __proj2
- );
+ ranges::begin(__range),
+ ranges::end(__range),
+ ranges::begin(__result_range),
+ ranges::end(__result_range),
+ __comp,
+ __proj1,
+ __proj2);
return {std::move(__result.first), std::move(__result.second)};
}
-
};
} // namespace __partial_sort_copy
inline namespace __cpo {
- inline constexpr auto partial_sort_copy = __partial_sort_copy::__fn{};
+inline constexpr auto partial_sort_copy = __partial_sort_copy::__fn{};
} // namespace __cpo
} // namespace ranges
diff --git a/libcxx/include/__algorithm/ranges_partition.h b/libcxx/include/__algorithm/ranges_partition.h
index de839de12bfcc..89d192b51fd32 100644
--- a/libcxx/include/__algorithm/ranges_partition.h
+++ b/libcxx/include/__algorithm/ranges_partition.h
@@ -40,38 +40,39 @@ namespace ranges {
namespace __partition {
struct __fn {
-
template <class _Iter, class _Sent, class _Proj, class _Pred>
- _LIBCPP_HIDE_FROM_ABI static constexpr
- subrange<__remove_cvref_t<_Iter>> __partition_fn_impl(_Iter&& __first, _Sent&& __last, _Pred&& __pred, _Proj&& __proj) {
+ _LIBCPP_HIDE_FROM_ABI static constexpr subrange<__remove_cvref_t<_Iter>>
+ __partition_fn_impl(_Iter&& __first, _Sent&& __last, _Pred&& __pred, _Proj&& __proj) {
auto&& __projected_pred = std::__make_projected(__pred, __proj);
- auto __result = std::__partition<_RangeAlgPolicy>(
+ auto __result = std::__partition<_RangeAlgPolicy>(
std::move(__first), std::move(__last), __projected_pred, __iterator_concept<_Iter>());
return {std::move(__result.first), std::move(__result.second)};
}
- template <permutable _Iter, sentinel_for<_Iter> _Sent, class _Proj = identity,
+ template <permutable _Iter,
+ sentinel_for<_Iter> _Sent,
+ class _Proj = identity,
indirect_unary_predicate<projected<_Iter, _Proj>> _Pred>
- _LIBCPP_HIDE_FROM_ABI constexpr
- subrange<_Iter> operator()(_Iter __first, _Sent __last, _Pred __pred, _Proj __proj = {}) const {
+ _LIBCPP_HIDE_FROM_ABI constexpr subrange<_Iter>
+ operator()(_Iter __first, _Sent __last, _Pred __pred, _Proj __proj = {}) const {
return __partition_fn_impl(__first, __last, __pred, __proj);
}
- template <forward_range _Range, class _Proj = identity,
+ template <forward_range _Range,
+ class _Proj = identity,
indirect_unary_predicate<projected<iterator_t<_Range>, _Proj>> _Pred>
- requires permutable<iterator_t<_Range>>
- _LIBCPP_HIDE_FROM_ABI constexpr
- borrowed_subrange_t<_Range> operator()(_Range&& __range, _Pred __pred, _Proj __proj = {}) const {
+ requires permutable<iterator_t<_Range>>
+ _LIBCPP_HIDE_FROM_ABI constexpr borrowed_subrange_t<_Range>
+ operator()(_Range&& __range, _Pred __pred, _Proj __proj = {}) const {
return __partition_fn_impl(ranges::begin(__range), ranges::end(__range), __pred, __proj);
}
-
};
} // namespace __partition
inline namespace __cpo {
- inline constexpr auto partition = __partition::__fn{};
+inline constexpr auto partition = __partition::__fn{};
} // namespace __cpo
} // namespace ranges
diff --git a/libcxx/include/__algorithm/ranges_partition_copy.h b/libcxx/include/__algorithm/ranges_partition_copy.h
index e398387bf0699..6a16b02db3e55 100644
--- a/libcxx/include/__algorithm/ranges_partition_copy.h
+++ b/libcxx/include/__algorithm/ranges_partition_copy.h
@@ -38,14 +38,18 @@ using partition_copy_result = in_out_out_result<_InIter, _OutIter1, _OutIter2>;
namespace __partition_copy {
struct __fn {
-
// TODO(ranges): delegate to the classic algorithm.
template <class _InIter, class _Sent, class _OutIter1, class _OutIter2, class _Proj, class _Pred>
- _LIBCPP_HIDE_FROM_ABI constexpr
- static partition_copy_result<
- __remove_cvref_t<_InIter>, __remove_cvref_t<_OutIter1>, __remove_cvref_t<_OutIter2>
- > __partition_copy_fn_impl( _InIter&& __first, _Sent&& __last, _OutIter1&& __out_true, _OutIter2&& __out_false,
- _Pred& __pred, _Proj& __proj) {
+ _LIBCPP_HIDE_FROM_ABI constexpr static partition_copy_result<__remove_cvref_t<_InIter>,
+ __remove_cvref_t<_OutIter1>,
+ __remove_cvref_t<_OutIter2> >
+ __partition_copy_fn_impl(
+ _InIter&& __first,
+ _Sent&& __last,
+ _OutIter1&& __out_true,
+ _OutIter2&& __out_false,
+ _Pred& __pred,
+ _Proj& __proj) {
for (; __first != __last; ++__first) {
if (std::invoke(__pred, std::invoke(__proj, *__first))) {
*__out_true = *__first;
@@ -60,34 +64,37 @@ struct __fn {
return {std::move(__first), std::move(__out_true), std::move(__out_false)};
}
- template <input_iterator _InIter, sentinel_for<_InIter> _Sent,
- weakly_incrementable _OutIter1, weakly_incrementable _OutIter2,
- class _Proj = identity, indirect_unary_predicate<projected<_InIter, _Proj>> _Pred>
- requires indirectly_copyable<_InIter, _OutIter1> && indirectly_copyable<_InIter, _OutIter2>
- _LIBCPP_HIDE_FROM_ABI constexpr
- partition_copy_result<_InIter, _OutIter1, _OutIter2>
- operator()(_InIter __first, _Sent __last, _OutIter1 __out_true, _OutIter2 __out_false,
- _Pred __pred, _Proj __proj = {}) const {
+ template <input_iterator _InIter,
+ sentinel_for<_InIter> _Sent,
+ weakly_incrementable _OutIter1,
+ weakly_incrementable _OutIter2,
+ class _Proj = identity,
+ indirect_unary_predicate<projected<_InIter, _Proj>> _Pred>
+ requires indirectly_copyable<_InIter, _OutIter1> && indirectly_copyable<_InIter, _OutIter2>
+ _LIBCPP_HIDE_FROM_ABI constexpr partition_copy_result<_InIter, _OutIter1, _OutIter2> operator()(
+ _InIter __first, _Sent __last, _OutIter1 __out_true, _OutIter2 __out_false, _Pred __pred, _Proj __proj = {})
+ const {
return __partition_copy_fn_impl(
std::move(__first), std::move(__last), std::move(__out_true), std::move(__out_false), __pred, __proj);
}
- template <input_range _Range, weakly_incrementable _OutIter1, weakly_incrementable _OutIter2,
- class _Proj = identity, indirect_unary_predicate<projected<iterator_t<_Range>, _Proj>> _Pred>
- requires indirectly_copyable<iterator_t<_Range>, _OutIter1> && indirectly_copyable<iterator_t<_Range>, _OutIter2>
- _LIBCPP_HIDE_FROM_ABI constexpr
- partition_copy_result<borrowed_iterator_t<_Range>, _OutIter1, _OutIter2>
+ template <input_range _Range,
+ weakly_incrementable _OutIter1,
+ weakly_incrementable _OutIter2,
+ class _Proj = identity,
+ indirect_unary_predicate<projected<iterator_t<_Range>, _Proj>> _Pred>
+ requires indirectly_copyable<iterator_t<_Range>, _OutIter1> && indirectly_copyable<iterator_t<_Range>, _OutIter2>
+ _LIBCPP_HIDE_FROM_ABI constexpr partition_copy_result<borrowed_iterator_t<_Range>, _OutIter1, _OutIter2>
operator()(_Range&& __range, _OutIter1 __out_true, _OutIter2 __out_false, _Pred __pred, _Proj __proj = {}) const {
return __partition_copy_fn_impl(
ranges::begin(__range), ranges::end(__range), std::move(__out_true), std::move(__out_false), __pred, __proj);
}
-
};
} // namespace __partition_copy
inline namespace __cpo {
- inline constexpr auto partition_copy = __partition_copy::__fn{};
+inline constexpr auto partition_copy = __partition_copy::__fn{};
} // namespace __cpo
} // namespace ranges
diff --git a/libcxx/include/__algorithm/ranges_partition_point.h b/libcxx/include/__algorithm/ranges_partition_point.h
index 129ebb6c68da4..6fc20e7d00e9f 100644
--- a/libcxx/include/__algorithm/ranges_partition_point.h
+++ b/libcxx/include/__algorithm/ranges_partition_point.h
@@ -35,16 +35,15 @@ namespace ranges {
namespace __partition_point {
struct __fn {
-
// TODO(ranges): delegate to the classic algorithm.
template <class _Iter, class _Sent, class _Proj, class _Pred>
- _LIBCPP_HIDE_FROM_ABI constexpr
- static _Iter __partition_point_fn_impl(_Iter&& __first, _Sent&& __last, _Pred& __pred, _Proj& __proj) {
+ _LIBCPP_HIDE_FROM_ABI constexpr static _Iter
+ __partition_point_fn_impl(_Iter&& __first, _Sent&& __last, _Pred& __pred, _Proj& __proj) {
auto __len = ranges::distance(__first, __last);
while (__len != 0) {
auto __half_len = std::__half_positive(__len);
- auto __mid = ranges::next(__first, __half_len);
+ auto __mid = ranges::next(__first, __half_len);
if (std::invoke(__pred, std::invoke(__proj, *__mid))) {
__first = ++__mid;
@@ -58,26 +57,27 @@ struct __fn {
return __first;
}
- template <forward_iterator _Iter, sentinel_for<_Iter> _Sent, class _Proj = identity,
+ template <forward_iterator _Iter,
+ sentinel_for<_Iter> _Sent,
+ class _Proj = identity,
indirect_unary_predicate<projected<_Iter, _Proj>> _Pred>
- _LIBCPP_HIDE_FROM_ABI constexpr
- _Iter operator()(_Iter __first, _Sent __last, _Pred __pred, _Proj __proj = {}) const {
+ _LIBCPP_HIDE_FROM_ABI constexpr _Iter operator()(_Iter __first, _Sent __last, _Pred __pred, _Proj __proj = {}) const {
return __partition_point_fn_impl(std::move(__first), std::move(__last), __pred, __proj);
}
- template <forward_range _Range, class _Proj = identity,
+ template <forward_range _Range,
+ class _Proj = identity,
indirect_unary_predicate<projected<iterator_t<_Range>, _Proj>> _Pred>
- _LIBCPP_HIDE_FROM_ABI constexpr
- borrowed_iterator_t<_Range> operator()(_Range&& __range, _Pred __pred, _Proj __proj = {}) const {
+ _LIBCPP_HIDE_FROM_ABI constexpr borrowed_iterator_t<_Range>
+ operator()(_Range&& __range, _Pred __pred, _Proj __proj = {}) const {
return __partition_point_fn_impl(ranges::begin(__range), ranges::end(__range), __pred, __proj);
}
-
};
} // namespace __partition_point
inline namespace __cpo {
- inline constexpr auto partition_point = __partition_point::__fn{};
+inline constexpr auto partition_point = __partition_point::__fn{};
} // namespace __cpo
} // namespace ranges
diff --git a/libcxx/include/__algorithm/ranges_pop_heap.h b/libcxx/include/__algorithm/ranges_pop_heap.h
index 54ea97db7a655..364cfe94b161e 100644
--- a/libcxx/include/__algorithm/ranges_pop_heap.h
+++ b/libcxx/include/__algorithm/ranges_pop_heap.h
@@ -41,10 +41,10 @@ namespace __pop_heap {
struct __fn {
template <class _Iter, class _Sent, class _Comp, class _Proj>
- _LIBCPP_HIDE_FROM_ABI constexpr static
- _Iter __pop_heap_fn_impl(_Iter __first, _Sent __last, _Comp& __comp, _Proj& __proj) {
+ _LIBCPP_HIDE_FROM_ABI constexpr static _Iter
+ __pop_heap_fn_impl(_Iter __first, _Sent __last, _Comp& __comp, _Proj& __proj) {
auto __last_iter = ranges::next(__first, __last);
- auto __len = __last_iter - __first;
+ auto __len = __last_iter - __first;
auto&& __projected_comp = std::__make_projected(__comp, __proj);
std::__pop_heap<_RangeAlgPolicy>(std::move(__first), __last_iter, __projected_comp, __len);
@@ -54,15 +54,15 @@ struct __fn {
template <random_access_iterator _Iter, sentinel_for<_Iter> _Sent, class _Comp = ranges::less, class _Proj = identity>
requires sortable<_Iter, _Comp, _Proj>
- _LIBCPP_HIDE_FROM_ABI constexpr
- _Iter operator()(_Iter __first, _Sent __last, _Comp __comp = {}, _Proj __proj = {}) const {
+ _LIBCPP_HIDE_FROM_ABI constexpr _Iter
+ operator()(_Iter __first, _Sent __last, _Comp __comp = {}, _Proj __proj = {}) const {
return __pop_heap_fn_impl(std::move(__first), std::move(__last), __comp, __proj);
}
template <random_access_range _Range, class _Comp = ranges::less, class _Proj = identity>
requires sortable<iterator_t<_Range>, _Comp, _Proj>
- _LIBCPP_HIDE_FROM_ABI constexpr
- borrowed_iterator_t<_Range> operator()(_Range&& __r, _Comp __comp = {}, _Proj __proj = {}) const {
+ _LIBCPP_HIDE_FROM_ABI constexpr borrowed_iterator_t<_Range>
+ operator()(_Range&& __r, _Comp __comp = {}, _Proj __proj = {}) const {
return __pop_heap_fn_impl(ranges::begin(__r), ranges::end(__r), __comp, __proj);
}
};
@@ -70,7 +70,7 @@ struct __fn {
} // namespace __pop_heap
inline namespace __cpo {
- inline constexpr auto pop_heap = __pop_heap::__fn{};
+inline constexpr auto pop_heap = __pop_heap::__fn{};
} // namespace __cpo
} // namespace ranges
diff --git a/libcxx/include/__algorithm/ranges_prev_permutation.h b/libcxx/include/__algorithm/ranges_prev_permutation.h
index bf062874a31c4..ae7a68cce5fdc 100644
--- a/libcxx/include/__algorithm/ranges_prev_permutation.h
+++ b/libcxx/include/__algorithm/ranges_prev_permutation.h
@@ -40,9 +40,7 @@ using prev_permutation_result = in_found_result<_InIter>;
namespace __prev_permutation {
struct __fn {
-
- template <bidirectional_iterator _Iter, sentinel_for<_Iter> _Sent,
- class _Comp = ranges::less, class _Proj = identity>
+ template <bidirectional_iterator _Iter, sentinel_for<_Iter> _Sent, class _Comp = ranges::less, class _Proj = identity>
requires sortable<_Iter, _Comp, _Proj>
_LIBCPP_HIDE_FROM_ABI constexpr prev_permutation_result<_Iter>
operator()(_Iter __first, _Sent __last, _Comp __comp = {}, _Proj __proj = {}) const {
@@ -51,8 +49,7 @@ struct __fn {
return {std::move(__result.first), std::move(__result.second)};
}
- template <bidirectional_range _Range,
- class _Comp = ranges::less, class _Proj = identity>
+ template <bidirectional_range _Range, class _Comp = ranges::less, class _Proj = identity>
requires sortable<iterator_t<_Range>, _Comp, _Proj>
_LIBCPP_HIDE_FROM_ABI constexpr prev_permutation_result<borrowed_iterator_t<_Range>>
operator()(_Range&& __range, _Comp __comp = {}, _Proj __proj = {}) const {
@@ -60,7 +57,6 @@ struct __fn {
ranges::begin(__range), ranges::end(__range), std::__make_projected(__comp, __proj));
return {std::move(__result.first), std::move(__result.second)};
}
-
};
} // namespace __prev_permutation
diff --git a/libcxx/include/__algorithm/ranges_push_heap.h b/libcxx/include/__algorithm/ranges_push_heap.h
index 6e65d11d01554..1ed9c953f54c3 100644
--- a/libcxx/include/__algorithm/ranges_push_heap.h
+++ b/libcxx/include/__algorithm/ranges_push_heap.h
@@ -41,8 +41,8 @@ namespace __push_heap {
struct __fn {
template <class _Iter, class _Sent, class _Comp, class _Proj>
- _LIBCPP_HIDE_FROM_ABI constexpr static
- _Iter __push_heap_fn_impl(_Iter __first, _Sent __last, _Comp& __comp, _Proj& __proj) {
+ _LIBCPP_HIDE_FROM_ABI constexpr static _Iter
+ __push_heap_fn_impl(_Iter __first, _Sent __last, _Comp& __comp, _Proj& __proj) {
auto __last_iter = ranges::next(__first, __last);
auto&& __projected_comp = std::__make_projected(__comp, __proj);
@@ -53,15 +53,15 @@ struct __fn {
template <random_access_iterator _Iter, sentinel_for<_Iter> _Sent, class _Comp = ranges::less, class _Proj = identity>
requires sortable<_Iter, _Comp, _Proj>
- _LIBCPP_HIDE_FROM_ABI constexpr
- _Iter operator()(_Iter __first, _Sent __last, _Comp __comp = {}, _Proj __proj = {}) const {
+ _LIBCPP_HIDE_FROM_ABI constexpr _Iter
+ operator()(_Iter __first, _Sent __last, _Comp __comp = {}, _Proj __proj = {}) const {
return __push_heap_fn_impl(std::move(__first), std::move(__last), __comp, __proj);
}
template <random_access_range _Range, class _Comp = ranges::less, class _Proj = identity>
requires sortable<iterator_t<_Range>, _Comp, _Proj>
- _LIBCPP_HIDE_FROM_ABI constexpr
- borrowed_iterator_t<_Range> operator()(_Range&& __r, _Comp __comp = {}, _Proj __proj = {}) const {
+ _LIBCPP_HIDE_FROM_ABI constexpr borrowed_iterator_t<_Range>
+ operator()(_Range&& __r, _Comp __comp = {}, _Proj __proj = {}) const {
return __push_heap_fn_impl(ranges::begin(__r), ranges::end(__r), __comp, __proj);
}
};
@@ -69,7 +69,7 @@ struct __fn {
} // namespace __push_heap
inline namespace __cpo {
- inline constexpr auto push_heap = __push_heap::__fn{};
+inline constexpr auto push_heap = __push_heap::__fn{};
} // namespace __cpo
} // namespace ranges
diff --git a/libcxx/include/__algorithm/ranges_remove.h b/libcxx/include/__algorithm/ranges_remove.h
index 6dd48e0876130..bf0928df599ce 100644
--- a/libcxx/include/__algorithm/ranges_remove.h
+++ b/libcxx/include/__algorithm/ranges_remove.h
@@ -32,20 +32,19 @@ _LIBCPP_BEGIN_NAMESPACE_STD
namespace ranges {
namespace __remove {
struct __fn {
-
template <permutable _Iter, sentinel_for<_Iter> _Sent, class _Type, class _Proj = identity>
requires indirect_binary_predicate<ranges::equal_to, projected<_Iter, _Proj>, const _Type*>
- _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr
- subrange<_Iter> operator()(_Iter __first, _Sent __last, const _Type& __value, _Proj __proj = {}) const {
+ _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr subrange<_Iter>
+ operator()(_Iter __first, _Sent __last, const _Type& __value, _Proj __proj = {}) const {
auto __pred = [&](auto&& __other) { return __value == __other; };
return ranges::__remove_if_impl(std::move(__first), std::move(__last), __pred, __proj);
}
template <forward_range _Range, class _Type, class _Proj = identity>
- requires permutable<iterator_t<_Range>>
- && indirect_binary_predicate<ranges::equal_to, projected<iterator_t<_Range>, _Proj>, const _Type*>
- _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr
- borrowed_subrange_t<_Range> operator()(_Range&& __range, const _Type& __value, _Proj __proj = {}) const {
+ requires permutable<iterator_t<_Range>> &&
+ indirect_binary_predicate<ranges::equal_to, projected<iterator_t<_Range>, _Proj>, const _Type*>
+ _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr borrowed_subrange_t<_Range>
+ operator()(_Range&& __range, const _Type& __value, _Proj __proj = {}) const {
auto __pred = [&](auto&& __other) { return __value == __other; };
return ranges::__remove_if_impl(ranges::begin(__range), ranges::end(__range), __pred, __proj);
}
@@ -53,7 +52,7 @@ struct __fn {
} // namespace __remove
inline namespace __cpo {
- inline constexpr auto remove = __remove::__fn{};
+inline constexpr auto remove = __remove::__fn{};
} // namespace __cpo
} // namespace ranges
diff --git a/libcxx/include/__algorithm/ranges_remove_copy.h b/libcxx/include/__algorithm/ranges_remove_copy.h
index a9a19c17f6312..457d593957adb 100644
--- a/libcxx/include/__algorithm/ranges_remove_copy.h
+++ b/libcxx/include/__algorithm/ranges_remove_copy.h
@@ -37,35 +37,35 @@ using remove_copy_result = in_out_result<_InIter, _OutIter>;
namespace __remove_copy {
- struct __fn {
- template <input_iterator _InIter,
- sentinel_for<_InIter> _Sent,
- weakly_incrementable _OutIter,
- class _Type,
- class _Proj = identity>
- requires indirectly_copyable<_InIter, _OutIter> &&
- indirect_binary_predicate<ranges::equal_to, projected<_InIter, _Proj>, const _Type*>
- _LIBCPP_HIDE_FROM_ABI constexpr remove_copy_result<_InIter, _OutIter>
- operator()(_InIter __first, _Sent __last, _OutIter __result, const _Type& __value, _Proj __proj = {}) const {
- auto __pred = [&](auto&& __val) { return __value == __val; };
- return ranges::__remove_copy_if_impl(std::move(__first), std::move(__last), std::move(__result), __pred, __proj);
- }
+struct __fn {
+ template <input_iterator _InIter,
+ sentinel_for<_InIter> _Sent,
+ weakly_incrementable _OutIter,
+ class _Type,
+ class _Proj = identity>
+ requires indirectly_copyable<_InIter, _OutIter> &&
+ indirect_binary_predicate<ranges::equal_to, projected<_InIter, _Proj>, const _Type*>
+ _LIBCPP_HIDE_FROM_ABI constexpr remove_copy_result<_InIter, _OutIter>
+ operator()(_InIter __first, _Sent __last, _OutIter __result, const _Type& __value, _Proj __proj = {}) const {
+ auto __pred = [&](auto&& __val) { return __value == __val; };
+ return ranges::__remove_copy_if_impl(std::move(__first), std::move(__last), std::move(__result), __pred, __proj);
+ }
- template <input_range _Range, weakly_incrementable _OutIter, class _Type, class _Proj = identity>
- requires indirectly_copyable<iterator_t<_Range>, _OutIter> &&
- indirect_binary_predicate<ranges::equal_to, projected<iterator_t<_Range>, _Proj>, const _Type*>
- _LIBCPP_HIDE_FROM_ABI constexpr remove_copy_result<borrowed_iterator_t<_Range>, _OutIter>
- operator()(_Range&& __range, _OutIter __result, const _Type& __value, _Proj __proj = {}) const {
- auto __pred = [&](auto&& __val) { return __value == __val; };
- return ranges::__remove_copy_if_impl(
- ranges::begin(__range), ranges::end(__range), std::move(__result), __pred, __proj);
- }
- };
+ template <input_range _Range, weakly_incrementable _OutIter, class _Type, class _Proj = identity>
+ requires indirectly_copyable<iterator_t<_Range>, _OutIter> &&
+ indirect_binary_predicate<ranges::equal_to, projected<iterator_t<_Range>, _Proj>, const _Type*>
+ _LIBCPP_HIDE_FROM_ABI constexpr remove_copy_result<borrowed_iterator_t<_Range>, _OutIter>
+ operator()(_Range&& __range, _OutIter __result, const _Type& __value, _Proj __proj = {}) const {
+ auto __pred = [&](auto&& __val) { return __value == __val; };
+ return ranges::__remove_copy_if_impl(
+ ranges::begin(__range), ranges::end(__range), std::move(__result), __pred, __proj);
+ }
+};
} // namespace __remove_copy
inline namespace __cpo {
- inline constexpr auto remove_copy = __remove_copy::__fn{};
+inline constexpr auto remove_copy = __remove_copy::__fn{};
} // namespace __cpo
} // namespace ranges
diff --git a/libcxx/include/__algorithm/ranges_remove_copy_if.h b/libcxx/include/__algorithm/ranges_remove_copy_if.h
index e6d043e365862..c07b4813d7d0a 100644
--- a/libcxx/include/__algorithm/ranges_remove_copy_if.h
+++ b/libcxx/include/__algorithm/ranges_remove_copy_if.h
@@ -52,34 +52,34 @@ __remove_copy_if_impl(_InIter __first, _Sent __last, _OutIter __result, _Pred& _
namespace __remove_copy_if {
- struct __fn {
- template <input_iterator _InIter,
- sentinel_for<_InIter> _Sent,
- weakly_incrementable _OutIter,
- class _Proj = identity,
- indirect_unary_predicate<projected<_InIter, _Proj>> _Pred>
- requires indirectly_copyable<_InIter, _OutIter>
- _LIBCPP_HIDE_FROM_ABI constexpr remove_copy_if_result<_InIter, _OutIter>
- operator()(_InIter __first, _Sent __last, _OutIter __result, _Pred __pred, _Proj __proj = {}) const {
- return ranges::__remove_copy_if_impl(std::move(__first), std::move(__last), std::move(__result), __pred, __proj);
- }
+struct __fn {
+ template <input_iterator _InIter,
+ sentinel_for<_InIter> _Sent,
+ weakly_incrementable _OutIter,
+ class _Proj = identity,
+ indirect_unary_predicate<projected<_InIter, _Proj>> _Pred>
+ requires indirectly_copyable<_InIter, _OutIter>
+ _LIBCPP_HIDE_FROM_ABI constexpr remove_copy_if_result<_InIter, _OutIter>
+ operator()(_InIter __first, _Sent __last, _OutIter __result, _Pred __pred, _Proj __proj = {}) const {
+ return ranges::__remove_copy_if_impl(std::move(__first), std::move(__last), std::move(__result), __pred, __proj);
+ }
- template <input_range _Range,
- weakly_incrementable _OutIter,
- class _Proj = identity,
- indirect_unary_predicate<projected<iterator_t<_Range>, _Proj>> _Pred>
- requires indirectly_copyable<iterator_t<_Range>, _OutIter>
- _LIBCPP_HIDE_FROM_ABI constexpr remove_copy_if_result<borrowed_iterator_t<_Range>, _OutIter>
- operator()(_Range&& __range, _OutIter __result, _Pred __pred, _Proj __proj = {}) const {
- return ranges::__remove_copy_if_impl(
- ranges::begin(__range), ranges::end(__range), std::move(__result), __pred, __proj);
- }
- };
+ template <input_range _Range,
+ weakly_incrementable _OutIter,
+ class _Proj = identity,
+ indirect_unary_predicate<projected<iterator_t<_Range>, _Proj>> _Pred>
+ requires indirectly_copyable<iterator_t<_Range>, _OutIter>
+ _LIBCPP_HIDE_FROM_ABI constexpr remove_copy_if_result<borrowed_iterator_t<_Range>, _OutIter>
+ operator()(_Range&& __range, _OutIter __result, _Pred __pred, _Proj __proj = {}) const {
+ return ranges::__remove_copy_if_impl(
+ ranges::begin(__range), ranges::end(__range), std::move(__result), __pred, __proj);
+ }
+};
} // namespace __remove_copy_if
inline namespace __cpo {
- inline constexpr auto remove_copy_if = __remove_copy_if::__fn{};
+inline constexpr auto remove_copy_if = __remove_copy_if::__fn{};
} // namespace __cpo
} // namespace ranges
diff --git a/libcxx/include/__algorithm/ranges_remove_if.h b/libcxx/include/__algorithm/ranges_remove_if.h
index 7507c21b87d30..4b7aa2d2be78a 100644
--- a/libcxx/include/__algorithm/ranges_remove_if.h
+++ b/libcxx/include/__algorithm/ranges_remove_if.h
@@ -34,8 +34,8 @@ _LIBCPP_BEGIN_NAMESPACE_STD
namespace ranges {
template <class _Iter, class _Sent, class _Proj, class _Pred>
-_LIBCPP_HIDE_FROM_ABI constexpr
-subrange<_Iter> __remove_if_impl(_Iter __first, _Sent __last, _Pred& __pred, _Proj& __proj) {
+_LIBCPP_HIDE_FROM_ABI constexpr subrange<_Iter>
+__remove_if_impl(_Iter __first, _Sent __last, _Pred& __pred, _Proj& __proj) {
auto __new_end = ranges::__find_if_impl(__first, __last, __pred, __proj);
if (__new_end == __last)
return {__new_end, __new_end};
@@ -52,12 +52,12 @@ subrange<_Iter> __remove_if_impl(_Iter __first, _Sent __last, _Pred& __pred, _Pr
namespace __remove_if {
struct __fn {
-
- template <permutable _Iter, sentinel_for<_Iter> _Sent,
+ template <permutable _Iter,
+ sentinel_for<_Iter> _Sent,
class _Proj = identity,
indirect_unary_predicate<projected<_Iter, _Proj>> _Pred>
- _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr
- subrange<_Iter> operator()(_Iter __first, _Sent __last, _Pred __pred, _Proj __proj = {}) const {
+ _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr subrange<_Iter>
+ operator()(_Iter __first, _Sent __last, _Pred __pred, _Proj __proj = {}) const {
return ranges::__remove_if_impl(std::move(__first), std::move(__last), __pred, __proj);
}
@@ -65,16 +65,15 @@ struct __fn {
class _Proj = identity,
indirect_unary_predicate<projected<iterator_t<_Range>, _Proj>> _Pred>
requires permutable<iterator_t<_Range>>
- _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr
- borrowed_subrange_t<_Range> operator()(_Range&& __range, _Pred __pred, _Proj __proj = {}) const {
+ _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr borrowed_subrange_t<_Range>
+ operator()(_Range&& __range, _Pred __pred, _Proj __proj = {}) const {
return ranges::__remove_if_impl(ranges::begin(__range), ranges::end(__range), __pred, __proj);
}
-
};
} // namespace __remove_if
inline namespace __cpo {
- inline constexpr auto remove_if = __remove_if::__fn{};
+inline constexpr auto remove_if = __remove_if::__fn{};
} // namespace __cpo
} // namespace ranges
diff --git a/libcxx/include/__algorithm/ranges_replace.h b/libcxx/include/__algorithm/ranges_replace.h
index 258e25d0569e9..714fd5c7b089f 100644
--- a/libcxx/include/__algorithm/ranges_replace.h
+++ b/libcxx/include/__algorithm/ranges_replace.h
@@ -31,39 +31,28 @@ _LIBCPP_BEGIN_NAMESPACE_STD
namespace ranges {
namespace __replace {
struct __fn {
-
- template <input_iterator _Iter, sentinel_for<_Iter> _Sent,
- class _Type1,
- class _Type2,
- class _Proj = identity>
- requires indirectly_writable<_Iter, const _Type2&>
- && indirect_binary_predicate<ranges::equal_to, projected<_Iter, _Proj>, const _Type1*>
- _LIBCPP_HIDE_FROM_ABI constexpr
- _Iter operator()(_Iter __first, _Sent __last,
- const _Type1& __old_value,
- const _Type2& __new_value,
- _Proj __proj = {}) const {
+ template <input_iterator _Iter, sentinel_for<_Iter> _Sent, class _Type1, class _Type2, class _Proj = identity>
+ requires indirectly_writable<_Iter, const _Type2&> &&
+ indirect_binary_predicate<ranges::equal_to, projected<_Iter, _Proj>, const _Type1*>
+ _LIBCPP_HIDE_FROM_ABI constexpr _Iter operator()(
+ _Iter __first, _Sent __last, const _Type1& __old_value, const _Type2& __new_value, _Proj __proj = {}) const {
auto __pred = [&](const auto& __val) { return __val == __old_value; };
return ranges::__replace_if_impl(std::move(__first), std::move(__last), __pred, __new_value, __proj);
}
- template <input_range _Range,
- class _Type1,
- class _Type2,
- class _Proj = identity>
- requires indirectly_writable<iterator_t<_Range>, const _Type2&>
- && indirect_binary_predicate<ranges::equal_to, projected<iterator_t<_Range>, _Proj>, const _Type1*>
+ template <input_range _Range, class _Type1, class _Type2, class _Proj = identity>
+ requires indirectly_writable<iterator_t<_Range>, const _Type2&> &&
+ indirect_binary_predicate<ranges::equal_to, projected<iterator_t<_Range>, _Proj>, const _Type1*>
_LIBCPP_HIDE_FROM_ABI constexpr borrowed_iterator_t<_Range>
operator()(_Range&& __range, const _Type1& __old_value, const _Type2& __new_value, _Proj __proj = {}) const {
auto __pred = [&](auto&& __val) { return __val == __old_value; };
return ranges::__replace_if_impl(ranges::begin(__range), ranges::end(__range), __pred, __new_value, __proj);
}
-
};
} // namespace __replace
inline namespace __cpo {
- inline constexpr auto replace = __replace::__fn{};
+inline constexpr auto replace = __replace::__fn{};
} // namespace __cpo
} // namespace ranges
diff --git a/libcxx/include/__algorithm/ranges_replace_copy.h b/libcxx/include/__algorithm/ranges_replace_copy.h
index 79eaebb41527d..124ff8f2c559d 100644
--- a/libcxx/include/__algorithm/ranges_replace_copy.h
+++ b/libcxx/include/__algorithm/ranges_replace_copy.h
@@ -37,50 +37,47 @@ using replace_copy_result = in_out_result<_InIter, _OutIter>;
namespace __replace_copy {
- struct __fn {
- template <input_iterator _InIter,
- sentinel_for<_InIter> _Sent,
- class _OldType,
- class _NewType,
- output_iterator<const _NewType&> _OutIter,
- class _Proj = identity>
- requires indirectly_copyable<_InIter, _OutIter> &&
- indirect_binary_predicate<ranges::equal_to, projected<_InIter, _Proj>, const _OldType*>
- _LIBCPP_HIDE_FROM_ABI constexpr replace_copy_result<_InIter, _OutIter>
- operator()(_InIter __first,
- _Sent __last,
- _OutIter __result,
- const _OldType& __old_value,
- const _NewType& __new_value,
- _Proj __proj = {}) const {
- auto __pred = [&](const auto& __value) { return __value == __old_value; };
- return ranges::__replace_copy_if_impl(
- std::move(__first), std::move(__last), std::move(__result), __pred, __new_value, __proj);
- }
+struct __fn {
+ template <input_iterator _InIter,
+ sentinel_for<_InIter> _Sent,
+ class _OldType,
+ class _NewType,
+ output_iterator<const _NewType&> _OutIter,
+ class _Proj = identity>
+ requires indirectly_copyable<_InIter, _OutIter> &&
+ indirect_binary_predicate<ranges::equal_to, projected<_InIter, _Proj>, const _OldType*>
+ _LIBCPP_HIDE_FROM_ABI constexpr replace_copy_result<_InIter, _OutIter>
+ operator()(_InIter __first,
+ _Sent __last,
+ _OutIter __result,
+ const _OldType& __old_value,
+ const _NewType& __new_value,
+ _Proj __proj = {}) const {
+ auto __pred = [&](const auto& __value) { return __value == __old_value; };
+ return ranges::__replace_copy_if_impl(
+ std::move(__first), std::move(__last), std::move(__result), __pred, __new_value, __proj);
+ }
- template <input_range _Range,
- class _OldType,
- class _NewType,
- output_iterator<const _NewType&> _OutIter,
- class _Proj = identity>
- requires indirectly_copyable<iterator_t<_Range>, _OutIter> &&
- indirect_binary_predicate<ranges::equal_to, projected<iterator_t<_Range>, _Proj>, const _OldType*>
- _LIBCPP_HIDE_FROM_ABI constexpr replace_copy_result<borrowed_iterator_t<_Range>, _OutIter>
- operator()(_Range&& __range,
- _OutIter __result,
- const _OldType& __old_value,
- const _NewType& __new_value,
- _Proj __proj = {}) const {
- auto __pred = [&](const auto& __value) { return __value == __old_value; };
- return ranges::__replace_copy_if_impl(
- ranges::begin(__range), ranges::end(__range), std::move(__result), __pred, __new_value, __proj);
- }
- };
+ template <input_range _Range,
+ class _OldType,
+ class _NewType,
+ output_iterator<const _NewType&> _OutIter,
+ class _Proj = identity>
+ requires indirectly_copyable<iterator_t<_Range>, _OutIter> &&
+ indirect_binary_predicate<ranges::equal_to, projected<iterator_t<_Range>, _Proj>, const _OldType*>
+ _LIBCPP_HIDE_FROM_ABI constexpr replace_copy_result<borrowed_iterator_t<_Range>, _OutIter> operator()(
+ _Range&& __range, _OutIter __result, const _OldType& __old_value, const _NewType& __new_value, _Proj __proj = {})
+ const {
+ auto __pred = [&](const auto& __value) { return __value == __old_value; };
+ return ranges::__replace_copy_if_impl(
+ ranges::begin(__range), ranges::end(__range), std::move(__result), __pred, __new_value, __proj);
+ }
+};
} // namespace __replace_copy
inline namespace __cpo {
- inline constexpr auto replace_copy = __replace_copy::__fn{};
+inline constexpr auto replace_copy = __replace_copy::__fn{};
} // namespace __cpo
} // namespace ranges
diff --git a/libcxx/include/__algorithm/ranges_replace_copy_if.h b/libcxx/include/__algorithm/ranges_replace_copy_if.h
index 8ff2eba8fb0a5..10ed1fda6c5c8 100644
--- a/libcxx/include/__algorithm/ranges_replace_copy_if.h
+++ b/libcxx/include/__algorithm/ranges_replace_copy_if.h
@@ -51,38 +51,38 @@ _LIBCPP_HIDE_FROM_ABI constexpr replace_copy_if_result<_InIter, _OutIter> __repl
namespace __replace_copy_if {
- struct __fn {
- template <input_iterator _InIter,
- sentinel_for<_InIter> _Sent,
- class _Type,
- output_iterator<const _Type&> _OutIter,
- class _Proj = identity,
- indirect_unary_predicate<projected<_InIter, _Proj>> _Pred>
- requires indirectly_copyable<_InIter, _OutIter>
- _LIBCPP_HIDE_FROM_ABI constexpr replace_copy_if_result<_InIter, _OutIter> operator()(
- _InIter __first, _Sent __last, _OutIter __result, _Pred __pred, const _Type& __new_value, _Proj __proj = {})
- const {
- return ranges::__replace_copy_if_impl(
- std::move(__first), std::move(__last), std::move(__result), __pred, __new_value, __proj);
- }
-
- template <input_range _Range,
- class _Type,
- output_iterator<const _Type&> _OutIter,
- class _Proj = identity,
- indirect_unary_predicate<projected<iterator_t<_Range>, _Proj>> _Pred>
- requires indirectly_copyable<iterator_t<_Range>, _OutIter>
- _LIBCPP_HIDE_FROM_ABI constexpr replace_copy_if_result<borrowed_iterator_t<_Range>, _OutIter>
- operator()(_Range&& __range, _OutIter __result, _Pred __pred, const _Type& __new_value, _Proj __proj = {}) const {
- return ranges::__replace_copy_if_impl(
- ranges::begin(__range), ranges::end(__range), std::move(__result), __pred, __new_value, __proj);
- }
- };
+struct __fn {
+ template <input_iterator _InIter,
+ sentinel_for<_InIter> _Sent,
+ class _Type,
+ output_iterator<const _Type&> _OutIter,
+ class _Proj = identity,
+ indirect_unary_predicate<projected<_InIter, _Proj>> _Pred>
+ requires indirectly_copyable<_InIter, _OutIter>
+ _LIBCPP_HIDE_FROM_ABI constexpr replace_copy_if_result<_InIter, _OutIter> operator()(
+ _InIter __first, _Sent __last, _OutIter __result, _Pred __pred, const _Type& __new_value, _Proj __proj = {})
+ const {
+ return ranges::__replace_copy_if_impl(
+ std::move(__first), std::move(__last), std::move(__result), __pred, __new_value, __proj);
+ }
+
+ template <input_range _Range,
+ class _Type,
+ output_iterator<const _Type&> _OutIter,
+ class _Proj = identity,
+ indirect_unary_predicate<projected<iterator_t<_Range>, _Proj>> _Pred>
+ requires indirectly_copyable<iterator_t<_Range>, _OutIter>
+ _LIBCPP_HIDE_FROM_ABI constexpr replace_copy_if_result<borrowed_iterator_t<_Range>, _OutIter>
+ operator()(_Range&& __range, _OutIter __result, _Pred __pred, const _Type& __new_value, _Proj __proj = {}) const {
+ return ranges::__replace_copy_if_impl(
+ ranges::begin(__range), ranges::end(__range), std::move(__result), __pred, __new_value, __proj);
+ }
+};
} // namespace __replace_copy_if
inline namespace __cpo {
- inline constexpr auto replace_copy_if = __replace_copy_if::__fn{};
+inline constexpr auto replace_copy_if = __replace_copy_if::__fn{};
} // namespace __cpo
} // namespace ranges
diff --git a/libcxx/include/__algorithm/ranges_replace_if.h b/libcxx/include/__algorithm/ranges_replace_if.h
index 2b7dda9e69f3b..519fa32029ac6 100644
--- a/libcxx/include/__algorithm/ranges_replace_if.h
+++ b/libcxx/include/__algorithm/ranges_replace_if.h
@@ -30,8 +30,8 @@ _LIBCPP_BEGIN_NAMESPACE_STD
namespace ranges {
template <class _Iter, class _Sent, class _Type, class _Proj, class _Pred>
-_LIBCPP_HIDE_FROM_ABI constexpr
-_Iter __replace_if_impl(_Iter __first, _Sent __last, _Pred& __pred, const _Type& __new_value, _Proj& __proj) {
+_LIBCPP_HIDE_FROM_ABI constexpr _Iter
+__replace_if_impl(_Iter __first, _Sent __last, _Pred& __pred, const _Type& __new_value, _Proj& __proj) {
for (; __first != __last; ++__first) {
if (std::invoke(__pred, std::invoke(__proj, *__first)))
*__first = __new_value;
@@ -41,14 +41,14 @@ _Iter __replace_if_impl(_Iter __first, _Sent __last, _Pred& __pred, const _Type&
namespace __replace_if {
struct __fn {
-
- template <input_iterator _Iter, sentinel_for<_Iter> _Sent,
+ template <input_iterator _Iter,
+ sentinel_for<_Iter> _Sent,
class _Type,
class _Proj = identity,
indirect_unary_predicate<projected<_Iter, _Proj>> _Pred>
requires indirectly_writable<_Iter, const _Type&>
- _LIBCPP_HIDE_FROM_ABI constexpr
- _Iter operator()(_Iter __first, _Sent __last, _Pred __pred, const _Type& __new_value, _Proj __proj = {}) const {
+ _LIBCPP_HIDE_FROM_ABI constexpr _Iter
+ operator()(_Iter __first, _Sent __last, _Pred __pred, const _Type& __new_value, _Proj __proj = {}) const {
return ranges::__replace_if_impl(std::move(__first), std::move(__last), __pred, __new_value, __proj);
}
@@ -61,12 +61,11 @@ struct __fn {
operator()(_Range&& __range, _Pred __pred, const _Type& __new_value, _Proj __proj = {}) const {
return ranges::__replace_if_impl(ranges::begin(__range), ranges::end(__range), __pred, __new_value, __proj);
}
-
};
} // namespace __replace_if
inline namespace __cpo {
- inline constexpr auto replace_if = __replace_if::__fn{};
+inline constexpr auto replace_if = __replace_if::__fn{};
} // namespace __cpo
} // namespace ranges
diff --git a/libcxx/include/__algorithm/ranges_reverse.h b/libcxx/include/__algorithm/ranges_reverse.h
index 801fccb853f20..9ec865995b4a5 100644
--- a/libcxx/include/__algorithm/ranges_reverse.h
+++ b/libcxx/include/__algorithm/ranges_reverse.h
@@ -29,11 +29,9 @@ _LIBCPP_BEGIN_NAMESPACE_STD
namespace ranges {
namespace __reverse {
struct __fn {
-
template <bidirectional_iterator _Iter, sentinel_for<_Iter> _Sent>
requires permutable<_Iter>
- _LIBCPP_HIDE_FROM_ABI constexpr
- _Iter operator()(_Iter __first, _Sent __last) const {
+ _LIBCPP_HIDE_FROM_ABI constexpr _Iter operator()(_Iter __first, _Sent __last) const {
if constexpr (random_access_iterator<_Iter>) {
if (__first == __last)
return __first;
@@ -63,16 +61,14 @@ struct __fn {
template <bidirectional_range _Range>
requires permutable<iterator_t<_Range>>
- _LIBCPP_HIDE_FROM_ABI constexpr
- borrowed_iterator_t<_Range> operator()(_Range&& __range) const {
+ _LIBCPP_HIDE_FROM_ABI constexpr borrowed_iterator_t<_Range> operator()(_Range&& __range) const {
return (*this)(ranges::begin(__range), ranges::end(__range));
}
-
};
} // namespace __reverse
inline namespace __cpo {
- inline constexpr auto reverse = __reverse::__fn{};
+inline constexpr auto reverse = __reverse::__fn{};
} // namespace __cpo
} // namespace ranges
diff --git a/libcxx/include/__algorithm/ranges_reverse_copy.h b/libcxx/include/__algorithm/ranges_reverse_copy.h
index c23039976347b..35b9edba0bfb2 100644
--- a/libcxx/include/__algorithm/ranges_reverse_copy.h
+++ b/libcxx/include/__algorithm/ranges_reverse_copy.h
@@ -36,27 +36,25 @@ using reverse_copy_result = in_out_result<_InIter, _OutIter>;
namespace __reverse_copy {
struct __fn {
-
template <bidirectional_iterator _InIter, sentinel_for<_InIter> _Sent, weakly_incrementable _OutIter>
requires indirectly_copyable<_InIter, _OutIter>
- _LIBCPP_HIDE_FROM_ABI constexpr
- reverse_copy_result<_InIter, _OutIter> operator()(_InIter __first, _Sent __last, _OutIter __result) const {
+ _LIBCPP_HIDE_FROM_ABI constexpr reverse_copy_result<_InIter, _OutIter>
+ operator()(_InIter __first, _Sent __last, _OutIter __result) const {
return (*this)(subrange(std::move(__first), std::move(__last)), std::move(__result));
}
template <bidirectional_range _Range, weakly_incrementable _OutIter>
requires indirectly_copyable<iterator_t<_Range>, _OutIter>
- _LIBCPP_HIDE_FROM_ABI constexpr
- reverse_copy_result<borrowed_iterator_t<_Range>, _OutIter> operator()(_Range&& __range, _OutIter __result) const {
+ _LIBCPP_HIDE_FROM_ABI constexpr reverse_copy_result<borrowed_iterator_t<_Range>, _OutIter>
+ operator()(_Range&& __range, _OutIter __result) const {
auto __ret = ranges::copy(std::__reverse_range(__range), std::move(__result));
return {ranges::next(ranges::begin(__range), ranges::end(__range)), std::move(__ret.out)};
}
-
};
} // namespace __reverse_copy
inline namespace __cpo {
- inline constexpr auto reverse_copy = __reverse_copy::__fn{};
+inline constexpr auto reverse_copy = __reverse_copy::__fn{};
} // namespace __cpo
} // namespace ranges
diff --git a/libcxx/include/__algorithm/ranges_rotate.h b/libcxx/include/__algorithm/ranges_rotate.h
index 99e6ca67e71a0..ebed9bbd54266 100644
--- a/libcxx/include/__algorithm/ranges_rotate.h
+++ b/libcxx/include/__algorithm/ranges_rotate.h
@@ -33,34 +33,29 @@ namespace ranges {
namespace __rotate {
struct __fn {
-
template <class _Iter, class _Sent>
- _LIBCPP_HIDE_FROM_ABI constexpr
- static subrange<_Iter> __rotate_fn_impl(_Iter __first, _Iter __middle, _Sent __last) {
- auto __ret = std::__rotate<_RangeAlgPolicy>(
- std::move(__first), std::move(__middle), std::move(__last));
+ _LIBCPP_HIDE_FROM_ABI constexpr static subrange<_Iter> __rotate_fn_impl(_Iter __first, _Iter __middle, _Sent __last) {
+ auto __ret = std::__rotate<_RangeAlgPolicy>(std::move(__first), std::move(__middle), std::move(__last));
return {std::move(__ret.first), std::move(__ret.second)};
}
template <permutable _Iter, sentinel_for<_Iter> _Sent>
- _LIBCPP_HIDE_FROM_ABI constexpr
- subrange<_Iter> operator()(_Iter __first, _Iter __middle, _Sent __last) const {
+ _LIBCPP_HIDE_FROM_ABI constexpr subrange<_Iter> operator()(_Iter __first, _Iter __middle, _Sent __last) const {
return __rotate_fn_impl(std::move(__first), std::move(__middle), std::move(__last));
}
template <forward_range _Range>
- requires permutable<iterator_t<_Range>>
- _LIBCPP_HIDE_FROM_ABI constexpr
- borrowed_subrange_t<_Range> operator()(_Range&& __range, iterator_t<_Range> __middle) const {
+ requires permutable<iterator_t<_Range>>
+ _LIBCPP_HIDE_FROM_ABI constexpr borrowed_subrange_t<_Range>
+ operator()(_Range&& __range, iterator_t<_Range> __middle) const {
return __rotate_fn_impl(ranges::begin(__range), std::move(__middle), ranges::end(__range));
}
-
};
} // namespace __rotate
inline namespace __cpo {
- inline constexpr auto rotate = __rotate::__fn{};
+inline constexpr auto rotate = __rotate::__fn{};
} // namespace __cpo
} // namespace ranges
diff --git a/libcxx/include/__algorithm/ranges_rotate_copy.h b/libcxx/include/__algorithm/ranges_rotate_copy.h
index 5b9321f90d5da..301672707f72b 100644
--- a/libcxx/include/__algorithm/ranges_rotate_copy.h
+++ b/libcxx/include/__algorithm/ranges_rotate_copy.h
@@ -34,11 +34,9 @@ using rotate_copy_result = in_out_result<_InIter, _OutIter>;
namespace __rotate_copy {
struct __fn {
-
template <bidirectional_iterator _InIter, sentinel_for<_InIter> _Sent, weakly_incrementable _OutIter>
requires indirectly_copyable<_InIter, _OutIter>
- _LIBCPP_HIDE_FROM_ABI constexpr
- rotate_copy_result<_InIter, _OutIter>
+ _LIBCPP_HIDE_FROM_ABI constexpr rotate_copy_result<_InIter, _OutIter>
operator()(_InIter __first, _InIter __middle, _Sent __last, _OutIter __result) const {
auto __res1 = ranges::copy(__middle, __last, std::move(__result));
auto __res2 = ranges::copy(__first, __middle, std::move(__res1.out));
@@ -47,17 +45,15 @@ struct __fn {
template <bidirectional_range _Range, weakly_incrementable _OutIter>
requires indirectly_copyable<iterator_t<_Range>, _OutIter>
- _LIBCPP_HIDE_FROM_ABI constexpr
- rotate_copy_result<borrowed_iterator_t<_Range>, _OutIter>
+ _LIBCPP_HIDE_FROM_ABI constexpr rotate_copy_result<borrowed_iterator_t<_Range>, _OutIter>
operator()(_Range&& __range, iterator_t<_Range> __middle, _OutIter __result) const {
return (*this)(ranges::begin(__range), std::move(__middle), ranges::end(__range), std::move(__result));
}
-
};
} // namespace __rotate_copy
inline namespace __cpo {
- inline constexpr auto rotate_copy = __rotate_copy::__fn{};
+inline constexpr auto rotate_copy = __rotate_copy::__fn{};
} // namespace __cpo
} // namespace ranges
diff --git a/libcxx/include/__algorithm/ranges_sample.h b/libcxx/include/__algorithm/ranges_sample.h
index a5ff2d0c8ece1..d347d82205a89 100644
--- a/libcxx/include/__algorithm/ranges_sample.h
+++ b/libcxx/include/__algorithm/ranges_sample.h
@@ -35,35 +35,30 @@ namespace ranges {
namespace __sample {
struct __fn {
-
template <input_iterator _Iter, sentinel_for<_Iter> _Sent, weakly_incrementable _OutIter, class _Gen>
- requires (forward_iterator<_Iter> || random_access_iterator<_OutIter>) &&
- indirectly_copyable<_Iter, _OutIter> &&
- uniform_random_bit_generator<remove_reference_t<_Gen>>
- _LIBCPP_HIDE_FROM_ABI
- _OutIter operator()(_Iter __first, _Sent __last,
- _OutIter __out_first, iter_
diff erence_t<_Iter> __n, _Gen&& __gen) const {
+ requires(forward_iterator<_Iter> || random_access_iterator<_OutIter>) && indirectly_copyable<_Iter, _OutIter> &&
+ uniform_random_bit_generator<remove_reference_t<_Gen>>
+ _LIBCPP_HIDE_FROM_ABI _OutIter
+ operator()(_Iter __first, _Sent __last, _OutIter __out_first, iter_
diff erence_t<_Iter> __n, _Gen&& __gen) const {
_ClassicGenAdaptor<_Gen> __adapted_gen(__gen);
return std::__sample<_RangeAlgPolicy>(
std::move(__first), std::move(__last), std::move(__out_first), __n, __adapted_gen);
}
template <input_range _Range, weakly_incrementable _OutIter, class _Gen>
- requires (forward_range<_Range> || random_access_iterator<_OutIter>) &&
- indirectly_copyable<iterator_t<_Range>, _OutIter> &&
- uniform_random_bit_generator<remove_reference_t<_Gen>>
- _LIBCPP_HIDE_FROM_ABI
- _OutIter operator()(_Range&& __range, _OutIter __out_first, range_
diff erence_t<_Range> __n, _Gen&& __gen) const {
- return (*this)(ranges::begin(__range), ranges::end(__range),
- std::move(__out_first), __n, std::forward<_Gen>(__gen));
+ requires(forward_range<_Range> || random_access_iterator<_OutIter>) &&
+ indirectly_copyable<iterator_t<_Range>, _OutIter> && uniform_random_bit_generator<remove_reference_t<_Gen>>
+ _LIBCPP_HIDE_FROM_ABI _OutIter
+ operator()(_Range&& __range, _OutIter __out_first, range_
diff erence_t<_Range> __n, _Gen&& __gen) const {
+ return (*this)(
+ ranges::begin(__range), ranges::end(__range), std::move(__out_first), __n, std::forward<_Gen>(__gen));
}
-
};
} // namespace __sample
inline namespace __cpo {
- inline constexpr auto sample = __sample::__fn{};
+inline constexpr auto sample = __sample::__fn{};
} // namespace __cpo
} // namespace ranges
diff --git a/libcxx/include/__algorithm/ranges_search.h b/libcxx/include/__algorithm/ranges_search.h
index 6d3e3186881a7..ca2326e9ab273 100644
--- a/libcxx/include/__algorithm/ranges_search.h
+++ b/libcxx/include/__algorithm/ranges_search.h
@@ -69,33 +69,33 @@ struct __fn {
return {__ret.first, __ret.second};
}
- template <forward_iterator _Iter1, sentinel_for<_Iter1> _Sent1,
- forward_iterator _Iter2, sentinel_for<_Iter2> _Sent2,
- class _Pred = ranges::equal_to,
+ template <forward_iterator _Iter1,
+ sentinel_for<_Iter1> _Sent1,
+ forward_iterator _Iter2,
+ sentinel_for<_Iter2> _Sent2,
+ class _Pred = ranges::equal_to,
class _Proj1 = identity,
class _Proj2 = identity>
requires indirectly_comparable<_Iter1, _Iter2, _Pred, _Proj1, _Proj2>
- _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr
- subrange<_Iter1> operator()(_Iter1 __first1, _Sent1 __last1,
- _Iter2 __first2, _Sent2 __last2,
- _Pred __pred = {},
- _Proj1 __proj1 = {},
- _Proj2 __proj2 = {}) const {
+ _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr subrange<_Iter1> operator()(
+ _Iter1 __first1,
+ _Sent1 __last1,
+ _Iter2 __first2,
+ _Sent2 __last2,
+ _Pred __pred = {},
+ _Proj1 __proj1 = {},
+ _Proj2 __proj2 = {}) const {
return __ranges_search_impl(__first1, __last1, __first2, __last2, __pred, __proj1, __proj2);
}
template <forward_range _Range1,
forward_range _Range2,
- class _Pred = ranges::equal_to,
+ class _Pred = ranges::equal_to,
class _Proj1 = identity,
class _Proj2 = identity>
requires indirectly_comparable<iterator_t<_Range1>, iterator_t<_Range2>, _Pred, _Proj1, _Proj2>
- _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr
- borrowed_subrange_t<_Range1> operator()(_Range1&& __range1,
- _Range2&& __range2,
- _Pred __pred = {},
- _Proj1 __proj1 = {},
- _Proj2 __proj2 = {}) const {
+ _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr borrowed_subrange_t<_Range1> operator()(
+ _Range1&& __range1, _Range2&& __range2, _Pred __pred = {}, _Proj1 __proj1 = {}, _Proj2 __proj2 = {}) const {
auto __first1 = ranges::begin(__range1);
if constexpr (sized_range<_Range2>) {
auto __size2 = ranges::size(__range2);
@@ -119,12 +119,11 @@ struct __fn {
__proj1,
__proj2);
}
-
};
} // namespace __search
inline namespace __cpo {
- inline constexpr auto search = __search::__fn{};
+inline constexpr auto search = __search::__fn{};
} // namespace __cpo
} // namespace ranges
diff --git a/libcxx/include/__algorithm/ranges_search_n.h b/libcxx/include/__algorithm/ranges_search_n.h
index ed5ec34f06348..4e53f30f71f9d 100644
--- a/libcxx/include/__algorithm/ranges_search_n.h
+++ b/libcxx/include/__algorithm/ranges_search_n.h
@@ -38,7 +38,6 @@ _LIBCPP_BEGIN_NAMESPACE_STD
namespace ranges {
namespace __search_n {
struct __fn {
-
template <class _Iter1, class _Sent1, class _SizeT, class _Type, class _Pred, class _Proj>
_LIBCPP_HIDE_FROM_ABI static constexpr subrange<_Iter1> __ranges_search_n_impl(
_Iter1 __first, _Sent1 __last, _SizeT __count, const _Type& __value, _Pred& __pred, _Proj& __proj) {
@@ -59,36 +58,31 @@ struct __fn {
}
}
- auto __ret = std::__search_n_forward_impl<_RangeAlgPolicy>(__first, __last,
- __count,
- __value,
- __pred,
- __proj);
+ auto __ret = std::__search_n_forward_impl<_RangeAlgPolicy>(__first, __last, __count, __value, __pred, __proj);
return {std::move(__ret.first), std::move(__ret.second)};
}
- template <forward_iterator _Iter, sentinel_for<_Iter> _Sent,
+ template <forward_iterator _Iter,
+ sentinel_for<_Iter> _Sent,
class _Type,
class _Pred = ranges::equal_to,
class _Proj = identity>
requires indirectly_comparable<_Iter, const _Type*, _Pred, _Proj>
- _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr
- subrange<_Iter> operator()(_Iter __first, _Sent __last,
- iter_
diff erence_t<_Iter> __count,
- const _Type& __value,
- _Pred __pred = {},
- _Proj __proj = _Proj{}) const {
+ _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr subrange<_Iter>
+ operator()(_Iter __first,
+ _Sent __last,
+ iter_
diff erence_t<_Iter> __count,
+ const _Type& __value,
+ _Pred __pred = {},
+ _Proj __proj = _Proj{}) const {
return __ranges_search_n_impl(__first, __last, __count, __value, __pred, __proj);
}
template <forward_range _Range, class _Type, class _Pred = ranges::equal_to, class _Proj = identity>
requires indirectly_comparable<iterator_t<_Range>, const _Type*, _Pred, _Proj>
- _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr
- borrowed_subrange_t<_Range> operator()(_Range&& __range,
- range_
diff erence_t<_Range> __count,
- const _Type& __value,
- _Pred __pred = {},
- _Proj __proj = {}) const {
+ _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr borrowed_subrange_t<_Range> operator()(
+ _Range&& __range, range_
diff erence_t<_Range> __count, const _Type& __value, _Pred __pred = {}, _Proj __proj = {})
+ const {
auto __first = ranges::begin(__range);
if (__count <= 0)
return {__first, __first};
@@ -106,7 +100,7 @@ struct __fn {
} // namespace __search_n
inline namespace __cpo {
- inline constexpr auto search_n = __search_n::__fn{};
+inline constexpr auto search_n = __search_n::__fn{};
} // namespace __cpo
} // namespace ranges
diff --git a/libcxx/include/__algorithm/ranges_set_
diff erence.h b/libcxx/include/__algorithm/ranges_set_
diff erence.h
index 6b9af876b5fe5..a9453ed336f51 100644
--- a/libcxx/include/__algorithm/ranges_set_
diff erence.h
+++ b/libcxx/include/__algorithm/ranges_set_
diff erence.h
@@ -42,15 +42,14 @@ using set_
diff erence_result = in_out_result<_InIter, _OutIter>;
namespace __set_
diff erence {
struct __fn {
- template <
- input_iterator _InIter1,
- sentinel_for<_InIter1> _Sent1,
- input_iterator _InIter2,
- sentinel_for<_InIter2> _Sent2,
- weakly_incrementable _OutIter,
- class _Comp = less,
- class _Proj1 = identity,
- class _Proj2 = identity>
+ template <input_iterator _InIter1,
+ sentinel_for<_InIter1> _Sent1,
+ input_iterator _InIter2,
+ sentinel_for<_InIter2> _Sent2,
+ weakly_incrementable _OutIter,
+ class _Comp = less,
+ class _Proj1 = identity,
+ class _Proj2 = identity>
requires mergeable<_InIter1, _InIter2, _OutIter, _Comp, _Proj1, _Proj2>
_LIBCPP_HIDE_FROM_ABI constexpr set_
diff erence_result<_InIter1, _OutIter> operator()(
_InIter1 __first1,
@@ -66,22 +65,20 @@ struct __fn {
return {std::move(__ret.first), std::move(__ret.second)};
}
- template <
- input_range _Range1,
- input_range _Range2,
- weakly_incrementable _OutIter,
- class _Comp = less,
- class _Proj1 = identity,
- class _Proj2 = identity>
+ template <input_range _Range1,
+ input_range _Range2,
+ weakly_incrementable _OutIter,
+ class _Comp = less,
+ class _Proj1 = identity,
+ class _Proj2 = identity>
requires mergeable<iterator_t<_Range1>, iterator_t<_Range2>, _OutIter, _Comp, _Proj1, _Proj2>
_LIBCPP_HIDE_FROM_ABI constexpr set_
diff erence_result<borrowed_iterator_t<_Range1>, _OutIter>
- operator()(
- _Range1&& __range1,
- _Range2&& __range2,
- _OutIter __result,
- _Comp __comp = {},
- _Proj1 __proj1 = {},
- _Proj2 __proj2 = {}) const {
+ operator()(_Range1&& __range1,
+ _Range2&& __range2,
+ _OutIter __result,
+ _Comp __comp = {},
+ _Proj1 __proj1 = {},
+ _Proj2 __proj2 = {}) const {
auto __ret = std::__set_
diff erence<_RangeAlgPolicy>(
ranges::begin(__range1),
ranges::end(__range1),
@@ -96,7 +93,7 @@ struct __fn {
} // namespace __set_
diff erence
inline namespace __cpo {
- inline constexpr auto set_
diff erence = __set_
diff erence::__fn{};
+inline constexpr auto set_
diff erence = __set_
diff erence::__fn{};
} // namespace __cpo
} // namespace ranges
diff --git a/libcxx/include/__algorithm/ranges_set_intersection.h b/libcxx/include/__algorithm/ranges_set_intersection.h
index 5848656ce3423..4cdcbb75051a1 100644
--- a/libcxx/include/__algorithm/ranges_set_intersection.h
+++ b/libcxx/include/__algorithm/ranges_set_intersection.h
@@ -40,15 +40,14 @@ using set_intersection_result = in_in_out_result<_InIter1, _InIter2, _OutIter>;
namespace __set_intersection {
struct __fn {
- template <
- input_iterator _InIter1,
- sentinel_for<_InIter1> _Sent1,
- input_iterator _InIter2,
- sentinel_for<_InIter2> _Sent2,
- weakly_incrementable _OutIter,
- class _Comp = less,
- class _Proj1 = identity,
- class _Proj2 = identity>
+ template <input_iterator _InIter1,
+ sentinel_for<_InIter1> _Sent1,
+ input_iterator _InIter2,
+ sentinel_for<_InIter2> _Sent2,
+ weakly_incrementable _OutIter,
+ class _Comp = less,
+ class _Proj1 = identity,
+ class _Proj2 = identity>
requires mergeable<_InIter1, _InIter2, _OutIter, _Comp, _Proj1, _Proj2>
_LIBCPP_HIDE_FROM_ABI constexpr set_intersection_result<_InIter1, _InIter2, _OutIter> operator()(
_InIter1 __first1,
@@ -69,30 +68,22 @@ struct __fn {
return {std::move(__ret.__in1_), std::move(__ret.__in2_), std::move(__ret.__out_)};
}
- template <
- input_range _Range1,
- input_range _Range2,
- weakly_incrementable _OutIter,
- class _Comp = less,
- class _Proj1 = identity,
- class _Proj2 = identity>
- requires mergeable<
- iterator_t<_Range1>,
- iterator_t<_Range2>,
- _OutIter,
- _Comp,
- _Proj1,
- _Proj2>
- _LIBCPP_HIDE_FROM_ABI constexpr set_intersection_result<borrowed_iterator_t<_Range1>,
- borrowed_iterator_t<_Range2>,
- _OutIter>
- operator()(
- _Range1&& __range1,
- _Range2&& __range2,
- _OutIter __result,
- _Comp __comp = {},
- _Proj1 __proj1 = {},
- _Proj2 __proj2 = {}) const {
+ template <input_range _Range1,
+ input_range _Range2,
+ weakly_incrementable _OutIter,
+ class _Comp = less,
+ class _Proj1 = identity,
+ class _Proj2 = identity>
+ requires mergeable<iterator_t<_Range1>, iterator_t<_Range2>, _OutIter, _Comp, _Proj1, _Proj2>
+ _LIBCPP_HIDE_FROM_ABI constexpr set_intersection_result<borrowed_iterator_t<_Range1>,
+ borrowed_iterator_t<_Range2>,
+ _OutIter>
+ operator()(_Range1&& __range1,
+ _Range2&& __range2,
+ _OutIter __result,
+ _Comp __comp = {},
+ _Proj1 __proj1 = {},
+ _Proj2 __proj2 = {}) const {
auto __ret = std::__set_intersection<_RangeAlgPolicy>(
ranges::begin(__range1),
ranges::end(__range1),
@@ -107,7 +98,7 @@ struct __fn {
} // namespace __set_intersection
inline namespace __cpo {
- inline constexpr auto set_intersection = __set_intersection::__fn{};
+inline constexpr auto set_intersection = __set_intersection::__fn{};
} // namespace __cpo
} // namespace ranges
diff --git a/libcxx/include/__algorithm/ranges_set_symmetric_
diff erence.h b/libcxx/include/__algorithm/ranges_set_symmetric_
diff erence.h
index f8bcf37954fc9..d8710a1c47b0b 100644
--- a/libcxx/include/__algorithm/ranges_set_symmetric_
diff erence.h
+++ b/libcxx/include/__algorithm/ranges_set_symmetric_
diff erence.h
@@ -40,15 +40,14 @@ using set_symmetric_
diff erence_result = in_in_out_result<_InIter1, _InIter2, _Ou
namespace __set_symmetric_
diff erence {
struct __fn {
- template <
- input_iterator _InIter1,
- sentinel_for<_InIter1> _Sent1,
- input_iterator _InIter2,
- sentinel_for<_InIter2> _Sent2,
- weakly_incrementable _OutIter,
- class _Comp = ranges::less,
- class _Proj1 = identity,
- class _Proj2 = identity>
+ template <input_iterator _InIter1,
+ sentinel_for<_InIter1> _Sent1,
+ input_iterator _InIter2,
+ sentinel_for<_InIter2> _Sent2,
+ weakly_incrementable _OutIter,
+ class _Comp = ranges::less,
+ class _Proj1 = identity,
+ class _Proj2 = identity>
requires mergeable<_InIter1, _InIter2, _OutIter, _Comp, _Proj1, _Proj2>
_LIBCPP_HIDE_FROM_ABI constexpr set_symmetric_
diff erence_result<_InIter1, _InIter2, _OutIter> operator()(
_InIter1 __first1,
@@ -69,30 +68,22 @@ struct __fn {
return {std::move(__ret.__in1_), std::move(__ret.__in2_), std::move(__ret.__out_)};
}
- template <
- input_range _Range1,
- input_range _Range2,
- weakly_incrementable _OutIter,
- class _Comp = ranges::less,
- class _Proj1 = identity,
- class _Proj2 = identity>
- requires mergeable<
- iterator_t<_Range1>,
- iterator_t<_Range2>,
- _OutIter,
- _Comp,
- _Proj1,
- _Proj2>
+ template <input_range _Range1,
+ input_range _Range2,
+ weakly_incrementable _OutIter,
+ class _Comp = ranges::less,
+ class _Proj1 = identity,
+ class _Proj2 = identity>
+ requires mergeable<iterator_t<_Range1>, iterator_t<_Range2>, _OutIter, _Comp, _Proj1, _Proj2>
_LIBCPP_HIDE_FROM_ABI constexpr set_symmetric_
diff erence_result<borrowed_iterator_t<_Range1>,
borrowed_iterator_t<_Range2>,
_OutIter>
- operator()(
- _Range1&& __range1,
- _Range2&& __range2,
- _OutIter __result,
- _Comp __comp = {},
- _Proj1 __proj1 = {},
- _Proj2 __proj2 = {}) const {
+ operator()(_Range1&& __range1,
+ _Range2&& __range2,
+ _OutIter __result,
+ _Comp __comp = {},
+ _Proj1 __proj1 = {},
+ _Proj2 __proj2 = {}) const {
auto __ret = std::__set_symmetric_
diff erence<_RangeAlgPolicy>(
ranges::begin(__range1),
ranges::end(__range1),
@@ -107,7 +98,7 @@ struct __fn {
} // namespace __set_symmetric_
diff erence
inline namespace __cpo {
- inline constexpr auto set_symmetric_
diff erence = __set_symmetric_
diff erence::__fn{};
+inline constexpr auto set_symmetric_
diff erence = __set_symmetric_
diff erence::__fn{};
} // namespace __cpo
} // namespace ranges
diff --git a/libcxx/include/__algorithm/ranges_set_union.h b/libcxx/include/__algorithm/ranges_set_union.h
index bc669cc83bb73..c627166fffed3 100644
--- a/libcxx/include/__algorithm/ranges_set_union.h
+++ b/libcxx/include/__algorithm/ranges_set_union.h
@@ -43,15 +43,14 @@ using set_union_result = in_in_out_result<_InIter1, _InIter2, _OutIter>;
namespace __set_union {
struct __fn {
- template <
- input_iterator _InIter1,
- sentinel_for<_InIter1> _Sent1,
- input_iterator _InIter2,
- sentinel_for<_InIter2> _Sent2,
- weakly_incrementable _OutIter,
- class _Comp = ranges::less,
- class _Proj1 = identity,
- class _Proj2 = identity>
+ template <input_iterator _InIter1,
+ sentinel_for<_InIter1> _Sent1,
+ input_iterator _InIter2,
+ sentinel_for<_InIter2> _Sent2,
+ weakly_incrementable _OutIter,
+ class _Comp = ranges::less,
+ class _Proj1 = identity,
+ class _Proj2 = identity>
requires mergeable<_InIter1, _InIter2, _OutIter, _Comp, _Proj1, _Proj2>
_LIBCPP_HIDE_FROM_ABI constexpr set_union_result<_InIter1, _InIter2, _OutIter> operator()(
_InIter1 __first1,
@@ -72,30 +71,20 @@ struct __fn {
return {std::move(__ret.__in1_), std::move(__ret.__in2_), std::move(__ret.__out_)};
}
- template <
- input_range _Range1,
- input_range _Range2,
- weakly_incrementable _OutIter,
- class _Comp = ranges::less,
- class _Proj1 = identity,
- class _Proj2 = identity>
- requires mergeable<
- iterator_t<_Range1>,
- iterator_t<_Range2>,
- _OutIter,
- _Comp,
- _Proj1,
- _Proj2>
- _LIBCPP_HIDE_FROM_ABI constexpr set_union_result<borrowed_iterator_t<_Range1>,
- borrowed_iterator_t<_Range2>,
- _OutIter>
- operator()(
- _Range1&& __range1,
- _Range2&& __range2,
- _OutIter __result,
- _Comp __comp = {},
- _Proj1 __proj1 = {},
- _Proj2 __proj2 = {}) const {
+ template <input_range _Range1,
+ input_range _Range2,
+ weakly_incrementable _OutIter,
+ class _Comp = ranges::less,
+ class _Proj1 = identity,
+ class _Proj2 = identity>
+ requires mergeable<iterator_t<_Range1>, iterator_t<_Range2>, _OutIter, _Comp, _Proj1, _Proj2>
+ _LIBCPP_HIDE_FROM_ABI constexpr set_union_result<borrowed_iterator_t<_Range1>, borrowed_iterator_t<_Range2>, _OutIter>
+ operator()(_Range1&& __range1,
+ _Range2&& __range2,
+ _OutIter __result,
+ _Comp __comp = {},
+ _Proj1 __proj1 = {},
+ _Proj2 __proj2 = {}) const {
auto __ret = std::__set_union<_RangeAlgPolicy>(
ranges::begin(__range1),
ranges::end(__range1),
@@ -110,7 +99,7 @@ struct __fn {
} // namespace __set_union
inline namespace __cpo {
- inline constexpr auto set_union = __set_union::__fn{};
+inline constexpr auto set_union = __set_union::__fn{};
} // namespace __cpo
} // namespace ranges
diff --git a/libcxx/include/__algorithm/ranges_shuffle.h b/libcxx/include/__algorithm/ranges_shuffle.h
index 2f45fb00fccc4..fca420058dec0 100644
--- a/libcxx/include/__algorithm/ranges_shuffle.h
+++ b/libcxx/include/__algorithm/ranges_shuffle.h
@@ -39,28 +39,24 @@ namespace ranges {
namespace __shuffle {
struct __fn {
-
template <random_access_iterator _Iter, sentinel_for<_Iter> _Sent, class _Gen>
- requires permutable<_Iter> && uniform_random_bit_generator<remove_reference_t<_Gen>>
- _LIBCPP_HIDE_FROM_ABI
- _Iter operator()(_Iter __first, _Sent __last, _Gen&& __gen) const {
+ requires permutable<_Iter> && uniform_random_bit_generator<remove_reference_t<_Gen>>
+ _LIBCPP_HIDE_FROM_ABI _Iter operator()(_Iter __first, _Sent __last, _Gen&& __gen) const {
_ClassicGenAdaptor<_Gen> __adapted_gen(__gen);
return std::__shuffle<_RangeAlgPolicy>(std::move(__first), std::move(__last), __adapted_gen);
}
- template<random_access_range _Range, class _Gen>
- requires permutable<iterator_t<_Range>> && uniform_random_bit_generator<remove_reference_t<_Gen>>
- _LIBCPP_HIDE_FROM_ABI
- borrowed_iterator_t<_Range> operator()(_Range&& __range, _Gen&& __gen) const {
+ template <random_access_range _Range, class _Gen>
+ requires permutable<iterator_t<_Range>> && uniform_random_bit_generator<remove_reference_t<_Gen>>
+ _LIBCPP_HIDE_FROM_ABI borrowed_iterator_t<_Range> operator()(_Range&& __range, _Gen&& __gen) const {
return (*this)(ranges::begin(__range), ranges::end(__range), std::forward<_Gen>(__gen));
}
-
};
} // namespace __shuffle
inline namespace __cpo {
- inline constexpr auto shuffle = __shuffle::__fn{};
+inline constexpr auto shuffle = __shuffle::__fn{};
} // namespace __cpo
} // namespace ranges
diff --git a/libcxx/include/__algorithm/ranges_sort.h b/libcxx/include/__algorithm/ranges_sort.h
index 60305b10abdc7..2ad0e0c233be4 100644
--- a/libcxx/include/__algorithm/ranges_sort.h
+++ b/libcxx/include/__algorithm/ranges_sort.h
@@ -40,8 +40,8 @@ namespace __sort {
struct __fn {
template <class _Iter, class _Sent, class _Comp, class _Proj>
- _LIBCPP_HIDE_FROM_ABI constexpr static
- _Iter __sort_fn_impl(_Iter __first, _Sent __last, _Comp& __comp, _Proj& __proj) {
+ _LIBCPP_HIDE_FROM_ABI constexpr static _Iter
+ __sort_fn_impl(_Iter __first, _Sent __last, _Comp& __comp, _Proj& __proj) {
auto __last_iter = ranges::next(__first, __last);
auto&& __projected_comp = std::__make_projected(__comp, __proj);
@@ -52,15 +52,15 @@ struct __fn {
template <random_access_iterator _Iter, sentinel_for<_Iter> _Sent, class _Comp = ranges::less, class _Proj = identity>
requires sortable<_Iter, _Comp, _Proj>
- _LIBCPP_HIDE_FROM_ABI constexpr
- _Iter operator()(_Iter __first, _Sent __last, _Comp __comp = {}, _Proj __proj = {}) const {
+ _LIBCPP_HIDE_FROM_ABI constexpr _Iter
+ operator()(_Iter __first, _Sent __last, _Comp __comp = {}, _Proj __proj = {}) const {
return __sort_fn_impl(std::move(__first), std::move(__last), __comp, __proj);
}
template <random_access_range _Range, class _Comp = ranges::less, class _Proj = identity>
requires sortable<iterator_t<_Range>, _Comp, _Proj>
- _LIBCPP_HIDE_FROM_ABI constexpr
- borrowed_iterator_t<_Range> operator()(_Range&& __r, _Comp __comp = {}, _Proj __proj = {}) const {
+ _LIBCPP_HIDE_FROM_ABI constexpr borrowed_iterator_t<_Range>
+ operator()(_Range&& __r, _Comp __comp = {}, _Proj __proj = {}) const {
return __sort_fn_impl(ranges::begin(__r), ranges::end(__r), __comp, __proj);
}
};
@@ -68,7 +68,7 @@ struct __fn {
} // namespace __sort
inline namespace __cpo {
- inline constexpr auto sort = __sort::__fn{};
+inline constexpr auto sort = __sort::__fn{};
} // namespace __cpo
} // namespace ranges
diff --git a/libcxx/include/__algorithm/ranges_sort_heap.h b/libcxx/include/__algorithm/ranges_sort_heap.h
index b40eef9761de3..365c7dba61567 100644
--- a/libcxx/include/__algorithm/ranges_sort_heap.h
+++ b/libcxx/include/__algorithm/ranges_sort_heap.h
@@ -41,8 +41,8 @@ namespace __sort_heap {
struct __fn {
template <class _Iter, class _Sent, class _Comp, class _Proj>
- _LIBCPP_HIDE_FROM_ABI constexpr static
- _Iter __sort_heap_fn_impl(_Iter __first, _Sent __last, _Comp& __comp, _Proj& __proj) {
+ _LIBCPP_HIDE_FROM_ABI constexpr static _Iter
+ __sort_heap_fn_impl(_Iter __first, _Sent __last, _Comp& __comp, _Proj& __proj) {
auto __last_iter = ranges::next(__first, __last);
auto&& __projected_comp = std::__make_projected(__comp, __proj);
@@ -53,15 +53,15 @@ struct __fn {
template <random_access_iterator _Iter, sentinel_for<_Iter> _Sent, class _Comp = ranges::less, class _Proj = identity>
requires sortable<_Iter, _Comp, _Proj>
- _LIBCPP_HIDE_FROM_ABI constexpr
- _Iter operator()(_Iter __first, _Sent __last, _Comp __comp = {}, _Proj __proj = {}) const {
+ _LIBCPP_HIDE_FROM_ABI constexpr _Iter
+ operator()(_Iter __first, _Sent __last, _Comp __comp = {}, _Proj __proj = {}) const {
return __sort_heap_fn_impl(std::move(__first), std::move(__last), __comp, __proj);
}
template <random_access_range _Range, class _Comp = ranges::less, class _Proj = identity>
requires sortable<iterator_t<_Range>, _Comp, _Proj>
- _LIBCPP_HIDE_FROM_ABI constexpr
- borrowed_iterator_t<_Range> operator()(_Range&& __r, _Comp __comp = {}, _Proj __proj = {}) const {
+ _LIBCPP_HIDE_FROM_ABI constexpr borrowed_iterator_t<_Range>
+ operator()(_Range&& __r, _Comp __comp = {}, _Proj __proj = {}) const {
return __sort_heap_fn_impl(ranges::begin(__r), ranges::end(__r), __comp, __proj);
}
};
@@ -69,7 +69,7 @@ struct __fn {
} // namespace __sort_heap
inline namespace __cpo {
- inline constexpr auto sort_heap = __sort_heap::__fn{};
+inline constexpr auto sort_heap = __sort_heap::__fn{};
} // namespace __cpo
} // namespace ranges
diff --git a/libcxx/include/__algorithm/ranges_stable_partition.h b/libcxx/include/__algorithm/ranges_stable_partition.h
index 77bef850aaeb8..44937fa589908 100644
--- a/libcxx/include/__algorithm/ranges_stable_partition.h
+++ b/libcxx/include/__algorithm/ranges_stable_partition.h
@@ -42,42 +42,41 @@ namespace ranges {
namespace __stable_partition {
struct __fn {
-
template <class _Iter, class _Sent, class _Proj, class _Pred>
- _LIBCPP_HIDE_FROM_ABI static
- subrange<__remove_cvref_t<_Iter>> __stable_partition_fn_impl(
- _Iter&& __first, _Sent&& __last, _Pred&& __pred, _Proj&& __proj) {
+ _LIBCPP_HIDE_FROM_ABI static subrange<__remove_cvref_t<_Iter>>
+ __stable_partition_fn_impl(_Iter&& __first, _Sent&& __last, _Pred&& __pred, _Proj&& __proj) {
auto __last_iter = ranges::next(__first, __last);
auto&& __projected_pred = std::__make_projected(__pred, __proj);
- auto __result = std::__stable_partition<_RangeAlgPolicy>(
+ auto __result = std::__stable_partition<_RangeAlgPolicy>(
std::move(__first), __last_iter, __projected_pred, __iterator_concept<_Iter>());
return {std::move(__result), std::move(__last_iter)};
}
- template <bidirectional_iterator _Iter, sentinel_for<_Iter> _Sent, class _Proj = identity,
+ template <bidirectional_iterator _Iter,
+ sentinel_for<_Iter> _Sent,
+ class _Proj = identity,
indirect_unary_predicate<projected<_Iter, _Proj>> _Pred>
- requires permutable<_Iter>
- _LIBCPP_HIDE_FROM_ABI
- subrange<_Iter> operator()(_Iter __first, _Sent __last, _Pred __pred, _Proj __proj = {}) const {
+ requires permutable<_Iter>
+ _LIBCPP_HIDE_FROM_ABI subrange<_Iter> operator()(_Iter __first, _Sent __last, _Pred __pred, _Proj __proj = {}) const {
return __stable_partition_fn_impl(__first, __last, __pred, __proj);
}
- template <bidirectional_range _Range, class _Proj = identity,
+ template <bidirectional_range _Range,
+ class _Proj = identity,
indirect_unary_predicate<projected<iterator_t<_Range>, _Proj>> _Pred>
- requires permutable<iterator_t<_Range>>
- _LIBCPP_HIDE_FROM_ABI
- borrowed_subrange_t<_Range> operator()(_Range&& __range, _Pred __pred, _Proj __proj = {}) const {
+ requires permutable<iterator_t<_Range>>
+ _LIBCPP_HIDE_FROM_ABI borrowed_subrange_t<_Range>
+ operator()(_Range&& __range, _Pred __pred, _Proj __proj = {}) const {
return __stable_partition_fn_impl(ranges::begin(__range), ranges::end(__range), __pred, __proj);
}
-
};
} // namespace __stable_partition
inline namespace __cpo {
- inline constexpr auto stable_partition = __stable_partition::__fn{};
+inline constexpr auto stable_partition = __stable_partition::__fn{};
} // namespace __cpo
} // namespace ranges
diff --git a/libcxx/include/__algorithm/ranges_stable_sort.h b/libcxx/include/__algorithm/ranges_stable_sort.h
index b823e3bcb4c77..a4eed3836356d 100644
--- a/libcxx/include/__algorithm/ranges_stable_sort.h
+++ b/libcxx/include/__algorithm/ranges_stable_sort.h
@@ -40,8 +40,7 @@ namespace __stable_sort {
struct __fn {
template <class _Iter, class _Sent, class _Comp, class _Proj>
- _LIBCPP_HIDE_FROM_ABI
- static _Iter __stable_sort_fn_impl(_Iter __first, _Sent __last, _Comp& __comp, _Proj& __proj) {
+ _LIBCPP_HIDE_FROM_ABI static _Iter __stable_sort_fn_impl(_Iter __first, _Sent __last, _Comp& __comp, _Proj& __proj) {
auto __last_iter = ranges::next(__first, __last);
auto&& __projected_comp = std::__make_projected(__comp, __proj);
@@ -52,15 +51,14 @@ struct __fn {
template <random_access_iterator _Iter, sentinel_for<_Iter> _Sent, class _Comp = ranges::less, class _Proj = identity>
requires sortable<_Iter, _Comp, _Proj>
- _LIBCPP_HIDE_FROM_ABI
- _Iter operator()(_Iter __first, _Sent __last, _Comp __comp = {}, _Proj __proj = {}) const {
+ _LIBCPP_HIDE_FROM_ABI _Iter operator()(_Iter __first, _Sent __last, _Comp __comp = {}, _Proj __proj = {}) const {
return __stable_sort_fn_impl(std::move(__first), std::move(__last), __comp, __proj);
}
template <random_access_range _Range, class _Comp = ranges::less, class _Proj = identity>
requires sortable<iterator_t<_Range>, _Comp, _Proj>
- _LIBCPP_HIDE_FROM_ABI
- borrowed_iterator_t<_Range> operator()(_Range&& __r, _Comp __comp = {}, _Proj __proj = {}) const {
+ _LIBCPP_HIDE_FROM_ABI borrowed_iterator_t<_Range>
+ operator()(_Range&& __r, _Comp __comp = {}, _Proj __proj = {}) const {
return __stable_sort_fn_impl(ranges::begin(__r), ranges::end(__r), __comp, __proj);
}
};
@@ -68,7 +66,7 @@ struct __fn {
} // namespace __stable_sort
inline namespace __cpo {
- inline constexpr auto stable_sort = __stable_sort::__fn{};
+inline constexpr auto stable_sort = __stable_sort::__fn{};
} // namespace __cpo
} // namespace ranges
diff --git a/libcxx/include/__algorithm/ranges_swap_ranges.h b/libcxx/include/__algorithm/ranges_swap_ranges.h
index 34124dbd88de8..1d0ebc0d5221e 100644
--- a/libcxx/include/__algorithm/ranges_swap_ranges.h
+++ b/libcxx/include/__algorithm/ranges_swap_ranges.h
@@ -35,8 +35,7 @@ using swap_ranges_result = in_in_result<_I1, _I2>;
namespace __swap_ranges {
struct __fn {
- template <input_iterator _I1, sentinel_for<_I1> _S1,
- input_iterator _I2, sentinel_for<_I2> _S2>
+ template <input_iterator _I1, sentinel_for<_I1> _S1, input_iterator _I2, sentinel_for<_I2> _S2>
requires indirectly_swappable<_I1, _I2>
_LIBCPP_HIDE_FROM_ABI constexpr swap_ranges_result<_I1, _I2>
operator()(_I1 __first1, _S1 __last1, _I2 __first2, _S2 __last2) const {
@@ -47,17 +46,15 @@ struct __fn {
template <input_range _R1, input_range _R2>
requires indirectly_swappable<iterator_t<_R1>, iterator_t<_R2>>
- _LIBCPP_HIDE_FROM_ABI constexpr
- swap_ranges_result<borrowed_iterator_t<_R1>, borrowed_iterator_t<_R2>>
+ _LIBCPP_HIDE_FROM_ABI constexpr swap_ranges_result<borrowed_iterator_t<_R1>, borrowed_iterator_t<_R2>>
operator()(_R1&& __r1, _R2&& __r2) const {
- return operator()(ranges::begin(__r1), ranges::end(__r1),
- ranges::begin(__r2), ranges::end(__r2));
+ return operator()(ranges::begin(__r1), ranges::end(__r1), ranges::begin(__r2), ranges::end(__r2));
}
};
} // namespace __swap_ranges
inline namespace __cpo {
- inline constexpr auto swap_ranges = __swap_ranges::__fn{};
+inline constexpr auto swap_ranges = __swap_ranges::__fn{};
} // namespace __cpo
} // namespace ranges
diff --git a/libcxx/include/__algorithm/ranges_transform.h b/libcxx/include/__algorithm/ranges_transform.h
index 1bba756fe5bf9..f66a07ac026e5 100644
--- a/libcxx/include/__algorithm/ranges_transform.h
+++ b/libcxx/include/__algorithm/ranges_transform.h
@@ -41,15 +41,9 @@ using binary_transform_result = in_in_out_result<_I1, _I2, _O1>;
namespace __transform {
struct __fn {
private:
- template <class _InIter, class _Sent,
- class _OutIter,
- class _Func,
- class _Proj>
- _LIBCPP_HIDE_FROM_ABI static constexpr
- unary_transform_result<_InIter, _OutIter> __unary(_InIter __first, _Sent __last,
- _OutIter __result,
- _Func& __operation,
- _Proj& __projection) {
+ template <class _InIter, class _Sent, class _OutIter, class _Func, class _Proj>
+ _LIBCPP_HIDE_FROM_ABI static constexpr unary_transform_result<_InIter, _OutIter>
+ __unary(_InIter __first, _Sent __last, _OutIter __result, _Func& __operation, _Proj& __projection) {
while (__first != __last) {
*__result = std::invoke(__operation, std::invoke(__projection, *__first));
++__first;
@@ -59,76 +53,80 @@ struct __fn {
return {std::move(__first), std::move(__result)};
}
- template <class _InIter1, class _Sent1,
- class _InIter2, class _Sent2,
+ template <class _InIter1,
+ class _Sent1,
+ class _InIter2,
+ class _Sent2,
class _OutIter,
class _Func,
class _Proj1,
class _Proj2>
_LIBCPP_HIDE_FROM_ABI static constexpr binary_transform_result<_InIter1, _InIter2, _OutIter>
- __binary(_InIter1 __first1, _Sent1 __last1,
- _InIter2 __first2, _Sent2 __last2,
+ __binary(_InIter1 __first1,
+ _Sent1 __last1,
+ _InIter2 __first2,
+ _Sent2 __last2,
_OutIter __result,
_Func& __binary_operation,
_Proj1& __projection1,
_Proj2& __projection2) {
while (__first1 != __last1 && __first2 != __last2) {
- *__result = std::invoke(__binary_operation, std::invoke(__projection1, *__first1),
- std::invoke(__projection2, *__first2));
+ *__result =
+ std::invoke(__binary_operation, std::invoke(__projection1, *__first1), std::invoke(__projection2, *__first2));
++__first1;
++__first2;
++__result;
}
return {std::move(__first1), std::move(__first2), std::move(__result)};
}
+
public:
- template <input_iterator _InIter, sentinel_for<_InIter> _Sent,
+ template <input_iterator _InIter,
+ sentinel_for<_InIter> _Sent,
weakly_incrementable _OutIter,
copy_constructible _Func,
class _Proj = identity>
requires indirectly_writable<_OutIter, indirect_result_t<_Func&, projected<_InIter, _Proj>>>
- _LIBCPP_HIDE_FROM_ABI constexpr
- unary_transform_result<_InIter, _OutIter> operator()(_InIter __first, _Sent __last,
- _OutIter __result,
- _Func __operation,
- _Proj __proj = {}) const {
+ _LIBCPP_HIDE_FROM_ABI constexpr unary_transform_result<_InIter, _OutIter>
+ operator()(_InIter __first, _Sent __last, _OutIter __result, _Func __operation, _Proj __proj = {}) const {
return __unary(std::move(__first), std::move(__last), std::move(__result), __operation, __proj);
}
- template <input_range _Range,
- weakly_incrementable _OutIter,
- copy_constructible _Func,
- class _Proj = identity>
+ template <input_range _Range, weakly_incrementable _OutIter, copy_constructible _Func, class _Proj = identity>
requires indirectly_writable<_OutIter, indirect_result_t<_Func, projected<iterator_t<_Range>, _Proj>>>
- _LIBCPP_HIDE_FROM_ABI constexpr
- unary_transform_result<borrowed_iterator_t<_Range>, _OutIter> operator()(_Range&& __range,
- _OutIter __result,
- _Func __operation,
- _Proj __projection = {}) const {
+ _LIBCPP_HIDE_FROM_ABI constexpr unary_transform_result<borrowed_iterator_t<_Range>, _OutIter>
+ operator()(_Range&& __range, _OutIter __result, _Func __operation, _Proj __projection = {}) const {
return __unary(ranges::begin(__range), ranges::end(__range), std::move(__result), __operation, __projection);
}
- template <input_iterator _InIter1, sentinel_for<_InIter1> _Sent1,
- input_iterator _InIter2, sentinel_for<_InIter2> _Sent2,
+ template <input_iterator _InIter1,
+ sentinel_for<_InIter1> _Sent1,
+ input_iterator _InIter2,
+ sentinel_for<_InIter2> _Sent2,
weakly_incrementable _OutIter,
copy_constructible _Func,
class _Proj1 = identity,
class _Proj2 = identity>
- requires indirectly_writable<_OutIter, indirect_result_t<_Func&, projected<_InIter1, _Proj1>,
- projected<_InIter2, _Proj2>>>
- _LIBCPP_HIDE_FROM_ABI constexpr
- binary_transform_result<_InIter1, _InIter2, _OutIter> operator()(_InIter1 __first1, _Sent1 __last1,
- _InIter2 __first2, _Sent2 __last2,
- _OutIter __result,
- _Func __binary_operation,
- _Proj1 __projection1 = {},
- _Proj2 __projection2 = {}) const {
- return __binary(std::move(__first1), std::move(__last1),
- std::move(__first2), std::move(__last2),
- std::move(__result),
- __binary_operation,
- __projection1,
- __projection2);
+ requires indirectly_writable<_OutIter,
+ indirect_result_t<_Func&, projected<_InIter1, _Proj1>, projected<_InIter2, _Proj2>>>
+ _LIBCPP_HIDE_FROM_ABI constexpr binary_transform_result<_InIter1, _InIter2, _OutIter> operator()(
+ _InIter1 __first1,
+ _Sent1 __last1,
+ _InIter2 __first2,
+ _Sent2 __last2,
+ _OutIter __result,
+ _Func __binary_operation,
+ _Proj1 __projection1 = {},
+ _Proj2 __projection2 = {}) const {
+ return __binary(
+ std::move(__first1),
+ std::move(__last1),
+ std::move(__first2),
+ std::move(__last2),
+ std::move(__result),
+ __binary_operation,
+ __projection1,
+ __projection2);
}
template <input_range _Range1,
@@ -137,29 +135,33 @@ struct __fn {
copy_constructible _Func,
class _Proj1 = identity,
class _Proj2 = identity>
- requires indirectly_writable<_OutIter, indirect_result_t<_Func&, projected<iterator_t<_Range1>, _Proj1>,
- projected<iterator_t<_Range2>, _Proj2>>>
- _LIBCPP_HIDE_FROM_ABI constexpr
- binary_transform_result<borrowed_iterator_t<_Range1>, borrowed_iterator_t<_Range2>, _OutIter>
+ requires indirectly_writable<
+ _OutIter,
+ indirect_result_t<_Func&, projected<iterator_t<_Range1>, _Proj1>, projected<iterator_t<_Range2>, _Proj2>>>
+ _LIBCPP_HIDE_FROM_ABI constexpr binary_transform_result<borrowed_iterator_t<_Range1>,
+ borrowed_iterator_t<_Range2>,
+ _OutIter>
operator()(_Range1&& __range1,
_Range2&& __range2,
_OutIter __result,
_Func __binary_operation,
_Proj1 __projection1 = {},
_Proj2 __projection2 = {}) const {
- return __binary(ranges::begin(__range1), ranges::end(__range1),
- ranges::begin(__range2), ranges::end(__range2),
- std::move(__result),
- __binary_operation,
- __projection1,
- __projection2);
+ return __binary(
+ ranges::begin(__range1),
+ ranges::end(__range1),
+ ranges::begin(__range2),
+ ranges::end(__range2),
+ std::move(__result),
+ __binary_operation,
+ __projection1,
+ __projection2);
}
-
};
} // namespace __transform
inline namespace __cpo {
- inline constexpr auto transform = __transform::__fn{};
+inline constexpr auto transform = __transform::__fn{};
} // namespace __cpo
} // namespace ranges
diff --git a/libcxx/include/__algorithm/ranges_unique.h b/libcxx/include/__algorithm/ranges_unique.h
index 9e05c09fe5ee8..b17e01fc50577 100644
--- a/libcxx/include/__algorithm/ranges_unique.h
+++ b/libcxx/include/__algorithm/ranges_unique.h
@@ -39,36 +39,34 @@ _LIBCPP_BEGIN_NAMESPACE_STD
namespace ranges {
namespace __unique {
- struct __fn {
- template <
- permutable _Iter,
- sentinel_for<_Iter> _Sent,
- class _Proj = identity,
- indirect_equivalence_relation<projected<_Iter, _Proj>> _Comp = ranges::equal_to>
- _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr subrange<_Iter>
- operator()(_Iter __first, _Sent __last, _Comp __comp = {}, _Proj __proj = {}) const {
- auto __ret = std::__unique<_RangeAlgPolicy>(
- std::move(__first), std::move(__last), std::__make_projected(__comp, __proj));
- return {std::move(__ret.first), std::move(__ret.second)};
- }
+struct __fn {
+ template <permutable _Iter,
+ sentinel_for<_Iter> _Sent,
+ class _Proj = identity,
+ indirect_equivalence_relation<projected<_Iter, _Proj>> _Comp = ranges::equal_to>
+ _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr subrange<_Iter>
+ operator()(_Iter __first, _Sent __last, _Comp __comp = {}, _Proj __proj = {}) const {
+ auto __ret =
+ std::__unique<_RangeAlgPolicy>(std::move(__first), std::move(__last), std::__make_projected(__comp, __proj));
+ return {std::move(__ret.first), std::move(__ret.second)};
+ }
- template <
- forward_range _Range,
- class _Proj = identity,
- indirect_equivalence_relation<projected<iterator_t<_Range>, _Proj>> _Comp = ranges::equal_to>
- requires permutable<iterator_t<_Range>>
- _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr borrowed_subrange_t<_Range>
- operator()(_Range&& __range, _Comp __comp = {}, _Proj __proj = {}) const {
- auto __ret = std::__unique<_RangeAlgPolicy>(
- ranges::begin(__range), ranges::end(__range), std::__make_projected(__comp, __proj));
- return {std::move(__ret.first), std::move(__ret.second)};
- }
- };
+ template <forward_range _Range,
+ class _Proj = identity,
+ indirect_equivalence_relation<projected<iterator_t<_Range>, _Proj>> _Comp = ranges::equal_to>
+ requires permutable<iterator_t<_Range>>
+ _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr borrowed_subrange_t<_Range>
+ operator()(_Range&& __range, _Comp __comp = {}, _Proj __proj = {}) const {
+ auto __ret = std::__unique<_RangeAlgPolicy>(
+ ranges::begin(__range), ranges::end(__range), std::__make_projected(__comp, __proj));
+ return {std::move(__ret.first), std::move(__ret.second)};
+ }
+};
} // namespace __unique
inline namespace __cpo {
- inline constexpr auto unique = __unique::__fn{};
+inline constexpr auto unique = __unique::__fn{};
} // namespace __cpo
} // namespace ranges
diff --git a/libcxx/include/__algorithm/ranges_unique_copy.h b/libcxx/include/__algorithm/ranges_unique_copy.h
index 2aaa879ea0f06..803ddca37028e 100644
--- a/libcxx/include/__algorithm/ranges_unique_copy.h
+++ b/libcxx/include/__algorithm/ranges_unique_copy.h
@@ -87,9 +87,9 @@ struct __fn {
class _Proj = identity,
indirect_equivalence_relation<projected<iterator_t<_Range>, _Proj>> _Comp = ranges::equal_to>
requires indirectly_copyable<iterator_t<_Range>, _OutIter> &&
- (forward_iterator<iterator_t<_Range>> ||
- (input_iterator<_OutIter> && same_as<range_value_t<_Range>, iter_value_t<_OutIter>>) ||
- indirectly_copyable_storable<iterator_t<_Range>, _OutIter>)
+ (forward_iterator<iterator_t<_Range>> ||
+ (input_iterator<_OutIter> && same_as<range_value_t<_Range>, iter_value_t<_OutIter>>) ||
+ indirectly_copyable_storable<iterator_t<_Range>, _OutIter>)
_LIBCPP_HIDE_FROM_ABI constexpr unique_copy_result<borrowed_iterator_t<_Range>, _OutIter>
operator()(_Range&& __range, _OutIter __result, _Comp __comp = {}, _Proj __proj = {}) const {
auto __ret = std::__unique_copy<_RangeAlgPolicy>(
diff --git a/libcxx/include/__algorithm/ranges_upper_bound.h b/libcxx/include/__algorithm/ranges_upper_bound.h
index 6e6f18dbc510b..a12a0e39b0849 100644
--- a/libcxx/include/__algorithm/ranges_upper_bound.h
+++ b/libcxx/include/__algorithm/ranges_upper_bound.h
@@ -32,10 +32,13 @@ _LIBCPP_BEGIN_NAMESPACE_STD
namespace ranges {
namespace __upper_bound {
struct __fn {
- template <forward_iterator _Iter, sentinel_for<_Iter> _Sent, class _Type, class _Proj = identity,
+ template <forward_iterator _Iter,
+ sentinel_for<_Iter> _Sent,
+ class _Type,
+ class _Proj = identity,
indirect_strict_weak_order<const _Type*, projected<_Iter, _Proj>> _Comp = ranges::less>
- _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr
- _Iter operator()(_Iter __first, _Sent __last, const _Type& __value, _Comp __comp = {}, _Proj __proj = {}) const {
+ _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr _Iter
+ operator()(_Iter __first, _Sent __last, const _Type& __value, _Comp __comp = {}, _Proj __proj = {}) const {
auto __comp_lhs_rhs_swapped = [&](const auto& __lhs, const auto& __rhs) {
return !std::invoke(__comp, __rhs, __lhs);
};
@@ -43,28 +46,24 @@ struct __fn {
return std::__lower_bound<_RangeAlgPolicy>(__first, __last, __value, __comp_lhs_rhs_swapped, __proj);
}
- template <forward_range _Range, class _Type, class _Proj = identity,
+ template <forward_range _Range,
+ class _Type,
+ class _Proj = identity,
indirect_strict_weak_order<const _Type*, projected<iterator_t<_Range>, _Proj>> _Comp = ranges::less>
- _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr
- borrowed_iterator_t<_Range> operator()(_Range&& __r,
- const _Type& __value,
- _Comp __comp = {},
- _Proj __proj = {}) const {
+ _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr borrowed_iterator_t<_Range>
+ operator()(_Range&& __r, const _Type& __value, _Comp __comp = {}, _Proj __proj = {}) const {
auto __comp_lhs_rhs_swapped = [&](const auto& __lhs, const auto& __rhs) {
return !std::invoke(__comp, __rhs, __lhs);
};
- return std::__lower_bound<_RangeAlgPolicy>(ranges::begin(__r),
- ranges::end(__r),
- __value,
- __comp_lhs_rhs_swapped,
- __proj);
+ return std::__lower_bound<_RangeAlgPolicy>(
+ ranges::begin(__r), ranges::end(__r), __value, __comp_lhs_rhs_swapped, __proj);
}
};
} // namespace __upper_bound
inline namespace __cpo {
- inline constexpr auto upper_bound = __upper_bound::__fn{};
+inline constexpr auto upper_bound = __upper_bound::__fn{};
} // namespace __cpo
} // namespace ranges
diff --git a/libcxx/include/__concepts/arithmetic.h b/libcxx/include/__concepts/arithmetic.h
index 91a0b184b18e3..f41e4c9f2747c 100644
--- a/libcxx/include/__concepts/arithmetic.h
+++ b/libcxx/include/__concepts/arithmetic.h
@@ -26,16 +26,16 @@ _LIBCPP_BEGIN_NAMESPACE_STD
// [concepts.arithmetic], arithmetic concepts
-template<class _Tp>
+template <class _Tp>
concept integral = is_integral_v<_Tp>;
-template<class _Tp>
+template <class _Tp>
concept signed_integral = integral<_Tp> && is_signed_v<_Tp>;
-template<class _Tp>
+template <class _Tp>
concept unsigned_integral = integral<_Tp> && !signed_integral<_Tp>;
-template<class _Tp>
+template <class _Tp>
concept floating_point = is_floating_point_v<_Tp>;
// Concept helpers for the internal type traits for the fundamental types.
diff --git a/libcxx/include/__concepts/assignable.h b/libcxx/include/__concepts/assignable.h
index 2dabae5766c09..3f7544c934066 100644
--- a/libcxx/include/__concepts/assignable.h
+++ b/libcxx/include/__concepts/assignable.h
@@ -26,13 +26,13 @@ _LIBCPP_BEGIN_NAMESPACE_STD
// [concept.assignable]
-template<class _Lhs, class _Rhs>
+template <class _Lhs, class _Rhs>
concept assignable_from =
- is_lvalue_reference_v<_Lhs> &&
- common_reference_with<__make_const_lvalue_ref<_Lhs>, __make_const_lvalue_ref<_Rhs>> &&
- requires (_Lhs __lhs, _Rhs&& __rhs) {
- { __lhs = _VSTD::forward<_Rhs>(__rhs) } -> same_as<_Lhs>;
- };
+ is_lvalue_reference_v<_Lhs> &&
+ common_reference_with<__make_const_lvalue_ref<_Lhs>, __make_const_lvalue_ref<_Rhs>> &&
+ requires(_Lhs __lhs, _Rhs&& __rhs) {
+ { __lhs = _VSTD::forward<_Rhs>(__rhs) } -> same_as<_Lhs>;
+ };
#endif // _LIBCPP_STD_VER >= 20
diff --git a/libcxx/include/__concepts/boolean_testable.h b/libcxx/include/__concepts/boolean_testable.h
index 8efb6e5ff46f5..d290e1cf3d836 100644
--- a/libcxx/include/__concepts/boolean_testable.h
+++ b/libcxx/include/__concepts/boolean_testable.h
@@ -23,10 +23,10 @@ _LIBCPP_BEGIN_NAMESPACE_STD
// [concepts.booleantestable]
-template<class _Tp>
+template <class _Tp>
concept __boolean_testable_impl = convertible_to<_Tp, bool>;
-template<class _Tp>
+template <class _Tp>
concept __boolean_testable = __boolean_testable_impl<_Tp> && requires(_Tp&& __t) {
{ !_VSTD::forward<_Tp>(__t) } -> __boolean_testable_impl;
};
diff --git a/libcxx/include/__concepts/class_or_enum.h b/libcxx/include/__concepts/class_or_enum.h
index 04c24bd98ff1e..c1b4a8c258f3a 100644
--- a/libcxx/include/__concepts/class_or_enum.h
+++ b/libcxx/include/__concepts/class_or_enum.h
@@ -25,12 +25,12 @@ _LIBCPP_BEGIN_NAMESPACE_STD
// Whether a type is a class type or enumeration type according to the Core wording.
-template<class _Tp>
+template <class _Tp>
concept __class_or_enum = is_class_v<_Tp> || is_union_v<_Tp> || is_enum_v<_Tp>;
// Work around Clang bug https://llvm.org/PR52970
// TODO: remove this workaround once libc++ no longer has to support Clang 13 (it was fixed in Clang 14).
-template<class _Tp>
+template <class _Tp>
concept __workaround_52970 = is_class_v<__remove_cvref_t<_Tp>> || is_union_v<__remove_cvref_t<_Tp>>;
#endif // _LIBCPP_STD_VER >= 20
diff --git a/libcxx/include/__concepts/common_reference_with.h b/libcxx/include/__concepts/common_reference_with.h
index 6ad0db22431e0..4eb687e071bc5 100644
--- a/libcxx/include/__concepts/common_reference_with.h
+++ b/libcxx/include/__concepts/common_reference_with.h
@@ -24,11 +24,10 @@ _LIBCPP_BEGIN_NAMESPACE_STD
// [concept.commonref]
-template<class _Tp, class _Up>
+template <class _Tp, class _Up>
concept common_reference_with =
- same_as<common_reference_t<_Tp, _Up>, common_reference_t<_Up, _Tp>> &&
- convertible_to<_Tp, common_reference_t<_Tp, _Up>> &&
- convertible_to<_Up, common_reference_t<_Tp, _Up>>;
+ same_as<common_reference_t<_Tp, _Up>, common_reference_t<_Up, _Tp>> &&
+ convertible_to<_Tp, common_reference_t<_Tp, _Up>> && convertible_to<_Up, common_reference_t<_Tp, _Up>>;
#endif // _LIBCPP_STD_VER >= 20
diff --git a/libcxx/include/__concepts/common_with.h b/libcxx/include/__concepts/common_with.h
index e159bcce968d8..85abb05efbc29 100644
--- a/libcxx/include/__concepts/common_with.h
+++ b/libcxx/include/__concepts/common_with.h
@@ -27,21 +27,23 @@ _LIBCPP_BEGIN_NAMESPACE_STD
// [concept.common]
-template<class _Tp, class _Up>
+// clang-format off
+template <class _Tp, class _Up>
concept common_with =
- same_as<common_type_t<_Tp, _Up>, common_type_t<_Up, _Tp>> &&
- requires {
- static_cast<common_type_t<_Tp, _Up>>(std::declval<_Tp>());
- static_cast<common_type_t<_Tp, _Up>>(std::declval<_Up>());
- } &&
- common_reference_with<
- add_lvalue_reference_t<const _Tp>,
- add_lvalue_reference_t<const _Up>> &&
- common_reference_with<
- add_lvalue_reference_t<common_type_t<_Tp, _Up>>,
- common_reference_t<
- add_lvalue_reference_t<const _Tp>,
- add_lvalue_reference_t<const _Up>>>;
+ same_as<common_type_t<_Tp, _Up>, common_type_t<_Up, _Tp>> &&
+ requires {
+ static_cast<common_type_t<_Tp, _Up>>(std::declval<_Tp>());
+ static_cast<common_type_t<_Tp, _Up>>(std::declval<_Up>());
+ } &&
+ common_reference_with<
+ add_lvalue_reference_t<const _Tp>,
+ add_lvalue_reference_t<const _Up>> &&
+ common_reference_with<
+ add_lvalue_reference_t<common_type_t<_Tp, _Up>>,
+ common_reference_t<
+ add_lvalue_reference_t<const _Tp>,
+ add_lvalue_reference_t<const _Up>>>;
+// clang-format on
#endif // _LIBCPP_STD_VER >= 20
diff --git a/libcxx/include/__concepts/constructible.h b/libcxx/include/__concepts/constructible.h
index 6e3862c51ffcb..835a44429c092 100644
--- a/libcxx/include/__concepts/constructible.h
+++ b/libcxx/include/__concepts/constructible.h
@@ -23,31 +23,30 @@ _LIBCPP_BEGIN_NAMESPACE_STD
#if _LIBCPP_STD_VER >= 20
// [concept.constructible]
-template<class _Tp, class... _Args>
-concept constructible_from =
- destructible<_Tp> && is_constructible_v<_Tp, _Args...>;
+template <class _Tp, class... _Args>
+concept constructible_from = destructible<_Tp> && is_constructible_v<_Tp, _Args...>;
// [concept.default.init]
-template<class _Tp>
+template <class _Tp>
concept __default_initializable = requires { ::new _Tp; };
-template<class _Tp>
-concept default_initializable = constructible_from<_Tp> &&
- requires { _Tp{}; } && __default_initializable<_Tp>;
+template <class _Tp>
+concept default_initializable = constructible_from<_Tp> && requires { _Tp{}; } && __default_initializable<_Tp>;
// [concept.moveconstructible]
-template<class _Tp>
-concept move_constructible =
- constructible_from<_Tp, _Tp> && convertible_to<_Tp, _Tp>;
+template <class _Tp>
+concept move_constructible = constructible_from<_Tp, _Tp> && convertible_to<_Tp, _Tp>;
// [concept.copyconstructible]
-template<class _Tp>
+// clang-format off
+template <class _Tp>
concept copy_constructible =
- move_constructible<_Tp> &&
- constructible_from<_Tp, _Tp&> && convertible_to<_Tp&, _Tp> &&
- constructible_from<_Tp, const _Tp&> && convertible_to<const _Tp&, _Tp> &&
- constructible_from<_Tp, const _Tp> && convertible_to<const _Tp, _Tp>;
+ move_constructible<_Tp> &&
+ constructible_from<_Tp, _Tp&> && convertible_to<_Tp&, _Tp> &&
+ constructible_from<_Tp, const _Tp&> && convertible_to<const _Tp&, _Tp> &&
+ constructible_from<_Tp, const _Tp> && convertible_to<const _Tp, _Tp>;
+// clang-format on
#endif // _LIBCPP_STD_VER >= 20
diff --git a/libcxx/include/__concepts/convertible_to.h b/libcxx/include/__concepts/convertible_to.h
index 20ee31bc058cd..6d5b6c1268d5d 100644
--- a/libcxx/include/__concepts/convertible_to.h
+++ b/libcxx/include/__concepts/convertible_to.h
@@ -23,12 +23,8 @@ _LIBCPP_BEGIN_NAMESPACE_STD
// [concept.convertible]
-template<class _From, class _To>
-concept convertible_to =
- is_convertible_v<_From, _To> &&
- requires {
- static_cast<_To>(std::declval<_From>());
- };
+template <class _From, class _To>
+concept convertible_to = is_convertible_v<_From, _To> && requires { static_cast<_To>(std::declval<_From>()); };
#endif // _LIBCPP_STD_VER >= 20
diff --git a/libcxx/include/__concepts/copyable.h b/libcxx/include/__concepts/copyable.h
index 0d6dd50cfbf09..2bf0ad42fc1a8 100644
--- a/libcxx/include/__concepts/copyable.h
+++ b/libcxx/include/__concepts/copyable.h
@@ -24,13 +24,15 @@ _LIBCPP_BEGIN_NAMESPACE_STD
// [concepts.object]
-template<class _Tp>
+// clang-format off
+template <class _Tp>
concept copyable =
- copy_constructible<_Tp> &&
- movable<_Tp> &&
- assignable_from<_Tp&, _Tp&> &&
- assignable_from<_Tp&, const _Tp&> &&
- assignable_from<_Tp&, const _Tp>;
+ copy_constructible<_Tp> &&
+ movable<_Tp> &&
+ assignable_from<_Tp&, _Tp&> &&
+ assignable_from<_Tp&, const _Tp&> &&
+ assignable_from<_Tp&, const _Tp>;
+// clang-format on
#endif // _LIBCPP_STD_VER >= 20
diff --git a/libcxx/include/__concepts/derived_from.h b/libcxx/include/__concepts/derived_from.h
index 1cbe458e2fa6f..9875faee81b90 100644
--- a/libcxx/include/__concepts/derived_from.h
+++ b/libcxx/include/__concepts/derived_from.h
@@ -23,10 +23,8 @@ _LIBCPP_BEGIN_NAMESPACE_STD
// [concept.derived]
-template<class _Dp, class _Bp>
-concept derived_from =
- is_base_of_v<_Bp, _Dp> &&
- is_convertible_v<const volatile _Dp*, const volatile _Bp*>;
+template <class _Dp, class _Bp>
+concept derived_from = is_base_of_v<_Bp, _Dp> && is_convertible_v<const volatile _Dp*, const volatile _Bp*>;
#endif // _LIBCPP_STD_VER >= 20
diff --git a/libcxx/include/__concepts/destructible.h b/libcxx/include/__concepts/destructible.h
index 8da9c378b76a0..28b4b1bc24ec9 100644
--- a/libcxx/include/__concepts/destructible.h
+++ b/libcxx/include/__concepts/destructible.h
@@ -22,7 +22,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD
// [concept.destructible]
-template<class _Tp>
+template <class _Tp>
concept destructible = is_nothrow_destructible_v<_Tp>;
#endif // _LIBCPP_STD_VER >= 20
diff --git a/libcxx/include/__concepts/
diff erent_from.h b/libcxx/include/__concepts/
diff erent_from.h
index 5ef1467acfd56..fd31f6e25805d 100644
--- a/libcxx/include/__concepts/
diff erent_from.h
+++ b/libcxx/include/__concepts/
diff erent_from.h
@@ -21,7 +21,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD
#if _LIBCPP_STD_VER >= 20
-template<class _Tp, class _Up>
+template <class _Tp, class _Up>
concept __
diff erent_from = !same_as<remove_cvref_t<_Tp>, remove_cvref_t<_Up>>;
#endif // _LIBCPP_STD_VER >= 20
diff --git a/libcxx/include/__concepts/equality_comparable.h b/libcxx/include/__concepts/equality_comparable.h
index f1062884e34be..278fc76409289 100644
--- a/libcxx/include/__concepts/equality_comparable.h
+++ b/libcxx/include/__concepts/equality_comparable.h
@@ -25,27 +25,29 @@ _LIBCPP_BEGIN_NAMESPACE_STD
// [concept.equalitycomparable]
-template<class _Tp, class _Up>
+template <class _Tp, class _Up>
concept __weakly_equality_comparable_with =
- requires(__make_const_lvalue_ref<_Tp> __t, __make_const_lvalue_ref<_Up> __u) {
- { __t == __u } -> __boolean_testable;
- { __t != __u } -> __boolean_testable;
- { __u == __t } -> __boolean_testable;
- { __u != __t } -> __boolean_testable;
- };
-
-template<class _Tp>
+ requires(__make_const_lvalue_ref<_Tp> __t, __make_const_lvalue_ref<_Up> __u) {
+ { __t == __u } -> __boolean_testable;
+ { __t != __u } -> __boolean_testable;
+ { __u == __t } -> __boolean_testable;
+ { __u != __t } -> __boolean_testable;
+ };
+
+template <class _Tp>
concept equality_comparable = __weakly_equality_comparable_with<_Tp, _Tp>;
-template<class _Tp, class _Up>
+// clang-format off
+template <class _Tp, class _Up>
concept equality_comparable_with =
- equality_comparable<_Tp> && equality_comparable<_Up> &&
- common_reference_with<__make_const_lvalue_ref<_Tp>, __make_const_lvalue_ref<_Up>> &&
- equality_comparable<
- common_reference_t<
- __make_const_lvalue_ref<_Tp>,
- __make_const_lvalue_ref<_Up>>> &&
- __weakly_equality_comparable_with<_Tp, _Up>;
+ equality_comparable<_Tp> && equality_comparable<_Up> &&
+ common_reference_with<__make_const_lvalue_ref<_Tp>, __make_const_lvalue_ref<_Up>> &&
+ equality_comparable<
+ common_reference_t<
+ __make_const_lvalue_ref<_Tp>,
+ __make_const_lvalue_ref<_Up>>> &&
+ __weakly_equality_comparable_with<_Tp, _Up>;
+// clang-format on
#endif // _LIBCPP_STD_VER >= 20
diff --git a/libcxx/include/__concepts/invocable.h b/libcxx/include/__concepts/invocable.h
index 59eab01f8d37c..e5be514b5c38e 100644
--- a/libcxx/include/__concepts/invocable.h
+++ b/libcxx/include/__concepts/invocable.h
@@ -23,14 +23,14 @@ _LIBCPP_BEGIN_NAMESPACE_STD
// [concept.invocable]
-template<class _Fn, class... _Args>
+template <class _Fn, class... _Args>
concept invocable = requires(_Fn&& __fn, _Args&&... __args) {
_VSTD::invoke(_VSTD::forward<_Fn>(__fn), _VSTD::forward<_Args>(__args)...); // not required to be equality preserving
};
// [concept.regular.invocable]
-template<class _Fn, class... _Args>
+template <class _Fn, class... _Args>
concept regular_invocable = invocable<_Fn, _Args...>;
#endif // _LIBCPP_STD_VER >= 20
diff --git a/libcxx/include/__concepts/movable.h b/libcxx/include/__concepts/movable.h
index f37d49f04eb5e..bc5b9d767c6a5 100644
--- a/libcxx/include/__concepts/movable.h
+++ b/libcxx/include/__concepts/movable.h
@@ -25,12 +25,8 @@ _LIBCPP_BEGIN_NAMESPACE_STD
// [concepts.object]
-template<class _Tp>
-concept movable =
- is_object_v<_Tp> &&
- move_constructible<_Tp> &&
- assignable_from<_Tp&, _Tp> &&
- swappable<_Tp>;
+template <class _Tp>
+concept movable = is_object_v<_Tp> && move_constructible<_Tp> && assignable_from<_Tp&, _Tp> && swappable<_Tp>;
#endif // _LIBCPP_STD_VER >= 20
diff --git a/libcxx/include/__concepts/predicate.h b/libcxx/include/__concepts/predicate.h
index b09183c5ca8eb..00731efc8fcd9 100644
--- a/libcxx/include/__concepts/predicate.h
+++ b/libcxx/include/__concepts/predicate.h
@@ -24,9 +24,8 @@ _LIBCPP_BEGIN_NAMESPACE_STD
// [concept.predicate]
-template<class _Fn, class... _Args>
-concept predicate =
- regular_invocable<_Fn, _Args...> && __boolean_testable<invoke_result_t<_Fn, _Args...>>;
+template <class _Fn, class... _Args>
+concept predicate = regular_invocable<_Fn, _Args...> && __boolean_testable<invoke_result_t<_Fn, _Args...>>;
#endif // _LIBCPP_STD_VER >= 20
diff --git a/libcxx/include/__concepts/regular.h b/libcxx/include/__concepts/regular.h
index 93fb7016cf4ed..9f3d8bf30be3e 100644
--- a/libcxx/include/__concepts/regular.h
+++ b/libcxx/include/__concepts/regular.h
@@ -23,7 +23,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD
// [concept.object]
-template<class _Tp>
+template <class _Tp>
concept regular = semiregular<_Tp> && equality_comparable<_Tp>;
#endif // _LIBCPP_STD_VER >= 20
diff --git a/libcxx/include/__concepts/relation.h b/libcxx/include/__concepts/relation.h
index 218afef21a382..7545a7db93da7 100644
--- a/libcxx/include/__concepts/relation.h
+++ b/libcxx/include/__concepts/relation.h
@@ -22,19 +22,18 @@ _LIBCPP_BEGIN_NAMESPACE_STD
// [concept.relation]
-template<class _Rp, class _Tp, class _Up>
+template <class _Rp, class _Tp, class _Up>
concept relation =
- predicate<_Rp, _Tp, _Tp> && predicate<_Rp, _Up, _Up> &&
- predicate<_Rp, _Tp, _Up> && predicate<_Rp, _Up, _Tp>;
+ predicate<_Rp, _Tp, _Tp> && predicate<_Rp, _Up, _Up> && predicate<_Rp, _Tp, _Up> && predicate<_Rp, _Up, _Tp>;
// [concept.equiv]
-template<class _Rp, class _Tp, class _Up>
+template <class _Rp, class _Tp, class _Up>
concept equivalence_relation = relation<_Rp, _Tp, _Up>;
// [concept.strictweakorder]
-template<class _Rp, class _Tp, class _Up>
+template <class _Rp, class _Tp, class _Up>
concept strict_weak_order = relation<_Rp, _Tp, _Up>;
#endif // _LIBCPP_STD_VER >= 20
diff --git a/libcxx/include/__concepts/same_as.h b/libcxx/include/__concepts/same_as.h
index b86cadaa1edcc..4241131c70c1f 100644
--- a/libcxx/include/__concepts/same_as.h
+++ b/libcxx/include/__concepts/same_as.h
@@ -22,10 +22,10 @@ _LIBCPP_BEGIN_NAMESPACE_STD
// [concept.same]
-template<class _Tp, class _Up>
+template <class _Tp, class _Up>
concept __same_as_impl = _IsSame<_Tp, _Up>::value;
-template<class _Tp, class _Up>
+template <class _Tp, class _Up>
concept same_as = __same_as_impl<_Tp, _Up> && __same_as_impl<_Up, _Tp>;
#endif // _LIBCPP_STD_VER >= 20
diff --git a/libcxx/include/__concepts/semiregular.h b/libcxx/include/__concepts/semiregular.h
index ae2f3c6694006..7a159d17dfc10 100644
--- a/libcxx/include/__concepts/semiregular.h
+++ b/libcxx/include/__concepts/semiregular.h
@@ -23,7 +23,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD
// [concept.object]
-template<class _Tp>
+template <class _Tp>
concept semiregular = copyable<_Tp> && default_initializable<_Tp>;
#endif // _LIBCPP_STD_VER >= 20
diff --git a/libcxx/include/__concepts/swappable.h b/libcxx/include/__concepts/swappable.h
index 859255dec9aac..c611bbb4eebde 100644
--- a/libcxx/include/__concepts/swappable.h
+++ b/libcxx/include/__concepts/swappable.h
@@ -37,82 +37,79 @@ _LIBCPP_BEGIN_NAMESPACE_STD
namespace ranges {
namespace __swap {
- template<class _Tp>
- void swap(_Tp&, _Tp&) = delete;
+template <class _Tp>
+void swap(_Tp&, _Tp&) = delete;
- template<class _Tp, class _Up>
- concept __unqualified_swappable_with =
+// clang-format off
+template <class _Tp, class _Up>
+concept __unqualified_swappable_with =
(__class_or_enum<remove_cvref_t<_Tp>> || __class_or_enum<remove_cvref_t<_Up>>) &&
requires(_Tp&& __t, _Up&& __u) {
- swap(_VSTD::forward<_Tp>(__t), _VSTD::forward<_Up>(__u));
+ swap(_VSTD::forward<_Tp>(__t), _VSTD::forward<_Up>(__u));
};
+// clang-format on
- struct __fn;
+struct __fn;
- template<class _Tp, class _Up, size_t _Size>
- concept __swappable_arrays =
- !__unqualified_swappable_with<_Tp(&)[_Size], _Up(&)[_Size]> &&
+// clang-format off
+template <class _Tp, class _Up, size_t _Size>
+concept __swappable_arrays =
+ !__unqualified_swappable_with<_Tp (&)[_Size], _Up (&)[_Size]> &&
extent_v<_Tp> == extent_v<_Up> &&
- requires(_Tp(& __t)[_Size], _Up(& __u)[_Size], const __fn& __swap) {
- __swap(__t[0], __u[0]);
+ requires(_Tp (&__t)[_Size], _Up (&__u)[_Size], const __fn& __swap) {
+ __swap(__t[0], __u[0]);
};
-
- template<class _Tp>
- concept __exchangeable =
- !__unqualified_swappable_with<_Tp&, _Tp&> &&
- move_constructible<_Tp> &&
- assignable_from<_Tp&, _Tp>;
-
- struct __fn {
- // 2.1 `S` is `(void)swap(E1, E2)`* if `E1` or `E2` has class or enumeration type and...
- // *The name `swap` is used here unqualified.
- template<class _Tp, class _Up>
- requires __unqualified_swappable_with<_Tp, _Up>
- _LIBCPP_HIDE_FROM_ABI constexpr void operator()(_Tp&& __t, _Up&& __u) const
- noexcept(noexcept(swap(_VSTD::forward<_Tp>(__t), _VSTD::forward<_Up>(__u))))
- {
- swap(_VSTD::forward<_Tp>(__t), _VSTD::forward<_Up>(__u));
- }
-
- // 2.2 Otherwise, if `E1` and `E2` are lvalues of array types with equal extent and...
- template<class _Tp, class _Up, size_t _Size>
- requires __swappable_arrays<_Tp, _Up, _Size>
- _LIBCPP_HIDE_FROM_ABI constexpr void operator()(_Tp(& __t)[_Size], _Up(& __u)[_Size]) const
- noexcept(noexcept((*this)(*__t, *__u)))
- {
- // TODO(cjdb): replace with `ranges::swap_ranges`.
- for (size_t __i = 0; __i < _Size; ++__i) {
- (*this)(__t[__i], __u[__i]);
- }
- }
-
- // 2.3 Otherwise, if `E1` and `E2` are lvalues of the same type `T` that models...
- template<__exchangeable _Tp>
- _LIBCPP_HIDE_FROM_ABI constexpr void operator()(_Tp& __x, _Tp& __y) const
- noexcept(is_nothrow_move_constructible_v<_Tp> && is_nothrow_move_assignable_v<_Tp>)
- {
- __y = _VSTD::exchange(__x, _VSTD::move(__y));
+// clang-format on
+
+template <class _Tp>
+concept __exchangeable =
+ !__unqualified_swappable_with<_Tp&, _Tp&> && move_constructible<_Tp> && assignable_from<_Tp&, _Tp>;
+
+struct __fn {
+ // 2.1 `S` is `(void)swap(E1, E2)`* if `E1` or `E2` has class or enumeration type and...
+ // *The name `swap` is used here unqualified.
+ template <class _Tp, class _Up>
+ requires __unqualified_swappable_with<_Tp, _Up>
+ _LIBCPP_HIDE_FROM_ABI constexpr void operator()(_Tp&& __t, _Up&& __u) const
+ noexcept(noexcept(swap(_VSTD::forward<_Tp>(__t), _VSTD::forward<_Up>(__u)))) {
+ swap(_VSTD::forward<_Tp>(__t), _VSTD::forward<_Up>(__u));
+ }
+
+ // 2.2 Otherwise, if `E1` and `E2` are lvalues of array types with equal extent and...
+ template <class _Tp, class _Up, size_t _Size>
+ requires __swappable_arrays<_Tp, _Up, _Size>
+ _LIBCPP_HIDE_FROM_ABI constexpr void operator()(_Tp (&__t)[_Size], _Up (&__u)[_Size]) const
+ noexcept(noexcept((*this)(*__t, *__u))) {
+ // TODO(cjdb): replace with `ranges::swap_ranges`.
+ for (size_t __i = 0; __i < _Size; ++__i) {
+ (*this)(__t[__i], __u[__i]);
}
- };
+ }
+
+ // 2.3 Otherwise, if `E1` and `E2` are lvalues of the same type `T` that models...
+ template <__exchangeable _Tp>
+ _LIBCPP_HIDE_FROM_ABI constexpr void operator()(_Tp& __x, _Tp& __y) const
+ noexcept(is_nothrow_move_constructible_v<_Tp>&& is_nothrow_move_assignable_v<_Tp>) {
+ __y = _VSTD::exchange(__x, _VSTD::move(__y));
+ }
+};
} // namespace __swap
inline namespace __cpo {
- inline constexpr auto swap = __swap::__fn{};
+inline constexpr auto swap = __swap::__fn{};
} // namespace __cpo
} // namespace ranges
-template<class _Tp>
+template <class _Tp>
concept swappable = requires(_Tp& __a, _Tp& __b) { ranges::swap(__a, __b); };
-template<class _Tp, class _Up>
-concept swappable_with =
- common_reference_with<_Tp, _Up> &&
- requires(_Tp&& __t, _Up&& __u) {
- ranges::swap(_VSTD::forward<_Tp>(__t), _VSTD::forward<_Tp>(__t));
- ranges::swap(_VSTD::forward<_Up>(__u), _VSTD::forward<_Up>(__u));
- ranges::swap(_VSTD::forward<_Tp>(__t), _VSTD::forward<_Up>(__u));
- ranges::swap(_VSTD::forward<_Up>(__u), _VSTD::forward<_Tp>(__t));
- };
+template <class _Tp, class _Up>
+concept swappable_with = common_reference_with<_Tp, _Up> && requires(_Tp&& __t, _Up&& __u) {
+ ranges::swap(_VSTD::forward<_Tp>(__t), _VSTD::forward<_Tp>(__t));
+ ranges::swap(_VSTD::forward<_Up>(__u), _VSTD::forward<_Up>(__u));
+ ranges::swap(_VSTD::forward<_Tp>(__t), _VSTD::forward<_Up>(__u));
+ ranges::swap(_VSTD::forward<_Up>(__u), _VSTD::forward<_Tp>(__t));
+};
#endif // _LIBCPP_STD_VER >= 20
diff --git a/libcxx/include/__concepts/totally_ordered.h b/libcxx/include/__concepts/totally_ordered.h
index 350eff33882b1..186c3b430dd54 100644
--- a/libcxx/include/__concepts/totally_ordered.h
+++ b/libcxx/include/__concepts/totally_ordered.h
@@ -25,31 +25,32 @@ _LIBCPP_BEGIN_NAMESPACE_STD
// [concept.totallyordered]
-template<class _Tp, class _Up>
-concept __partially_ordered_with =
- requires(__make_const_lvalue_ref<_Tp> __t, __make_const_lvalue_ref<_Up> __u) {
- { __t < __u } -> __boolean_testable;
- { __t > __u } -> __boolean_testable;
- { __t <= __u } -> __boolean_testable;
- { __t >= __u } -> __boolean_testable;
- { __u < __t } -> __boolean_testable;
- { __u > __t } -> __boolean_testable;
- { __u <= __t } -> __boolean_testable;
- { __u >= __t } -> __boolean_testable;
- };
-
-template<class _Tp>
+template <class _Tp, class _Up>
+concept __partially_ordered_with = requires(__make_const_lvalue_ref<_Tp> __t, __make_const_lvalue_ref<_Up> __u) {
+ { __t < __u } -> __boolean_testable;
+ { __t > __u } -> __boolean_testable;
+ { __t <= __u } -> __boolean_testable;
+ { __t >= __u } -> __boolean_testable;
+ { __u < __t } -> __boolean_testable;
+ { __u > __t } -> __boolean_testable;
+ { __u <= __t } -> __boolean_testable;
+ { __u >= __t } -> __boolean_testable;
+};
+
+template <class _Tp>
concept totally_ordered = equality_comparable<_Tp> && __partially_ordered_with<_Tp, _Tp>;
-template<class _Tp, class _Up>
+// clang-format off
+template <class _Tp, class _Up>
concept totally_ordered_with =
- totally_ordered<_Tp> && totally_ordered<_Up> &&
- equality_comparable_with<_Tp, _Up> &&
- totally_ordered<
- common_reference_t<
- __make_const_lvalue_ref<_Tp>,
- __make_const_lvalue_ref<_Up>>> &&
- __partially_ordered_with<_Tp, _Up>;
+ totally_ordered<_Tp> && totally_ordered<_Up> &&
+ equality_comparable_with<_Tp, _Up> &&
+ totally_ordered<
+ common_reference_t<
+ __make_const_lvalue_ref<_Tp>,
+ __make_const_lvalue_ref<_Up>>> &&
+ __partially_ordered_with<_Tp, _Up>;
+// clang-format on
#endif // _LIBCPP_STD_VER >= 20
diff --git a/libcxx/include/__type_traits/add_const.h b/libcxx/include/__type_traits/add_const.h
index 44d4058ba8436..9a6f1c10299f7 100644
--- a/libcxx/include/__type_traits/add_const.h
+++ b/libcxx/include/__type_traits/add_const.h
@@ -17,12 +17,14 @@
_LIBCPP_BEGIN_NAMESPACE_STD
-template <class _Tp> struct _LIBCPP_TEMPLATE_VIS add_const {
+template <class _Tp>
+struct _LIBCPP_TEMPLATE_VIS add_const {
typedef _LIBCPP_NODEBUG const _Tp type;
};
#if _LIBCPP_STD_VER >= 14
-template <class _Tp> using add_const_t = typename add_const<_Tp>::type;
+template <class _Tp>
+using add_const_t = typename add_const<_Tp>::type;
#endif
_LIBCPP_END_NAMESPACE_STD
diff --git a/libcxx/include/__type_traits/add_cv.h b/libcxx/include/__type_traits/add_cv.h
index ee821b3293cc0..9e23e5ceb7a3b 100644
--- a/libcxx/include/__type_traits/add_cv.h
+++ b/libcxx/include/__type_traits/add_cv.h
@@ -17,12 +17,14 @@
_LIBCPP_BEGIN_NAMESPACE_STD
-template <class _Tp> struct _LIBCPP_TEMPLATE_VIS add_cv {
+template <class _Tp>
+struct _LIBCPP_TEMPLATE_VIS add_cv {
typedef _LIBCPP_NODEBUG const volatile _Tp type;
};
#if _LIBCPP_STD_VER >= 14
-template <class _Tp> using add_cv_t = typename add_cv<_Tp>::type;
+template <class _Tp>
+using add_cv_t = typename add_cv<_Tp>::type;
#endif
_LIBCPP_END_NAMESPACE_STD
diff --git a/libcxx/include/__type_traits/add_lvalue_reference.h b/libcxx/include/__type_traits/add_lvalue_reference.h
index 848cc21f60385..a633e39045320 100644
--- a/libcxx/include/__type_traits/add_lvalue_reference.h
+++ b/libcxx/include/__type_traits/add_lvalue_reference.h
@@ -45,7 +45,8 @@ struct add_lvalue_reference {
};
#if _LIBCPP_STD_VER >= 14
-template <class _Tp> using add_lvalue_reference_t = __add_lvalue_reference_t<_Tp>;
+template <class _Tp>
+using add_lvalue_reference_t = __add_lvalue_reference_t<_Tp>;
#endif
_LIBCPP_END_NAMESPACE_STD
diff --git a/libcxx/include/__type_traits/add_pointer.h b/libcxx/include/__type_traits/add_pointer.h
index 1e74dafaf0e8b..358e3cbd23843 100644
--- a/libcxx/include/__type_traits/add_pointer.h
+++ b/libcxx/include/__type_traits/add_pointer.h
@@ -28,13 +28,14 @@ template <class _Tp>
using __add_pointer_t = __add_pointer(_Tp);
#else
-template <class _Tp,
- bool = __libcpp_is_referenceable<_Tp>::value || is_void<_Tp>::value>
+template <class _Tp, bool = __libcpp_is_referenceable<_Tp>::value || is_void<_Tp>::value>
struct __add_pointer_impl {
typedef _LIBCPP_NODEBUG __libcpp_remove_reference_t<_Tp>* type;
};
-template <class _Tp> struct __add_pointer_impl<_Tp, false>
- {typedef _LIBCPP_NODEBUG _Tp type;};
+template <class _Tp>
+struct __add_pointer_impl<_Tp, false> {
+ typedef _LIBCPP_NODEBUG _Tp type;
+};
template <class _Tp>
using __add_pointer_t = typename __add_pointer_impl<_Tp>::type;
@@ -47,7 +48,8 @@ struct add_pointer {
};
#if _LIBCPP_STD_VER >= 14
-template <class _Tp> using add_pointer_t = __add_pointer_t<_Tp>;
+template <class _Tp>
+using add_pointer_t = __add_pointer_t<_Tp>;
#endif
_LIBCPP_END_NAMESPACE_STD
diff --git a/libcxx/include/__type_traits/add_volatile.h b/libcxx/include/__type_traits/add_volatile.h
index f4fc42f69ebb3..56b7dfaac026e 100644
--- a/libcxx/include/__type_traits/add_volatile.h
+++ b/libcxx/include/__type_traits/add_volatile.h
@@ -17,12 +17,14 @@
_LIBCPP_BEGIN_NAMESPACE_STD
-template <class _Tp> struct _LIBCPP_TEMPLATE_VIS add_volatile {
+template <class _Tp>
+struct _LIBCPP_TEMPLATE_VIS add_volatile {
typedef _LIBCPP_NODEBUG volatile _Tp type;
};
#if _LIBCPP_STD_VER >= 14
-template <class _Tp> using add_volatile_t = typename add_volatile<_Tp>::type;
+template <class _Tp>
+using add_volatile_t = typename add_volatile<_Tp>::type;
#endif
_LIBCPP_END_NAMESPACE_STD
diff --git a/libcxx/include/__type_traits/aligned_storage.h b/libcxx/include/__type_traits/aligned_storage.h
index 29938d286244e..46aae12832f86 100644
--- a/libcxx/include/__type_traits/aligned_storage.h
+++ b/libcxx/include/__type_traits/aligned_storage.h
@@ -23,59 +23,63 @@
_LIBCPP_BEGIN_NAMESPACE_STD
template <class _Tp>
-struct __align_type
-{
- static const size_t value = _LIBCPP_PREFERRED_ALIGNOF(_Tp);
- typedef _Tp type;
+struct __align_type {
+ static const size_t value = _LIBCPP_PREFERRED_ALIGNOF(_Tp);
+ typedef _Tp type;
};
-struct __struct_double {long double __lx;};
-struct __struct_double4 {double __lx[4];};
-
-typedef
- __type_list<__align_type<unsigned char>,
- __type_list<__align_type<unsigned short>,
- __type_list<__align_type<unsigned int>,
- __type_list<__align_type<unsigned long>,
- __type_list<__align_type<unsigned long long>,
- __type_list<__align_type<double>,
- __type_list<__align_type<long double>,
- __type_list<__align_type<__struct_double>,
- __type_list<__align_type<__struct_double4>,
- __type_list<__align_type<int*>,
- __nat
- > > > > > > > > > > __all_types;
+struct __struct_double {
+ long double __lx;
+};
+struct __struct_double4 {
+ double __lx[4];
+};
+
+// clang-format off
+typedef __type_list<__align_type<unsigned char>,
+ __type_list<__align_type<unsigned short>,
+ __type_list<__align_type<unsigned int>,
+ __type_list<__align_type<unsigned long>,
+ __type_list<__align_type<unsigned long long>,
+ __type_list<__align_type<double>,
+ __type_list<__align_type<long double>,
+ __type_list<__align_type<__struct_double>,
+ __type_list<__align_type<__struct_double4>,
+ __type_list<__align_type<int*>,
+ __nat
+ > > > > > > > > > > __all_types;
+// clang-format on
template <size_t _Align>
struct _ALIGNAS(_Align) __fallback_overaligned {};
-template <class _TL, size_t _Align> struct __find_pod;
+template <class _TL, size_t _Align>
+struct __find_pod;
template <class _Hp, size_t _Align>
-struct __find_pod<__type_list<_Hp, __nat>, _Align>
-{
- typedef __conditional_t<_Align == _Hp::value, typename _Hp::type, __fallback_overaligned<_Align> > type;
+struct __find_pod<__type_list<_Hp, __nat>, _Align> {
+ typedef __conditional_t<_Align == _Hp::value, typename _Hp::type, __fallback_overaligned<_Align> > type;
};
template <class _Hp, class _Tp, size_t _Align>
-struct __find_pod<__type_list<_Hp, _Tp>, _Align>
-{
- typedef __conditional_t<_Align == _Hp::value, typename _Hp::type, typename __find_pod<_Tp, _Align>::type> type;
+struct __find_pod<__type_list<_Hp, _Tp>, _Align> {
+ typedef __conditional_t<_Align == _Hp::value, typename _Hp::type, typename __find_pod<_Tp, _Align>::type> type;
};
-template <class _TL, size_t _Len> struct __find_max_align;
+template <class _TL, size_t _Len>
+struct __find_max_align;
template <class _Hp, size_t _Len>
struct __find_max_align<__type_list<_Hp, __nat>, _Len> : public integral_constant<size_t, _Hp::value> {};
template <size_t _Len, size_t _A1, size_t _A2>
-struct __select_align
-{
+struct __select_align {
private:
- static const size_t __min = _A2 < _A1 ? _A2 : _A1;
- static const size_t __max = _A1 < _A2 ? _A2 : _A1;
+ static const size_t __min = _A2 < _A1 ? _A2 : _A1;
+ static const size_t __max = _A1 < _A2 ? _A2 : _A1;
+
public:
- static const size_t value = _Len < __max ? __min : __max;
+ static const size_t value = _Len < __max ? __min : __max;
};
template <class _Hp, class _Tp, size_t _Len>
@@ -83,22 +87,20 @@ struct __find_max_align<__type_list<_Hp, _Tp>, _Len>
: public integral_constant<size_t, __select_align<_Len, _Hp::value, __find_max_align<_Tp, _Len>::value>::value> {};
template <size_t _Len, size_t _Align = __find_max_align<__all_types, _Len>::value>
-struct _LIBCPP_DEPRECATED_IN_CXX23 _LIBCPP_TEMPLATE_VIS aligned_storage
-{
- typedef typename __find_pod<__all_types, _Align>::type _Aligner;
- union type
- {
- _Aligner __align;
- unsigned char __data[(_Len + _Align - 1)/_Align * _Align];
- };
+struct _LIBCPP_DEPRECATED_IN_CXX23 _LIBCPP_TEMPLATE_VIS aligned_storage {
+ typedef typename __find_pod<__all_types, _Align>::type _Aligner;
+ union type {
+ _Aligner __align;
+ unsigned char __data[(_Len + _Align - 1) / _Align * _Align];
+ };
};
#if _LIBCPP_STD_VER >= 14
- _LIBCPP_SUPPRESS_DEPRECATED_PUSH
+_LIBCPP_SUPPRESS_DEPRECATED_PUSH
template <size_t _Len, size_t _Align = __find_max_align<__all_types, _Len>::value>
- using aligned_storage_t _LIBCPP_DEPRECATED_IN_CXX23 = typename aligned_storage<_Len, _Align>::type;
- _LIBCPP_SUPPRESS_DEPRECATED_POP
+using aligned_storage_t _LIBCPP_DEPRECATED_IN_CXX23 = typename aligned_storage<_Len, _Align>::type;
+_LIBCPP_SUPPRESS_DEPRECATED_POP
#endif
diff --git a/libcxx/include/__type_traits/aligned_union.h b/libcxx/include/__type_traits/aligned_union.h
index dd1515a693c11..005ed9a096ea8 100644
--- a/libcxx/include/__type_traits/aligned_union.h
+++ b/libcxx/include/__type_traits/aligned_union.h
@@ -20,30 +20,25 @@
_LIBCPP_BEGIN_NAMESPACE_STD
-template <size_t _I0, size_t ..._In>
+template <size_t _I0, size_t... _In>
struct __static_max;
template <size_t _I0>
-struct __static_max<_I0>
-{
- static const size_t value = _I0;
+struct __static_max<_I0> {
+ static const size_t value = _I0;
};
-template <size_t _I0, size_t _I1, size_t ..._In>
-struct __static_max<_I0, _I1, _In...>
-{
- static const size_t value = _I0 >= _I1 ? __static_max<_I0, _In...>::value :
- __static_max<_I1, _In...>::value;
+template <size_t _I0, size_t _I1, size_t... _In>
+struct __static_max<_I0, _I1, _In...> {
+ static const size_t value = _I0 >= _I1 ? __static_max<_I0, _In...>::value : __static_max<_I1, _In...>::value;
};
-template <size_t _Len, class _Type0, class ..._Types>
-struct _LIBCPP_DEPRECATED_IN_CXX23 aligned_union
-{
- static const size_t alignment_value = __static_max<_LIBCPP_PREFERRED_ALIGNOF(_Type0),
- _LIBCPP_PREFERRED_ALIGNOF(_Types)...>::value;
- static const size_t __len = __static_max<_Len, sizeof(_Type0),
- sizeof(_Types)...>::value;
- typedef typename aligned_storage<__len, alignment_value>::type type;
+template <size_t _Len, class _Type0, class... _Types>
+struct _LIBCPP_DEPRECATED_IN_CXX23 aligned_union {
+ static const size_t alignment_value =
+ __static_max<_LIBCPP_PREFERRED_ALIGNOF(_Type0), _LIBCPP_PREFERRED_ALIGNOF(_Types)...>::value;
+ static const size_t __len = __static_max<_Len, sizeof(_Type0), sizeof(_Types)...>::value;
+ typedef typename aligned_storage<__len, alignment_value>::type type;
};
#if _LIBCPP_STD_VER >= 14
diff --git a/libcxx/include/__type_traits/alignment_of.h b/libcxx/include/__type_traits/alignment_of.h
index d7851aefe7673..f2d069bf2488f 100644
--- a/libcxx/include/__type_traits/alignment_of.h
+++ b/libcxx/include/__type_traits/alignment_of.h
@@ -19,8 +19,8 @@
_LIBCPP_BEGIN_NAMESPACE_STD
-template <class _Tp> struct _LIBCPP_TEMPLATE_VIS alignment_of
- : public integral_constant<size_t, _LIBCPP_ALIGNOF(_Tp)> {};
+template <class _Tp>
+struct _LIBCPP_TEMPLATE_VIS alignment_of : public integral_constant<size_t, _LIBCPP_ALIGNOF(_Tp)> {};
#if _LIBCPP_STD_VER >= 17
template <class _Tp>
diff --git a/libcxx/include/__type_traits/can_extract_key.h b/libcxx/include/__type_traits/can_extract_key.h
index 454c56bfae9da..b8359d0708810 100644
--- a/libcxx/include/__type_traits/can_extract_key.h
+++ b/libcxx/include/__type_traits/can_extract_key.h
@@ -40,16 +40,13 @@ struct __can_extract_key<_Pair, _Key, pair<_First, _Second> >
// __can_extract_map_key uses true_type/false_type instead of the tags.
// It returns true if _Key != _ContainerValueTy (the container is a map not a set)
// and _ValTy == _Key.
-template <class _ValTy, class _Key, class _ContainerValueTy,
- class _RawValTy = __remove_const_ref_t<_ValTy> >
-struct __can_extract_map_key
- : integral_constant<bool, _IsSame<_RawValTy, _Key>::value> {};
+template <class _ValTy, class _Key, class _ContainerValueTy, class _RawValTy = __remove_const_ref_t<_ValTy> >
+struct __can_extract_map_key : integral_constant<bool, _IsSame<_RawValTy, _Key>::value> {};
// This specialization returns __extract_key_fail_tag for non-map containers
// because _Key == _ContainerValueTy
template <class _ValTy, class _Key, class _RawValTy>
-struct __can_extract_map_key<_ValTy, _Key, _Key, _RawValTy>
- : false_type {};
+struct __can_extract_map_key<_ValTy, _Key, _Key, _RawValTy> : false_type {};
_LIBCPP_END_NAMESPACE_STD
diff --git a/libcxx/include/__type_traits/common_reference.h b/libcxx/include/__type_traits/common_reference.h
index 59b3dfbe1233e..c802902eb19fc 100644
--- a/libcxx/include/__type_traits/common_reference.h
+++ b/libcxx/include/__type_traits/common_reference.h
@@ -30,8 +30,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD
#if _LIBCPP_STD_VER >= 20
// Let COND_RES(X, Y) be:
template <class _Xp, class _Yp>
-using __cond_res =
- decltype(false ? std::declval<_Xp(&)()>()() : std::declval<_Yp(&)()>()());
+using __cond_res = decltype(false ? std::declval<_Xp (&)()>()() : std::declval<_Yp (&)()>()());
// Let `XREF(A)` denote a unary alias template `T` such that `T<U>` denotes the same type as `U`
// with the addition of `A`'s cv and reference qualifiers, for a non-reference cv-unqualified type
@@ -39,47 +38,49 @@ using __cond_res =
// [Note: `XREF(A)` is `__xref<A>::template __apply`]
template <class _Tp>
struct __xref {
- template<class _Up>
+ template <class _Up>
using __apply = __copy_cvref_t<_Tp, _Up>;
};
// Given types A and B, let X be remove_reference_t<A>, let Y be remove_reference_t<B>,
// and let COMMON-REF(A, B) be:
-template<class _Ap, class _Bp, class _Xp = remove_reference_t<_Ap>, class _Yp = remove_reference_t<_Bp>>
+template <class _Ap, class _Bp, class _Xp = remove_reference_t<_Ap>, class _Yp = remove_reference_t<_Bp>>
struct __common_ref;
-template<class _Xp, class _Yp>
+template <class _Xp, class _Yp>
using __common_ref_t = typename __common_ref<_Xp, _Yp>::__type;
-template<class _Xp, class _Yp>
+template <class _Xp, class _Yp>
using __cv_cond_res = __cond_res<__copy_cv_t<_Xp, _Yp>&, __copy_cv_t<_Yp, _Xp>&>;
-
// If A and B are both lvalue reference types, COMMON-REF(A, B) is
// COND-RES(COPYCV(X, Y)&, COPYCV(Y, X)&) if that type exists and is a reference type.
-template<class _Ap, class _Bp, class _Xp, class _Yp>
-requires requires { typename __cv_cond_res<_Xp, _Yp>; } && is_reference_v<__cv_cond_res<_Xp, _Yp>>
-struct __common_ref<_Ap&, _Bp&, _Xp, _Yp>
-{
- using __type = __cv_cond_res<_Xp, _Yp>;
+// clang-format off
+template <class _Ap, class _Bp, class _Xp, class _Yp>
+ requires
+ requires { typename __cv_cond_res<_Xp, _Yp>; } &&
+ is_reference_v<__cv_cond_res<_Xp, _Yp>>
+struct __common_ref<_Ap&, _Bp&, _Xp, _Yp> {
+ using __type = __cv_cond_res<_Xp, _Yp>;
};
+// clang-format on
// Otherwise, let C be remove_reference_t<COMMON-REF(X&, Y&)>&&. ...
template <class _Xp, class _Yp>
using __common_ref_C = remove_reference_t<__common_ref_t<_Xp&, _Yp&>>&&;
-
// .... If A and B are both rvalue reference types, C is well-formed, and
// is_convertible_v<A, C> && is_convertible_v<B, C> is true, then COMMON-REF(A, B) is C.
-template<class _Ap, class _Bp, class _Xp, class _Yp>
-requires
- requires { typename __common_ref_C<_Xp, _Yp>; } &&
- is_convertible_v<_Ap&&, __common_ref_C<_Xp, _Yp>> &&
- is_convertible_v<_Bp&&, __common_ref_C<_Xp, _Yp>>
-struct __common_ref<_Ap&&, _Bp&&, _Xp, _Yp>
-{
- using __type = __common_ref_C<_Xp, _Yp>;
+// clang-format off
+template <class _Ap, class _Bp, class _Xp, class _Yp>
+ requires
+ requires { typename __common_ref_C<_Xp, _Yp>; } &&
+ is_convertible_v<_Ap&&, __common_ref_C<_Xp, _Yp>> &&
+ is_convertible_v<_Bp&&, __common_ref_C<_Xp, _Yp>>
+struct __common_ref<_Ap&&, _Bp&&, _Xp, _Yp> {
+ using __type = __common_ref_C<_Xp, _Yp>;
};
+// clang-format on
// Otherwise, let D be COMMON-REF(const X&, Y&). ...
template <class _Tp, class _Up>
@@ -87,21 +88,23 @@ using __common_ref_D = __common_ref_t<const _Tp&, _Up&>;
// ... If A is an rvalue reference and B is an lvalue reference and D is well-formed and
// is_convertible_v<A, D> is true, then COMMON-REF(A, B) is D.
-template<class _Ap, class _Bp, class _Xp, class _Yp>
-requires requires { typename __common_ref_D<_Xp, _Yp>; } &&
- is_convertible_v<_Ap&&, __common_ref_D<_Xp, _Yp>>
-struct __common_ref<_Ap&&, _Bp&, _Xp, _Yp>
-{
- using __type = __common_ref_D<_Xp, _Yp>;
+// clang-format off
+template <class _Ap, class _Bp, class _Xp, class _Yp>
+ requires
+ requires { typename __common_ref_D<_Xp, _Yp>; } &&
+ is_convertible_v<_Ap&&, __common_ref_D<_Xp, _Yp>>
+struct __common_ref<_Ap&&, _Bp&, _Xp, _Yp> {
+ using __type = __common_ref_D<_Xp, _Yp>;
};
+// clang-format on
// Otherwise, if A is an lvalue reference and B is an rvalue reference, then
// COMMON-REF(A, B) is COMMON-REF(B, A).
-template<class _Ap, class _Bp, class _Xp, class _Yp>
+template <class _Ap, class _Bp, class _Xp, class _Yp>
struct __common_ref<_Ap&, _Bp&&, _Xp, _Yp> : __common_ref<_Bp&&, _Ap&> {};
// Otherwise, COMMON-REF(A, B) is ill-formed.
-template<class _Ap, class _Bp, class _Xp, class _Yp>
+template <class _Ap, class _Bp, class _Xp, class _Yp>
struct __common_ref {};
// Note C: For the common_reference trait applied to a parameter pack [...]
@@ -113,73 +116,75 @@ template <class... _Types>
using common_reference_t = typename common_reference<_Types...>::type;
// bullet 1 - sizeof...(T) == 0
-template<>
+template <>
struct common_reference<> {};
// bullet 2 - sizeof...(T) == 1
template <class _Tp>
-struct common_reference<_Tp>
-{
- using type = _Tp;
+struct common_reference<_Tp> {
+ using type = _Tp;
};
// bullet 3 - sizeof...(T) == 2
-template <class _Tp, class _Up> struct __common_reference_sub_bullet3;
-template <class _Tp, class _Up> struct __common_reference_sub_bullet2 : __common_reference_sub_bullet3<_Tp, _Up> {};
-template <class _Tp, class _Up> struct __common_reference_sub_bullet1 : __common_reference_sub_bullet2<_Tp, _Up> {};
+template <class _Tp, class _Up>
+struct __common_reference_sub_bullet3;
+template <class _Tp, class _Up>
+struct __common_reference_sub_bullet2 : __common_reference_sub_bullet3<_Tp, _Up> {};
+template <class _Tp, class _Up>
+struct __common_reference_sub_bullet1 : __common_reference_sub_bullet2<_Tp, _Up> {};
// sub-bullet 1 - If T1 and T2 are reference types and COMMON-REF(T1, T2) is well-formed, then
// the member typedef `type` denotes that type.
-template <class _Tp, class _Up> struct common_reference<_Tp, _Up> : __common_reference_sub_bullet1<_Tp, _Up> {};
+template <class _Tp, class _Up>
+struct common_reference<_Tp, _Up> : __common_reference_sub_bullet1<_Tp, _Up> {};
template <class _Tp, class _Up>
-requires is_reference_v<_Tp> && is_reference_v<_Up> && requires { typename __common_ref_t<_Tp, _Up>; }
-struct __common_reference_sub_bullet1<_Tp, _Up>
-{
- using type = __common_ref_t<_Tp, _Up>;
+ requires is_reference_v<_Tp> && is_reference_v<_Up> && requires { typename __common_ref_t<_Tp, _Up>; }
+struct __common_reference_sub_bullet1<_Tp, _Up> {
+ using type = __common_ref_t<_Tp, _Up>;
};
// sub-bullet 2 - Otherwise, if basic_common_reference<remove_cvref_t<T1>, remove_cvref_t<T2>, XREF(T1), XREF(T2)>::type
// is well-formed, then the member typedef `type` denotes that type.
-template <class, class, template <class> class, template <class> class> struct basic_common_reference {};
+template <class, class, template <class> class, template <class> class>
+struct basic_common_reference {};
template <class _Tp, class _Up>
-using __basic_common_reference_t = typename basic_common_reference<
- remove_cvref_t<_Tp>, remove_cvref_t<_Up>,
- __xref<_Tp>::template __apply, __xref<_Up>::template __apply>::type;
+using __basic_common_reference_t =
+ typename basic_common_reference<remove_cvref_t<_Tp>,
+ remove_cvref_t<_Up>,
+ __xref<_Tp>::template __apply,
+ __xref<_Up>::template __apply>::type;
template <class _Tp, class _Up>
-requires requires { typename __basic_common_reference_t<_Tp, _Up>; }
-struct __common_reference_sub_bullet2<_Tp, _Up>
-{
- using type = __basic_common_reference_t<_Tp, _Up>;
+ requires requires { typename __basic_common_reference_t<_Tp, _Up>; }
+struct __common_reference_sub_bullet2<_Tp, _Up> {
+ using type = __basic_common_reference_t<_Tp, _Up>;
};
// sub-bullet 3 - Otherwise, if COND-RES(T1, T2) is well-formed,
// then the member typedef `type` denotes that type.
template <class _Tp, class _Up>
-requires requires { typename __cond_res<_Tp, _Up>; }
-struct __common_reference_sub_bullet3<_Tp, _Up>
-{
- using type = __cond_res<_Tp, _Up>;
+ requires requires { typename __cond_res<_Tp, _Up>; }
+struct __common_reference_sub_bullet3<_Tp, _Up> {
+ using type = __cond_res<_Tp, _Up>;
};
-
// sub-bullet 4 & 5 - Otherwise, if common_type_t<T1, T2> is well-formed,
// then the member typedef `type` denotes that type.
// - Otherwise, there shall be no member `type`.
-template <class _Tp, class _Up> struct __common_reference_sub_bullet3 : common_type<_Tp, _Up> {};
+template <class _Tp, class _Up>
+struct __common_reference_sub_bullet3 : common_type<_Tp, _Up> {};
// bullet 4 - If there is such a type `C`, the member typedef type shall denote the same type, if
// any, as `common_reference_t<C, Rest...>`.
template <class _Tp, class _Up, class _Vp, class... _Rest>
-requires requires { typename common_reference_t<_Tp, _Up>; }
-struct common_reference<_Tp, _Up, _Vp, _Rest...>
- : common_reference<common_reference_t<_Tp, _Up>, _Vp, _Rest...>
-{};
+ requires requires { typename common_reference_t<_Tp, _Up>; }
+struct common_reference<_Tp, _Up, _Vp, _Rest...> : common_reference<common_reference_t<_Tp, _Up>, _Vp, _Rest...> {};
// bullet 5 - Otherwise, there shall be no member `type`.
-template <class...> struct common_reference {};
+template <class...>
+struct common_reference {};
#endif // _LIBCPP_STD_VER >= 20
diff --git a/libcxx/include/__type_traits/common_type.h b/libcxx/include/__type_traits/common_type.h
index d6f73f64588c1..7f86fcaaace44 100644
--- a/libcxx/include/__type_traits/common_type.h
+++ b/libcxx/include/__type_traits/common_type.h
@@ -33,9 +33,8 @@ struct __common_type3 {};
// sub-bullet 4 - "if COND_RES(CREF(D1), CREF(D2)) denotes a type..."
template <class _Tp, class _Up>
-struct __common_type3<_Tp, _Up, void_t<__cond_type<const _Tp&, const _Up&>>>
-{
- using type = remove_cvref_t<__cond_type<const _Tp&, const _Up&>>;
+struct __common_type3<_Tp, _Up, void_t<__cond_type<const _Tp&, const _Up&>>> {
+ using type = remove_cvref_t<__cond_type<const _Tp&, const _Up&>>;
};
template <class _Tp, class _Up, class = void>
@@ -47,11 +46,8 @@ struct __common_type2_imp {};
// sub-bullet 3 - "if decay_t<decltype(false ? declval<D1>() : declval<D2>())> ..."
template <class _Tp, class _Up>
-struct __common_type2_imp<_Tp, _Up, __void_t<decltype(true ? std::declval<_Tp>() : std::declval<_Up>())> >
-{
- typedef _LIBCPP_NODEBUG __decay_t<decltype(
- true ? std::declval<_Tp>() : std::declval<_Up>()
- )> type;
+struct __common_type2_imp<_Tp, _Up, __void_t<decltype(true ? std::declval<_Tp>() : std::declval<_Up>())> > {
+ typedef _LIBCPP_NODEBUG __decay_t<decltype(true ? std::declval<_Tp>() : std::declval<_Up>())> type;
};
template <class, class = void>
@@ -63,19 +59,13 @@ template <class... _Tp>
struct _LIBCPP_TEMPLATE_VIS common_type;
template <class _Tp, class _Up>
-struct __common_type_impl<
- __common_types<_Tp, _Up>, __void_t<typename common_type<_Tp, _Up>::type> >
-{
+struct __common_type_impl< __common_types<_Tp, _Up>, __void_t<typename common_type<_Tp, _Up>::type> > {
typedef typename common_type<_Tp, _Up>::type type;
};
template <class _Tp, class _Up, class _Vp, class... _Rest>
-struct __common_type_impl<
- __common_types<_Tp, _Up, _Vp, _Rest...>,
- __void_t<typename common_type<_Tp, _Up>::type> >
- : __common_type_impl<__common_types<typename common_type<_Tp, _Up>::type,
- _Vp, _Rest...> > {
-};
+struct __common_type_impl<__common_types<_Tp, _Up, _Vp, _Rest...>, __void_t<typename common_type<_Tp, _Up>::type> >
+ : __common_type_impl<__common_types<typename common_type<_Tp, _Up>::type, _Vp, _Rest...> > {};
// bullet 1 - sizeof...(Tp) == 0
@@ -85,31 +75,26 @@ struct _LIBCPP_TEMPLATE_VIS common_type<> {};
// bullet 2 - sizeof...(Tp) == 1
template <class _Tp>
-struct _LIBCPP_TEMPLATE_VIS common_type<_Tp>
- : public common_type<_Tp, _Tp> {};
+struct _LIBCPP_TEMPLATE_VIS common_type<_Tp> : public common_type<_Tp, _Tp> {};
// bullet 3 - sizeof...(Tp) == 2
// sub-bullet 1 - "If is_same_v<T1, D1> is false or ..."
template <class _Tp, class _Up>
struct _LIBCPP_TEMPLATE_VIS common_type<_Tp, _Up>
- : conditional<
- _IsSame<_Tp, __decay_t<_Tp> >::value && _IsSame<_Up, __decay_t<_Up> >::value,
- __common_type2_imp<_Tp, _Up>,
- common_type<__decay_t<_Tp>, __decay_t<_Up> >
- >::type
-{};
+ : conditional<_IsSame<_Tp, __decay_t<_Tp> >::value && _IsSame<_Up, __decay_t<_Up> >::value,
+ __common_type2_imp<_Tp, _Up>,
+ common_type<__decay_t<_Tp>, __decay_t<_Up> > >::type {};
// bullet 4 - sizeof...(Tp) > 2
template <class _Tp, class _Up, class _Vp, class... _Rest>
-struct _LIBCPP_TEMPLATE_VIS
- common_type<_Tp, _Up, _Vp, _Rest...>
- : __common_type_impl<
- __common_types<_Tp, _Up, _Vp, _Rest...> > {};
+struct _LIBCPP_TEMPLATE_VIS common_type<_Tp, _Up, _Vp, _Rest...>
+ : __common_type_impl<__common_types<_Tp, _Up, _Vp, _Rest...> > {};
#if _LIBCPP_STD_VER >= 14
-template <class ..._Tp> using common_type_t = typename common_type<_Tp...>::type;
+template <class... _Tp>
+using common_type_t = typename common_type<_Tp...>::type;
#endif
_LIBCPP_END_NAMESPACE_STD
diff --git a/libcxx/include/__type_traits/copy_cv.h b/libcxx/include/__type_traits/copy_cv.h
index 8e9bfe0a522f8..3c4ee857f7bc7 100644
--- a/libcxx/include/__type_traits/copy_cv.h
+++ b/libcxx/include/__type_traits/copy_cv.h
@@ -23,27 +23,23 @@ _LIBCPP_BEGIN_NAMESPACE_STD
// Let COPYCV(FROM, TO) be an alias for type TO with the addition of FROM's
// top-level cv-qualifiers.
template <class _From, class _To>
-struct __copy_cv
-{
- using type = _To;
+struct __copy_cv {
+ using type = _To;
};
template <class _From, class _To>
-struct __copy_cv<const _From, _To>
-{
- using type = typename add_const<_To>::type;
+struct __copy_cv<const _From, _To> {
+ using type = typename add_const<_To>::type;
};
template <class _From, class _To>
-struct __copy_cv<volatile _From, _To>
-{
- using type = typename add_volatile<_To>::type;
+struct __copy_cv<volatile _From, _To> {
+ using type = typename add_volatile<_To>::type;
};
template <class _From, class _To>
-struct __copy_cv<const volatile _From, _To>
-{
- using type = typename add_cv<_To>::type;
+struct __copy_cv<const volatile _From, _To> {
+ using type = typename add_cv<_To>::type;
};
template <class _From, class _To>
diff --git a/libcxx/include/__type_traits/copy_cvref.h b/libcxx/include/__type_traits/copy_cvref.h
index 8ec59b95a0ada..8bbf8efdf44de 100644
--- a/libcxx/include/__type_traits/copy_cvref.h
+++ b/libcxx/include/__type_traits/copy_cvref.h
@@ -21,21 +21,18 @@
_LIBCPP_BEGIN_NAMESPACE_STD
template <class _From, class _To>
-struct __copy_cvref
-{
- using type = __copy_cv_t<_From, _To>;
+struct __copy_cvref {
+ using type = __copy_cv_t<_From, _To>;
};
template <class _From, class _To>
-struct __copy_cvref<_From&, _To>
-{
- using type = __add_lvalue_reference_t<__copy_cv_t<_From, _To> >;
+struct __copy_cvref<_From&, _To> {
+ using type = __add_lvalue_reference_t<__copy_cv_t<_From, _To> >;
};
template <class _From, class _To>
-struct __copy_cvref<_From&&, _To>
-{
- using type = __add_rvalue_reference_t<__copy_cv_t<_From, _To> >;
+struct __copy_cvref<_From&&, _To> {
+ using type = __add_rvalue_reference_t<__copy_cv_t<_From, _To> >;
};
template <class _From, class _To>
diff --git a/libcxx/include/__type_traits/decay.h b/libcxx/include/__type_traits/decay.h
index a32c140e3c5e2..95dccaa29cbe1 100644
--- a/libcxx/include/__type_traits/decay.h
+++ b/libcxx/include/__type_traits/decay.h
@@ -37,30 +37,24 @@ struct decay {
#else
template <class _Up, bool>
struct __decay {
- typedef _LIBCPP_NODEBUG __remove_cv_t<_Up> type;
+ typedef _LIBCPP_NODEBUG __remove_cv_t<_Up> type;
};
template <class _Up>
struct __decay<_Up, true> {
public:
- typedef _LIBCPP_NODEBUG typename conditional
- <
- is_array<_Up>::value,
- __add_pointer_t<__remove_extent_t<_Up> >,
- typename conditional
- <
- is_function<_Up>::value,
- typename add_pointer<_Up>::type,
- __remove_cv_t<_Up>
- >::type
- >::type type;
+ typedef _LIBCPP_NODEBUG typename conditional<
+ is_array<_Up>::value,
+ __add_pointer_t<__remove_extent_t<_Up> >,
+ typename conditional<is_function<_Up>::value, typename add_pointer<_Up>::type, __remove_cv_t<_Up> >::type >::type
+ type;
};
template <class _Tp>
-struct _LIBCPP_TEMPLATE_VIS decay
-{
+struct _LIBCPP_TEMPLATE_VIS decay {
private:
- typedef _LIBCPP_NODEBUG __libcpp_remove_reference_t<_Tp> _Up;
+ typedef _LIBCPP_NODEBUG __libcpp_remove_reference_t<_Tp> _Up;
+
public:
typedef _LIBCPP_NODEBUG typename __decay<_Up, __libcpp_is_referenceable<_Up>::value>::type type;
};
@@ -70,7 +64,8 @@ using __decay_t = typename decay<_Tp>::type;
#endif // __has_builtin(__decay)
#if _LIBCPP_STD_VER >= 14
-template <class _Tp> using decay_t = __decay_t<_Tp>;
+template <class _Tp>
+using decay_t = __decay_t<_Tp>;
#endif
_LIBCPP_END_NAMESPACE_STD
diff --git a/libcxx/include/__type_traits/enable_if.h b/libcxx/include/__type_traits/enable_if.h
index 4859981f1c314..77da9622ca28f 100644
--- a/libcxx/include/__type_traits/enable_if.h
+++ b/libcxx/include/__type_traits/enable_if.h
@@ -17,13 +17,19 @@
_LIBCPP_BEGIN_NAMESPACE_STD
-template <bool, class _Tp = void> struct _LIBCPP_TEMPLATE_VIS enable_if {};
-template <class _Tp> struct _LIBCPP_TEMPLATE_VIS enable_if<true, _Tp> {typedef _Tp type;};
+template <bool, class _Tp = void>
+struct _LIBCPP_TEMPLATE_VIS enable_if {};
+template <class _Tp>
+struct _LIBCPP_TEMPLATE_VIS enable_if<true, _Tp> {
+ typedef _Tp type;
+};
-template <bool _Bp, class _Tp = void> using __enable_if_t _LIBCPP_NODEBUG = typename enable_if<_Bp, _Tp>::type;
+template <bool _Bp, class _Tp = void>
+using __enable_if_t _LIBCPP_NODEBUG = typename enable_if<_Bp, _Tp>::type;
#if _LIBCPP_STD_VER >= 14
-template <bool _Bp, class _Tp = void> using enable_if_t = typename enable_if<_Bp, _Tp>::type;
+template <bool _Bp, class _Tp = void>
+using enable_if_t = typename enable_if<_Bp, _Tp>::type;
#endif
_LIBCPP_END_NAMESPACE_STD
diff --git a/libcxx/include/__type_traits/extent.h b/libcxx/include/__type_traits/extent.h
index a031f5ed1ef05..bab03fe997eb6 100644
--- a/libcxx/include/__type_traits/extent.h
+++ b/libcxx/include/__type_traits/extent.h
@@ -21,32 +21,31 @@ _LIBCPP_BEGIN_NAMESPACE_STD
#if __has_builtin(__array_extent)
-template<class _Tp, size_t _Dim = 0>
-struct _LIBCPP_TEMPLATE_VIS extent
- : integral_constant<size_t, __array_extent(_Tp, _Dim)> { };
+template <class _Tp, size_t _Dim = 0>
+struct _LIBCPP_TEMPLATE_VIS extent : integral_constant<size_t, __array_extent(_Tp, _Dim)> {};
-#if _LIBCPP_STD_VER >= 17
+# if _LIBCPP_STD_VER >= 17
template <class _Tp, unsigned _Ip = 0>
inline constexpr size_t extent_v = __array_extent(_Tp, _Ip);
-#endif
+# endif
#else // __has_builtin(__array_extent)
-template <class _Tp, unsigned _Ip = 0> struct _LIBCPP_TEMPLATE_VIS extent
- : public integral_constant<size_t, 0> {};
-template <class _Tp> struct _LIBCPP_TEMPLATE_VIS extent<_Tp[], 0>
- : public integral_constant<size_t, 0> {};
-template <class _Tp, unsigned _Ip> struct _LIBCPP_TEMPLATE_VIS extent<_Tp[], _Ip>
- : public integral_constant<size_t, extent<_Tp, _Ip-1>::value> {};
-template <class _Tp, size_t _Np> struct _LIBCPP_TEMPLATE_VIS extent<_Tp[_Np], 0>
- : public integral_constant<size_t, _Np> {};
-template <class _Tp, size_t _Np, unsigned _Ip> struct _LIBCPP_TEMPLATE_VIS extent<_Tp[_Np], _Ip>
- : public integral_constant<size_t, extent<_Tp, _Ip-1>::value> {};
-
-#if _LIBCPP_STD_VER >= 17
+template <class _Tp, unsigned _Ip = 0>
+struct _LIBCPP_TEMPLATE_VIS extent : public integral_constant<size_t, 0> {};
+template <class _Tp>
+struct _LIBCPP_TEMPLATE_VIS extent<_Tp[], 0> : public integral_constant<size_t, 0> {};
+template <class _Tp, unsigned _Ip>
+struct _LIBCPP_TEMPLATE_VIS extent<_Tp[], _Ip> : public integral_constant<size_t, extent<_Tp, _Ip - 1>::value> {};
+template <class _Tp, size_t _Np>
+struct _LIBCPP_TEMPLATE_VIS extent<_Tp[_Np], 0> : public integral_constant<size_t, _Np> {};
+template <class _Tp, size_t _Np, unsigned _Ip>
+struct _LIBCPP_TEMPLATE_VIS extent<_Tp[_Np], _Ip> : public integral_constant<size_t, extent<_Tp, _Ip - 1>::value> {};
+
+# if _LIBCPP_STD_VER >= 17
template <class _Tp, unsigned _Ip = 0>
inline constexpr size_t extent_v = extent<_Tp, _Ip>::value;
-#endif
+# endif
#endif // __has_builtin(__array_extent)
diff --git a/libcxx/include/__type_traits/has_unique_object_representation.h b/libcxx/include/__type_traits/has_unique_object_representation.h
index aa45bbb14cbf0..c0ada5618f0e3 100644
--- a/libcxx/include/__type_traits/has_unique_object_representation.h
+++ b/libcxx/include/__type_traits/has_unique_object_representation.h
@@ -22,9 +22,9 @@ _LIBCPP_BEGIN_NAMESPACE_STD
#if _LIBCPP_STD_VER >= 17
-template <class _Tp> struct _LIBCPP_TEMPLATE_VIS has_unique_object_representations
- : public integral_constant<bool,
- __has_unique_object_representations(remove_cv_t<remove_all_extents_t<_Tp>>)> {};
+template <class _Tp>
+struct _LIBCPP_TEMPLATE_VIS has_unique_object_representations
+ : public integral_constant<bool, __has_unique_object_representations(remove_cv_t<remove_all_extents_t<_Tp>>)> {};
template <class _Tp>
inline constexpr bool has_unique_object_representations_v = has_unique_object_representations<_Tp>::value;
diff --git a/libcxx/include/__type_traits/has_virtual_destructor.h b/libcxx/include/__type_traits/has_virtual_destructor.h
index ae3137e9d6e37..4ce96e649e67a 100644
--- a/libcxx/include/__type_traits/has_virtual_destructor.h
+++ b/libcxx/include/__type_traits/has_virtual_destructor.h
@@ -18,8 +18,8 @@
_LIBCPP_BEGIN_NAMESPACE_STD
-template <class _Tp> struct _LIBCPP_TEMPLATE_VIS has_virtual_destructor
- : public integral_constant<bool, __has_virtual_destructor(_Tp)> {};
+template <class _Tp>
+struct _LIBCPP_TEMPLATE_VIS has_virtual_destructor : public integral_constant<bool, __has_virtual_destructor(_Tp)> {};
#if _LIBCPP_STD_VER >= 17
template <class _Tp>
diff --git a/libcxx/include/__type_traits/integral_constant.h b/libcxx/include/__type_traits/integral_constant.h
index 0951ab5ad837a..a3f4fd34057c9 100644
--- a/libcxx/include/__type_traits/integral_constant.h
+++ b/libcxx/include/__type_traits/integral_constant.h
@@ -18,23 +18,20 @@
_LIBCPP_BEGIN_NAMESPACE_STD
template <class _Tp, _Tp __v>
-struct _LIBCPP_TEMPLATE_VIS integral_constant
-{
- static _LIBCPP_CONSTEXPR const _Tp value = __v;
- typedef _Tp value_type;
+struct _LIBCPP_TEMPLATE_VIS integral_constant {
+ static _LIBCPP_CONSTEXPR const _Tp value = __v;
+ typedef _Tp value_type;
typedef integral_constant type;
- _LIBCPP_INLINE_VISIBILITY
- _LIBCPP_CONSTEXPR operator value_type() const _NOEXCEPT {return value;}
+ _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR operator value_type() const _NOEXCEPT { return value; }
#if _LIBCPP_STD_VER >= 14
- _LIBCPP_INLINE_VISIBILITY
- constexpr value_type operator ()() const _NOEXCEPT {return value;}
+ _LIBCPP_INLINE_VISIBILITY constexpr value_type operator()() const _NOEXCEPT { return value; }
#endif
};
template <class _Tp, _Tp __v>
_LIBCPP_CONSTEXPR const _Tp integral_constant<_Tp, __v>::value;
-typedef integral_constant<bool, true> true_type;
+typedef integral_constant<bool, true> true_type;
typedef integral_constant<bool, false> false_type;
template <bool _Val>
diff --git a/libcxx/include/__type_traits/invoke.h b/libcxx/include/__type_traits/invoke.h
index bc1852ca73710..f3c00e7ede7c3 100644
--- a/libcxx/include/__type_traits/invoke.h
+++ b/libcxx/include/__type_traits/invoke.h
@@ -35,224 +35,195 @@
_LIBCPP_BEGIN_NAMESPACE_STD
-struct __any
-{
- __any(...);
+struct __any {
+ __any(...);
};
template <class _MP, bool _IsMemberFunctionPtr, bool _IsMemberObjectPtr>
-struct __member_pointer_traits_imp
-{
-};
+struct __member_pointer_traits_imp {};
-template <class _Rp, class _Class, class ..._Param>
-struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...), true, false>
-{
- typedef _Class _ClassType;
- typedef _Rp _ReturnType;
- typedef _Rp (_FnType) (_Param...);
+template <class _Rp, class _Class, class... _Param>
+struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...), true, false> {
+ typedef _Class _ClassType;
+ typedef _Rp _ReturnType;
+ typedef _Rp(_FnType)(_Param...);
};
-template <class _Rp, class _Class, class ..._Param>
-struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param..., ...), true, false>
-{
- typedef _Class _ClassType;
- typedef _Rp _ReturnType;
- typedef _Rp (_FnType) (_Param..., ...);
+template <class _Rp, class _Class, class... _Param>
+struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param..., ...), true, false> {
+ typedef _Class _ClassType;
+ typedef _Rp _ReturnType;
+ typedef _Rp(_FnType)(_Param..., ...);
};
-template <class _Rp, class _Class, class ..._Param>
-struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) const, true, false>
-{
- typedef _Class const _ClassType;
- typedef _Rp _ReturnType;
- typedef _Rp (_FnType) (_Param...);
+template <class _Rp, class _Class, class... _Param>
+struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) const, true, false> {
+ typedef _Class const _ClassType;
+ typedef _Rp _ReturnType;
+ typedef _Rp(_FnType)(_Param...);
};
-template <class _Rp, class _Class, class ..._Param>
-struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param..., ...) const, true, false>
-{
- typedef _Class const _ClassType;
- typedef _Rp _ReturnType;
- typedef _Rp (_FnType) (_Param..., ...);
+template <class _Rp, class _Class, class... _Param>
+struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param..., ...) const, true, false> {
+ typedef _Class const _ClassType;
+ typedef _Rp _ReturnType;
+ typedef _Rp(_FnType)(_Param..., ...);
};
-template <class _Rp, class _Class, class ..._Param>
-struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) volatile, true, false>
-{
- typedef _Class volatile _ClassType;
- typedef _Rp _ReturnType;
- typedef _Rp (_FnType) (_Param...);
+template <class _Rp, class _Class, class... _Param>
+struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) volatile, true, false> {
+ typedef _Class volatile _ClassType;
+ typedef _Rp _ReturnType;
+ typedef _Rp(_FnType)(_Param...);
};
-template <class _Rp, class _Class, class ..._Param>
-struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param..., ...) volatile, true, false>
-{
- typedef _Class volatile _ClassType;
- typedef _Rp _ReturnType;
- typedef _Rp (_FnType) (_Param..., ...);
+template <class _Rp, class _Class, class... _Param>
+struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param..., ...) volatile, true, false> {
+ typedef _Class volatile _ClassType;
+ typedef _Rp _ReturnType;
+ typedef _Rp(_FnType)(_Param..., ...);
};
-template <class _Rp, class _Class, class ..._Param>
-struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) const volatile, true, false>
-{
- typedef _Class const volatile _ClassType;
- typedef _Rp _ReturnType;
- typedef _Rp (_FnType) (_Param...);
+template <class _Rp, class _Class, class... _Param>
+struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) const volatile, true, false> {
+ typedef _Class const volatile _ClassType;
+ typedef _Rp _ReturnType;
+ typedef _Rp(_FnType)(_Param...);
};
-template <class _Rp, class _Class, class ..._Param>
-struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param..., ...) const volatile, true, false>
-{
- typedef _Class const volatile _ClassType;
- typedef _Rp _ReturnType;
- typedef _Rp (_FnType) (_Param..., ...);
+template <class _Rp, class _Class, class... _Param>
+struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param..., ...) const volatile, true, false> {
+ typedef _Class const volatile _ClassType;
+ typedef _Rp _ReturnType;
+ typedef _Rp(_FnType)(_Param..., ...);
};
-template <class _Rp, class _Class, class ..._Param>
-struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) &, true, false>
-{
- typedef _Class& _ClassType;
- typedef _Rp _ReturnType;
- typedef _Rp (_FnType) (_Param...);
+template <class _Rp, class _Class, class... _Param>
+struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...)&, true, false> {
+ typedef _Class& _ClassType;
+ typedef _Rp _ReturnType;
+ typedef _Rp(_FnType)(_Param...);
};
-template <class _Rp, class _Class, class ..._Param>
-struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param..., ...) &, true, false>
-{
- typedef _Class& _ClassType;
- typedef _Rp _ReturnType;
- typedef _Rp (_FnType) (_Param..., ...);
+template <class _Rp, class _Class, class... _Param>
+struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param..., ...)&, true, false> {
+ typedef _Class& _ClassType;
+ typedef _Rp _ReturnType;
+ typedef _Rp(_FnType)(_Param..., ...);
};
-template <class _Rp, class _Class, class ..._Param>
-struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) const&, true, false>
-{
- typedef _Class const& _ClassType;
- typedef _Rp _ReturnType;
- typedef _Rp (_FnType) (_Param...);
+template <class _Rp, class _Class, class... _Param>
+struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) const&, true, false> {
+ typedef _Class const& _ClassType;
+ typedef _Rp _ReturnType;
+ typedef _Rp(_FnType)(_Param...);
};
-template <class _Rp, class _Class, class ..._Param>
-struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param..., ...) const&, true, false>
-{
- typedef _Class const& _ClassType;
- typedef _Rp _ReturnType;
- typedef _Rp (_FnType) (_Param..., ...);
+template <class _Rp, class _Class, class... _Param>
+struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param..., ...) const&, true, false> {
+ typedef _Class const& _ClassType;
+ typedef _Rp _ReturnType;
+ typedef _Rp(_FnType)(_Param..., ...);
};
-template <class _Rp, class _Class, class ..._Param>
-struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) volatile&, true, false>
-{
- typedef _Class volatile& _ClassType;
- typedef _Rp _ReturnType;
- typedef _Rp (_FnType) (_Param...);
+template <class _Rp, class _Class, class... _Param>
+struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) volatile&, true, false> {
+ typedef _Class volatile& _ClassType;
+ typedef _Rp _ReturnType;
+ typedef _Rp(_FnType)(_Param...);
};
-template <class _Rp, class _Class, class ..._Param>
-struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param..., ...) volatile&, true, false>
-{
- typedef _Class volatile& _ClassType;
- typedef _Rp _ReturnType;
- typedef _Rp (_FnType) (_Param..., ...);
+template <class _Rp, class _Class, class... _Param>
+struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param..., ...) volatile&, true, false> {
+ typedef _Class volatile& _ClassType;
+ typedef _Rp _ReturnType;
+ typedef _Rp(_FnType)(_Param..., ...);
};
-template <class _Rp, class _Class, class ..._Param>
-struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) const volatile&, true, false>
-{
- typedef _Class const volatile& _ClassType;
- typedef _Rp _ReturnType;
- typedef _Rp (_FnType) (_Param...);
+template <class _Rp, class _Class, class... _Param>
+struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) const volatile&, true, false> {
+ typedef _Class const volatile& _ClassType;
+ typedef _Rp _ReturnType;
+ typedef _Rp(_FnType)(_Param...);
};
-template <class _Rp, class _Class, class ..._Param>
-struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param..., ...) const volatile&, true, false>
-{
- typedef _Class const volatile& _ClassType;
- typedef _Rp _ReturnType;
- typedef _Rp (_FnType) (_Param..., ...);
+template <class _Rp, class _Class, class... _Param>
+struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param..., ...) const volatile&, true, false> {
+ typedef _Class const volatile& _ClassType;
+ typedef _Rp _ReturnType;
+ typedef _Rp(_FnType)(_Param..., ...);
};
-template <class _Rp, class _Class, class ..._Param>
-struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) &&, true, false>
-{
- typedef _Class&& _ClassType;
- typedef _Rp _ReturnType;
- typedef _Rp (_FnType) (_Param...);
+template <class _Rp, class _Class, class... _Param>
+struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...)&&, true, false> {
+ typedef _Class&& _ClassType;
+ typedef _Rp _ReturnType;
+ typedef _Rp(_FnType)(_Param...);
};
-template <class _Rp, class _Class, class ..._Param>
-struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param..., ...) &&, true, false>
-{
- typedef _Class&& _ClassType;
- typedef _Rp _ReturnType;
- typedef _Rp (_FnType) (_Param..., ...);
+template <class _Rp, class _Class, class... _Param>
+struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param..., ...)&&, true, false> {
+ typedef _Class&& _ClassType;
+ typedef _Rp _ReturnType;
+ typedef _Rp(_FnType)(_Param..., ...);
};
-template <class _Rp, class _Class, class ..._Param>
-struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) const&&, true, false>
-{
- typedef _Class const&& _ClassType;
- typedef _Rp _ReturnType;
- typedef _Rp (_FnType) (_Param...);
+template <class _Rp, class _Class, class... _Param>
+struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) const&&, true, false> {
+ typedef _Class const&& _ClassType;
+ typedef _Rp _ReturnType;
+ typedef _Rp(_FnType)(_Param...);
};
-template <class _Rp, class _Class, class ..._Param>
-struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param..., ...) const&&, true, false>
-{
- typedef _Class const&& _ClassType;
- typedef _Rp _ReturnType;
- typedef _Rp (_FnType) (_Param..., ...);
+template <class _Rp, class _Class, class... _Param>
+struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param..., ...) const&&, true, false> {
+ typedef _Class const&& _ClassType;
+ typedef _Rp _ReturnType;
+ typedef _Rp(_FnType)(_Param..., ...);
};
-template <class _Rp, class _Class, class ..._Param>
-struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) volatile&&, true, false>
-{
- typedef _Class volatile&& _ClassType;
- typedef _Rp _ReturnType;
- typedef _Rp (_FnType) (_Param...);
+template <class _Rp, class _Class, class... _Param>
+struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) volatile&&, true, false> {
+ typedef _Class volatile&& _ClassType;
+ typedef _Rp _ReturnType;
+ typedef _Rp(_FnType)(_Param...);
};
-template <class _Rp, class _Class, class ..._Param>
-struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param..., ...) volatile&&, true, false>
-{
- typedef _Class volatile&& _ClassType;
- typedef _Rp _ReturnType;
- typedef _Rp (_FnType) (_Param..., ...);
+template <class _Rp, class _Class, class... _Param>
+struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param..., ...) volatile&&, true, false> {
+ typedef _Class volatile&& _ClassType;
+ typedef _Rp _ReturnType;
+ typedef _Rp(_FnType)(_Param..., ...);
};
-template <class _Rp, class _Class, class ..._Param>
-struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) const volatile&&, true, false>
-{
- typedef _Class const volatile&& _ClassType;
- typedef _Rp _ReturnType;
- typedef _Rp (_FnType) (_Param...);
+template <class _Rp, class _Class, class... _Param>
+struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) const volatile&&, true, false> {
+ typedef _Class const volatile&& _ClassType;
+ typedef _Rp _ReturnType;
+ typedef _Rp(_FnType)(_Param...);
};
-template <class _Rp, class _Class, class ..._Param>
-struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param..., ...) const volatile&&, true, false>
-{
- typedef _Class const volatile&& _ClassType;
- typedef _Rp _ReturnType;
- typedef _Rp (_FnType) (_Param..., ...);
+template <class _Rp, class _Class, class... _Param>
+struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param..., ...) const volatile&&, true, false> {
+ typedef _Class const volatile&& _ClassType;
+ typedef _Rp _ReturnType;
+ typedef _Rp(_FnType)(_Param..., ...);
};
template <class _Rp, class _Class>
-struct __member_pointer_traits_imp<_Rp _Class::*, false, true>
-{
- typedef _Class _ClassType;
- typedef _Rp _ReturnType;
+struct __member_pointer_traits_imp<_Rp _Class::*, false, true> {
+ typedef _Class _ClassType;
+ typedef _Rp _ReturnType;
};
template <class _MP>
struct __member_pointer_traits
: public __member_pointer_traits_imp<__remove_cv_t<_MP>,
- is_member_function_pointer<_MP>::value,
- is_member_object_pointer<_MP>::value>
-{
-// typedef ... _ClassType;
-// typedef ... _ReturnType;
-// typedef ... _FnType;
+ is_member_function_pointer<_MP>::value,
+ is_member_object_pointer<_MP>::value> {
+ // typedef ... _ClassType;
+ // typedef ... _ReturnType;
+ // typedef ... _FnType;
};
template <class _DecayedFp>
@@ -263,268 +234,222 @@ struct __member_pointer_class_type<_Ret _ClassType::*> {
typedef _ClassType type;
};
-template <class _Fp, class _A0,
- class _DecayFp = __decay_t<_Fp>,
- class _DecayA0 = __decay_t<_A0>,
- class _ClassT = typename __member_pointer_class_type<_DecayFp>::type>
-using __enable_if_bullet1 = typename enable_if
- <
- is_member_function_pointer<_DecayFp>::value
- && is_base_of<_ClassT, _DecayA0>::value
- >::type;
-
-template <class _Fp, class _A0,
- class _DecayFp = __decay_t<_Fp>,
- class _DecayA0 = __decay_t<_A0> >
-using __enable_if_bullet2 = typename enable_if
- <
- is_member_function_pointer<_DecayFp>::value
- && __is_reference_wrapper<_DecayA0>::value
- >::type;
-
-template <class _Fp, class _A0,
- class _DecayFp = __decay_t<_Fp>,
- class _DecayA0 = __decay_t<_A0>,
- class _ClassT = typename __member_pointer_class_type<_DecayFp>::type>
-using __enable_if_bullet3 = typename enable_if
- <
- is_member_function_pointer<_DecayFp>::value
- && !is_base_of<_ClassT, _DecayA0>::value
- && !__is_reference_wrapper<_DecayA0>::value
- >::type;
-
-template <class _Fp, class _A0,
- class _DecayFp = __decay_t<_Fp>,
- class _DecayA0 = __decay_t<_A0>,
- class _ClassT = typename __member_pointer_class_type<_DecayFp>::type>
-using __enable_if_bullet4 = typename enable_if
- <
- is_member_object_pointer<_DecayFp>::value
- && is_base_of<_ClassT, _DecayA0>::value
- >::type;
-
-template <class _Fp, class _A0,
- class _DecayFp = __decay_t<_Fp>,
- class _DecayA0 = __decay_t<_A0> >
-using __enable_if_bullet5 = typename enable_if
- <
- is_member_object_pointer<_DecayFp>::value
- && __is_reference_wrapper<_DecayA0>::value
- >::type;
-
-template <class _Fp, class _A0,
- class _DecayFp = __decay_t<_Fp>,
- class _DecayA0 = __decay_t<_A0>,
- class _ClassT = typename __member_pointer_class_type<_DecayFp>::type>
-using __enable_if_bullet6 = typename enable_if
- <
- is_member_object_pointer<_DecayFp>::value
- && !is_base_of<_ClassT, _DecayA0>::value
- && !__is_reference_wrapper<_DecayA0>::value
- >::type;
+template <class _Fp,
+ class _A0,
+ class _DecayFp = __decay_t<_Fp>,
+ class _DecayA0 = __decay_t<_A0>,
+ class _ClassT = typename __member_pointer_class_type<_DecayFp>::type>
+using __enable_if_bullet1 =
+ typename enable_if<is_member_function_pointer<_DecayFp>::value && is_base_of<_ClassT, _DecayA0>::value >::type;
+
+template <class _Fp, class _A0, class _DecayFp = __decay_t<_Fp>, class _DecayA0 = __decay_t<_A0> >
+using __enable_if_bullet2 =
+ typename enable_if<is_member_function_pointer<_DecayFp>::value && __is_reference_wrapper<_DecayA0>::value >::type;
+
+template <class _Fp,
+ class _A0,
+ class _DecayFp = __decay_t<_Fp>,
+ class _DecayA0 = __decay_t<_A0>,
+ class _ClassT = typename __member_pointer_class_type<_DecayFp>::type>
+using __enable_if_bullet3 =
+ typename enable_if<is_member_function_pointer<_DecayFp>::value && !is_base_of<_ClassT, _DecayA0>::value &&
+ !__is_reference_wrapper<_DecayA0>::value >::type;
+
+template <class _Fp,
+ class _A0,
+ class _DecayFp = __decay_t<_Fp>,
+ class _DecayA0 = __decay_t<_A0>,
+ class _ClassT = typename __member_pointer_class_type<_DecayFp>::type>
+using __enable_if_bullet4 =
+ typename enable_if<is_member_object_pointer<_DecayFp>::value && is_base_of<_ClassT, _DecayA0>::value >::type;
+
+template <class _Fp, class _A0, class _DecayFp = __decay_t<_Fp>, class _DecayA0 = __decay_t<_A0> >
+using __enable_if_bullet5 =
+ typename enable_if<is_member_object_pointer<_DecayFp>::value && __is_reference_wrapper<_DecayA0>::value >::type;
+
+template <class _Fp,
+ class _A0,
+ class _DecayFp = __decay_t<_Fp>,
+ class _DecayA0 = __decay_t<_A0>,
+ class _ClassT = typename __member_pointer_class_type<_DecayFp>::type>
+using __enable_if_bullet6 =
+ typename enable_if<is_member_object_pointer<_DecayFp>::value && !is_base_of<_ClassT, _DecayA0>::value &&
+ !__is_reference_wrapper<_DecayA0>::value >::type;
// __invoke forward declarations
// fall back - none of the bullets
-template <class ..._Args>
-__nat __invoke(__any, _Args&& ...__args);
+template <class... _Args>
+__nat __invoke(__any, _Args&&... __args);
// bullets 1, 2 and 3
-template <class _Fp, class _A0, class ..._Args,
- class = __enable_if_bullet1<_Fp, _A0> >
-inline _LIBCPP_INLINE_VISIBILITY
-_LIBCPP_CONSTEXPR decltype((std::declval<_A0>().*std::declval<_Fp>())(std::declval<_Args>()...))
-__invoke(_Fp&& __f, _A0&& __a0, _Args&& ...__args)
+// clang-format off
+template <class _Fp, class _A0, class... _Args, class = __enable_if_bullet1<_Fp, _A0> >
+inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
+decltype((std::declval<_A0>().*std::declval<_Fp>())(std::declval<_Args>()...))
+__invoke(_Fp&& __f, _A0&& __a0, _Args&&... __args)
_NOEXCEPT_(noexcept((static_cast<_A0&&>(__a0).*__f)(static_cast<_Args&&>(__args)...)))
- { return (static_cast<_A0&&>(__a0).*__f)(static_cast<_Args&&>(__args)...); }
+ { return (static_cast<_A0&&>(__a0).*__f)(static_cast<_Args&&>(__args)...); }
-template <class _Fp, class _A0, class ..._Args,
- class = __enable_if_bullet2<_Fp, _A0> >
-inline _LIBCPP_INLINE_VISIBILITY
-_LIBCPP_CONSTEXPR decltype((std::declval<_A0>().get().*std::declval<_Fp>())(std::declval<_Args>()...))
-__invoke(_Fp&& __f, _A0&& __a0, _Args&& ...__args)
+template <class _Fp, class _A0, class... _Args, class = __enable_if_bullet2<_Fp, _A0> >
+inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
+decltype((std::declval<_A0>().get().*std::declval<_Fp>())(std::declval<_Args>()...))
+__invoke(_Fp&& __f, _A0&& __a0, _Args&&... __args)
_NOEXCEPT_(noexcept((__a0.get().*__f)(static_cast<_Args&&>(__args)...)))
- { return (__a0.get().*__f)(static_cast<_Args&&>(__args)...); }
+ { return (__a0.get().*__f)(static_cast<_Args&&>(__args)...); }
-template <class _Fp, class _A0, class ..._Args,
- class = __enable_if_bullet3<_Fp, _A0> >
-inline _LIBCPP_INLINE_VISIBILITY
-_LIBCPP_CONSTEXPR decltype(((*std::declval<_A0>()).*std::declval<_Fp>())(std::declval<_Args>()...))
-__invoke(_Fp&& __f, _A0&& __a0, _Args&& ...__args)
+template <class _Fp, class _A0, class... _Args, class = __enable_if_bullet3<_Fp, _A0> >
+inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
+decltype(((*std::declval<_A0>()).*std::declval<_Fp>())(std::declval<_Args>()...))
+__invoke(_Fp&& __f, _A0&& __a0, _Args&&... __args)
_NOEXCEPT_(noexcept(((*static_cast<_A0&&>(__a0)).*__f)(static_cast<_Args&&>(__args)...)))
- { return ((*static_cast<_A0&&>(__a0)).*__f)(static_cast<_Args&&>(__args)...); }
+ { return ((*static_cast<_A0&&>(__a0)).*__f)(static_cast<_Args&&>(__args)...); }
// bullets 4, 5 and 6
-template <class _Fp, class _A0,
- class = __enable_if_bullet4<_Fp, _A0> >
-inline _LIBCPP_INLINE_VISIBILITY
-_LIBCPP_CONSTEXPR decltype(std::declval<_A0>().*std::declval<_Fp>())
+template <class _Fp, class _A0, class = __enable_if_bullet4<_Fp, _A0> >
+inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
+decltype(std::declval<_A0>().*std::declval<_Fp>())
__invoke(_Fp&& __f, _A0&& __a0)
_NOEXCEPT_(noexcept(static_cast<_A0&&>(__a0).*__f))
- { return static_cast<_A0&&>(__a0).*__f; }
+ { return static_cast<_A0&&>(__a0).*__f; }
-template <class _Fp, class _A0,
- class = __enable_if_bullet5<_Fp, _A0> >
-inline _LIBCPP_INLINE_VISIBILITY
-_LIBCPP_CONSTEXPR decltype(std::declval<_A0>().get().*std::declval<_Fp>())
+template <class _Fp, class _A0, class = __enable_if_bullet5<_Fp, _A0> >
+inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
+decltype(std::declval<_A0>().get().*std::declval<_Fp>())
__invoke(_Fp&& __f, _A0&& __a0)
_NOEXCEPT_(noexcept(__a0.get().*__f))
- { return __a0.get().*__f; }
+ { return __a0.get().*__f; }
-template <class _Fp, class _A0,
- class = __enable_if_bullet6<_Fp, _A0> >
-inline _LIBCPP_INLINE_VISIBILITY
-_LIBCPP_CONSTEXPR decltype((*std::declval<_A0>()).*std::declval<_Fp>())
+template <class _Fp, class _A0, class = __enable_if_bullet6<_Fp, _A0> >
+inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
+decltype((*std::declval<_A0>()).*std::declval<_Fp>())
__invoke(_Fp&& __f, _A0&& __a0)
_NOEXCEPT_(noexcept((*static_cast<_A0&&>(__a0)).*__f))
- { return (*static_cast<_A0&&>(__a0)).*__f; }
+ { return (*static_cast<_A0&&>(__a0)).*__f; }
// bullet 7
-template <class _Fp, class ..._Args>
-inline _LIBCPP_INLINE_VISIBILITY
-_LIBCPP_CONSTEXPR decltype(std::declval<_Fp>()(std::declval<_Args>()...))
-__invoke(_Fp&& __f, _Args&& ...__args)
+template <class _Fp, class... _Args>
+inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
+decltype(std::declval<_Fp>()(std::declval<_Args>()...))
+__invoke(_Fp&& __f, _Args&&... __args)
_NOEXCEPT_(noexcept(static_cast<_Fp&&>(__f)(static_cast<_Args&&>(__args)...)))
- { return static_cast<_Fp&&>(__f)(static_cast<_Args&&>(__args)...); }
+ { return static_cast<_Fp&&>(__f)(static_cast<_Args&&>(__args)...); }
+// clang-format on
// __invokable
-template <class _Ret, class _Fp, class ..._Args>
-struct __invokable_r
-{
- template <class _XFp, class ..._XArgs>
+template <class _Ret, class _Fp, class... _Args>
+struct __invokable_r {
+ template <class _XFp, class... _XArgs>
static decltype(std::__invoke(std::declval<_XFp>(), std::declval<_XArgs>()...)) __try_call(int);
- template <class _XFp, class ..._XArgs>
+ template <class _XFp, class... _XArgs>
static __nat __try_call(...);
// FIXME: Check that _Ret, _Fp, and _Args... are all complete types, cv void,
// or incomplete array types as required by the standard.
using _Result = decltype(__try_call<_Fp, _Args...>(0));
- using type = __conditional_t<
- _IsNotSame<_Result, __nat>::value,
- __conditional_t<is_void<_Ret>::value, true_type, __is_core_convertible<_Result, _Ret> >,
- false_type>;
+ using type = __conditional_t<_IsNotSame<_Result, __nat>::value,
+ __conditional_t<is_void<_Ret>::value, true_type, __is_core_convertible<_Result, _Ret> >,
+ false_type>;
static const bool value = type::value;
};
-template <class _Fp, class ..._Args>
+template <class _Fp, class... _Args>
using __invokable = __invokable_r<void, _Fp, _Args...>;
-template <bool _IsInvokable, bool _IsCVVoid, class _Ret, class _Fp, class ..._Args>
+template <bool _IsInvokable, bool _IsCVVoid, class _Ret, class _Fp, class... _Args>
struct __nothrow_invokable_r_imp {
static const bool value = false;
};
-template <class _Ret, class _Fp, class ..._Args>
-struct __nothrow_invokable_r_imp<true, false, _Ret, _Fp, _Args...>
-{
- typedef __nothrow_invokable_r_imp _ThisT;
+template <class _Ret, class _Fp, class... _Args>
+struct __nothrow_invokable_r_imp<true, false, _Ret, _Fp, _Args...> {
+ typedef __nothrow_invokable_r_imp _ThisT;
- template <class _Tp>
- static void __test_noexcept(_Tp) _NOEXCEPT;
+ template <class _Tp>
+ static void __test_noexcept(_Tp) _NOEXCEPT;
#ifdef _LIBCPP_CXX03_LANG
- static const bool value = false;
+ static const bool value = false;
#else
- static const bool value = noexcept(_ThisT::__test_noexcept<_Ret>(
- _VSTD::__invoke(std::declval<_Fp>(), std::declval<_Args>()...)));
+ static const bool value =
+ noexcept(_ThisT::__test_noexcept<_Ret>(_VSTD::__invoke(std::declval<_Fp>(), std::declval<_Args>()...)));
#endif
};
-template <class _Ret, class _Fp, class ..._Args>
-struct __nothrow_invokable_r_imp<true, true, _Ret, _Fp, _Args...>
-{
+template <class _Ret, class _Fp, class... _Args>
+struct __nothrow_invokable_r_imp<true, true, _Ret, _Fp, _Args...> {
#ifdef _LIBCPP_CXX03_LANG
- static const bool value = false;
+ static const bool value = false;
#else
- static const bool value = noexcept(
- _VSTD::__invoke(std::declval<_Fp>(), std::declval<_Args>()...));
+ static const bool value = noexcept(_VSTD::__invoke(std::declval<_Fp>(), std::declval<_Args>()...));
#endif
};
-template <class _Ret, class _Fp, class ..._Args>
+template <class _Ret, class _Fp, class... _Args>
using __nothrow_invokable_r =
- __nothrow_invokable_r_imp<
- __invokable_r<_Ret, _Fp, _Args...>::value,
- is_void<_Ret>::value,
- _Ret, _Fp, _Args...
- >;
-
-template <class _Fp, class ..._Args>
-using __nothrow_invokable =
- __nothrow_invokable_r_imp<
- __invokable<_Fp, _Args...>::value,
- true, void, _Fp, _Args...
- >;
-
-template <class _Fp, class ..._Args>
+ __nothrow_invokable_r_imp<__invokable_r<_Ret, _Fp, _Args...>::value, is_void<_Ret>::value, _Ret, _Fp, _Args...>;
+
+template <class _Fp, class... _Args>
+using __nothrow_invokable = __nothrow_invokable_r_imp<__invokable<_Fp, _Args...>::value, true, void, _Fp, _Args...>;
+
+template <class _Fp, class... _Args>
struct __invoke_of
- : public enable_if<
- __invokable<_Fp, _Args...>::value,
- typename __invokable_r<void, _Fp, _Args...>::_Result>
-{
-};
+ : public enable_if<__invokable<_Fp, _Args...>::value, typename __invokable_r<void, _Fp, _Args...>::_Result> {};
template <class _Ret, bool = is_void<_Ret>::value>
-struct __invoke_void_return_wrapper
-{
- template <class ..._Args>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 static _Ret __call(_Args&&... __args) {
- return std::__invoke(std::forward<_Args>(__args)...);
- }
+struct __invoke_void_return_wrapper {
+ template <class... _Args>
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 static _Ret __call(_Args&&... __args) {
+ return std::__invoke(std::forward<_Args>(__args)...);
+ }
};
template <class _Ret>
-struct __invoke_void_return_wrapper<_Ret, true>
-{
- template <class ..._Args>
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 static void __call(_Args&&... __args) {
- std::__invoke(std::forward<_Args>(__args)...);
- }
+struct __invoke_void_return_wrapper<_Ret, true> {
+ template <class... _Args>
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 static void __call(_Args&&... __args) {
+ std::__invoke(std::forward<_Args>(__args)...);
+ }
};
#if _LIBCPP_STD_VER >= 17
// is_invocable
-template <class _Fn, class ..._Args>
-struct _LIBCPP_TEMPLATE_VIS is_invocable
- : integral_constant<bool, __invokable<_Fn, _Args...>::value> {};
+template <class _Fn, class... _Args>
+struct _LIBCPP_TEMPLATE_VIS is_invocable : integral_constant<bool, __invokable<_Fn, _Args...>::value> {};
-template <class _Ret, class _Fn, class ..._Args>
-struct _LIBCPP_TEMPLATE_VIS is_invocable_r
- : integral_constant<bool, __invokable_r<_Ret, _Fn, _Args...>::value> {};
+template <class _Ret, class _Fn, class... _Args>
+struct _LIBCPP_TEMPLATE_VIS is_invocable_r : integral_constant<bool, __invokable_r<_Ret, _Fn, _Args...>::value> {};
-template <class _Fn, class ..._Args>
+template <class _Fn, class... _Args>
inline constexpr bool is_invocable_v = is_invocable<_Fn, _Args...>::value;
-template <class _Ret, class _Fn, class ..._Args>
+template <class _Ret, class _Fn, class... _Args>
inline constexpr bool is_invocable_r_v = is_invocable_r<_Ret, _Fn, _Args...>::value;
// is_nothrow_invocable
-template <class _Fn, class ..._Args>
-struct _LIBCPP_TEMPLATE_VIS is_nothrow_invocable
- : integral_constant<bool, __nothrow_invokable<_Fn, _Args...>::value> {};
+template <class _Fn, class... _Args>
+struct _LIBCPP_TEMPLATE_VIS is_nothrow_invocable : integral_constant<bool, __nothrow_invokable<_Fn, _Args...>::value> {
+};
-template <class _Ret, class _Fn, class ..._Args>
+template <class _Ret, class _Fn, class... _Args>
struct _LIBCPP_TEMPLATE_VIS is_nothrow_invocable_r
: integral_constant<bool, __nothrow_invokable_r<_Ret, _Fn, _Args...>::value> {};
-template <class _Fn, class ..._Args>
+template <class _Fn, class... _Args>
inline constexpr bool is_nothrow_invocable_v = is_nothrow_invocable<_Fn, _Args...>::value;
-template <class _Ret, class _Fn, class ..._Args>
+template <class _Ret, class _Fn, class... _Args>
inline constexpr bool is_nothrow_invocable_r_v = is_nothrow_invocable_r<_Ret, _Fn, _Args...>::value;
template <class _Fn, class... _Args>
-struct _LIBCPP_TEMPLATE_VIS invoke_result
- : __invoke_of<_Fn, _Args...>
-{
-};
+struct _LIBCPP_TEMPLATE_VIS invoke_result : __invoke_of<_Fn, _Args...> {};
template <class _Fn, class... _Args>
using invoke_result_t = typename invoke_result<_Fn, _Args...>::type;
diff --git a/libcxx/include/__type_traits/is_abstract.h b/libcxx/include/__type_traits/is_abstract.h
index 5e886bb8d6d93..4aa456be1c48e 100644
--- a/libcxx/include/__type_traits/is_abstract.h
+++ b/libcxx/include/__type_traits/is_abstract.h
@@ -18,8 +18,8 @@
_LIBCPP_BEGIN_NAMESPACE_STD
-template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_abstract
- : public integral_constant<bool, __is_abstract(_Tp)> {};
+template <class _Tp>
+struct _LIBCPP_TEMPLATE_VIS is_abstract : public integral_constant<bool, __is_abstract(_Tp)> {};
#if _LIBCPP_STD_VER >= 17
template <class _Tp>
diff --git a/libcxx/include/__type_traits/is_aggregate.h b/libcxx/include/__type_traits/is_aggregate.h
index 3b0942048cf34..4e0988071adee 100644
--- a/libcxx/include/__type_traits/is_aggregate.h
+++ b/libcxx/include/__type_traits/is_aggregate.h
@@ -20,8 +20,8 @@ _LIBCPP_BEGIN_NAMESPACE_STD
#if _LIBCPP_STD_VER >= 17
-template <class _Tp> struct _LIBCPP_TEMPLATE_VIS
-is_aggregate : public integral_constant<bool, __is_aggregate(_Tp)> {};
+template <class _Tp>
+struct _LIBCPP_TEMPLATE_VIS is_aggregate : public integral_constant<bool, __is_aggregate(_Tp)> {};
template <class _Tp>
inline constexpr bool is_aggregate_v = __is_aggregate(_Tp);
diff --git a/libcxx/include/__type_traits/is_allocator.h b/libcxx/include/__type_traits/is_allocator.h
index ee4154d7e4a43..144ffac4d7ce5 100644
--- a/libcxx/include/__type_traits/is_allocator.h
+++ b/libcxx/include/__type_traits/is_allocator.h
@@ -21,15 +21,13 @@
_LIBCPP_BEGIN_NAMESPACE_STD
-template<typename _Alloc, typename = void, typename = void>
+template <typename _Alloc, typename = void, typename = void>
struct __is_allocator : false_type {};
-template<typename _Alloc>
+template <typename _Alloc>
struct __is_allocator<_Alloc,
- __void_t<typename _Alloc::value_type>,
- __void_t<decltype(std::declval<_Alloc&>().allocate(size_t(0)))>
- >
- : true_type {};
+ __void_t<typename _Alloc::value_type>,
+ __void_t<decltype(std::declval<_Alloc&>().allocate(size_t(0)))> > : true_type {};
_LIBCPP_END_NAMESPACE_STD
diff --git a/libcxx/include/__type_traits/is_always_bitcastable.h b/libcxx/include/__type_traits/is_always_bitcastable.h
index 63304eb492b7c..5bc650b41358a 100644
--- a/libcxx/include/__type_traits/is_always_bitcastable.h
+++ b/libcxx/include/__type_traits/is_always_bitcastable.h
@@ -32,49 +32,52 @@ _LIBCPP_BEGIN_NAMESPACE_STD
template <class _From, class _To>
struct __is_always_bitcastable {
using _UnqualFrom = __remove_cv_t<_From>;
- using _UnqualTo = __remove_cv_t<_To>;
+ using _UnqualTo = __remove_cv_t<_To>;
+ // clang-format off
static const bool value =
- // First, the simple case -- `From` and `To` are the same object type.
- (is_same<_UnqualFrom, _UnqualTo>::value && is_trivially_copyable<_UnqualFrom>::value) ||
+ // First, the simple case -- `From` and `To` are the same object type.
+ (is_same<_UnqualFrom, _UnqualTo>::value && is_trivially_copyable<_UnqualFrom>::value) ||
- // Beyond the simple case, we say that one type is "always bit-castable" to another if:
- // - (1) `From` and `To` have the same value representation, and in addition every possible value of `From` has
- // a corresponding value in the `To` type (in other words, the set of values of `To` is a superset of the set of
- // values of `From`);
- // - (2) When the corresponding values are not the same value (as, for example, between an unsigned and a signed
- // integer, where a large positive value of the unsigned integer corresponds to a negative value in the signed
- // integer type), the value of `To` that results from a bitwise copy of `From` is the same what would be produced
- // by the built-in assignment (if it were defined for the two types, to which there are minor exceptions, e.g.
- // built-in arrays).
- //
- // In practice, that means:
- // - all integral types (except `bool`, see below) -- that is, character types and `int` types, both signed and
- // unsigned...
- // - as well as arrays of such types...
- // - ...that have the same size.
- //
- // Other trivially-copyable types can't be validly bit-cast outside of their own type:
- // - floating-point types normally have
diff erent sizes and thus aren't bit-castable between each other (fails #1);
- // - integral types and floating-point types use
diff erent representations, so for example bit-casting an integral
- // `1` to `float` results in a very small less-than-one value, unlike built-in assignment that produces `1.0`
- // (fails #2);
- // - booleans normally use only a single bit of their object representation; bit-casting an integer to a boolean
- // will result in a boolean object with an incorrect representation, which is undefined behavior (fails #2).
- // Bit-casting from a boolean into an integer, however, is valid;
- // - enumeration types may have
diff erent ranges of possible values (fails #1);
- // - for pointers, it is not guaranteed that pointers to
diff erent types use the same set of values to represent
- // addresses, and the conversion results are explicitly unspecified for types with
diff erent alignments
- // (fails #1);
- // - for structs and unions it is impossible to determine whether the set of values of one of them is a subset of
- // the other (fails #1);
- // - there is no need to consider `nullptr_t` for practical purposes.
- (
- sizeof(_From) == sizeof(_To) &&
- is_integral<_From>::value &&
- is_integral<_To>::value &&
- !is_same<_UnqualTo, bool>::value
- );
+ // Beyond the simple case, we say that one type is "always bit-castable" to another if:
+ // - (1) `From` and `To` have the same value representation, and in addition every possible value of `From` has
+ // a corresponding value in the `To` type (in other words, the set of values of `To` is a superset of the set of
+ // values of `From`);
+ // - (2) When the corresponding values are not the same value (as, for example, between an unsigned and a signed
+ // integer, where a large positive value of the unsigned integer corresponds to a negative value in the signed
+ // integer type), the value of `To` that results from a bitwise copy of `From` is the same what would be
+ // produced by the built-in assignment (if it were defined for the two types, to which there are minor
+ // exceptions, e.g. built-in arrays).
+ //
+ // In practice, that means:
+ // - all integral types (except `bool`, see below) -- that is, character types and `int` types, both signed and
+ // unsigned...
+ // - as well as arrays of such types...
+ // - ...that have the same size.
+ //
+ // Other trivially-copyable types can't be validly bit-cast outside of their own type:
+ // - floating-point types normally have
diff erent sizes and thus aren't bit-castable between each other (fails
+ // #1);
+ // - integral types and floating-point types use
diff erent representations, so for example bit-casting an integral
+ // `1` to `float` results in a very small less-than-one value, unlike built-in assignment that produces `1.0`
+ // (fails #2);
+ // - booleans normally use only a single bit of their object representation; bit-casting an integer to a boolean
+ // will result in a boolean object with an incorrect representation, which is undefined behavior (fails #2).
+ // Bit-casting from a boolean into an integer, however, is valid;
+ // - enumeration types may have
diff erent ranges of possible values (fails #1);
+ // - for pointers, it is not guaranteed that pointers to
diff erent types use the same set of values to represent
+ // addresses, and the conversion results are explicitly unspecified for types with
diff erent alignments
+ // (fails #1);
+ // - for structs and unions it is impossible to determine whether the set of values of one of them is a subset of
+ // the other (fails #1);
+ // - there is no need to consider `nullptr_t` for practical purposes.
+ (
+ sizeof(_From) == sizeof(_To) &&
+ is_integral<_From>::value &&
+ is_integral<_To>::value &&
+ !is_same<_UnqualTo, bool>::value
+ );
+ // clang-format on
};
_LIBCPP_END_NAMESPACE_STD
diff --git a/libcxx/include/__type_traits/is_arithmetic.h b/libcxx/include/__type_traits/is_arithmetic.h
index 03218c8169965..c9713e1840a7b 100644
--- a/libcxx/include/__type_traits/is_arithmetic.h
+++ b/libcxx/include/__type_traits/is_arithmetic.h
@@ -20,9 +20,9 @@
_LIBCPP_BEGIN_NAMESPACE_STD
-template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_arithmetic
- : public integral_constant<bool, is_integral<_Tp>::value ||
- is_floating_point<_Tp>::value> {};
+template <class _Tp>
+struct _LIBCPP_TEMPLATE_VIS is_arithmetic
+ : public integral_constant<bool, is_integral<_Tp>::value || is_floating_point<_Tp>::value> {};
#if _LIBCPP_STD_VER >= 17
template <class _Tp>
diff --git a/libcxx/include/__type_traits/is_array.h b/libcxx/include/__type_traits/is_array.h
index 827517666c373..5b0e0e6f46b81 100644
--- a/libcxx/include/__type_traits/is_array.h
+++ b/libcxx/include/__type_traits/is_array.h
@@ -24,26 +24,26 @@ _LIBCPP_BEGIN_NAMESPACE_STD
#if __has_builtin(__is_array) && 0
template <class _Tp>
-struct _LIBCPP_TEMPLATE_VIS is_array : _BoolConstant<__is_array(_Tp)> { };
+struct _LIBCPP_TEMPLATE_VIS is_array : _BoolConstant<__is_array(_Tp)> {};
-#if _LIBCPP_STD_VER >= 17
+# if _LIBCPP_STD_VER >= 17
template <class _Tp>
inline constexpr bool is_array_v = __is_array(_Tp);
-#endif
+# endif
#else
-template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_array
- : public false_type {};
-template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_array<_Tp[]>
- : public true_type {};
-template <class _Tp, size_t _Np> struct _LIBCPP_TEMPLATE_VIS is_array<_Tp[_Np]>
- : public true_type {};
+template <class _Tp>
+struct _LIBCPP_TEMPLATE_VIS is_array : public false_type {};
+template <class _Tp>
+struct _LIBCPP_TEMPLATE_VIS is_array<_Tp[]> : public true_type {};
+template <class _Tp, size_t _Np>
+struct _LIBCPP_TEMPLATE_VIS is_array<_Tp[_Np]> : public true_type {};
-#if _LIBCPP_STD_VER >= 17
+# if _LIBCPP_STD_VER >= 17
template <class _Tp>
inline constexpr bool is_array_v = is_array<_Tp>::value;
-#endif
+# endif
#endif // __has_builtin(__is_array)
diff --git a/libcxx/include/__type_traits/is_assignable.h b/libcxx/include/__type_traits/is_assignable.h
index 3ee3e21bf97a1..11134b1c1abaf 100644
--- a/libcxx/include/__type_traits/is_assignable.h
+++ b/libcxx/include/__type_traits/is_assignable.h
@@ -18,8 +18,8 @@
_LIBCPP_BEGIN_NAMESPACE_STD
-template<class _Tp, class _Up>
-struct _LIBCPP_TEMPLATE_VIS is_assignable : _BoolConstant<__is_assignable(_Tp, _Up)> { };
+template <class _Tp, class _Up>
+struct _LIBCPP_TEMPLATE_VIS is_assignable : _BoolConstant<__is_assignable(_Tp, _Up)> {};
#if _LIBCPP_STD_VER >= 17
template <class _Tp, class _Arg>
diff --git a/libcxx/include/__type_traits/is_base_of.h b/libcxx/include/__type_traits/is_base_of.h
index 3338fffe23de1..090abeeb54dcc 100644
--- a/libcxx/include/__type_traits/is_base_of.h
+++ b/libcxx/include/__type_traits/is_base_of.h
@@ -19,8 +19,7 @@
_LIBCPP_BEGIN_NAMESPACE_STD
template <class _Bp, class _Dp>
-struct _LIBCPP_TEMPLATE_VIS is_base_of
- : public integral_constant<bool, __is_base_of(_Bp, _Dp)> {};
+struct _LIBCPP_TEMPLATE_VIS is_base_of : public integral_constant<bool, __is_base_of(_Bp, _Dp)> {};
#if _LIBCPP_STD_VER >= 17
template <class _Bp, class _Dp>
diff --git a/libcxx/include/__type_traits/is_bounded_array.h b/libcxx/include/__type_traits/is_bounded_array.h
index 46da83a5654a7..211403d638d08 100644
--- a/libcxx/include/__type_traits/is_bounded_array.h
+++ b/libcxx/include/__type_traits/is_bounded_array.h
@@ -19,17 +19,20 @@
_LIBCPP_BEGIN_NAMESPACE_STD
-template <class> struct _LIBCPP_TEMPLATE_VIS __libcpp_is_bounded_array : false_type {};
-template <class _Tp, size_t _Np> struct _LIBCPP_TEMPLATE_VIS __libcpp_is_bounded_array<_Tp[_Np]> : true_type {};
+template <class>
+struct _LIBCPP_TEMPLATE_VIS __libcpp_is_bounded_array : false_type {};
+template <class _Tp, size_t _Np>
+struct _LIBCPP_TEMPLATE_VIS __libcpp_is_bounded_array<_Tp[_Np]> : true_type {};
#if _LIBCPP_STD_VER >= 20
-template <class> struct _LIBCPP_TEMPLATE_VIS is_bounded_array : false_type {};
-template <class _Tp, size_t _Np> struct _LIBCPP_TEMPLATE_VIS is_bounded_array<_Tp[_Np]> : true_type {};
+template <class>
+struct _LIBCPP_TEMPLATE_VIS is_bounded_array : false_type {};
+template <class _Tp, size_t _Np>
+struct _LIBCPP_TEMPLATE_VIS is_bounded_array<_Tp[_Np]> : true_type {};
template <class _Tp>
-inline constexpr
-bool is_bounded_array_v = is_bounded_array<_Tp>::value;
+inline constexpr bool is_bounded_array_v = is_bounded_array<_Tp>::value;
#endif
diff --git a/libcxx/include/__type_traits/is_callable.h b/libcxx/include/__type_traits/is_callable.h
index 445373c43b9d4..49724fe892ee5 100644
--- a/libcxx/include/__type_traits/is_callable.h
+++ b/libcxx/include/__type_traits/is_callable.h
@@ -19,12 +19,12 @@
_LIBCPP_BEGIN_NAMESPACE_STD
-template<class _Func, class... _Args, class = decltype(std::declval<_Func>()(std::declval<_Args>()...))>
+template <class _Func, class... _Args, class = decltype(std::declval<_Func>()(std::declval<_Args>()...))>
true_type __is_callable_helper(int);
-template<class...>
+template <class...>
false_type __is_callable_helper(...);
-template<class _Func, class... _Args>
+template <class _Func, class... _Args>
struct __is_callable : decltype(std::__is_callable_helper<_Func, _Args...>(0)) {};
_LIBCPP_END_NAMESPACE_STD
diff --git a/libcxx/include/__type_traits/is_class.h b/libcxx/include/__type_traits/is_class.h
index 62bf6d9cfa0e8..034f76a7865e3 100644
--- a/libcxx/include/__type_traits/is_class.h
+++ b/libcxx/include/__type_traits/is_class.h
@@ -18,8 +18,8 @@
_LIBCPP_BEGIN_NAMESPACE_STD
-template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_class
- : public integral_constant<bool, __is_class(_Tp)> {};
+template <class _Tp>
+struct _LIBCPP_TEMPLATE_VIS is_class : public integral_constant<bool, __is_class(_Tp)> {};
#if _LIBCPP_STD_VER >= 17
template <class _Tp>
diff --git a/libcxx/include/__type_traits/is_compound.h b/libcxx/include/__type_traits/is_compound.h
index 73d830c80aff0..cd208ceab2886 100644
--- a/libcxx/include/__type_traits/is_compound.h
+++ b/libcxx/include/__type_traits/is_compound.h
@@ -21,23 +21,23 @@ _LIBCPP_BEGIN_NAMESPACE_STD
#if __has_builtin(__is_compound)
-template<class _Tp>
-struct _LIBCPP_TEMPLATE_VIS is_compound : _BoolConstant<__is_compound(_Tp)> { };
+template <class _Tp>
+struct _LIBCPP_TEMPLATE_VIS is_compound : _BoolConstant<__is_compound(_Tp)> {};
-#if _LIBCPP_STD_VER >= 17
+# if _LIBCPP_STD_VER >= 17
template <class _Tp>
inline constexpr bool is_compound_v = __is_compound(_Tp);
-#endif
+# endif
#else // __has_builtin(__is_compound)
-template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_compound
- : public integral_constant<bool, !is_fundamental<_Tp>::value> {};
+template <class _Tp>
+struct _LIBCPP_TEMPLATE_VIS is_compound : public integral_constant<bool, !is_fundamental<_Tp>::value> {};
-#if _LIBCPP_STD_VER >= 17
+# if _LIBCPP_STD_VER >= 17
template <class _Tp>
inline constexpr bool is_compound_v = is_compound<_Tp>::value;
-#endif
+# endif
#endif // __has_builtin(__is_compound)
diff --git a/libcxx/include/__type_traits/is_const.h b/libcxx/include/__type_traits/is_const.h
index fad3602862019..47ef70872b790 100644
--- a/libcxx/include/__type_traits/is_const.h
+++ b/libcxx/include/__type_traits/is_const.h
@@ -21,22 +21,24 @@ _LIBCPP_BEGIN_NAMESPACE_STD
#if __has_builtin(__is_const)
template <class _Tp>
-struct _LIBCPP_TEMPLATE_VIS is_const : _BoolConstant<__is_const(_Tp)> { };
+struct _LIBCPP_TEMPLATE_VIS is_const : _BoolConstant<__is_const(_Tp)> {};
-#if _LIBCPP_STD_VER >= 17
+# if _LIBCPP_STD_VER >= 17
template <class _Tp>
inline constexpr bool is_const_v = __is_const(_Tp);
-#endif
+# endif
#else
-template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_const : public false_type {};
-template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_const<_Tp const> : public true_type {};
+template <class _Tp>
+struct _LIBCPP_TEMPLATE_VIS is_const : public false_type {};
+template <class _Tp>
+struct _LIBCPP_TEMPLATE_VIS is_const<_Tp const> : public true_type {};
-#if _LIBCPP_STD_VER >= 17
+# if _LIBCPP_STD_VER >= 17
template <class _Tp>
inline constexpr bool is_const_v = is_const<_Tp>::value;
-#endif
+# endif
#endif // __has_builtin(__is_const)
diff --git a/libcxx/include/__type_traits/is_constant_evaluated.h b/libcxx/include/__type_traits/is_constant_evaluated.h
index d6278f521ab04..d7af462486e13 100644
--- a/libcxx/include/__type_traits/is_constant_evaluated.h
+++ b/libcxx/include/__type_traits/is_constant_evaluated.h
@@ -18,14 +18,14 @@
_LIBCPP_BEGIN_NAMESPACE_STD
#if _LIBCPP_STD_VER >= 20
-_LIBCPP_INLINE_VISIBILITY
-inline constexpr bool is_constant_evaluated() noexcept {
+_LIBCPP_INLINE_VISIBILITY inline constexpr bool is_constant_evaluated() noexcept {
return __builtin_is_constant_evaluated();
}
#endif
-_LIBCPP_HIDE_FROM_ABI inline _LIBCPP_CONSTEXPR
-bool __libcpp_is_constant_evaluated() _NOEXCEPT { return __builtin_is_constant_evaluated(); }
+_LIBCPP_HIDE_FROM_ABI inline _LIBCPP_CONSTEXPR bool __libcpp_is_constant_evaluated() _NOEXCEPT {
+ return __builtin_is_constant_evaluated();
+}
_LIBCPP_END_NAMESPACE_STD
diff --git a/libcxx/include/__type_traits/is_constructible.h b/libcxx/include/__type_traits/is_constructible.h
index ebe7bfd373f17..4e62eb061fd59 100644
--- a/libcxx/include/__type_traits/is_constructible.h
+++ b/libcxx/include/__type_traits/is_constructible.h
@@ -18,13 +18,11 @@
_LIBCPP_BEGIN_NAMESPACE_STD
-template <class _Tp, class ..._Args>
-struct _LIBCPP_TEMPLATE_VIS is_constructible
- : public integral_constant<bool, __is_constructible(_Tp, _Args...)>
-{ };
+template <class _Tp, class... _Args>
+struct _LIBCPP_TEMPLATE_VIS is_constructible : public integral_constant<bool, __is_constructible(_Tp, _Args...)> {};
#if _LIBCPP_STD_VER >= 17
-template <class _Tp, class ..._Args>
+template <class _Tp, class... _Args>
inline constexpr bool is_constructible_v = __is_constructible(_Tp, _Args...);
#endif
diff --git a/libcxx/include/__type_traits/is_convertible.h b/libcxx/include/__type_traits/is_convertible.h
index 749d6fd47af9c..b378a20cedeb6 100644
--- a/libcxx/include/__type_traits/is_convertible.h
+++ b/libcxx/include/__type_traits/is_convertible.h
@@ -31,76 +31,75 @@ struct _LIBCPP_TEMPLATE_VIS is_convertible : public integral_constant<bool, __is
#elif __has_builtin(__is_convertible_to) && !defined(_LIBCPP_USE_IS_CONVERTIBLE_FALLBACK)
-template <class _T1, class _T2> struct _LIBCPP_TEMPLATE_VIS is_convertible
- : public integral_constant<bool, __is_convertible_to(_T1, _T2)> {};
+template <class _T1, class _T2>
+struct _LIBCPP_TEMPLATE_VIS is_convertible : public integral_constant<bool, __is_convertible_to(_T1, _T2)> {};
// TODO: Remove this fallback when GCC < 13 support is no longer required.
// GCC 13 has the __is_convertible built-in.
-#else // __has_builtin(__is_convertible_to) && !defined(_LIBCPP_USE_IS_CONVERTIBLE_FALLBACK)
+#else // __has_builtin(__is_convertible_to) && !defined(_LIBCPP_USE_IS_CONVERTIBLE_FALLBACK)
-namespace __is_convertible_imp
-{
-template <class _Tp> void __test_convert(_Tp);
+namespace __is_convertible_imp {
+template <class _Tp>
+void __test_convert(_Tp);
template <class _From, class _To, class = void>
struct __is_convertible_test : public false_type {};
template <class _From, class _To>
-struct __is_convertible_test<_From, _To,
- decltype(__is_convertible_imp::__test_convert<_To>(std::declval<_From>()))> : public true_type
-{};
-
-template <class _Tp, bool _IsArray = is_array<_Tp>::value,
- bool _IsFunction = is_function<_Tp>::value,
- bool _IsVoid = is_void<_Tp>::value>
- struct __is_array_function_or_void {enum {value = 0};};
-template <class _Tp> struct __is_array_function_or_void<_Tp, true, false, false> {enum {value = 1};};
-template <class _Tp> struct __is_array_function_or_void<_Tp, false, true, false> {enum {value = 2};};
-template <class _Tp> struct __is_array_function_or_void<_Tp, false, false, true> {enum {value = 3};};
-}
+struct __is_convertible_test<_From, _To, decltype(__is_convertible_imp::__test_convert<_To>(std::declval<_From>()))>
+ : public true_type {};
+// clang-format off
template <class _Tp,
- unsigned = __is_convertible_imp::__is_array_function_or_void<__libcpp_remove_reference_t<_Tp> >::value>
-struct __is_convertible_check
-{
- static const size_t __v = 0;
+ bool _IsArray = is_array<_Tp>::value,
+ bool _IsFunction = is_function<_Tp>::value,
+ bool _IsVoid = is_void<_Tp>::value>
+ struct __is_array_function_or_void { enum { value = 0 }; };
+template <class _Tp> struct __is_array_function_or_void<_Tp, true, false, false> { enum { value = 1 }; };
+template <class _Tp> struct __is_array_function_or_void<_Tp, false, true, false> { enum { value = 2 }; };
+template <class _Tp> struct __is_array_function_or_void<_Tp, false, false, true> { enum { value = 3 }; };
+// clang-format on
+} // namespace __is_convertible_imp
+
+template <class _Tp,
+ unsigned = __is_convertible_imp::__is_array_function_or_void<__libcpp_remove_reference_t<_Tp> >::value>
+struct __is_convertible_check {
+ static const size_t __v = 0;
};
template <class _Tp>
-struct __is_convertible_check<_Tp, 0>
-{
- static const size_t __v = sizeof(_Tp);
+struct __is_convertible_check<_Tp, 0> {
+ static const size_t __v = sizeof(_Tp);
};
-template <class _T1, class _T2,
- unsigned _T1_is_array_function_or_void = __is_convertible_imp::__is_array_function_or_void<_T1>::value,
- unsigned _T2_is_array_function_or_void = __is_convertible_imp::__is_array_function_or_void<_T2>::value>
+template <class _T1,
+ class _T2,
+ unsigned _T1_is_array_function_or_void = __is_convertible_imp::__is_array_function_or_void<_T1>::value,
+ unsigned _T2_is_array_function_or_void = __is_convertible_imp::__is_array_function_or_void<_T2>::value>
struct __is_convertible
- : public integral_constant<bool,
- __is_convertible_imp::__is_convertible_test<_T1, _T2>::value
- >
-{};
-
-template <class _T1, class _T2> struct __is_convertible<_T1, _T2, 0, 1> : public false_type {};
-template <class _T1, class _T2> struct __is_convertible<_T1, _T2, 1, 1> : public false_type {};
-template <class _T1, class _T2> struct __is_convertible<_T1, _T2, 2, 1> : public false_type {};
-template <class _T1, class _T2> struct __is_convertible<_T1, _T2, 3, 1> : public false_type {};
-
-template <class _T1, class _T2> struct __is_convertible<_T1, _T2, 0, 2> : public false_type {};
-template <class _T1, class _T2> struct __is_convertible<_T1, _T2, 1, 2> : public false_type {};
-template <class _T1, class _T2> struct __is_convertible<_T1, _T2, 2, 2> : public false_type {};
-template <class _T1, class _T2> struct __is_convertible<_T1, _T2, 3, 2> : public false_type {};
-
-template <class _T1, class _T2> struct __is_convertible<_T1, _T2, 0, 3> : public false_type {};
-template <class _T1, class _T2> struct __is_convertible<_T1, _T2, 1, 3> : public false_type {};
-template <class _T1, class _T2> struct __is_convertible<_T1, _T2, 2, 3> : public false_type {};
-template <class _T1, class _T2> struct __is_convertible<_T1, _T2, 3, 3> : public true_type {};
-
-template <class _T1, class _T2> struct _LIBCPP_TEMPLATE_VIS is_convertible
- : public __is_convertible<_T1, _T2>
-{
- static const size_t __complete_check1 = __is_convertible_check<_T1>::__v;
- static const size_t __complete_check2 = __is_convertible_check<_T2>::__v;
+ : public integral_constant<bool, __is_convertible_imp::__is_convertible_test<_T1, _T2>::value >{};
+
+// clang-format off
+template <class _T1, class _T2> struct __is_convertible<_T1, _T2, 0, 1> : public false_type{};
+template <class _T1, class _T2> struct __is_convertible<_T1, _T2, 1, 1> : public false_type{};
+template <class _T1, class _T2> struct __is_convertible<_T1, _T2, 2, 1> : public false_type{};
+template <class _T1, class _T2> struct __is_convertible<_T1, _T2, 3, 1> : public false_type{};
+
+template <class _T1, class _T2> struct __is_convertible<_T1, _T2, 0, 2> : public false_type{};
+template <class _T1, class _T2> struct __is_convertible<_T1, _T2, 1, 2> : public false_type{};
+template <class _T1, class _T2> struct __is_convertible<_T1, _T2, 2, 2> : public false_type{};
+template <class _T1, class _T2> struct __is_convertible<_T1, _T2, 3, 2> : public false_type{};
+
+template <class _T1, class _T2> struct __is_convertible<_T1, _T2, 0, 3> : public false_type{};
+template <class _T1, class _T2> struct __is_convertible<_T1, _T2, 1, 3> : public false_type{};
+template <class _T1, class _T2> struct __is_convertible<_T1, _T2, 2, 3> : public false_type{};
+template <class _T1, class _T2> struct __is_convertible<_T1, _T2, 3, 3> : public true_type{};
+// clang-format on
+
+template <class _T1, class _T2>
+struct _LIBCPP_TEMPLATE_VIS is_convertible : public __is_convertible<_T1, _T2> {
+ static const size_t __complete_check1 = __is_convertible_check<_T1>::__v;
+ static const size_t __complete_check2 = __is_convertible_check<_T2>::__v;
};
#endif // __has_builtin(__is_convertible_to) && !defined(_LIBCPP_USE_IS_CONVERTIBLE_FALLBACK)
diff --git a/libcxx/include/__type_traits/is_copy_assignable.h b/libcxx/include/__type_traits/is_copy_assignable.h
index 245ae4b28912d..e607ace540437 100644
--- a/libcxx/include/__type_traits/is_copy_assignable.h
+++ b/libcxx/include/__type_traits/is_copy_assignable.h
@@ -24,8 +24,7 @@ template <class _Tp>
struct _LIBCPP_TEMPLATE_VIS is_copy_assignable
: public integral_constant<
bool,
- __is_assignable(__add_lvalue_reference_t<_Tp>,
- __add_lvalue_reference_t<typename add_const<_Tp>::type>)> {};
+ __is_assignable(__add_lvalue_reference_t<_Tp>, __add_lvalue_reference_t<typename add_const<_Tp>::type>)> {};
#if _LIBCPP_STD_VER >= 17
template <class _Tp>
diff --git a/libcxx/include/__type_traits/is_copy_constructible.h b/libcxx/include/__type_traits/is_copy_constructible.h
index 07e2c93ecd0c8..402f2b89875bb 100644
--- a/libcxx/include/__type_traits/is_copy_constructible.h
+++ b/libcxx/include/__type_traits/is_copy_constructible.h
@@ -22,9 +22,8 @@ _LIBCPP_BEGIN_NAMESPACE_STD
template <class _Tp>
struct _LIBCPP_TEMPLATE_VIS is_copy_constructible
- : public integral_constant<
- bool,
- __is_constructible(_Tp, __add_lvalue_reference_t<typename add_const<_Tp>::type>)> {};
+ : public integral_constant<bool, __is_constructible(_Tp, __add_lvalue_reference_t<typename add_const<_Tp>::type>)> {
+};
#if _LIBCPP_STD_VER >= 17
template <class _Tp>
diff --git a/libcxx/include/__type_traits/is_core_convertible.h b/libcxx/include/__type_traits/is_core_convertible.h
index 1ce4079130524..0de177c7771f4 100644
--- a/libcxx/include/__type_traits/is_core_convertible.h
+++ b/libcxx/include/__type_traits/is_core_convertible.h
@@ -27,9 +27,8 @@ template <class _Tp, class _Up, class = void>
struct __is_core_convertible : public false_type {};
template <class _Tp, class _Up>
-struct __is_core_convertible<_Tp, _Up, decltype(
- static_cast<void(*)(_Up)>(0) ( static_cast<_Tp(*)()>(0)() )
-)> : public true_type {};
+struct __is_core_convertible<_Tp, _Up, decltype(static_cast<void (*)(_Up)>(0)(static_cast<_Tp (*)()>(0)()))>
+ : public true_type {};
_LIBCPP_END_NAMESPACE_STD
diff --git a/libcxx/include/__type_traits/is_default_constructible.h b/libcxx/include/__type_traits/is_default_constructible.h
index 7bc21f5724d18..e73e9b98f5dca 100644
--- a/libcxx/include/__type_traits/is_default_constructible.h
+++ b/libcxx/include/__type_traits/is_default_constructible.h
@@ -19,9 +19,7 @@
_LIBCPP_BEGIN_NAMESPACE_STD
template <class _Tp>
-struct _LIBCPP_TEMPLATE_VIS is_default_constructible
- : public integral_constant<bool, __is_constructible(_Tp)>
- {};
+struct _LIBCPP_TEMPLATE_VIS is_default_constructible : public integral_constant<bool, __is_constructible(_Tp)> {};
#if _LIBCPP_STD_VER >= 17
template <class _Tp>
diff --git a/libcxx/include/__type_traits/is_destructible.h b/libcxx/include/__type_traits/is_destructible.h
index d785b4b47301b..3248b07d36ee6 100644
--- a/libcxx/include/__type_traits/is_destructible.h
+++ b/libcxx/include/__type_traits/is_destructible.h
@@ -24,13 +24,13 @@ _LIBCPP_BEGIN_NAMESPACE_STD
#if __has_builtin(__is_destructible)
-template<class _Tp>
-struct _LIBCPP_TEMPLATE_VIS is_destructible : _BoolConstant<__is_destructible(_Tp)> { };
+template <class _Tp>
+struct _LIBCPP_TEMPLATE_VIS is_destructible : _BoolConstant<__is_destructible(_Tp)> {};
-#if _LIBCPP_STD_VER >= 17
+# if _LIBCPP_STD_VER >= 17
template <class _Tp>
inline constexpr bool is_destructible_v = __is_destructible(_Tp);
-#endif
+# endif
#else // __has_builtin(__is_destructible)
@@ -42,19 +42,19 @@ inline constexpr bool is_destructible_v = __is_destructible(_Tp);
// where _Up is remove_all_extents<_Tp>::type
template <class>
-struct __is_destructible_apply { typedef int type; };
+struct __is_destructible_apply {
+ typedef int type;
+};
template <typename _Tp>
struct __is_destructor_wellformed {
- template <typename _Tp1>
- static true_type __test (
- typename __is_destructible_apply<decltype(std::declval<_Tp1&>().~_Tp1())>::type
- );
+ template <typename _Tp1>
+ static true_type __test(typename __is_destructible_apply<decltype(std::declval<_Tp1&>().~_Tp1())>::type);
- template <typename _Tp1>
- static false_type __test (...);
+ template <typename _Tp1>
+ static false_type __test(...);
- static const bool value = decltype(__test<_Tp>(12))::value;
+ static const bool value = decltype(__test<_Tp>(12))::value;
};
template <class _Tp, bool>
@@ -62,12 +62,10 @@ struct __destructible_imp;
template <class _Tp>
struct __destructible_imp<_Tp, false>
- : public integral_constant<bool,
- __is_destructor_wellformed<__remove_all_extents_t<_Tp> >::value> {};
+ : public integral_constant<bool, __is_destructor_wellformed<__remove_all_extents_t<_Tp> >::value> {};
template <class _Tp>
-struct __destructible_imp<_Tp, true>
- : public true_type {};
+struct __destructible_imp<_Tp, true> : public true_type {};
template <class _Tp, bool>
struct __destructible_false;
@@ -79,21 +77,18 @@ template <class _Tp>
struct __destructible_false<_Tp, true> : public false_type {};
template <class _Tp>
-struct is_destructible
- : public __destructible_false<_Tp, is_function<_Tp>::value> {};
+struct is_destructible : public __destructible_false<_Tp, is_function<_Tp>::value> {};
template <class _Tp>
-struct is_destructible<_Tp[]>
- : public false_type {};
+struct is_destructible<_Tp[]> : public false_type {};
template <>
-struct is_destructible<void>
- : public false_type {};
+struct is_destructible<void> : public false_type {};
-#if _LIBCPP_STD_VER >= 17
+# if _LIBCPP_STD_VER >= 17
template <class _Tp>
inline constexpr bool is_destructible_v = is_destructible<_Tp>::value;
-#endif
+# endif
#endif // __has_builtin(__is_destructible)
diff --git a/libcxx/include/__type_traits/is_empty.h b/libcxx/include/__type_traits/is_empty.h
index 46518e19086b1..951d93b5a2f10 100644
--- a/libcxx/include/__type_traits/is_empty.h
+++ b/libcxx/include/__type_traits/is_empty.h
@@ -19,8 +19,7 @@
_LIBCPP_BEGIN_NAMESPACE_STD
template <class _Tp>
-struct _LIBCPP_TEMPLATE_VIS is_empty
- : public integral_constant<bool, __is_empty(_Tp)> {};
+struct _LIBCPP_TEMPLATE_VIS is_empty : public integral_constant<bool, __is_empty(_Tp)> {};
#if _LIBCPP_STD_VER >= 17
template <class _Tp>
diff --git a/libcxx/include/__type_traits/is_enum.h b/libcxx/include/__type_traits/is_enum.h
index 7b7221d40e506..77ca3ea108742 100644
--- a/libcxx/include/__type_traits/is_enum.h
+++ b/libcxx/include/__type_traits/is_enum.h
@@ -18,8 +18,8 @@
_LIBCPP_BEGIN_NAMESPACE_STD
-template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_enum
- : public integral_constant<bool, __is_enum(_Tp)> {};
+template <class _Tp>
+struct _LIBCPP_TEMPLATE_VIS is_enum : public integral_constant<bool, __is_enum(_Tp)> {};
#if _LIBCPP_STD_VER >= 17
template <class _Tp>
diff --git a/libcxx/include/__type_traits/is_final.h b/libcxx/include/__type_traits/is_final.h
index ad03b213b06e3..499c5e3a1edca 100644
--- a/libcxx/include/__type_traits/is_final.h
+++ b/libcxx/include/__type_traits/is_final.h
@@ -18,12 +18,12 @@
_LIBCPP_BEGIN_NAMESPACE_STD
-template <class _Tp> struct _LIBCPP_TEMPLATE_VIS
-__libcpp_is_final : public integral_constant<bool, __is_final(_Tp)> {};
+template <class _Tp>
+struct _LIBCPP_TEMPLATE_VIS __libcpp_is_final : public integral_constant<bool, __is_final(_Tp)> {};
#if _LIBCPP_STD_VER >= 14
-template <class _Tp> struct _LIBCPP_TEMPLATE_VIS
-is_final : public integral_constant<bool, __is_final(_Tp)> {};
+template <class _Tp>
+struct _LIBCPP_TEMPLATE_VIS is_final : public integral_constant<bool, __is_final(_Tp)> {};
#endif
#if _LIBCPP_STD_VER >= 17
diff --git a/libcxx/include/__type_traits/is_floating_point.h b/libcxx/include/__type_traits/is_floating_point.h
index 2789943a71076..add34782dfa09 100644
--- a/libcxx/include/__type_traits/is_floating_point.h
+++ b/libcxx/include/__type_traits/is_floating_point.h
@@ -19,13 +19,15 @@
_LIBCPP_BEGIN_NAMESPACE_STD
+// clang-format off
template <class _Tp> struct __libcpp_is_floating_point : public false_type {};
template <> struct __libcpp_is_floating_point<float> : public true_type {};
template <> struct __libcpp_is_floating_point<double> : public true_type {};
template <> struct __libcpp_is_floating_point<long double> : public true_type {};
+// clang-format on
-template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_floating_point
- : public __libcpp_is_floating_point<__remove_cv_t<_Tp> > {};
+template <class _Tp>
+struct _LIBCPP_TEMPLATE_VIS is_floating_point : public __libcpp_is_floating_point<__remove_cv_t<_Tp> > {};
#if _LIBCPP_STD_VER >= 17
template <class _Tp>
diff --git a/libcxx/include/__type_traits/is_fundamental.h b/libcxx/include/__type_traits/is_fundamental.h
index 8a1c8142b27fe..57206e0d9deb1 100644
--- a/libcxx/include/__type_traits/is_fundamental.h
+++ b/libcxx/include/__type_traits/is_fundamental.h
@@ -22,25 +22,24 @@ _LIBCPP_BEGIN_NAMESPACE_STD
#if __has_builtin(__is_fundamental)
-template<class _Tp>
-struct _LIBCPP_TEMPLATE_VIS is_fundamental : _BoolConstant<__is_fundamental(_Tp)> { };
+template <class _Tp>
+struct _LIBCPP_TEMPLATE_VIS is_fundamental : _BoolConstant<__is_fundamental(_Tp)> {};
-#if _LIBCPP_STD_VER >= 17
+# if _LIBCPP_STD_VER >= 17
template <class _Tp>
inline constexpr bool is_fundamental_v = __is_fundamental(_Tp);
-#endif
+# endif
#else // __has_builtin(__is_fundamental)
-template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_fundamental
- : public integral_constant<bool, is_void<_Tp>::value ||
- __is_nullptr_t<_Tp>::value ||
- is_arithmetic<_Tp>::value> {};
+template <class _Tp>
+struct _LIBCPP_TEMPLATE_VIS is_fundamental
+ : public integral_constant<bool, is_void<_Tp>::value || __is_nullptr_t<_Tp>::value || is_arithmetic<_Tp>::value> {};
-#if _LIBCPP_STD_VER >= 17
+# if _LIBCPP_STD_VER >= 17
template <class _Tp>
inline constexpr bool is_fundamental_v = is_fundamental<_Tp>::value;
-#endif
+# endif
#endif // __has_builtin(__is_fundamental)
diff --git a/libcxx/include/__type_traits/is_implicitly_default_constructible.h b/libcxx/include/__type_traits/is_implicitly_default_constructible.h
index b77f94845fde0..576166e52698a 100644
--- a/libcxx/include/__type_traits/is_implicitly_default_constructible.h
+++ b/libcxx/include/__type_traits/is_implicitly_default_constructible.h
@@ -28,19 +28,17 @@ template <class _Tp>
void __test_implicit_default_constructible(_Tp);
template <class _Tp, class = void, class = typename is_default_constructible<_Tp>::type>
-struct __is_implicitly_default_constructible
- : false_type
-{ };
+struct __is_implicitly_default_constructible : false_type {};
template <class _Tp>
-struct __is_implicitly_default_constructible<_Tp, decltype(std::__test_implicit_default_constructible<_Tp const&>({})), true_type>
- : true_type
-{ };
+struct __is_implicitly_default_constructible<_Tp,
+ decltype(std::__test_implicit_default_constructible<_Tp const&>({})),
+ true_type> : true_type {};
template <class _Tp>
-struct __is_implicitly_default_constructible<_Tp, decltype(std::__test_implicit_default_constructible<_Tp const&>({})), false_type>
- : false_type
-{ };
+struct __is_implicitly_default_constructible<_Tp,
+ decltype(std::__test_implicit_default_constructible<_Tp const&>({})),
+ false_type> : false_type {};
#endif // !C++03
_LIBCPP_END_NAMESPACE_STD
diff --git a/libcxx/include/__type_traits/is_integral.h b/libcxx/include/__type_traits/is_integral.h
index c4803cb036048..26969885af8df 100644
--- a/libcxx/include/__type_traits/is_integral.h
+++ b/libcxx/include/__type_traits/is_integral.h
@@ -19,6 +19,7 @@
_LIBCPP_BEGIN_NAMESPACE_STD
+// clang-format off
template <class _Tp> struct __libcpp_is_integral { enum { value = 0 }; };
template <> struct __libcpp_is_integral<bool> { enum { value = 1 }; };
template <> struct __libcpp_is_integral<char> { enum { value = 1 }; };
@@ -44,26 +45,27 @@ template <> struct __libcpp_is_integral<unsigned long long> { enum { va
template <> struct __libcpp_is_integral<__int128_t> { enum { value = 1 }; };
template <> struct __libcpp_is_integral<__uint128_t> { enum { value = 1 }; };
#endif
+// clang-format on
#if __has_builtin(__is_integral)
template <class _Tp>
-struct _LIBCPP_TEMPLATE_VIS is_integral : _BoolConstant<__is_integral(_Tp)> { };
+struct _LIBCPP_TEMPLATE_VIS is_integral : _BoolConstant<__is_integral(_Tp)> {};
-#if _LIBCPP_STD_VER >= 17
+# if _LIBCPP_STD_VER >= 17
template <class _Tp>
inline constexpr bool is_integral_v = __is_integral(_Tp);
-#endif
+# endif
#else
-template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_integral
- : public _BoolConstant<__libcpp_is_integral<__remove_cv_t<_Tp> >::value> {};
+template <class _Tp>
+struct _LIBCPP_TEMPLATE_VIS is_integral : public _BoolConstant<__libcpp_is_integral<__remove_cv_t<_Tp> >::value> {};
-#if _LIBCPP_STD_VER >= 17
+# if _LIBCPP_STD_VER >= 17
template <class _Tp>
inline constexpr bool is_integral_v = is_integral<_Tp>::value;
-#endif
+# endif
#endif // __has_builtin(__is_integral)
diff --git a/libcxx/include/__type_traits/is_literal_type.h b/libcxx/include/__type_traits/is_literal_type.h
index 624fa5dbce5a9..81da34572c750 100644
--- a/libcxx/include/__type_traits/is_literal_type.h
+++ b/libcxx/include/__type_traits/is_literal_type.h
@@ -19,15 +19,15 @@
_LIBCPP_BEGIN_NAMESPACE_STD
#if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_TYPE_TRAITS)
-template <class _Tp> struct _LIBCPP_TEMPLATE_VIS _LIBCPP_DEPRECATED_IN_CXX17 is_literal_type
- : public integral_constant<bool, __is_literal_type(_Tp)>
- {};
+template <class _Tp>
+struct _LIBCPP_TEMPLATE_VIS _LIBCPP_DEPRECATED_IN_CXX17 is_literal_type
+ : public integral_constant<bool, __is_literal_type(_Tp)> {};
-#if _LIBCPP_STD_VER >= 17
+# if _LIBCPP_STD_VER >= 17
template <class _Tp>
_LIBCPP_DEPRECATED_IN_CXX17 inline constexpr bool is_literal_type_v = __is_literal_type(_Tp);
-#endif // _LIBCPP_STD_VER >= 17
-#endif // _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_TYPE_TRAITS)
+# endif // _LIBCPP_STD_VER >= 17
+#endif // _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_TYPE_TRAITS)
_LIBCPP_END_NAMESPACE_STD
diff --git a/libcxx/include/__type_traits/is_member_function_pointer.h b/libcxx/include/__type_traits/is_member_function_pointer.h
index 72f84bdaff564..11c8a00c99756 100644
--- a/libcxx/include/__type_traits/is_member_function_pointer.h
+++ b/libcxx/include/__type_traits/is_member_function_pointer.h
@@ -21,41 +21,39 @@
_LIBCPP_BEGIN_NAMESPACE_STD
-template <class _Tp> struct __libcpp_is_member_pointer {
- enum {
- __is_member = false,
- __is_func = false,
- __is_obj = false
- };
+template <class _Tp>
+struct __libcpp_is_member_pointer {
+ enum { __is_member = false, __is_func = false, __is_obj = false };
};
-template <class _Tp, class _Up> struct __libcpp_is_member_pointer<_Tp _Up::*> {
+template <class _Tp, class _Up>
+struct __libcpp_is_member_pointer<_Tp _Up::*> {
enum {
__is_member = true,
- __is_func = is_function<_Tp>::value,
- __is_obj = !__is_func,
+ __is_func = is_function<_Tp>::value,
+ __is_obj = !__is_func,
};
};
#if __has_builtin(__is_member_function_pointer)
-template<class _Tp>
-struct _LIBCPP_TEMPLATE_VIS is_member_function_pointer
- : _BoolConstant<__is_member_function_pointer(_Tp)> { };
+template <class _Tp>
+struct _LIBCPP_TEMPLATE_VIS is_member_function_pointer : _BoolConstant<__is_member_function_pointer(_Tp)> {};
-#if _LIBCPP_STD_VER >= 17
+# if _LIBCPP_STD_VER >= 17
template <class _Tp>
inline constexpr bool is_member_function_pointer_v = __is_member_function_pointer(_Tp);
-#endif
+# endif
#else // __has_builtin(__is_member_function_pointer)
-template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_member_function_pointer
- : public _BoolConstant< __libcpp_is_member_pointer<__remove_cv_t<_Tp> >::__is_func > {};
+template <class _Tp>
+struct _LIBCPP_TEMPLATE_VIS is_member_function_pointer
+ : public _BoolConstant<__libcpp_is_member_pointer<__remove_cv_t<_Tp> >::__is_func> {};
-#if _LIBCPP_STD_VER >= 17
+# if _LIBCPP_STD_VER >= 17
template <class _Tp>
inline constexpr bool is_member_function_pointer_v = is_member_function_pointer<_Tp>::value;
-#endif
+# endif
#endif // __has_builtin(__is_member_function_pointer)
diff --git a/libcxx/include/__type_traits/is_member_object_pointer.h b/libcxx/include/__type_traits/is_member_object_pointer.h
index bcdc651683282..9141f9da530f2 100644
--- a/libcxx/include/__type_traits/is_member_object_pointer.h
+++ b/libcxx/include/__type_traits/is_member_object_pointer.h
@@ -20,24 +20,24 @@ _LIBCPP_BEGIN_NAMESPACE_STD
#if __has_builtin(__is_member_object_pointer)
-template<class _Tp>
-struct _LIBCPP_TEMPLATE_VIS is_member_object_pointer
- : _BoolConstant<__is_member_object_pointer(_Tp)> { };
+template <class _Tp>
+struct _LIBCPP_TEMPLATE_VIS is_member_object_pointer : _BoolConstant<__is_member_object_pointer(_Tp)> {};
-#if _LIBCPP_STD_VER >= 17
+# if _LIBCPP_STD_VER >= 17
template <class _Tp>
inline constexpr bool is_member_object_pointer_v = __is_member_object_pointer(_Tp);
-#endif
+# endif
#else // __has_builtin(__is_member_object_pointer)
-template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_member_object_pointer
- : public _BoolConstant< __libcpp_is_member_pointer<__remove_cv_t<_Tp> >::__is_obj > {};
+template <class _Tp>
+struct _LIBCPP_TEMPLATE_VIS is_member_object_pointer
+ : public _BoolConstant<__libcpp_is_member_pointer<__remove_cv_t<_Tp> >::__is_obj> {};
-#if _LIBCPP_STD_VER >= 17
+# if _LIBCPP_STD_VER >= 17
template <class _Tp>
inline constexpr bool is_member_object_pointer_v = is_member_object_pointer<_Tp>::value;
-#endif
+# endif
#endif // __has_builtin(__is_member_object_pointer)
diff --git a/libcxx/include/__type_traits/is_member_pointer.h b/libcxx/include/__type_traits/is_member_pointer.h
index 5339fb0509b46..4ca01d1c2fc89 100644
--- a/libcxx/include/__type_traits/is_member_pointer.h
+++ b/libcxx/include/__type_traits/is_member_pointer.h
@@ -21,23 +21,24 @@ _LIBCPP_BEGIN_NAMESPACE_STD
#if __has_builtin(__is_member_pointer)
-template<class _Tp>
-struct _LIBCPP_TEMPLATE_VIS is_member_pointer : _BoolConstant<__is_member_pointer(_Tp)> { };
+template <class _Tp>
+struct _LIBCPP_TEMPLATE_VIS is_member_pointer : _BoolConstant<__is_member_pointer(_Tp)> {};
-#if _LIBCPP_STD_VER >= 17
+# if _LIBCPP_STD_VER >= 17
template <class _Tp>
inline constexpr bool is_member_pointer_v = __is_member_pointer(_Tp);
-#endif
+# endif
#else // __has_builtin(__is_member_pointer)
-template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_member_pointer
- : public _BoolConstant< __libcpp_is_member_pointer<__remove_cv_t<_Tp> >::__is_member > {};
+template <class _Tp>
+struct _LIBCPP_TEMPLATE_VIS is_member_pointer
+ : public _BoolConstant<__libcpp_is_member_pointer<__remove_cv_t<_Tp> >::__is_member> {};
-#if _LIBCPP_STD_VER >= 17
+# if _LIBCPP_STD_VER >= 17
template <class _Tp>
inline constexpr bool is_member_pointer_v = is_member_pointer<_Tp>::value;
-#endif
+# endif
#endif // __has_builtin(__is_member_pointer)
diff --git a/libcxx/include/__type_traits/is_move_assignable.h b/libcxx/include/__type_traits/is_move_assignable.h
index 8c4c82084bfa1..867bc00d824ae 100644
--- a/libcxx/include/__type_traits/is_move_assignable.h
+++ b/libcxx/include/__type_traits/is_move_assignable.h
@@ -22,9 +22,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD
template <class _Tp>
struct _LIBCPP_TEMPLATE_VIS is_move_assignable
- : public integral_constant<
- bool,
- __is_assignable(__add_lvalue_reference_t<_Tp>, __add_rvalue_reference_t<_Tp>)> {};
+ : public integral_constant<bool, __is_assignable(__add_lvalue_reference_t<_Tp>, __add_rvalue_reference_t<_Tp>)> {};
#if _LIBCPP_STD_VER >= 17
template <class _Tp>
diff --git a/libcxx/include/__type_traits/is_move_constructible.h b/libcxx/include/__type_traits/is_move_constructible.h
index d908e49863822..40ec4a070816b 100644
--- a/libcxx/include/__type_traits/is_move_constructible.h
+++ b/libcxx/include/__type_traits/is_move_constructible.h
@@ -21,8 +21,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD
template <class _Tp>
struct _LIBCPP_TEMPLATE_VIS is_move_constructible
- : public integral_constant<bool, __is_constructible(_Tp, __add_rvalue_reference_t<_Tp>)>
- {};
+ : public integral_constant<bool, __is_constructible(_Tp, __add_rvalue_reference_t<_Tp>)> {};
#if _LIBCPP_STD_VER >= 17
template <class _Tp>
diff --git a/libcxx/include/__type_traits/is_nothrow_assignable.h b/libcxx/include/__type_traits/is_nothrow_assignable.h
index 4d17b9fc9b7c7..cc57493313859 100644
--- a/libcxx/include/__type_traits/is_nothrow_assignable.h
+++ b/libcxx/include/__type_traits/is_nothrow_assignable.h
@@ -19,8 +19,8 @@
_LIBCPP_BEGIN_NAMESPACE_STD
template <class _Tp, class _Arg>
-struct _LIBCPP_TEMPLATE_VIS is_nothrow_assignable
- : public integral_constant<bool, __is_nothrow_assignable(_Tp, _Arg)> {};
+struct _LIBCPP_TEMPLATE_VIS is_nothrow_assignable : public integral_constant<bool, __is_nothrow_assignable(_Tp, _Arg)> {
+};
#if _LIBCPP_STD_VER >= 17
template <class _Tp, class _Arg>
diff --git a/libcxx/include/__type_traits/is_nothrow_constructible.h b/libcxx/include/__type_traits/is_nothrow_constructible.h
index a967bc8791223..d4686d89fd96e 100644
--- a/libcxx/include/__type_traits/is_nothrow_constructible.h
+++ b/libcxx/include/__type_traits/is_nothrow_constructible.h
@@ -24,52 +24,44 @@ _LIBCPP_BEGIN_NAMESPACE_STD
#if __has_builtin(__is_nothrow_constructible)
-template <
- class _Tp, class... _Args>
+template < class _Tp, class... _Args>
struct _LIBCPP_TEMPLATE_VIS is_nothrow_constructible
: public integral_constant<bool, __is_nothrow_constructible(_Tp, _Args...)> {};
#else
-template <bool, bool, class _Tp, class... _Args> struct __libcpp_is_nothrow_constructible;
+template <bool, bool, class _Tp, class... _Args>
+struct __libcpp_is_nothrow_constructible;
template <class _Tp, class... _Args>
-struct __libcpp_is_nothrow_constructible</*is constructible*/true, /*is reference*/false, _Tp, _Args...>
- : public integral_constant<bool, noexcept(_Tp(std::declval<_Args>()...))>
-{
-};
+struct __libcpp_is_nothrow_constructible</*is constructible*/ true, /*is reference*/ false, _Tp, _Args...>
+ : public integral_constant<bool, noexcept(_Tp(std::declval<_Args>()...))> {};
template <class _Tp>
-void __implicit_conversion_to(_Tp) noexcept { }
+void __implicit_conversion_to(_Tp) noexcept {}
template <class _Tp, class _Arg>
-struct __libcpp_is_nothrow_constructible</*is constructible*/true, /*is reference*/true, _Tp, _Arg>
- : public integral_constant<bool, noexcept(_VSTD::__implicit_conversion_to<_Tp>(std::declval<_Arg>()))>
-{
-};
+struct __libcpp_is_nothrow_constructible</*is constructible*/ true, /*is reference*/ true, _Tp, _Arg>
+ : public integral_constant<bool, noexcept(_VSTD::__implicit_conversion_to<_Tp>(std::declval<_Arg>()))> {};
template <class _Tp, bool _IsReference, class... _Args>
-struct __libcpp_is_nothrow_constructible</*is constructible*/false, _IsReference, _Tp, _Args...>
- : public false_type
-{
+struct __libcpp_is_nothrow_constructible</*is constructible*/ false, _IsReference, _Tp, _Args...> : public false_type {
};
template <class _Tp, class... _Args>
struct _LIBCPP_TEMPLATE_VIS is_nothrow_constructible
- : __libcpp_is_nothrow_constructible<is_constructible<_Tp, _Args...>::value, is_reference<_Tp>::value, _Tp, _Args...>
-{
-};
+ : __libcpp_is_nothrow_constructible<is_constructible<_Tp, _Args...>::value,
+ is_reference<_Tp>::value,
+ _Tp,
+ _Args...> {};
template <class _Tp, size_t _Ns>
struct _LIBCPP_TEMPLATE_VIS is_nothrow_constructible<_Tp[_Ns]>
- : __libcpp_is_nothrow_constructible<is_constructible<_Tp>::value, is_reference<_Tp>::value, _Tp>
-{
-};
+ : __libcpp_is_nothrow_constructible<is_constructible<_Tp>::value, is_reference<_Tp>::value, _Tp> {};
#endif // __has_builtin(__is_nothrow_constructible)
-
#if _LIBCPP_STD_VER >= 17
-template <class _Tp, class ..._Args>
+template <class _Tp, class... _Args>
inline constexpr bool is_nothrow_constructible_v = is_nothrow_constructible<_Tp, _Args...>::value;
#endif
diff --git a/libcxx/include/__type_traits/is_nothrow_convertible.h b/libcxx/include/__type_traits/is_nothrow_convertible.h
index 64f75e1fd68db..a8f8b4d063a10 100644
--- a/libcxx/include/__type_traits/is_nothrow_convertible.h
+++ b/libcxx/include/__type_traits/is_nothrow_convertible.h
@@ -29,19 +29,16 @@ _LIBCPP_BEGIN_NAMESPACE_STD
template <typename _Tp>
void __test_noexcept(_Tp) noexcept;
-template<typename _Fm, typename _To>
-bool_constant<noexcept(_VSTD::__test_noexcept<_To>(std::declval<_Fm>()))>
-__is_nothrow_convertible_test();
+template <typename _Fm, typename _To>
+bool_constant<noexcept(_VSTD::__test_noexcept<_To>(std::declval<_Fm>()))> __is_nothrow_convertible_test();
template <typename _Fm, typename _To>
-struct __is_nothrow_convertible_helper: decltype(__is_nothrow_convertible_test<_Fm, _To>())
-{ };
+struct __is_nothrow_convertible_helper : decltype(__is_nothrow_convertible_test<_Fm, _To>()) {};
template <typename _Fm, typename _To>
-struct is_nothrow_convertible : _Or<
- _And<is_void<_To>, is_void<_Fm>>,
- _Lazy<_And, is_convertible<_Fm, _To>, __is_nothrow_convertible_helper<_Fm, _To>>
->::type { };
+struct is_nothrow_convertible
+ : _Or<_And<is_void<_To>, is_void<_Fm>>,
+ _Lazy<_And, is_convertible<_Fm, _To>, __is_nothrow_convertible_helper<_Fm, _To> > >::type {};
template <typename _Fm, typename _To>
inline constexpr bool is_nothrow_convertible_v = is_nothrow_convertible<_Fm, _To>::value;
diff --git a/libcxx/include/__type_traits/is_nothrow_copy_assignable.h b/libcxx/include/__type_traits/is_nothrow_copy_assignable.h
index d11ec1c01fba6..a97e962b308c8 100644
--- a/libcxx/include/__type_traits/is_nothrow_copy_assignable.h
+++ b/libcxx/include/__type_traits/is_nothrow_copy_assignable.h
@@ -22,11 +22,9 @@ _LIBCPP_BEGIN_NAMESPACE_STD
template <class _Tp>
struct _LIBCPP_TEMPLATE_VIS is_nothrow_copy_assignable
- : public integral_constant<
- bool,
- __is_nothrow_assignable(
- __add_lvalue_reference_t<_Tp>,
- __add_lvalue_reference_t<typename add_const<_Tp>::type>)> {};
+ : public integral_constant<bool,
+ __is_nothrow_assignable(__add_lvalue_reference_t<_Tp>,
+ __add_lvalue_reference_t<typename add_const<_Tp>::type>)> {};
#if _LIBCPP_STD_VER >= 17
template <class _Tp>
diff --git a/libcxx/include/__type_traits/is_nothrow_copy_constructible.h b/libcxx/include/__type_traits/is_nothrow_copy_constructible.h
index de4e272277765..dd7f1d5ef6276 100644
--- a/libcxx/include/__type_traits/is_nothrow_copy_constructible.h
+++ b/libcxx/include/__type_traits/is_nothrow_copy_constructible.h
@@ -24,9 +24,9 @@ _LIBCPP_BEGIN_NAMESPACE_STD
// TODO: remove this implementation once https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106611 is fixed
#ifdef _LIBCPP_COMPILER_GCC
-template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_nothrow_copy_constructible
- : public is_nothrow_constructible<_Tp,
- __add_lvalue_reference_t<typename add_const<_Tp>::type> > {};
+template <class _Tp>
+struct _LIBCPP_TEMPLATE_VIS is_nothrow_copy_constructible
+ : public is_nothrow_constructible<_Tp, __add_lvalue_reference_t<typename add_const<_Tp>::type> > {};
#else // _LIBCPP_COMPILER_GCC
diff --git a/libcxx/include/__type_traits/is_nothrow_default_constructible.h b/libcxx/include/__type_traits/is_nothrow_default_constructible.h
index 446808f44c756..58f31f21b0267 100644
--- a/libcxx/include/__type_traits/is_nothrow_default_constructible.h
+++ b/libcxx/include/__type_traits/is_nothrow_default_constructible.h
@@ -18,9 +18,9 @@
_LIBCPP_BEGIN_NAMESPACE_STD
-template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_nothrow_default_constructible
- : public integral_constant<bool, __is_nothrow_constructible(_Tp)>
- {};
+template <class _Tp>
+struct _LIBCPP_TEMPLATE_VIS is_nothrow_default_constructible
+ : public integral_constant<bool, __is_nothrow_constructible(_Tp)> {};
#if _LIBCPP_STD_VER >= 17
template <class _Tp>
diff --git a/libcxx/include/__type_traits/is_nothrow_destructible.h b/libcxx/include/__type_traits/is_nothrow_destructible.h
index e842465a3ca4b..370ba27ecd1f1 100644
--- a/libcxx/include/__type_traits/is_nothrow_destructible.h
+++ b/libcxx/include/__type_traits/is_nothrow_destructible.h
@@ -26,56 +26,41 @@ _LIBCPP_BEGIN_NAMESPACE_STD
#if !defined(_LIBCPP_CXX03_LANG)
-template <bool, class _Tp> struct __libcpp_is_nothrow_destructible;
+template <bool, class _Tp>
+struct __libcpp_is_nothrow_destructible;
template <class _Tp>
-struct __libcpp_is_nothrow_destructible<false, _Tp>
- : public false_type
-{
-};
+struct __libcpp_is_nothrow_destructible<false, _Tp> : public false_type {};
template <class _Tp>
struct __libcpp_is_nothrow_destructible<true, _Tp>
- : public integral_constant<bool, noexcept(std::declval<_Tp>().~_Tp()) >
-{
-};
+ : public integral_constant<bool, noexcept(std::declval<_Tp>().~_Tp()) > {};
template <class _Tp>
struct _LIBCPP_TEMPLATE_VIS is_nothrow_destructible
- : public __libcpp_is_nothrow_destructible<is_destructible<_Tp>::value, _Tp>
-{
-};
+ : public __libcpp_is_nothrow_destructible<is_destructible<_Tp>::value, _Tp> {};
template <class _Tp, size_t _Ns>
-struct _LIBCPP_TEMPLATE_VIS is_nothrow_destructible<_Tp[_Ns]>
- : public is_nothrow_destructible<_Tp>
-{
-};
+struct _LIBCPP_TEMPLATE_VIS is_nothrow_destructible<_Tp[_Ns]> : public is_nothrow_destructible<_Tp> {};
template <class _Tp>
-struct _LIBCPP_TEMPLATE_VIS is_nothrow_destructible<_Tp&>
- : public true_type
-{
-};
+struct _LIBCPP_TEMPLATE_VIS is_nothrow_destructible<_Tp&> : public true_type {};
template <class _Tp>
-struct _LIBCPP_TEMPLATE_VIS is_nothrow_destructible<_Tp&&>
- : public true_type
-{
-};
+struct _LIBCPP_TEMPLATE_VIS is_nothrow_destructible<_Tp&&> : public true_type {};
#else
-template <class _Tp> struct __libcpp_nothrow_destructor
- : public integral_constant<bool, is_scalar<_Tp>::value ||
- is_reference<_Tp>::value> {};
+template <class _Tp>
+struct __libcpp_nothrow_destructor : public integral_constant<bool, is_scalar<_Tp>::value || is_reference<_Tp>::value> {
+};
-template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_nothrow_destructible
- : public __libcpp_nothrow_destructor<__remove_all_extents_t<_Tp> > {};
+template <class _Tp>
+struct _LIBCPP_TEMPLATE_VIS is_nothrow_destructible : public __libcpp_nothrow_destructor<__remove_all_extents_t<_Tp> > {
+};
template <class _Tp>
-struct _LIBCPP_TEMPLATE_VIS is_nothrow_destructible<_Tp[]>
- : public false_type {};
+struct _LIBCPP_TEMPLATE_VIS is_nothrow_destructible<_Tp[]> : public false_type {};
#endif
diff --git a/libcxx/include/__type_traits/is_nothrow_move_assignable.h b/libcxx/include/__type_traits/is_nothrow_move_assignable.h
index 7649a3fcd4a51..aa87e369cd5d0 100644
--- a/libcxx/include/__type_traits/is_nothrow_move_assignable.h
+++ b/libcxx/include/__type_traits/is_nothrow_move_assignable.h
@@ -22,9 +22,8 @@ _LIBCPP_BEGIN_NAMESPACE_STD
template <class _Tp>
struct _LIBCPP_TEMPLATE_VIS is_nothrow_move_assignable
- : public integral_constant<
- bool,
- __is_nothrow_assignable(__add_lvalue_reference_t<_Tp>, __add_rvalue_reference_t<_Tp>)> {
+ : public integral_constant<bool,
+ __is_nothrow_assignable(__add_lvalue_reference_t<_Tp>, __add_rvalue_reference_t<_Tp>)> {
};
#if _LIBCPP_STD_VER >= 17
diff --git a/libcxx/include/__type_traits/is_nothrow_move_constructible.h b/libcxx/include/__type_traits/is_nothrow_move_constructible.h
index 21a22bbb8ce5c..dab5a019b33bf 100644
--- a/libcxx/include/__type_traits/is_nothrow_move_constructible.h
+++ b/libcxx/include/__type_traits/is_nothrow_move_constructible.h
@@ -23,15 +23,15 @@ _LIBCPP_BEGIN_NAMESPACE_STD
// TODO: remove this implementation once https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106611 is fixed
#ifndef _LIBCPP_COMPILER_GCC
-template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_nothrow_move_constructible
- : public integral_constant<bool, __is_nothrow_constructible(_Tp, __add_rvalue_reference_t<_Tp>)>
- {};
+template <class _Tp>
+struct _LIBCPP_TEMPLATE_VIS is_nothrow_move_constructible
+ : public integral_constant<bool, __is_nothrow_constructible(_Tp, __add_rvalue_reference_t<_Tp>)> {};
#else // _LIBCPP_COMPILER_GCC
-template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_nothrow_move_constructible
- : public is_nothrow_constructible<_Tp, __add_rvalue_reference_t<_Tp> >
- {};
+template <class _Tp>
+struct _LIBCPP_TEMPLATE_VIS is_nothrow_move_constructible
+ : public is_nothrow_constructible<_Tp, __add_rvalue_reference_t<_Tp> > {};
#endif // _LIBCPP_COMPILER_GCC
diff --git a/libcxx/include/__type_traits/is_null_pointer.h b/libcxx/include/__type_traits/is_null_pointer.h
index 3a94fce1bc8aa..c666f5f24759c 100644
--- a/libcxx/include/__type_traits/is_null_pointer.h
+++ b/libcxx/include/__type_traits/is_null_pointer.h
@@ -20,20 +20,22 @@
_LIBCPP_BEGIN_NAMESPACE_STD
-template <class _Tp> struct __is_nullptr_t_impl : public false_type {};
-template <> struct __is_nullptr_t_impl<nullptr_t> : public true_type {};
+template <class _Tp>
+struct __is_nullptr_t_impl : public false_type {};
+template <>
+struct __is_nullptr_t_impl<nullptr_t> : public true_type {};
-template <class _Tp> struct _LIBCPP_TEMPLATE_VIS __is_nullptr_t
- : public __is_nullptr_t_impl<__remove_cv_t<_Tp> > {};
+template <class _Tp>
+struct _LIBCPP_TEMPLATE_VIS __is_nullptr_t : public __is_nullptr_t_impl<__remove_cv_t<_Tp> > {};
#if _LIBCPP_STD_VER >= 14
-template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_null_pointer
- : public __is_nullptr_t_impl<__remove_cv_t<_Tp> > {};
+template <class _Tp>
+struct _LIBCPP_TEMPLATE_VIS is_null_pointer : public __is_nullptr_t_impl<__remove_cv_t<_Tp> > {};
-#if _LIBCPP_STD_VER >= 17
+# if _LIBCPP_STD_VER >= 17
template <class _Tp>
inline constexpr bool is_null_pointer_v = is_null_pointer<_Tp>::value;
-#endif
+# endif
#endif // _LIBCPP_STD_VER >= 14
_LIBCPP_END_NAMESPACE_STD
diff --git a/libcxx/include/__type_traits/is_object.h b/libcxx/include/__type_traits/is_object.h
index 4d038c3e67a09..5ac1d854a6958 100644
--- a/libcxx/include/__type_traits/is_object.h
+++ b/libcxx/include/__type_traits/is_object.h
@@ -24,26 +24,26 @@ _LIBCPP_BEGIN_NAMESPACE_STD
#if __has_builtin(__is_object)
-template<class _Tp>
-struct _LIBCPP_TEMPLATE_VIS is_object : _BoolConstant<__is_object(_Tp)> { };
+template <class _Tp>
+struct _LIBCPP_TEMPLATE_VIS is_object : _BoolConstant<__is_object(_Tp)> {};
-#if _LIBCPP_STD_VER >= 17
+# if _LIBCPP_STD_VER >= 17
template <class _Tp>
inline constexpr bool is_object_v = __is_object(_Tp);
-#endif
+# endif
#else // __has_builtin(__is_object)
-template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_object
- : public integral_constant<bool, is_scalar<_Tp>::value ||
- is_array<_Tp>::value ||
- is_union<_Tp>::value ||
- is_class<_Tp>::value > {};
+template <class _Tp>
+struct _LIBCPP_TEMPLATE_VIS is_object
+ : public integral_constant<bool,
+ is_scalar<_Tp>::value || is_array<_Tp>::value || is_union<_Tp>::value ||
+ is_class<_Tp>::value > {};
-#if _LIBCPP_STD_VER >= 17
+# if _LIBCPP_STD_VER >= 17
template <class _Tp>
inline constexpr bool is_object_v = is_object<_Tp>::value;
-#endif
+# endif
#endif // __has_builtin(__is_object)
diff --git a/libcxx/include/__type_traits/is_pod.h b/libcxx/include/__type_traits/is_pod.h
index 851cbd165a636..5888fbf457d8b 100644
--- a/libcxx/include/__type_traits/is_pod.h
+++ b/libcxx/include/__type_traits/is_pod.h
@@ -18,8 +18,8 @@
_LIBCPP_BEGIN_NAMESPACE_STD
-template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_pod
- : public integral_constant<bool, __is_pod(_Tp)> {};
+template <class _Tp>
+struct _LIBCPP_TEMPLATE_VIS is_pod : public integral_constant<bool, __is_pod(_Tp)> {};
#if _LIBCPP_STD_VER >= 17
template <class _Tp>
diff --git a/libcxx/include/__type_traits/is_pointer.h b/libcxx/include/__type_traits/is_pointer.h
index 51c628f452e00..38eb7996c6864 100644
--- a/libcxx/include/__type_traits/is_pointer.h
+++ b/libcxx/include/__type_traits/is_pointer.h
@@ -21,34 +21,42 @@ _LIBCPP_BEGIN_NAMESPACE_STD
#if __has_builtin(__is_pointer)
-template<class _Tp>
-struct _LIBCPP_TEMPLATE_VIS is_pointer : _BoolConstant<__is_pointer(_Tp)> { };
+template <class _Tp>
+struct _LIBCPP_TEMPLATE_VIS is_pointer : _BoolConstant<__is_pointer(_Tp)> {};
-#if _LIBCPP_STD_VER >= 17
+# if _LIBCPP_STD_VER >= 17
template <class _Tp>
inline constexpr bool is_pointer_v = __is_pointer(_Tp);
-#endif
+# endif
#else // __has_builtin(__is_pointer)
-template <class _Tp> struct __libcpp_is_pointer : public false_type {};
-template <class _Tp> struct __libcpp_is_pointer<_Tp*> : public true_type {};
+template <class _Tp>
+struct __libcpp_is_pointer : public false_type {};
+template <class _Tp>
+struct __libcpp_is_pointer<_Tp*> : public true_type {};
-template <class _Tp> struct __libcpp_remove_objc_qualifiers { typedef _Tp type; };
-#if defined(_LIBCPP_HAS_OBJC_ARC)
+template <class _Tp>
+struct __libcpp_remove_objc_qualifiers {
+ typedef _Tp type;
+};
+# if defined(_LIBCPP_HAS_OBJC_ARC)
+// clang-format off
template <class _Tp> struct __libcpp_remove_objc_qualifiers<_Tp __strong> { typedef _Tp type; };
template <class _Tp> struct __libcpp_remove_objc_qualifiers<_Tp __weak> { typedef _Tp type; };
template <class _Tp> struct __libcpp_remove_objc_qualifiers<_Tp __autoreleasing> { typedef _Tp type; };
template <class _Tp> struct __libcpp_remove_objc_qualifiers<_Tp __unsafe_unretained> { typedef _Tp type; };
-#endif
+// clang-format on
+# endif
-template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_pointer
+template <class _Tp>
+struct _LIBCPP_TEMPLATE_VIS is_pointer
: public __libcpp_is_pointer<typename __libcpp_remove_objc_qualifiers<__remove_cv_t<_Tp> >::type> {};
-#if _LIBCPP_STD_VER >= 17
+# if _LIBCPP_STD_VER >= 17
template <class _Tp>
inline constexpr bool is_pointer_v = is_pointer<_Tp>::value;
-#endif
+# endif
#endif // __has_builtin(__is_pointer)
diff --git a/libcxx/include/__type_traits/is_polymorphic.h b/libcxx/include/__type_traits/is_polymorphic.h
index 21b3cdcdc75d7..d122e1c87775b 100644
--- a/libcxx/include/__type_traits/is_polymorphic.h
+++ b/libcxx/include/__type_traits/is_polymorphic.h
@@ -19,8 +19,7 @@
_LIBCPP_BEGIN_NAMESPACE_STD
template <class _Tp>
-struct _LIBCPP_TEMPLATE_VIS is_polymorphic
- : public integral_constant<bool, __is_polymorphic(_Tp)> {};
+struct _LIBCPP_TEMPLATE_VIS is_polymorphic : public integral_constant<bool, __is_polymorphic(_Tp)> {};
#if _LIBCPP_STD_VER >= 17
template <class _Tp>
diff --git a/libcxx/include/__type_traits/is_primary_template.h b/libcxx/include/__type_traits/is_primary_template.h
index a9bebcf7e64c0..f308dfadc8ec8 100644
--- a/libcxx/include/__type_traits/is_primary_template.h
+++ b/libcxx/include/__type_traits/is_primary_template.h
@@ -21,13 +21,10 @@
_LIBCPP_BEGIN_NAMESPACE_STD
template <class _Tp>
-using __test_for_primary_template = __enable_if_t<
- _IsSame<_Tp, typename _Tp::__primary_template>::value
- >;
+using __test_for_primary_template = __enable_if_t<_IsSame<_Tp, typename _Tp::__primary_template>::value>;
+
template <class _Tp>
-using __is_primary_template = _IsValidExpansion<
- __test_for_primary_template, _Tp
- >;
+using __is_primary_template = _IsValidExpansion<__test_for_primary_template, _Tp>;
_LIBCPP_END_NAMESPACE_STD
diff --git a/libcxx/include/__type_traits/is_reference.h b/libcxx/include/__type_traits/is_reference.h
index 3334c60cc58c4..42853d4790395 100644
--- a/libcxx/include/__type_traits/is_reference.h
+++ b/libcxx/include/__type_traits/is_reference.h
@@ -18,41 +18,46 @@
_LIBCPP_BEGIN_NAMESPACE_STD
-#if __has_builtin(__is_lvalue_reference) && \
- __has_builtin(__is_rvalue_reference) && \
- __has_builtin(__is_reference)
+#if __has_builtin(__is_lvalue_reference) && __has_builtin(__is_rvalue_reference) && __has_builtin(__is_reference)
-template<class _Tp>
-struct _LIBCPP_TEMPLATE_VIS is_lvalue_reference : _BoolConstant<__is_lvalue_reference(_Tp)> { };
+template <class _Tp>
+struct _LIBCPP_TEMPLATE_VIS is_lvalue_reference : _BoolConstant<__is_lvalue_reference(_Tp)> {};
-template<class _Tp>
-struct _LIBCPP_TEMPLATE_VIS is_rvalue_reference : _BoolConstant<__is_rvalue_reference(_Tp)> { };
+template <class _Tp>
+struct _LIBCPP_TEMPLATE_VIS is_rvalue_reference : _BoolConstant<__is_rvalue_reference(_Tp)> {};
-template<class _Tp>
-struct _LIBCPP_TEMPLATE_VIS is_reference : _BoolConstant<__is_reference(_Tp)> { };
+template <class _Tp>
+struct _LIBCPP_TEMPLATE_VIS is_reference : _BoolConstant<__is_reference(_Tp)> {};
-#if _LIBCPP_STD_VER >= 17
+# if _LIBCPP_STD_VER >= 17
template <class _Tp>
inline constexpr bool is_reference_v = __is_reference(_Tp);
template <class _Tp>
inline constexpr bool is_lvalue_reference_v = __is_lvalue_reference(_Tp);
template <class _Tp>
inline constexpr bool is_rvalue_reference_v = __is_rvalue_reference(_Tp);
-#endif
+# endif
#else // __has_builtin(__is_lvalue_reference) && etc...
-template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_lvalue_reference : public false_type {};
-template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_lvalue_reference<_Tp&> : public true_type {};
+template <class _Tp>
+struct _LIBCPP_TEMPLATE_VIS is_lvalue_reference : public false_type {};
+template <class _Tp>
+struct _LIBCPP_TEMPLATE_VIS is_lvalue_reference<_Tp&> : public true_type {};
-template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_rvalue_reference : public false_type {};
-template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_rvalue_reference<_Tp&&> : public true_type {};
+template <class _Tp>
+struct _LIBCPP_TEMPLATE_VIS is_rvalue_reference : public false_type {};
+template <class _Tp>
+struct _LIBCPP_TEMPLATE_VIS is_rvalue_reference<_Tp&&> : public true_type {};
-template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_reference : public false_type {};
-template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_reference<_Tp&> : public true_type {};
-template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_reference<_Tp&&> : public true_type {};
+template <class _Tp>
+struct _LIBCPP_TEMPLATE_VIS is_reference : public false_type {};
+template <class _Tp>
+struct _LIBCPP_TEMPLATE_VIS is_reference<_Tp&> : public true_type {};
+template <class _Tp>
+struct _LIBCPP_TEMPLATE_VIS is_reference<_Tp&&> : public true_type {};
-#if _LIBCPP_STD_VER >= 17
+# if _LIBCPP_STD_VER >= 17
template <class _Tp>
inline constexpr bool is_reference_v = is_reference<_Tp>::value;
@@ -61,7 +66,7 @@ inline constexpr bool is_lvalue_reference_v = is_lvalue_reference<_Tp>::value;
template <class _Tp>
inline constexpr bool is_rvalue_reference_v = is_rvalue_reference<_Tp>::value;
-#endif
+# endif
#endif // __has_builtin(__is_lvalue_reference) && etc...
diff --git a/libcxx/include/__type_traits/is_reference_wrapper.h b/libcxx/include/__type_traits/is_reference_wrapper.h
index d187eec1e1320..b638e7046b71c 100644
--- a/libcxx/include/__type_traits/is_reference_wrapper.h
+++ b/libcxx/include/__type_traits/is_reference_wrapper.h
@@ -19,12 +19,15 @@
_LIBCPP_BEGIN_NAMESPACE_STD
-template <class _Tp> class _LIBCPP_TEMPLATE_VIS reference_wrapper;
-
-template <class _Tp> struct __is_reference_wrapper_impl : public false_type {};
-template <class _Tp> struct __is_reference_wrapper_impl<reference_wrapper<_Tp> > : public true_type {};
-template <class _Tp> struct __is_reference_wrapper
- : public __is_reference_wrapper_impl<__remove_cv_t<_Tp> > {};
+template <class _Tp>
+class _LIBCPP_TEMPLATE_VIS reference_wrapper;
+
+template <class _Tp>
+struct __is_reference_wrapper_impl : public false_type {};
+template <class _Tp>
+struct __is_reference_wrapper_impl<reference_wrapper<_Tp> > : public true_type {};
+template <class _Tp>
+struct __is_reference_wrapper : public __is_reference_wrapper_impl<__remove_cv_t<_Tp> > {};
_LIBCPP_END_NAMESPACE_STD
diff --git a/libcxx/include/__type_traits/is_same.h b/libcxx/include/__type_traits/is_same.h
index c598f0d407842..9561b7b5d6da3 100644
--- a/libcxx/include/__type_traits/is_same.h
+++ b/libcxx/include/__type_traits/is_same.h
@@ -19,7 +19,7 @@
_LIBCPP_BEGIN_NAMESPACE_STD
template <class _Tp, class _Up>
-struct _LIBCPP_TEMPLATE_VIS is_same : _BoolConstant<__is_same(_Tp, _Up)> { };
+struct _LIBCPP_TEMPLATE_VIS is_same : _BoolConstant<__is_same(_Tp, _Up)> {};
#if _LIBCPP_STD_VER >= 17
template <class _Tp, class _Up>
diff --git a/libcxx/include/__type_traits/is_scalar.h b/libcxx/include/__type_traits/is_scalar.h
index 9892ae089d7b6..2bfedc3693659 100644
--- a/libcxx/include/__type_traits/is_scalar.h
+++ b/libcxx/include/__type_traits/is_scalar.h
@@ -18,41 +18,45 @@
#include <__type_traits/is_pointer.h>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
+#pragma GCC system_header
#endif
_LIBCPP_BEGIN_NAMESPACE_STD
#if __has_builtin(__is_scalar)
-template<class _Tp>
-struct _LIBCPP_TEMPLATE_VIS is_scalar : _BoolConstant<__is_scalar(_Tp)> { };
+template <class _Tp>
+struct _LIBCPP_TEMPLATE_VIS is_scalar : _BoolConstant<__is_scalar(_Tp)> {};
#if _LIBCPP_STD_VER >= 17
-template <class _Tp>
-inline constexpr bool is_scalar_v = __is_scalar(_Tp);
+template <class _Tp> inline constexpr bool is_scalar_v = __is_scalar(_Tp);
#endif
#else // __has_builtin(__is_scalar)
template <class _Tp> struct __is_block : false_type {};
#if defined(_LIBCPP_HAS_EXTENSION_BLOCKS)
-template <class _Rp, class ..._Args> struct __is_block<_Rp (^)(_Args...)> : true_type {};
+template <class _Rp, class... _Args>
+struct __is_block<_Rp (^)(_Args...)> : true_type {};
#endif
-template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_scalar
- : public integral_constant<bool, is_arithmetic<_Tp>::value ||
- is_member_pointer<_Tp>::value ||
- is_pointer<_Tp>::value ||
- __is_nullptr_t<_Tp>::value ||
- __is_block<_Tp>::value ||
- is_enum<_Tp>::value > {};
+// clang-format off
+template <class _Tp>
+struct _LIBCPP_TEMPLATE_VIS is_scalar
+ : public integral_constant<
+ bool, is_arithmetic<_Tp>::value ||
+ is_member_pointer<_Tp>::value ||
+ is_pointer<_Tp>::value ||
+ __is_nullptr_t<_Tp>::value ||
+ __is_block<_Tp>::value ||
+ is_enum<_Tp>::value> {};
+// clang-format on
-template <> struct _LIBCPP_TEMPLATE_VIS is_scalar<nullptr_t> : public true_type {};
+template <>
+struct _LIBCPP_TEMPLATE_VIS is_scalar<nullptr_t> : public true_type {};
#if _LIBCPP_STD_VER >= 17
-template <class _Tp>
-inline constexpr bool is_scalar_v = is_scalar<_Tp>::value;
+template <class _Tp> inline constexpr bool is_scalar_v = is_scalar<_Tp>::value;
#endif
#endif // __has_builtin(__is_scalar)
diff --git a/libcxx/include/__type_traits/is_scoped_enum.h b/libcxx/include/__type_traits/is_scoped_enum.h
index 3f0fd589a8aa7..43b3a6b66b1f5 100644
--- a/libcxx/include/__type_traits/is_scoped_enum.h
+++ b/libcxx/include/__type_traits/is_scoped_enum.h
@@ -26,12 +26,10 @@ template <class _Tp, bool = is_enum_v<_Tp> >
struct __is_scoped_enum_helper : false_type {};
template <class _Tp>
-struct __is_scoped_enum_helper<_Tp, true>
- : public bool_constant<!is_convertible_v<_Tp, underlying_type_t<_Tp> > > {};
+struct __is_scoped_enum_helper<_Tp, true> : public bool_constant<!is_convertible_v<_Tp, underlying_type_t<_Tp> > > {};
template <class _Tp>
-struct _LIBCPP_TEMPLATE_VIS is_scoped_enum
- : public __is_scoped_enum_helper<_Tp> {};
+struct _LIBCPP_TEMPLATE_VIS is_scoped_enum : public __is_scoped_enum_helper<_Tp> {};
template <class _Tp>
inline constexpr bool is_scoped_enum_v = is_scoped_enum<_Tp>::value;
diff --git a/libcxx/include/__type_traits/is_signed.h b/libcxx/include/__type_traits/is_signed.h
index ebd3873d5db26..fd6f93e182362 100644
--- a/libcxx/include/__type_traits/is_signed.h
+++ b/libcxx/include/__type_traits/is_signed.h
@@ -22,13 +22,13 @@ _LIBCPP_BEGIN_NAMESPACE_STD
#if __has_builtin(__is_signed)
-template<class _Tp>
-struct _LIBCPP_TEMPLATE_VIS is_signed : _BoolConstant<__is_signed(_Tp)> { };
+template <class _Tp>
+struct _LIBCPP_TEMPLATE_VIS is_signed : _BoolConstant<__is_signed(_Tp)> {};
-#if _LIBCPP_STD_VER >= 17
+# if _LIBCPP_STD_VER >= 17
template <class _Tp>
inline constexpr bool is_signed_v = __is_signed(_Tp);
-#endif
+# endif
#else // __has_builtin(__is_signed)
@@ -36,19 +36,21 @@ template <class _Tp, bool = is_integral<_Tp>::value>
struct __libcpp_is_signed_impl : public _BoolConstant<(_Tp(-1) < _Tp(0))> {};
template <class _Tp>
-struct __libcpp_is_signed_impl<_Tp, false> : public true_type {}; // floating point
+struct __libcpp_is_signed_impl<_Tp, false> : public true_type {}; // floating point
template <class _Tp, bool = is_arithmetic<_Tp>::value>
struct __libcpp_is_signed : public __libcpp_is_signed_impl<_Tp> {};
-template <class _Tp> struct __libcpp_is_signed<_Tp, false> : public false_type {};
+template <class _Tp>
+struct __libcpp_is_signed<_Tp, false> : public false_type {};
-template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_signed : public __libcpp_is_signed<_Tp> {};
+template <class _Tp>
+struct _LIBCPP_TEMPLATE_VIS is_signed : public __libcpp_is_signed<_Tp> {};
-#if _LIBCPP_STD_VER >= 17
+# if _LIBCPP_STD_VER >= 17
template <class _Tp>
inline constexpr bool is_signed_v = is_signed<_Tp>::value;
-#endif
+# endif
#endif // __has_builtin(__is_signed)
diff --git a/libcxx/include/__type_traits/is_signed_integer.h b/libcxx/include/__type_traits/is_signed_integer.h
index 95aa11bfa1b58..467548d0aaafb 100644
--- a/libcxx/include/__type_traits/is_signed_integer.h
+++ b/libcxx/include/__type_traits/is_signed_integer.h
@@ -18,15 +18,17 @@
_LIBCPP_BEGIN_NAMESPACE_STD
-template <class _Tp> struct __libcpp_is_signed_integer : public false_type {};
-template <> struct __libcpp_is_signed_integer<signed char> : public true_type {};
-template <> struct __libcpp_is_signed_integer<signed short> : public true_type {};
-template <> struct __libcpp_is_signed_integer<signed int> : public true_type {};
-template <> struct __libcpp_is_signed_integer<signed long> : public true_type {};
-template <> struct __libcpp_is_signed_integer<signed long long> : public true_type {};
+// clang-format off
+template <class _Tp> struct __libcpp_is_signed_integer : public false_type {};
+template <> struct __libcpp_is_signed_integer<signed char> : public true_type {};
+template <> struct __libcpp_is_signed_integer<signed short> : public true_type {};
+template <> struct __libcpp_is_signed_integer<signed int> : public true_type {};
+template <> struct __libcpp_is_signed_integer<signed long> : public true_type {};
+template <> struct __libcpp_is_signed_integer<signed long long> : public true_type {};
#ifndef _LIBCPP_HAS_NO_INT128
-template <> struct __libcpp_is_signed_integer<__int128_t> : public true_type {};
+template <> struct __libcpp_is_signed_integer<__int128_t> : public true_type {};
#endif
+// clang-format on
_LIBCPP_END_NAMESPACE_STD
diff --git a/libcxx/include/__type_traits/is_standard_layout.h b/libcxx/include/__type_traits/is_standard_layout.h
index aae533b453ef5..76484f3e2a301 100644
--- a/libcxx/include/__type_traits/is_standard_layout.h
+++ b/libcxx/include/__type_traits/is_standard_layout.h
@@ -18,9 +18,8 @@
_LIBCPP_BEGIN_NAMESPACE_STD
-template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_standard_layout
- : public integral_constant<bool, __is_standard_layout(_Tp)>
- {};
+template <class _Tp>
+struct _LIBCPP_TEMPLATE_VIS is_standard_layout : public integral_constant<bool, __is_standard_layout(_Tp)> {};
#if _LIBCPP_STD_VER >= 17
template <class _Tp>
diff --git a/libcxx/include/__type_traits/is_swappable.h b/libcxx/include/__type_traits/is_swappable.h
index 5a78f470874db..07c56619856d3 100644
--- a/libcxx/include/__type_traits/is_swappable.h
+++ b/libcxx/include/__type_traits/is_swappable.h
@@ -30,9 +30,10 @@
_LIBCPP_BEGIN_NAMESPACE_STD
-template <class _Tp> struct __is_swappable;
-template <class _Tp> struct __is_nothrow_swappable;
-
+template <class _Tp>
+struct __is_swappable;
+template <class _Tp>
+struct __is_nothrow_swappable;
#ifndef _LIBCPP_CXX03_LANG
template <class _Tp>
@@ -43,49 +44,40 @@ using __swap_result_t = void;
#endif
template <class _Tp>
-inline _LIBCPP_INLINE_VISIBILITY
-_LIBCPP_CONSTEXPR_SINCE_CXX20 __swap_result_t<_Tp>
-swap(_Tp& __x, _Tp& __y) _NOEXCEPT_(is_nothrow_move_constructible<_Tp>::value &&
- is_nothrow_move_assignable<_Tp>::value);
+inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 __swap_result_t<_Tp> swap(_Tp& __x, _Tp& __y)
+ _NOEXCEPT_(is_nothrow_move_constructible<_Tp>::value&& is_nothrow_move_assignable<_Tp>::value);
-template<class _Tp, size_t _Np>
+template <class _Tp, size_t _Np>
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20
-typename enable_if<
- __is_swappable<_Tp>::value
->::type
-swap(_Tp (&__a)[_Np], _Tp (&__b)[_Np]) _NOEXCEPT_(__is_nothrow_swappable<_Tp>::value);
+ typename enable_if<__is_swappable<_Tp>::value>::type swap(_Tp (&__a)[_Np], _Tp (&__b)[_Np])
+ _NOEXCEPT_(__is_nothrow_swappable<_Tp>::value);
-namespace __detail
-{
+namespace __detail {
// ALL generic swap overloads MUST already have a declaration available at this point.
-template <class _Tp, class _Up = _Tp,
- bool _NotVoid = !is_void<_Tp>::value && !is_void<_Up>::value>
-struct __swappable_with
-{
- template <class _LHS, class _RHS>
- static decltype(swap(std::declval<_LHS>(), std::declval<_RHS>()))
- __test_swap(int);
- template <class, class>
- static __nat __test_swap(long);
-
- // Extra parens are needed for the C++03 definition of decltype.
- typedef decltype((__test_swap<_Tp, _Up>(0))) __swap1;
- typedef decltype((__test_swap<_Up, _Tp>(0))) __swap2;
-
- static const bool value = _IsNotSame<__swap1, __nat>::value
- && _IsNotSame<__swap2, __nat>::value;
+template <class _Tp, class _Up = _Tp, bool _NotVoid = !is_void<_Tp>::value && !is_void<_Up>::value>
+struct __swappable_with {
+ template <class _LHS, class _RHS>
+ static decltype(swap(std::declval<_LHS>(), std::declval<_RHS>())) __test_swap(int);
+ template <class, class>
+ static __nat __test_swap(long);
+
+ // Extra parens are needed for the C++03 definition of decltype.
+ typedef decltype((__test_swap<_Tp, _Up>(0))) __swap1;
+ typedef decltype((__test_swap<_Up, _Tp>(0))) __swap2;
+
+ static const bool value = _IsNotSame<__swap1, __nat>::value && _IsNotSame<__swap2, __nat>::value;
};
template <class _Tp, class _Up>
-struct __swappable_with<_Tp, _Up, false> : false_type {};
+struct __swappable_with<_Tp, _Up, false> : false_type {};
template <class _Tp, class _Up = _Tp, bool _Swappable = __swappable_with<_Tp, _Up>::value>
struct __nothrow_swappable_with {
static const bool value =
#ifndef _LIBCPP_HAS_NO_NOEXCEPT
- noexcept(swap(std::declval<_Tp>(), std::declval<_Up>()))
- && noexcept(swap(std::declval<_Up>(), std::declval<_Tp>()));
+ noexcept(swap(std::declval<_Tp>(), std::declval<_Up>()))&& noexcept(
+ swap(std::declval<_Up>(), std::declval<_Tp>()));
#else
false;
#endif
@@ -97,54 +89,32 @@ struct __nothrow_swappable_with<_Tp, _Up, false> : false_type {};
} // namespace __detail
template <class _Tp>
-struct __is_swappable
- : public integral_constant<bool, __detail::__swappable_with<_Tp&>::value>
-{
-};
+struct __is_swappable : public integral_constant<bool, __detail::__swappable_with<_Tp&>::value> {};
template <class _Tp>
-struct __is_nothrow_swappable
- : public integral_constant<bool, __detail::__nothrow_swappable_with<_Tp&>::value>
-{
-};
+struct __is_nothrow_swappable : public integral_constant<bool, __detail::__nothrow_swappable_with<_Tp&>::value> {};
#if _LIBCPP_STD_VER >= 17
template <class _Tp, class _Up>
struct _LIBCPP_TEMPLATE_VIS is_swappable_with
- : public integral_constant<bool, __detail::__swappable_with<_Tp, _Up>::value>
-{
-};
+ : public integral_constant<bool, __detail::__swappable_with<_Tp, _Up>::value> {};
template <class _Tp>
struct _LIBCPP_TEMPLATE_VIS is_swappable
- : public __conditional_t<
- __libcpp_is_referenceable<_Tp>::value,
- is_swappable_with<
- __add_lvalue_reference_t<_Tp>,
- __add_lvalue_reference_t<_Tp> >,
- false_type
- >
-{
-};
+ : public __conditional_t<__libcpp_is_referenceable<_Tp>::value,
+ is_swappable_with<__add_lvalue_reference_t<_Tp>, __add_lvalue_reference_t<_Tp> >,
+ false_type> {};
template <class _Tp, class _Up>
struct _LIBCPP_TEMPLATE_VIS is_nothrow_swappable_with
- : public integral_constant<bool, __detail::__nothrow_swappable_with<_Tp, _Up>::value>
-{
-};
+ : public integral_constant<bool, __detail::__nothrow_swappable_with<_Tp, _Up>::value> {};
template <class _Tp>
struct _LIBCPP_TEMPLATE_VIS is_nothrow_swappable
- : public __conditional_t<
- __libcpp_is_referenceable<_Tp>::value,
- is_nothrow_swappable_with<
- __add_lvalue_reference_t<_Tp>,
- __add_lvalue_reference_t<_Tp> >,
- false_type
- >
-{
-};
+ : public __conditional_t<__libcpp_is_referenceable<_Tp>::value,
+ is_nothrow_swappable_with<__add_lvalue_reference_t<_Tp>, __add_lvalue_reference_t<_Tp> >,
+ false_type> {};
template <class _Tp, class _Up>
inline constexpr bool is_swappable_with_v = is_swappable_with<_Tp, _Up>::value;
diff --git a/libcxx/include/__type_traits/is_trivial.h b/libcxx/include/__type_traits/is_trivial.h
index f43904891b21f..0007c7446d5e5 100644
--- a/libcxx/include/__type_traits/is_trivial.h
+++ b/libcxx/include/__type_traits/is_trivial.h
@@ -18,9 +18,8 @@
_LIBCPP_BEGIN_NAMESPACE_STD
-template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_trivial
- : public integral_constant<bool, __is_trivial(_Tp)>
- {};
+template <class _Tp>
+struct _LIBCPP_TEMPLATE_VIS is_trivial : public integral_constant<bool, __is_trivial(_Tp)> {};
#if _LIBCPP_STD_VER >= 17
template <class _Tp>
diff --git a/libcxx/include/__type_traits/is_trivially_assignable.h b/libcxx/include/__type_traits/is_trivially_assignable.h
index c16d17732d6b1..19169d13d6d23 100644
--- a/libcxx/include/__type_traits/is_trivially_assignable.h
+++ b/libcxx/include/__type_traits/is_trivially_assignable.h
@@ -19,9 +19,7 @@
_LIBCPP_BEGIN_NAMESPACE_STD
template <class _Tp, class _Arg>
-struct is_trivially_assignable
- : integral_constant<bool, __is_trivially_assignable(_Tp, _Arg)>
-{ };
+struct is_trivially_assignable : integral_constant<bool, __is_trivially_assignable(_Tp, _Arg)> {};
#if _LIBCPP_STD_VER >= 17
template <class _Tp, class _Arg>
diff --git a/libcxx/include/__type_traits/is_trivially_constructible.h b/libcxx/include/__type_traits/is_trivially_constructible.h
index a71a49bae255d..4faaf9323cd5b 100644
--- a/libcxx/include/__type_traits/is_trivially_constructible.h
+++ b/libcxx/include/__type_traits/is_trivially_constructible.h
@@ -20,9 +20,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD
template <class _Tp, class... _Args>
struct _LIBCPP_TEMPLATE_VIS is_trivially_constructible
- : integral_constant<bool, __is_trivially_constructible(_Tp, _Args...)>
-{
-};
+ : integral_constant<bool, __is_trivially_constructible(_Tp, _Args...)> {};
#if _LIBCPP_STD_VER >= 17
template <class _Tp, class... _Args>
diff --git a/libcxx/include/__type_traits/is_trivially_copy_assignable.h b/libcxx/include/__type_traits/is_trivially_copy_assignable.h
index b38ab7ef4dac8..b6b3c119746f5 100644
--- a/libcxx/include/__type_traits/is_trivially_copy_assignable.h
+++ b/libcxx/include/__type_traits/is_trivially_copy_assignable.h
@@ -22,11 +22,9 @@ _LIBCPP_BEGIN_NAMESPACE_STD
template <class _Tp>
struct _LIBCPP_TEMPLATE_VIS is_trivially_copy_assignable
- : public integral_constant<
- bool,
- __is_trivially_assignable(
- __add_lvalue_reference_t<_Tp>,
- __add_lvalue_reference_t<typename add_const<_Tp>::type>)> {};
+ : public integral_constant<bool,
+ __is_trivially_assignable(__add_lvalue_reference_t<_Tp>,
+ __add_lvalue_reference_t<typename add_const<_Tp>::type>)> {};
#if _LIBCPP_STD_VER >= 17
template <class _Tp>
diff --git a/libcxx/include/__type_traits/is_trivially_copy_constructible.h b/libcxx/include/__type_traits/is_trivially_copy_constructible.h
index c6c96a051d5bd..8e71fd1fbf8b3 100644
--- a/libcxx/include/__type_traits/is_trivially_copy_constructible.h
+++ b/libcxx/include/__type_traits/is_trivially_copy_constructible.h
@@ -19,9 +19,9 @@
_LIBCPP_BEGIN_NAMESPACE_STD
-template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_trivially_copy_constructible
- : public integral_constant<bool, __is_trivially_constructible(_Tp, __add_lvalue_reference_t<const _Tp>)>
- {};
+template <class _Tp>
+struct _LIBCPP_TEMPLATE_VIS is_trivially_copy_constructible
+ : public integral_constant<bool, __is_trivially_constructible(_Tp, __add_lvalue_reference_t<const _Tp>)> {};
#if _LIBCPP_STD_VER >= 17
template <class _Tp>
diff --git a/libcxx/include/__type_traits/is_trivially_copyable.h b/libcxx/include/__type_traits/is_trivially_copyable.h
index a725a0beb4ffa..e92af126ee94d 100644
--- a/libcxx/include/__type_traits/is_trivially_copyable.h
+++ b/libcxx/include/__type_traits/is_trivially_copyable.h
@@ -19,9 +19,8 @@
_LIBCPP_BEGIN_NAMESPACE_STD
-template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_trivially_copyable
- : public integral_constant<bool, __is_trivially_copyable(_Tp)>
- {};
+template <class _Tp>
+struct _LIBCPP_TEMPLATE_VIS is_trivially_copyable : public integral_constant<bool, __is_trivially_copyable(_Tp)> {};
#if _LIBCPP_STD_VER >= 17
template <class _Tp>
diff --git a/libcxx/include/__type_traits/is_trivially_default_constructible.h b/libcxx/include/__type_traits/is_trivially_default_constructible.h
index 2b64a69a7ff95..c3b6152a9fcad 100644
--- a/libcxx/include/__type_traits/is_trivially_default_constructible.h
+++ b/libcxx/include/__type_traits/is_trivially_default_constructible.h
@@ -18,9 +18,9 @@
_LIBCPP_BEGIN_NAMESPACE_STD
-template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_trivially_default_constructible
- : public integral_constant<bool, __is_trivially_constructible(_Tp)>
- {};
+template <class _Tp>
+struct _LIBCPP_TEMPLATE_VIS is_trivially_default_constructible
+ : public integral_constant<bool, __is_trivially_constructible(_Tp)> {};
#if _LIBCPP_STD_VER >= 17
template <class _Tp>
diff --git a/libcxx/include/__type_traits/is_trivially_destructible.h b/libcxx/include/__type_traits/is_trivially_destructible.h
index e718af015ea72..5f9652f2a5011 100644
--- a/libcxx/include/__type_traits/is_trivially_destructible.h
+++ b/libcxx/include/__type_traits/is_trivially_destructible.h
@@ -21,17 +21,19 @@ _LIBCPP_BEGIN_NAMESPACE_STD
#if __has_builtin(__is_trivially_destructible)
-template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_trivially_destructible
+template <class _Tp>
+struct _LIBCPP_TEMPLATE_VIS is_trivially_destructible
: public integral_constant<bool, __is_trivially_destructible(_Tp)> {};
#elif __has_builtin(__has_trivial_destructor)
-template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_trivially_destructible
- : public integral_constant<bool, is_destructible<_Tp>::value && __has_trivial_destructor(_Tp)> {};
+template <class _Tp>
+struct _LIBCPP_TEMPLATE_VIS is_trivially_destructible
+ : public integral_constant<bool, is_destructible<_Tp>::value&& __has_trivial_destructor(_Tp)> {};
#else
-#error is_trivially_destructible is not implemented
+# error is_trivially_destructible is not implemented
#endif // __has_builtin(__is_trivially_destructible)
diff --git a/libcxx/include/__type_traits/is_unbounded_array.h b/libcxx/include/__type_traits/is_unbounded_array.h
index 16bc62d17f34a..d58bb09e10428 100644
--- a/libcxx/include/__type_traits/is_unbounded_array.h
+++ b/libcxx/include/__type_traits/is_unbounded_array.h
@@ -18,17 +18,20 @@
_LIBCPP_BEGIN_NAMESPACE_STD
-template <class> struct _LIBCPP_TEMPLATE_VIS __libcpp_is_unbounded_array : false_type {};
-template <class _Tp> struct _LIBCPP_TEMPLATE_VIS __libcpp_is_unbounded_array<_Tp[]> : true_type {};
+template <class>
+struct _LIBCPP_TEMPLATE_VIS __libcpp_is_unbounded_array : false_type {};
+template <class _Tp>
+struct _LIBCPP_TEMPLATE_VIS __libcpp_is_unbounded_array<_Tp[]> : true_type {};
#if _LIBCPP_STD_VER >= 20
-template <class> struct _LIBCPP_TEMPLATE_VIS is_unbounded_array : false_type {};
-template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_unbounded_array<_Tp[]> : true_type {};
+template <class>
+struct _LIBCPP_TEMPLATE_VIS is_unbounded_array : false_type {};
+template <class _Tp>
+struct _LIBCPP_TEMPLATE_VIS is_unbounded_array<_Tp[]> : true_type {};
template <class _Tp>
-inline constexpr
-bool is_unbounded_array_v = is_unbounded_array<_Tp>::value;
+inline constexpr bool is_unbounded_array_v = is_unbounded_array<_Tp>::value;
#endif
diff --git a/libcxx/include/__type_traits/is_union.h b/libcxx/include/__type_traits/is_union.h
index 6d2f47a116bdb..1f009d993545b 100644
--- a/libcxx/include/__type_traits/is_union.h
+++ b/libcxx/include/__type_traits/is_union.h
@@ -18,8 +18,8 @@
_LIBCPP_BEGIN_NAMESPACE_STD
-template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_union
- : public integral_constant<bool, __is_union(_Tp)> {};
+template <class _Tp>
+struct _LIBCPP_TEMPLATE_VIS is_union : public integral_constant<bool, __is_union(_Tp)> {};
#if _LIBCPP_STD_VER >= 17
template <class _Tp>
diff --git a/libcxx/include/__type_traits/is_unsigned.h b/libcxx/include/__type_traits/is_unsigned.h
index d955106d5333b..48c5751ed70d8 100644
--- a/libcxx/include/__type_traits/is_unsigned.h
+++ b/libcxx/include/__type_traits/is_unsigned.h
@@ -22,13 +22,13 @@ _LIBCPP_BEGIN_NAMESPACE_STD
#if __has_builtin(__is_unsigned)
-template<class _Tp>
-struct _LIBCPP_TEMPLATE_VIS is_unsigned : _BoolConstant<__is_unsigned(_Tp)> { };
+template <class _Tp>
+struct _LIBCPP_TEMPLATE_VIS is_unsigned : _BoolConstant<__is_unsigned(_Tp)> {};
-#if _LIBCPP_STD_VER >= 17
+# if _LIBCPP_STD_VER >= 17
template <class _Tp>
inline constexpr bool is_unsigned_v = __is_unsigned(_Tp);
-#endif
+# endif
#else // __has_builtin(__is_unsigned)
@@ -36,19 +36,21 @@ template <class _Tp, bool = is_integral<_Tp>::value>
struct __libcpp_is_unsigned_impl : public _BoolConstant<(_Tp(0) < _Tp(-1))> {};
template <class _Tp>
-struct __libcpp_is_unsigned_impl<_Tp, false> : public false_type {}; // floating point
+struct __libcpp_is_unsigned_impl<_Tp, false> : public false_type {}; // floating point
template <class _Tp, bool = is_arithmetic<_Tp>::value>
struct __libcpp_is_unsigned : public __libcpp_is_unsigned_impl<_Tp> {};
-template <class _Tp> struct __libcpp_is_unsigned<_Tp, false> : public false_type {};
+template <class _Tp>
+struct __libcpp_is_unsigned<_Tp, false> : public false_type {};
-template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_unsigned : public __libcpp_is_unsigned<_Tp> {};
+template <class _Tp>
+struct _LIBCPP_TEMPLATE_VIS is_unsigned : public __libcpp_is_unsigned<_Tp> {};
-#if _LIBCPP_STD_VER >= 17
+# if _LIBCPP_STD_VER >= 17
template <class _Tp>
inline constexpr bool is_unsigned_v = is_unsigned<_Tp>::value;
-#endif
+# endif
#endif // __has_builtin(__is_unsigned)
diff --git a/libcxx/include/__type_traits/is_unsigned_integer.h b/libcxx/include/__type_traits/is_unsigned_integer.h
index 54b29acd9ea38..265894b32d4fc 100644
--- a/libcxx/include/__type_traits/is_unsigned_integer.h
+++ b/libcxx/include/__type_traits/is_unsigned_integer.h
@@ -18,15 +18,17 @@
_LIBCPP_BEGIN_NAMESPACE_STD
-template <class _Tp> struct __libcpp_is_unsigned_integer : public false_type {};
-template <> struct __libcpp_is_unsigned_integer<unsigned char> : public true_type {};
-template <> struct __libcpp_is_unsigned_integer<unsigned short> : public true_type {};
-template <> struct __libcpp_is_unsigned_integer<unsigned int> : public true_type {};
-template <> struct __libcpp_is_unsigned_integer<unsigned long> : public true_type {};
-template <> struct __libcpp_is_unsigned_integer<unsigned long long> : public true_type {};
+// clang-format off
+template <class _Tp> struct __libcpp_is_unsigned_integer : public false_type {};
+template <> struct __libcpp_is_unsigned_integer<unsigned char> : public true_type {};
+template <> struct __libcpp_is_unsigned_integer<unsigned short> : public true_type {};
+template <> struct __libcpp_is_unsigned_integer<unsigned int> : public true_type {};
+template <> struct __libcpp_is_unsigned_integer<unsigned long> : public true_type {};
+template <> struct __libcpp_is_unsigned_integer<unsigned long long> : public true_type {};
#ifndef _LIBCPP_HAS_NO_INT128
-template <> struct __libcpp_is_unsigned_integer<__uint128_t> : public true_type {};
+template <> struct __libcpp_is_unsigned_integer<__uint128_t> : public true_type {};
#endif
+// clang-format on
_LIBCPP_END_NAMESPACE_STD
diff --git a/libcxx/include/__type_traits/is_valid_expansion.h b/libcxx/include/__type_traits/is_valid_expansion.h
index db7d7e5f1d057..346bc98b110ff 100644
--- a/libcxx/include/__type_traits/is_valid_expansion.h
+++ b/libcxx/include/__type_traits/is_valid_expansion.h
@@ -18,12 +18,12 @@
_LIBCPP_BEGIN_NAMESPACE_STD
-template <template <class...> class _Templ, class ..._Args, class = _Templ<_Args...> >
+template <template <class...> class _Templ, class... _Args, class = _Templ<_Args...> >
true_type __sfinae_test_impl(int);
-template <template <class...> class, class ...>
+template <template <class...> class, class...>
false_type __sfinae_test_impl(...);
-template <template <class ...> class _Templ, class ..._Args>
+template <template <class...> class _Templ, class... _Args>
using _IsValidExpansion _LIBCPP_NODEBUG = decltype(std::__sfinae_test_impl<_Templ, _Args...>(0));
_LIBCPP_END_NAMESPACE_STD
diff --git a/libcxx/include/__type_traits/is_void.h b/libcxx/include/__type_traits/is_void.h
index 7e8b8b64178eb..4c27060530c8e 100644
--- a/libcxx/include/__type_traits/is_void.h
+++ b/libcxx/include/__type_traits/is_void.h
@@ -23,22 +23,22 @@ _LIBCPP_BEGIN_NAMESPACE_STD
#if __has_builtin(__is_void)
template <class _Tp>
-struct _LIBCPP_TEMPLATE_VIS is_void : _BoolConstant<__is_void(_Tp)> { };
+struct _LIBCPP_TEMPLATE_VIS is_void : _BoolConstant<__is_void(_Tp)> {};
-#if _LIBCPP_STD_VER >= 17
+# if _LIBCPP_STD_VER >= 17
template <class _Tp>
inline constexpr bool is_void_v = __is_void(_Tp);
-#endif
+# endif
#else
-template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_void
- : public is_same<__remove_cv_t<_Tp>, void> {};
+template <class _Tp>
+struct _LIBCPP_TEMPLATE_VIS is_void : public is_same<__remove_cv_t<_Tp>, void> {};
-#if _LIBCPP_STD_VER >= 17
+# if _LIBCPP_STD_VER >= 17
template <class _Tp>
inline constexpr bool is_void_v = is_void<_Tp>::value;
-#endif
+# endif
#endif // __has_builtin(__is_void)
diff --git a/libcxx/include/__type_traits/is_volatile.h b/libcxx/include/__type_traits/is_volatile.h
index c020220e03070..87960a819c8fc 100644
--- a/libcxx/include/__type_traits/is_volatile.h
+++ b/libcxx/include/__type_traits/is_volatile.h
@@ -21,22 +21,24 @@ _LIBCPP_BEGIN_NAMESPACE_STD
#if __has_builtin(__is_volatile)
template <class _Tp>
-struct _LIBCPP_TEMPLATE_VIS is_volatile : _BoolConstant<__is_volatile(_Tp)> { };
+struct _LIBCPP_TEMPLATE_VIS is_volatile : _BoolConstant<__is_volatile(_Tp)> {};
-#if _LIBCPP_STD_VER >= 17
+# if _LIBCPP_STD_VER >= 17
template <class _Tp>
inline constexpr bool is_volatile_v = __is_volatile(_Tp);
-#endif
+# endif
#else
-template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_volatile : public false_type {};
-template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_volatile<_Tp volatile> : public true_type {};
+template <class _Tp>
+struct _LIBCPP_TEMPLATE_VIS is_volatile : public false_type {};
+template <class _Tp>
+struct _LIBCPP_TEMPLATE_VIS is_volatile<_Tp volatile> : public true_type {};
-#if _LIBCPP_STD_VER >= 17
+# if _LIBCPP_STD_VER >= 17
template <class _Tp>
inline constexpr bool is_volatile_v = is_volatile<_Tp>::value;
-#endif
+# endif
#endif // __has_builtin(__is_volatile)
diff --git a/libcxx/include/__type_traits/lazy.h b/libcxx/include/__type_traits/lazy.h
index 6874b06f3c5af..80826f1d64f60 100644
--- a/libcxx/include/__type_traits/lazy.h
+++ b/libcxx/include/__type_traits/lazy.h
@@ -17,7 +17,7 @@
_LIBCPP_BEGIN_NAMESPACE_STD
-template <template <class...> class _Func, class ..._Args>
+template <template <class...> class _Func, class... _Args>
struct _Lazy : _Func<_Args...> {};
_LIBCPP_END_NAMESPACE_STD
diff --git a/libcxx/include/__type_traits/make_32_64_or_128_bit.h b/libcxx/include/__type_traits/make_32_64_or_128_bit.h
index 30595712b67a3..f7f2e81735daf 100644
--- a/libcxx/include/__type_traits/make_32_64_or_128_bit.h
+++ b/libcxx/include/__type_traits/make_32_64_or_128_bit.h
@@ -28,20 +28,21 @@ _LIBCPP_BEGIN_NAMESPACE_STD
/// The restriction is the same as the integral version of to_char.
template <class _Tp>
#if _LIBCPP_STD_VER >= 20
- requires (is_signed_v<_Tp> || is_unsigned_v<_Tp> || is_same_v<_Tp, char>)
+ requires(is_signed_v<_Tp> || is_unsigned_v<_Tp> || is_same_v<_Tp, char>)
#endif
+// clang-format off
using __make_32_64_or_128_bit_t =
- __copy_unsigned_t<_Tp,
- __conditional_t<sizeof(_Tp) <= sizeof(int32_t), int32_t,
- __conditional_t<sizeof(_Tp) <= sizeof(int64_t), int64_t,
+ __copy_unsigned_t<_Tp,
+ __conditional_t<sizeof(_Tp) <= sizeof(int32_t), int32_t,
+ __conditional_t<sizeof(_Tp) <= sizeof(int64_t), int64_t,
#ifndef _LIBCPP_HAS_NO_INT128
- __conditional_t<sizeof(_Tp) <= sizeof(__int128_t), __int128_t,
- /* else */ void>
+ __conditional_t<sizeof(_Tp) <= sizeof(__int128_t), __int128_t,
+ /* else */ void>
#else
- /* else */ void
+ /* else */ void
#endif
- > >
- >;
+ > > >;
+// clang-format on
_LIBCPP_END_NAMESPACE_STD
diff --git a/libcxx/include/__type_traits/make_const_lvalue_ref.h b/libcxx/include/__type_traits/make_const_lvalue_ref.h
index deea40d5e61a1..469d4cb31ef7d 100644
--- a/libcxx/include/__type_traits/make_const_lvalue_ref.h
+++ b/libcxx/include/__type_traits/make_const_lvalue_ref.h
@@ -18,7 +18,7 @@
_LIBCPP_BEGIN_NAMESPACE_STD
-template<class _Tp>
+template <class _Tp>
using __make_const_lvalue_ref = const __libcpp_remove_reference_t<_Tp>&;
_LIBCPP_END_NAMESPACE_STD
diff --git a/libcxx/include/__type_traits/make_signed.h b/libcxx/include/__type_traits/make_signed.h
index a8142a43cb515..1a8a35f3859d2 100644
--- a/libcxx/include/__type_traits/make_signed.h
+++ b/libcxx/include/__type_traits/make_signed.h
@@ -29,30 +29,31 @@ template <class _Tp>
using __make_signed_t = __make_signed(_Tp);
#else
-typedef
- __type_list<signed char,
- __type_list<signed short,
- __type_list<signed int,
- __type_list<signed long,
- __type_list<signed long long,
+// clang-format off
+typedef __type_list<signed char,
+ __type_list<signed short,
+ __type_list<signed int,
+ __type_list<signed long,
+ __type_list<signed long long,
# ifndef _LIBCPP_HAS_NO_INT128
- __type_list<__int128_t,
+ __type_list<__int128_t,
# endif
- __nat
+ __nat
# ifndef _LIBCPP_HAS_NO_INT128
- >
+ >
# endif
- > > > > > __signed_types;
+ > > > > > __signed_types;
+// clang-format on
template <class _Tp, bool = is_integral<_Tp>::value || is_enum<_Tp>::value>
-struct __make_signed {};
+struct __make_signed{};
template <class _Tp>
-struct __make_signed<_Tp, true>
-{
- typedef typename __find_first<__signed_types, sizeof(_Tp)>::type type;
+struct __make_signed<_Tp, true> {
+ typedef typename __find_first<__signed_types, sizeof(_Tp)>::type type;
};
+// clang-format off
template <> struct __make_signed<bool, true> {};
template <> struct __make_signed< signed short, true> {typedef short type;};
template <> struct __make_signed<unsigned short, true> {typedef short type;};
@@ -66,6 +67,7 @@ template <> struct __make_signed<unsigned long long, true> {typedef long long ty
template <> struct __make_signed<__int128_t, true> {typedef __int128_t type;};
template <> struct __make_signed<__uint128_t, true> {typedef __int128_t type;};
# endif
+// clang-format on
template <class _Tp>
using __make_signed_t = __apply_cv_t<_Tp, typename __make_signed<__remove_cv_t<_Tp> >::type>;
@@ -78,7 +80,8 @@ struct make_signed {
};
#if _LIBCPP_STD_VER >= 14
-template <class _Tp> using make_signed_t = __make_signed_t<_Tp>;
+template <class _Tp>
+using make_signed_t = __make_signed_t<_Tp>;
#endif
_LIBCPP_END_NAMESPACE_STD
diff --git a/libcxx/include/__type_traits/make_unsigned.h b/libcxx/include/__type_traits/make_unsigned.h
index 0ee4347a721aa..98967371e7738 100644
--- a/libcxx/include/__type_traits/make_unsigned.h
+++ b/libcxx/include/__type_traits/make_unsigned.h
@@ -31,30 +31,31 @@ template <class _Tp>
using __make_unsigned_t = __make_unsigned(_Tp);
#else
-typedef
- __type_list<unsigned char,
- __type_list<unsigned short,
- __type_list<unsigned int,
- __type_list<unsigned long,
- __type_list<unsigned long long,
+// clang-format off
+typedef __type_list<unsigned char,
+ __type_list<unsigned short,
+ __type_list<unsigned int,
+ __type_list<unsigned long,
+ __type_list<unsigned long long,
# ifndef _LIBCPP_HAS_NO_INT128
- __type_list<__uint128_t,
+ __type_list<__uint128_t,
# endif
- __nat
+ __nat
# ifndef _LIBCPP_HAS_NO_INT128
- >
+ >
# endif
- > > > > > __unsigned_types;
+ > > > > > __unsigned_types;
+// clang-format on
template <class _Tp, bool = is_integral<_Tp>::value || is_enum<_Tp>::value>
-struct __make_unsigned {};
+struct __make_unsigned{};
template <class _Tp>
-struct __make_unsigned<_Tp, true>
-{
- typedef typename __find_first<__unsigned_types, sizeof(_Tp)>::type type;
+struct __make_unsigned<_Tp, true> {
+ typedef typename __find_first<__unsigned_types, sizeof(_Tp)>::type type;
};
+// clang-format off
template <> struct __make_unsigned<bool, true> {};
template <> struct __make_unsigned< signed short, true> {typedef unsigned short type;};
template <> struct __make_unsigned<unsigned short, true> {typedef unsigned short type;};
@@ -68,6 +69,7 @@ template <> struct __make_unsigned<unsigned long long, true> {typedef unsigned l
template <> struct __make_unsigned<__int128_t, true> {typedef __uint128_t type;};
template <> struct __make_unsigned<__uint128_t, true> {typedef __uint128_t type;};
# endif
+// clang-format on
template <class _Tp>
using __make_unsigned_t = __apply_cv_t<_Tp, typename __make_unsigned<__remove_cv_t<_Tp> >::type>;
@@ -80,14 +82,14 @@ struct make_unsigned {
};
#if _LIBCPP_STD_VER >= 14
-template <class _Tp> using make_unsigned_t = __make_unsigned_t<_Tp>;
+template <class _Tp>
+using make_unsigned_t = __make_unsigned_t<_Tp>;
#endif
#ifndef _LIBCPP_CXX03_LANG
template <class _Tp>
-_LIBCPP_HIDE_FROM_ABI constexpr
-__make_unsigned_t<_Tp> __to_unsigned_like(_Tp __x) noexcept {
- return static_cast<__make_unsigned_t<_Tp> >(__x);
+_LIBCPP_HIDE_FROM_ABI constexpr __make_unsigned_t<_Tp> __to_unsigned_like(_Tp __x) noexcept {
+ return static_cast<__make_unsigned_t<_Tp> >(__x);
}
#endif
diff --git a/libcxx/include/__type_traits/maybe_const.h b/libcxx/include/__type_traits/maybe_const.h
index 8403f6aba7468..25fba58fb7730 100644
--- a/libcxx/include/__type_traits/maybe_const.h
+++ b/libcxx/include/__type_traits/maybe_const.h
@@ -18,7 +18,7 @@
_LIBCPP_BEGIN_NAMESPACE_STD
-template<bool _Const, class _Tp>
+template <bool _Const, class _Tp>
using __maybe_const = __conditional_t<_Const, const _Tp, _Tp>;
_LIBCPP_END_NAMESPACE_STD
diff --git a/libcxx/include/__type_traits/nat.h b/libcxx/include/__type_traits/nat.h
index 5216ef5204202..9f39b806814e2 100644
--- a/libcxx/include/__type_traits/nat.h
+++ b/libcxx/include/__type_traits/nat.h
@@ -17,13 +17,12 @@
_LIBCPP_BEGIN_NAMESPACE_STD
-struct __nat
-{
+struct __nat {
#ifndef _LIBCPP_CXX03_LANG
- __nat() = delete;
- __nat(const __nat&) = delete;
- __nat& operator=(const __nat&) = delete;
- ~__nat() = delete;
+ __nat() = delete;
+ __nat(const __nat&) = delete;
+ __nat& operator=(const __nat&) = delete;
+ ~__nat() = delete;
#endif
};
diff --git a/libcxx/include/__type_traits/negation.h b/libcxx/include/__type_traits/negation.h
index 3a70ef1408cd6..a72e62d3f96e0 100644
--- a/libcxx/include/__type_traits/negation.h
+++ b/libcxx/include/__type_traits/negation.h
@@ -24,7 +24,7 @@ struct _Not : _BoolConstant<!_Pred::value> {};
#if _LIBCPP_STD_VER >= 17
template <class _Tp>
struct negation : _Not<_Tp> {};
-template<class _Tp>
+template <class _Tp>
inline constexpr bool negation_v = !_Tp::value;
#endif // _LIBCPP_STD_VER >= 17
diff --git a/libcxx/include/__type_traits/noexcept_move_assign_container.h b/libcxx/include/__type_traits/noexcept_move_assign_container.h
index 65384d05ae1b9..1d6c07e8cf96d 100644
--- a/libcxx/include/__type_traits/noexcept_move_assign_container.h
+++ b/libcxx/include/__type_traits/noexcept_move_assign_container.h
@@ -20,15 +20,17 @@
_LIBCPP_BEGIN_NAMESPACE_STD
-template <typename _Alloc, typename _Traits=allocator_traits<_Alloc> >
-struct __noexcept_move_assign_container : public integral_constant<bool,
- _Traits::propagate_on_container_move_assignment::value
+template <typename _Alloc, typename _Traits = allocator_traits<_Alloc> >
+struct __noexcept_move_assign_container
+ : public integral_constant<bool,
+ _Traits::propagate_on_container_move_assignment::value
#if _LIBCPP_STD_VER >= 17
- || _Traits::is_always_equal::value
+ || _Traits::is_always_equal::value
#else
- && is_nothrow_move_assignable<_Alloc>::value
+ && is_nothrow_move_assignable<_Alloc>::value
#endif
- > {};
+ > {
+};
_LIBCPP_END_NAMESPACE_STD
diff --git a/libcxx/include/__type_traits/promote.h b/libcxx/include/__type_traits/promote.h
index e01e7781c5b3d..018bd69df2604 100644
--- a/libcxx/include/__type_traits/promote.h
+++ b/libcxx/include/__type_traits/promote.h
@@ -21,73 +21,69 @@
_LIBCPP_BEGIN_NAMESPACE_STD
template <class _Tp>
-struct __numeric_type
-{
- static void __test(...);
- static float __test(float);
- static double __test(char);
- static double __test(int);
- static double __test(unsigned);
- static double __test(long);
- static double __test(unsigned long);
- static double __test(long long);
- static double __test(unsigned long long);
+struct __numeric_type {
+ static void __test(...);
+ static float __test(float);
+ static double __test(char);
+ static double __test(int);
+ static double __test(unsigned);
+ static double __test(long);
+ static double __test(unsigned long);
+ static double __test(long long);
+ static double __test(unsigned long long);
#ifndef _LIBCPP_HAS_NO_INT128
- static double __test(__int128_t);
- static double __test(__uint128_t);
+ static double __test(__int128_t);
+ static double __test(__uint128_t);
#endif
- static double __test(double);
- static long double __test(long double);
+ static double __test(double);
+ static long double __test(long double);
- typedef decltype(__test(std::declval<_Tp>())) type;
- static const bool value = _IsNotSame<type, void>::value;
+ typedef decltype(__test(std::declval<_Tp>())) type;
+ static const bool value = _IsNotSame<type, void>::value;
};
template <>
-struct __numeric_type<void>
-{
- static const bool value = true;
+struct __numeric_type<void> {
+ static const bool value = true;
};
-template <class _A1, class _A2 = void, class _A3 = void,
- bool = __numeric_type<_A1>::value &&
- __numeric_type<_A2>::value &&
- __numeric_type<_A3>::value>
-class __promote_imp
-{
+template <class _A1,
+ class _A2 = void,
+ class _A3 = void,
+ bool = __numeric_type<_A1>::value&& __numeric_type<_A2>::value&& __numeric_type<_A3>::value>
+class __promote_imp {
public:
- static const bool value = false;
+ static const bool value = false;
};
template <class _A1, class _A2, class _A3>
-class __promote_imp<_A1, _A2, _A3, true>
-{
+class __promote_imp<_A1, _A2, _A3, true> {
private:
- typedef typename __promote_imp<_A1>::type __type1;
- typedef typename __promote_imp<_A2>::type __type2;
- typedef typename __promote_imp<_A3>::type __type3;
+ typedef typename __promote_imp<_A1>::type __type1;
+ typedef typename __promote_imp<_A2>::type __type2;
+ typedef typename __promote_imp<_A3>::type __type3;
+
public:
- typedef decltype(__type1() + __type2() + __type3()) type;
- static const bool value = true;
+ typedef decltype(__type1() + __type2() + __type3()) type;
+ static const bool value = true;
};
template <class _A1, class _A2>
-class __promote_imp<_A1, _A2, void, true>
-{
+class __promote_imp<_A1, _A2, void, true> {
private:
- typedef typename __promote_imp<_A1>::type __type1;
- typedef typename __promote_imp<_A2>::type __type2;
+ typedef typename __promote_imp<_A1>::type __type1;
+ typedef typename __promote_imp<_A2>::type __type2;
+
public:
- typedef decltype(__type1() + __type2()) type;
- static const bool value = true;
+ typedef decltype(__type1() + __type2()) type;
+ static const bool value = true;
};
template <class _A1>
-class __promote_imp<_A1, void, void, true>
-{
+class __promote_imp<_A1, void, void, true> {
public:
- typedef typename __numeric_type<_A1>::type type;
- static const bool value = true;
+ typedef typename __numeric_type<_A1>::type type;
+ static const bool value = true;
};
template <class _A1, class _A2 = void, class _A3 = void>
diff --git a/libcxx/include/__type_traits/rank.h b/libcxx/include/__type_traits/rank.h
index 5f3fab89d95d0..7f6fad1c54024 100644
--- a/libcxx/include/__type_traits/rank.h
+++ b/libcxx/include/__type_traits/rank.h
@@ -27,12 +27,12 @@ struct rank : integral_constant<size_t, __array_rank(_Tp)> {};
#else
-template <class _Tp> struct _LIBCPP_TEMPLATE_VIS rank
- : public integral_constant<size_t, 0> {};
-template <class _Tp> struct _LIBCPP_TEMPLATE_VIS rank<_Tp[]>
- : public integral_constant<size_t, rank<_Tp>::value + 1> {};
-template <class _Tp, size_t _Np> struct _LIBCPP_TEMPLATE_VIS rank<_Tp[_Np]>
- : public integral_constant<size_t, rank<_Tp>::value + 1> {};
+template <class _Tp>
+struct _LIBCPP_TEMPLATE_VIS rank : public integral_constant<size_t, 0> {};
+template <class _Tp>
+struct _LIBCPP_TEMPLATE_VIS rank<_Tp[]> : public integral_constant<size_t, rank<_Tp>::value + 1> {};
+template <class _Tp, size_t _Np>
+struct _LIBCPP_TEMPLATE_VIS rank<_Tp[_Np]> : public integral_constant<size_t, rank<_Tp>::value + 1> {};
#endif // __has_builtin(__array_rank)
diff --git a/libcxx/include/__type_traits/remove_all_extents.h b/libcxx/include/__type_traits/remove_all_extents.h
index f7e32251c0cf9..d5373b51f5221 100644
--- a/libcxx/include/__type_traits/remove_all_extents.h
+++ b/libcxx/include/__type_traits/remove_all_extents.h
@@ -27,19 +27,26 @@ struct remove_all_extents {
template <class _Tp>
using __remove_all_extents_t = __remove_all_extents(_Tp);
#else
-template <class _Tp> struct _LIBCPP_TEMPLATE_VIS remove_all_extents
- {typedef _Tp type;};
-template <class _Tp> struct _LIBCPP_TEMPLATE_VIS remove_all_extents<_Tp[]>
- {typedef typename remove_all_extents<_Tp>::type type;};
-template <class _Tp, size_t _Np> struct _LIBCPP_TEMPLATE_VIS remove_all_extents<_Tp[_Np]>
- {typedef typename remove_all_extents<_Tp>::type type;};
+template <class _Tp>
+struct _LIBCPP_TEMPLATE_VIS remove_all_extents {
+ typedef _Tp type;
+};
+template <class _Tp>
+struct _LIBCPP_TEMPLATE_VIS remove_all_extents<_Tp[]> {
+ typedef typename remove_all_extents<_Tp>::type type;
+};
+template <class _Tp, size_t _Np>
+struct _LIBCPP_TEMPLATE_VIS remove_all_extents<_Tp[_Np]> {
+ typedef typename remove_all_extents<_Tp>::type type;
+};
template <class _Tp>
using __remove_all_extents_t = typename remove_all_extents<_Tp>::type;
#endif // __has_builtin(__remove_all_extents)
#if _LIBCPP_STD_VER >= 14
-template <class _Tp> using remove_all_extents_t = __remove_all_extents_t<_Tp>;
+template <class _Tp>
+using remove_all_extents_t = __remove_all_extents_t<_Tp>;
#endif
_LIBCPP_END_NAMESPACE_STD
diff --git a/libcxx/include/__type_traits/remove_const.h b/libcxx/include/__type_traits/remove_const.h
index 37f0609e4dbeb..a3f0648c47850 100644
--- a/libcxx/include/__type_traits/remove_const.h
+++ b/libcxx/include/__type_traits/remove_const.h
@@ -26,15 +26,22 @@ struct remove_const {
template <class _Tp>
using __remove_const_t = __remove_const(_Tp);
#else
-template <class _Tp> struct _LIBCPP_TEMPLATE_VIS remove_const {typedef _Tp type;};
-template <class _Tp> struct _LIBCPP_TEMPLATE_VIS remove_const<const _Tp> {typedef _Tp type;};
+template <class _Tp>
+struct _LIBCPP_TEMPLATE_VIS remove_const {
+ typedef _Tp type;
+};
+template <class _Tp>
+struct _LIBCPP_TEMPLATE_VIS remove_const<const _Tp> {
+ typedef _Tp type;
+};
template <class _Tp>
using __remove_const_t = typename remove_const<_Tp>::type;
#endif // __has_builtin(__remove_const)
#if _LIBCPP_STD_VER >= 14
-template <class _Tp> using remove_const_t = __remove_const_t<_Tp>;
+template <class _Tp>
+using remove_const_t = __remove_const_t<_Tp>;
#endif
_LIBCPP_END_NAMESPACE_STD
diff --git a/libcxx/include/__type_traits/remove_cv.h b/libcxx/include/__type_traits/remove_cv.h
index 7eb894074a058..8fe8fb0e49596 100644
--- a/libcxx/include/__type_traits/remove_cv.h
+++ b/libcxx/include/__type_traits/remove_cv.h
@@ -28,15 +28,18 @@ struct remove_cv {
template <class _Tp>
using __remove_cv_t = __remove_cv(_Tp);
#else
-template <class _Tp> struct _LIBCPP_TEMPLATE_VIS remove_cv
-{typedef __remove_volatile_t<__remove_const_t<_Tp> > type;};
+template <class _Tp>
+struct _LIBCPP_TEMPLATE_VIS remove_cv {
+ typedef __remove_volatile_t<__remove_const_t<_Tp> > type;
+};
template <class _Tp>
using __remove_cv_t = __remove_volatile_t<__remove_const_t<_Tp> >;
#endif // __has_builtin(__remove_cv)
#if _LIBCPP_STD_VER >= 14
-template <class _Tp> using remove_cv_t = __remove_cv_t<_Tp>;
+template <class _Tp>
+using remove_cv_t = __remove_cv_t<_Tp>;
#endif
_LIBCPP_END_NAMESPACE_STD
diff --git a/libcxx/include/__type_traits/remove_cvref.h b/libcxx/include/__type_traits/remove_cvref.h
index f1111fd9429bf..4dc950ac31ad8 100644
--- a/libcxx/include/__type_traits/remove_cvref.h
+++ b/libcxx/include/__type_traits/remove_cvref.h
@@ -34,10 +34,11 @@ struct __is_same_uncvref : _IsSame<__remove_cvref_t<_Tp>, __remove_cvref_t<_Up>
#if _LIBCPP_STD_VER >= 20
template <class _Tp>
struct remove_cvref {
- using type _LIBCPP_NODEBUG = __remove_cvref_t<_Tp>;
+ using type _LIBCPP_NODEBUG = __remove_cvref_t<_Tp>;
};
-template <class _Tp> using remove_cvref_t = __remove_cvref_t<_Tp>;
+template <class _Tp>
+using remove_cvref_t = __remove_cvref_t<_Tp>;
#endif
_LIBCPP_END_NAMESPACE_STD
diff --git a/libcxx/include/__type_traits/remove_extent.h b/libcxx/include/__type_traits/remove_extent.h
index 65dfcdc00aa8d..fe37b5c7266c6 100644
--- a/libcxx/include/__type_traits/remove_extent.h
+++ b/libcxx/include/__type_traits/remove_extent.h
@@ -27,19 +27,26 @@ struct remove_extent {
template <class _Tp>
using __remove_extent_t = __remove_extent(_Tp);
#else
-template <class _Tp> struct _LIBCPP_TEMPLATE_VIS remove_extent
- {typedef _Tp type;};
-template <class _Tp> struct _LIBCPP_TEMPLATE_VIS remove_extent<_Tp[]>
- {typedef _Tp type;};
-template <class _Tp, size_t _Np> struct _LIBCPP_TEMPLATE_VIS remove_extent<_Tp[_Np]>
- {typedef _Tp type;};
+template <class _Tp>
+struct _LIBCPP_TEMPLATE_VIS remove_extent {
+ typedef _Tp type;
+};
+template <class _Tp>
+struct _LIBCPP_TEMPLATE_VIS remove_extent<_Tp[]> {
+ typedef _Tp type;
+};
+template <class _Tp, size_t _Np>
+struct _LIBCPP_TEMPLATE_VIS remove_extent<_Tp[_Np]> {
+ typedef _Tp type;
+};
template <class _Tp>
using __remove_extent_t = typename remove_extent<_Tp>::type;
#endif // __has_builtin(__remove_extent)
#if _LIBCPP_STD_VER >= 14
-template <class _Tp> using remove_extent_t = __remove_extent_t<_Tp>;
+template <class _Tp>
+using remove_extent_t = __remove_extent_t<_Tp>;
#endif
_LIBCPP_END_NAMESPACE_STD
diff --git a/libcxx/include/__type_traits/remove_pointer.h b/libcxx/include/__type_traits/remove_pointer.h
index 8b3a9c7c039f4..54390a1939f7d 100644
--- a/libcxx/include/__type_traits/remove_pointer.h
+++ b/libcxx/include/__type_traits/remove_pointer.h
@@ -26,18 +26,21 @@ struct remove_pointer {
template <class _Tp>
using __remove_pointer_t = __remove_pointer(_Tp);
#else
+// clang-format off
template <class _Tp> struct _LIBCPP_TEMPLATE_VIS remove_pointer {typedef _LIBCPP_NODEBUG _Tp type;};
template <class _Tp> struct _LIBCPP_TEMPLATE_VIS remove_pointer<_Tp*> {typedef _LIBCPP_NODEBUG _Tp type;};
template <class _Tp> struct _LIBCPP_TEMPLATE_VIS remove_pointer<_Tp* const> {typedef _LIBCPP_NODEBUG _Tp type;};
template <class _Tp> struct _LIBCPP_TEMPLATE_VIS remove_pointer<_Tp* volatile> {typedef _LIBCPP_NODEBUG _Tp type;};
template <class _Tp> struct _LIBCPP_TEMPLATE_VIS remove_pointer<_Tp* const volatile> {typedef _LIBCPP_NODEBUG _Tp type;};
+// clang-format on
template <class _Tp>
using __remove_pointer_t = typename remove_pointer<_Tp>::type;
#endif // !defined(_LIBCPP_WORKAROUND_OBJCXX_COMPILER_INTRINSICS) && __has_builtin(__remove_pointer)
#if _LIBCPP_STD_VER >= 14
-template <class _Tp> using remove_pointer_t = __remove_pointer_t<_Tp>;
+template <class _Tp>
+using remove_pointer_t = __remove_pointer_t<_Tp>;
#endif
_LIBCPP_END_NAMESPACE_STD
diff --git a/libcxx/include/__type_traits/remove_reference.h b/libcxx/include/__type_traits/remove_reference.h
index 1d510c248abf9..fd66417bd84fe 100644
--- a/libcxx/include/__type_traits/remove_reference.h
+++ b/libcxx/include/__type_traits/remove_reference.h
@@ -27,16 +27,19 @@ struct remove_reference {
template <class _Tp>
using __libcpp_remove_reference_t = __remove_reference_t(_Tp);
#else
+// clang-format off
template <class _Tp> struct _LIBCPP_TEMPLATE_VIS remove_reference {typedef _LIBCPP_NODEBUG _Tp type;};
template <class _Tp> struct _LIBCPP_TEMPLATE_VIS remove_reference<_Tp&> {typedef _LIBCPP_NODEBUG _Tp type;};
template <class _Tp> struct _LIBCPP_TEMPLATE_VIS remove_reference<_Tp&&> {typedef _LIBCPP_NODEBUG _Tp type;};
+// clang-format on
template <class _Tp>
using __libcpp_remove_reference_t = typename remove_reference<_Tp>::type;
#endif // __has_builtin(__remove_reference_t)
#if _LIBCPP_STD_VER >= 14
-template <class _Tp> using remove_reference_t = __libcpp_remove_reference_t<_Tp>;
+template <class _Tp>
+using remove_reference_t = __libcpp_remove_reference_t<_Tp>;
#endif
_LIBCPP_END_NAMESPACE_STD
diff --git a/libcxx/include/__type_traits/remove_volatile.h b/libcxx/include/__type_traits/remove_volatile.h
index cc9fb55e04028..7600ae0ec5167 100644
--- a/libcxx/include/__type_traits/remove_volatile.h
+++ b/libcxx/include/__type_traits/remove_volatile.h
@@ -26,15 +26,22 @@ struct remove_volatile {
template <class _Tp>
using __remove_volatile_t = __remove_volatile(_Tp);
#else
-template <class _Tp> struct _LIBCPP_TEMPLATE_VIS remove_volatile {typedef _Tp type;};
-template <class _Tp> struct _LIBCPP_TEMPLATE_VIS remove_volatile<volatile _Tp> {typedef _Tp type;};
+template <class _Tp>
+struct _LIBCPP_TEMPLATE_VIS remove_volatile {
+ typedef _Tp type;
+};
+template <class _Tp>
+struct _LIBCPP_TEMPLATE_VIS remove_volatile<volatile _Tp> {
+ typedef _Tp type;
+};
template <class _Tp>
using __remove_volatile_t = typename remove_volatile<_Tp>::type;
#endif // __has_builtin(__remove_volatile)
#if _LIBCPP_STD_VER >= 14
-template <class _Tp> using remove_volatile_t = __remove_volatile_t<_Tp>;
+template <class _Tp>
+using remove_volatile_t = __remove_volatile_t<_Tp>;
#endif
_LIBCPP_END_NAMESPACE_STD
diff --git a/libcxx/include/__type_traits/result_of.h b/libcxx/include/__type_traits/result_of.h
index dff28286efd35..f00fa8e9be7f7 100644
--- a/libcxx/include/__type_traits/result_of.h
+++ b/libcxx/include/__type_traits/result_of.h
@@ -21,18 +21,17 @@ _LIBCPP_BEGIN_NAMESPACE_STD
// result_of
#if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_TYPE_TRAITS)
-template <class _Callable> class _LIBCPP_DEPRECATED_IN_CXX17 result_of;
-
-template <class _Fp, class ..._Args>
-class _LIBCPP_TEMPLATE_VIS result_of<_Fp(_Args...)>
- : public __invoke_of<_Fp, _Args...>
-{
-};
-
-#if _LIBCPP_STD_VER >= 14
-template <class _Tp> using result_of_t _LIBCPP_DEPRECATED_IN_CXX17 = typename result_of<_Tp>::type;
-#endif // _LIBCPP_STD_VER >= 14
-#endif // _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_TYPE_TRAITS)
+template <class _Callable>
+class _LIBCPP_DEPRECATED_IN_CXX17 result_of;
+
+template <class _Fp, class... _Args>
+class _LIBCPP_TEMPLATE_VIS result_of<_Fp(_Args...)> : public __invoke_of<_Fp, _Args...> {};
+
+# if _LIBCPP_STD_VER >= 14
+template <class _Tp>
+using result_of_t _LIBCPP_DEPRECATED_IN_CXX17 = typename result_of<_Tp>::type;
+# endif // _LIBCPP_STD_VER >= 14
+#endif // _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_TYPE_TRAITS)
_LIBCPP_END_NAMESPACE_STD
diff --git a/libcxx/include/__type_traits/strip_signature.h b/libcxx/include/__type_traits/strip_signature.h
index 2bb7393c1ee7f..3fe79592f55b8 100644
--- a/libcxx/include/__type_traits/strip_signature.h
+++ b/libcxx/include/__type_traits/strip_signature.h
@@ -19,23 +19,24 @@
_LIBCPP_BEGIN_NAMESPACE_STD
-template<class _Fp>
+template <class _Fp>
struct __strip_signature;
# if defined(__cpp_static_call_operator) && __cpp_static_call_operator >= 202207L
template <class _Rp, class... _Args>
-struct __strip_signature<_Rp(*)(_Args...)> {
+struct __strip_signature<_Rp (*)(_Args...)> {
using type = _Rp(_Args...);
};
template <class _Rp, class... _Args>
-struct __strip_signature<_Rp(*)(_Args...) noexcept> {
+struct __strip_signature<_Rp (*)(_Args...) noexcept> {
using type = _Rp(_Args...);
};
# endif // defined(__cpp_static_call_operator) && __cpp_static_call_operator >= 202207L
+// clang-format off
template<class _Rp, class _Gp, class ..._Ap>
struct __strip_signature<_Rp (_Gp::*) (_Ap...)> { using type = _Rp(_Ap...); };
template<class _Rp, class _Gp, class ..._Ap>
@@ -71,6 +72,7 @@ template<class _Rp, class _Gp, class ..._Ap>
struct __strip_signature<_Rp (_Gp::*) (_Ap...) volatile & noexcept> { using type = _Rp(_Ap...); };
template<class _Rp, class _Gp, class ..._Ap>
struct __strip_signature<_Rp (_Gp::*) (_Ap...) const volatile & noexcept> { using type = _Rp(_Ap...); };
+// clang-format on
_LIBCPP_END_NAMESPACE_STD
diff --git a/libcxx/include/__type_traits/type_identity.h b/libcxx/include/__type_traits/type_identity.h
index 92f288f4c0b1d..b0b5a1277d596 100644
--- a/libcxx/include/__type_traits/type_identity.h
+++ b/libcxx/include/__type_traits/type_identity.h
@@ -18,14 +18,20 @@
_LIBCPP_BEGIN_NAMESPACE_STD
template <class _Tp>
-struct __type_identity { typedef _Tp type; };
+struct __type_identity {
+ typedef _Tp type;
+};
template <class _Tp>
using __type_identity_t _LIBCPP_NODEBUG = typename __type_identity<_Tp>::type;
#if _LIBCPP_STD_VER >= 20
-template<class _Tp> struct type_identity { typedef _Tp type; };
-template<class _Tp> using type_identity_t = typename type_identity<_Tp>::type;
+template <class _Tp>
+struct type_identity {
+ typedef _Tp type;
+};
+template <class _Tp>
+using type_identity_t = typename type_identity<_Tp>::type;
#endif
_LIBCPP_END_NAMESPACE_STD
diff --git a/libcxx/include/__type_traits/type_list.h b/libcxx/include/__type_traits/type_list.h
index 5a9e3319a1d46..02905707ee37a 100644
--- a/libcxx/include/__type_traits/type_list.h
+++ b/libcxx/include/__type_traits/type_list.h
@@ -19,24 +19,22 @@
_LIBCPP_BEGIN_NAMESPACE_STD
template <class _Hp, class _Tp>
-struct __type_list
-{
- typedef _Hp _Head;
- typedef _Tp _Tail;
+struct __type_list {
+ typedef _Hp _Head;
+ typedef _Tp _Tail;
};
-template <class _TypeList, size_t _Size, bool = _Size <= sizeof(typename _TypeList::_Head)> struct __find_first;
+template <class _TypeList, size_t _Size, bool = _Size <= sizeof(typename _TypeList::_Head)>
+struct __find_first;
template <class _Hp, class _Tp, size_t _Size>
-struct __find_first<__type_list<_Hp, _Tp>, _Size, true>
-{
- typedef _LIBCPP_NODEBUG _Hp type;
+struct __find_first<__type_list<_Hp, _Tp>, _Size, true> {
+ typedef _LIBCPP_NODEBUG _Hp type;
};
template <class _Hp, class _Tp, size_t _Size>
-struct __find_first<__type_list<_Hp, _Tp>, _Size, false>
-{
- typedef _LIBCPP_NODEBUG typename __find_first<_Tp, _Size>::type type;
+struct __find_first<__type_list<_Hp, _Tp>, _Size, false> {
+ typedef _LIBCPP_NODEBUG typename __find_first<_Tp, _Size>::type type;
};
_LIBCPP_END_NAMESPACE_STD
diff --git a/libcxx/include/__type_traits/underlying_type.h b/libcxx/include/__type_traits/underlying_type.h
index 6f52d678b3eb2..16e7501dee17d 100644
--- a/libcxx/include/__type_traits/underlying_type.h
+++ b/libcxx/include/__type_traits/underlying_type.h
@@ -18,22 +18,23 @@
_LIBCPP_BEGIN_NAMESPACE_STD
-template <class _Tp, bool = is_enum<_Tp>::value> struct __underlying_type_impl;
+template <class _Tp, bool = is_enum<_Tp>::value>
+struct __underlying_type_impl;
template <class _Tp>
struct __underlying_type_impl<_Tp, false> {};
template <class _Tp>
-struct __underlying_type_impl<_Tp, true>
-{
- typedef __underlying_type(_Tp) type;
+struct __underlying_type_impl<_Tp, true> {
+ typedef __underlying_type(_Tp) type;
};
template <class _Tp>
struct underlying_type : __underlying_type_impl<_Tp, is_enum<_Tp>::value> {};
#if _LIBCPP_STD_VER >= 14
-template <class _Tp> using underlying_type_t = typename underlying_type<_Tp>::type;
+template <class _Tp>
+using underlying_type_t = typename underlying_type<_Tp>::type;
#endif
_LIBCPP_END_NAMESPACE_STD
diff --git a/libcxx/include/__type_traits/unwrap_ref.h b/libcxx/include/__type_traits/unwrap_ref.h
index 94cc8ea722edf..5fed08f7ddda1 100644
--- a/libcxx/include/__type_traits/unwrap_ref.h
+++ b/libcxx/include/__type_traits/unwrap_ref.h
@@ -19,26 +19,30 @@
_LIBCPP_BEGIN_NAMESPACE_STD
template <class _Tp>
-struct __unwrap_reference { typedef _LIBCPP_NODEBUG _Tp type; };
+struct __unwrap_reference {
+ typedef _LIBCPP_NODEBUG _Tp type;
+};
template <class _Tp>
class reference_wrapper;
template <class _Tp>
-struct __unwrap_reference<reference_wrapper<_Tp> > { typedef _LIBCPP_NODEBUG _Tp& type; };
+struct __unwrap_reference<reference_wrapper<_Tp> > {
+ typedef _LIBCPP_NODEBUG _Tp& type;
+};
template <class _Tp>
struct decay;
#if _LIBCPP_STD_VER >= 20
template <class _Tp>
-struct unwrap_reference : __unwrap_reference<_Tp> { };
+struct unwrap_reference : __unwrap_reference<_Tp> {};
template <class _Tp>
using unwrap_reference_t = typename unwrap_reference<_Tp>::type;
template <class _Tp>
-struct unwrap_ref_decay : unwrap_reference<__decay_t<_Tp> > { };
+struct unwrap_ref_decay : unwrap_reference<__decay_t<_Tp> > {};
template <class _Tp>
using unwrap_ref_decay_t = typename unwrap_ref_decay<_Tp>::type;
@@ -51,7 +55,8 @@ struct __unwrap_ref_decay
#else
: __unwrap_reference<__decay_t<_Tp> >
#endif
-{ };
+{
+};
_LIBCPP_END_NAMESPACE_STD
diff --git a/libcxx/include/__type_traits/void_t.h b/libcxx/include/__type_traits/void_t.h
index 2fe438cf39cd3..985bba02e72f7 100644
--- a/libcxx/include/__type_traits/void_t.h
+++ b/libcxx/include/__type_traits/void_t.h
@@ -18,7 +18,8 @@
_LIBCPP_BEGIN_NAMESPACE_STD
#if _LIBCPP_STD_VER >= 17
-template <class...> using void_t = void;
+template <class...>
+using void_t = void;
#endif
template <class...>
diff --git a/libcxx/utils/data/ignore_format.txt b/libcxx/utils/data/ignore_format.txt
index dfe30a2c3f4c1..5e5a23dfca1b6 100644
--- a/libcxx/utils/data/ignore_format.txt
+++ b/libcxx/utils/data/ignore_format.txt
@@ -1,40 +1,3 @@
-libcxx/benchmarks/CartesianBenchmarks.h
-libcxx/benchmarks/ContainerBenchmarks.h
-libcxx/benchmarks/GenerateInput.h
-libcxx/benchmarks/Utilities.h
-libcxx/benchmarks/VariantBenchmarks.h
-libcxx/benchmarks/algorithms/common.h
-libcxx/benchmarks/algorithms/lower_bound.bench.cpp
-libcxx/benchmarks/algorithms/make_heap.bench.cpp
-libcxx/benchmarks/algorithms/make_heap_then_sort_heap.bench.cpp
-libcxx/benchmarks/algorithms.partition_point.bench.cpp
-libcxx/benchmarks/algorithms/pop_heap.bench.cpp
-libcxx/benchmarks/algorithms/push_heap.bench.cpp
-libcxx/benchmarks/algorithms/ranges_make_heap.bench.cpp
-libcxx/benchmarks/algorithms/ranges_make_heap_then_sort_heap.bench.cpp
-libcxx/benchmarks/algorithms/ranges_pop_heap.bench.cpp
-libcxx/benchmarks/algorithms/ranges_push_heap.bench.cpp
-libcxx/benchmarks/algorithms/ranges_sort.bench.cpp
-libcxx/benchmarks/algorithms/ranges_sort_heap.bench.cpp
-libcxx/benchmarks/algorithms/ranges_stable_sort.bench.cpp
-libcxx/benchmarks/algorithms/sort.bench.cpp
-libcxx/benchmarks/algorithms/sort_heap.bench.cpp
-libcxx/benchmarks/algorithms/stable_sort.bench.cpp
-libcxx/benchmarks/allocation.bench.cpp
-libcxx/benchmarks/deque.bench.cpp
-libcxx/benchmarks/filesystem.bench.cpp
-libcxx/benchmarks/formatter_float.bench.cpp
-libcxx/benchmarks/formatter_int.bench.cpp
-libcxx/benchmarks/format_to.bench.cpp
-libcxx/benchmarks/format_to_n.bench.cpp
-libcxx/benchmarks/function.bench.cpp
-libcxx/benchmarks/map.bench.cpp
-libcxx/benchmarks/ordered_set.bench.cpp
-libcxx/benchmarks/random.bench.cpp
-libcxx/benchmarks/string.bench.cpp
-libcxx/benchmarks/stringstream.bench.cpp
-libcxx/benchmarks/unordered_set_operations.bench.cpp
-libcxx/benchmarks/vector_operations.bench.cpp
libcxx/include/__algorithm/binary_search.h
libcxx/include/__algorithm/clamp.h
libcxx/include/__algorithm/comp_ref_type.h
@@ -94,90 +57,6 @@ libcxx/include/__algorithm/partition_point.h
libcxx/include/__algorithm/pop_heap.h
libcxx/include/__algorithm/prev_permutation.h
libcxx/include/__algorithm/push_heap.h
-libcxx/include/__algorithm/ranges_adjacent_find.h
-libcxx/include/__algorithm/ranges_all_of.h
-libcxx/include/__algorithm/ranges_any_of.h
-libcxx/include/__algorithm/ranges_binary_search.h
-libcxx/include/__algorithm/ranges_clamp.h
-libcxx/include/__algorithm/ranges_copy_backward.h
-libcxx/include/__algorithm/ranges_copy.h
-libcxx/include/__algorithm/ranges_copy_if.h
-libcxx/include/__algorithm/ranges_copy_n.h
-libcxx/include/__algorithm/ranges_count.h
-libcxx/include/__algorithm/ranges_count_if.h
-libcxx/include/__algorithm/ranges_equal.h
-libcxx/include/__algorithm/ranges_equal_range.h
-libcxx/include/__algorithm/ranges_fill.h
-libcxx/include/__algorithm/ranges_fill_n.h
-libcxx/include/__algorithm/ranges_find_end.h
-libcxx/include/__algorithm/ranges_find_first_of.h
-libcxx/include/__algorithm/ranges_find.h
-libcxx/include/__algorithm/ranges_find_if.h
-libcxx/include/__algorithm/ranges_find_if_not.h
-libcxx/include/__algorithm/ranges_for_each.h
-libcxx/include/__algorithm/ranges_for_each_n.h
-libcxx/include/__algorithm/ranges_generate.h
-libcxx/include/__algorithm/ranges_generate_n.h
-libcxx/include/__algorithm/ranges_includes.h
-libcxx/include/__algorithm/ranges_inplace_merge.h
-libcxx/include/__algorithm/ranges_is_heap.h
-libcxx/include/__algorithm/ranges_is_heap_until.h
-libcxx/include/__algorithm/ranges_is_partitioned.h
-libcxx/include/__algorithm/ranges_is_permutation.h
-libcxx/include/__algorithm/ranges_is_sorted.h
-libcxx/include/__algorithm/ranges_is_sorted_until.h
-libcxx/include/__algorithm/ranges_lexicographical_compare.h
-libcxx/include/__algorithm/ranges_lower_bound.h
-libcxx/include/__algorithm/ranges_make_heap.h
-libcxx/include/__algorithm/ranges_max_element.h
-libcxx/include/__algorithm/ranges_max.h
-libcxx/include/__algorithm/ranges_merge.h
-libcxx/include/__algorithm/ranges_min_element.h
-libcxx/include/__algorithm/ranges_min.h
-libcxx/include/__algorithm/ranges_minmax_element.h
-libcxx/include/__algorithm/ranges_minmax.h
-libcxx/include/__algorithm/ranges_mismatch.h
-libcxx/include/__algorithm/ranges_move_backward.h
-libcxx/include/__algorithm/ranges_move.h
-libcxx/include/__algorithm/ranges_none_of.h
-libcxx/include/__algorithm/ranges_nth_element.h
-libcxx/include/__algorithm/ranges_partial_sort_copy.h
-libcxx/include/__algorithm/ranges_partial_sort.h
-libcxx/include/__algorithm/ranges_partition_copy.h
-libcxx/include/__algorithm/ranges_partition.h
-libcxx/include/__algorithm/ranges_partition_point.h
-libcxx/include/__algorithm/ranges_pop_heap.h
-libcxx/include/__algorithm/ranges_prev_permutation.h
-libcxx/include/__algorithm/ranges_push_heap.h
-libcxx/include/__algorithm/ranges_remove_copy.h
-libcxx/include/__algorithm/ranges_remove_copy_if.h
-libcxx/include/__algorithm/ranges_remove.h
-libcxx/include/__algorithm/ranges_remove_if.h
-libcxx/include/__algorithm/ranges_replace_copy.h
-libcxx/include/__algorithm/ranges_replace_copy_if.h
-libcxx/include/__algorithm/ranges_replace.h
-libcxx/include/__algorithm/ranges_replace_if.h
-libcxx/include/__algorithm/ranges_reverse_copy.h
-libcxx/include/__algorithm/ranges_reverse.h
-libcxx/include/__algorithm/ranges_rotate_copy.h
-libcxx/include/__algorithm/ranges_rotate.h
-libcxx/include/__algorithm/ranges_sample.h
-libcxx/include/__algorithm/ranges_search.h
-libcxx/include/__algorithm/ranges_search_n.h
-libcxx/include/__algorithm/ranges_set_
diff erence.h
-libcxx/include/__algorithm/ranges_set_intersection.h
-libcxx/include/__algorithm/ranges_set_symmetric_
diff erence.h
-libcxx/include/__algorithm/ranges_set_union.h
-libcxx/include/__algorithm/ranges_shuffle.h
-libcxx/include/__algorithm/ranges_sort.h
-libcxx/include/__algorithm/ranges_sort_heap.h
-libcxx/include/__algorithm/ranges_stable_partition.h
-libcxx/include/__algorithm/ranges_stable_sort.h
-libcxx/include/__algorithm/ranges_swap_ranges.h
-libcxx/include/__algorithm/ranges_transform.h
-libcxx/include/__algorithm/ranges_unique_copy.h
-libcxx/include/__algorithm/ranges_unique.h
-libcxx/include/__algorithm/ranges_upper_bound.h
libcxx/include/__algorithm/remove_copy.h
libcxx/include/__algorithm/remove_copy_if.h
libcxx/include/__algorithm/remove.h
@@ -269,28 +148,6 @@ libcxx/include/__compare/strong_order.h
libcxx/include/__compare/three_way_comparable.h
libcxx/include/__compare/weak_order.h
libcxx/include/complex
-libcxx/include/__concepts/arithmetic.h
-libcxx/include/__concepts/assignable.h
-libcxx/include/__concepts/boolean_testable.h
-libcxx/include/__concepts/class_or_enum.h
-libcxx/include/__concepts/common_reference_with.h
-libcxx/include/__concepts/common_with.h
-libcxx/include/__concepts/constructible.h
-libcxx/include/__concepts/convertible_to.h
-libcxx/include/__concepts/copyable.h
-libcxx/include/__concepts/derived_from.h
-libcxx/include/__concepts/destructible.h
-libcxx/include/__concepts/
diff erent_from.h
-libcxx/include/__concepts/equality_comparable.h
-libcxx/include/__concepts/invocable.h
-libcxx/include/__concepts/movable.h
-libcxx/include/__concepts/predicate.h
-libcxx/include/__concepts/regular.h
-libcxx/include/__concepts/relation.h
-libcxx/include/__concepts/same_as.h
-libcxx/include/__concepts/semiregular.h
-libcxx/include/__concepts/swappable.h
-libcxx/include/__concepts/totally_ordered.h
libcxx/include/condition_variable
libcxx/include/__config
libcxx/include/__coroutine/coroutine_handle.h
@@ -638,125 +495,6 @@ libcxx/include/__tuple/tuple_size.h
libcxx/include/__tuple/tuple_types.h
libcxx/include/typeindex
libcxx/include/typeinfo
-libcxx/include/__type_traits/add_const.h
-libcxx/include/__type_traits/add_cv.h
-libcxx/include/__type_traits/add_lvalue_reference.h
-libcxx/include/__type_traits/add_pointer.h
-libcxx/include/__type_traits/add_volatile.h
-libcxx/include/__type_traits/aligned_storage.h
-libcxx/include/__type_traits/aligned_union.h
-libcxx/include/__type_traits/alignment_of.h
-libcxx/include/__type_traits/can_extract_key.h
-libcxx/include/__type_traits/common_reference.h
-libcxx/include/__type_traits/common_type.h
-libcxx/include/__type_traits/copy_cv.h
-libcxx/include/__type_traits/copy_cvref.h
-libcxx/include/__type_traits/decay.h
-libcxx/include/__type_traits/enable_if.h
-libcxx/include/__type_traits/extent.h
-libcxx/include/__type_traits/has_unique_object_representation.h
-libcxx/include/__type_traits/has_virtual_destructor.h
-libcxx/include/__type_traits/integral_constant.h
-libcxx/include/__type_traits/invoke.h
-libcxx/include/__type_traits/is_abstract.h
-libcxx/include/__type_traits/is_aggregate.h
-libcxx/include/__type_traits/is_allocator.h
-libcxx/include/__type_traits/is_always_bitcastable.h
-libcxx/include/__type_traits/is_arithmetic.h
-libcxx/include/__type_traits/is_array.h
-libcxx/include/__type_traits/is_assignable.h
-libcxx/include/__type_traits/is_base_of.h
-libcxx/include/__type_traits/is_bounded_array.h
-libcxx/include/__type_traits/is_callable.h
-libcxx/include/__type_traits/is_class.h
-libcxx/include/__type_traits/is_compound.h
-libcxx/include/__type_traits/is_constant_evaluated.h
-libcxx/include/__type_traits/is_const.h
-libcxx/include/__type_traits/is_constructible.h
-libcxx/include/__type_traits/is_convertible.h
-libcxx/include/__type_traits/is_copy_assignable.h
-libcxx/include/__type_traits/is_copy_constructible.h
-libcxx/include/__type_traits/is_core_convertible.h
-libcxx/include/__type_traits/is_default_constructible.h
-libcxx/include/__type_traits/is_destructible.h
-libcxx/include/__type_traits/is_empty.h
-libcxx/include/__type_traits/is_enum.h
-libcxx/include/__type_traits/is_final.h
-libcxx/include/__type_traits/is_floating_point.h
-libcxx/include/__type_traits/is_fundamental.h
-libcxx/include/__type_traits/is_implicitly_default_constructible.h
-libcxx/include/__type_traits/is_integral.h
-libcxx/include/__type_traits/is_literal_type.h
-libcxx/include/__type_traits/is_member_function_pointer.h
-libcxx/include/__type_traits/is_member_object_pointer.h
-libcxx/include/__type_traits/is_member_pointer.h
-libcxx/include/__type_traits/is_move_assignable.h
-libcxx/include/__type_traits/is_move_constructible.h
-libcxx/include/__type_traits/is_nothrow_assignable.h
-libcxx/include/__type_traits/is_nothrow_constructible.h
-libcxx/include/__type_traits/is_nothrow_convertible.h
-libcxx/include/__type_traits/is_nothrow_copy_assignable.h
-libcxx/include/__type_traits/is_nothrow_copy_constructible.h
-libcxx/include/__type_traits/is_nothrow_default_constructible.h
-libcxx/include/__type_traits/is_nothrow_destructible.h
-libcxx/include/__type_traits/is_nothrow_move_assignable.h
-libcxx/include/__type_traits/is_nothrow_move_constructible.h
-libcxx/include/__type_traits/is_null_pointer.h
-libcxx/include/__type_traits/is_object.h
-libcxx/include/__type_traits/is_pod.h
-libcxx/include/__type_traits/is_pointer.h
-libcxx/include/__type_traits/is_polymorphic.h
-libcxx/include/__type_traits/is_primary_template.h
-libcxx/include/__type_traits/is_reference.h
-libcxx/include/__type_traits/is_reference_wrapper.h
-libcxx/include/__type_traits/is_same.h
-libcxx/include/__type_traits/is_scalar.h
-libcxx/include/__type_traits/is_scoped_enum.h
-libcxx/include/__type_traits/is_signed.h
-libcxx/include/__type_traits/is_signed_integer.h
-libcxx/include/__type_traits/is_standard_layout.h
-libcxx/include/__type_traits/is_swappable.h
-libcxx/include/__type_traits/is_trivial.h
-libcxx/include/__type_traits/is_trivially_assignable.h
-libcxx/include/__type_traits/is_trivially_constructible.h
-libcxx/include/__type_traits/is_trivially_copyable.h
-libcxx/include/__type_traits/is_trivially_copy_assignable.h
-libcxx/include/__type_traits/is_trivially_copy_constructible.h
-libcxx/include/__type_traits/is_trivially_default_constructible.h
-libcxx/include/__type_traits/is_trivially_destructible.h
-libcxx/include/__type_traits/is_unbounded_array.h
-libcxx/include/__type_traits/is_union.h
-libcxx/include/__type_traits/is_unsigned.h
-libcxx/include/__type_traits/is_unsigned_integer.h
-libcxx/include/__type_traits/is_valid_expansion.h
-libcxx/include/__type_traits/is_void.h
-libcxx/include/__type_traits/is_volatile.h
-libcxx/include/__type_traits/lazy.h
-libcxx/include/__type_traits/make_32_64_or_128_bit.h
-libcxx/include/__type_traits/make_const_lvalue_ref.h
-libcxx/include/__type_traits/make_signed.h
-libcxx/include/__type_traits/make_unsigned.h
-libcxx/include/__type_traits/maybe_const.h
-libcxx/include/__type_traits/nat.h
-libcxx/include/__type_traits/negation.h
-libcxx/include/__type_traits/noexcept_move_assign_container.h
-libcxx/include/__type_traits/promote.h
-libcxx/include/__type_traits/rank.h
-libcxx/include/__type_traits/remove_all_extents.h
-libcxx/include/__type_traits/remove_const.h
-libcxx/include/__type_traits/remove_cv.h
-libcxx/include/__type_traits/remove_cvref.h
-libcxx/include/__type_traits/remove_extent.h
-libcxx/include/__type_traits/remove_pointer.h
-libcxx/include/__type_traits/remove_reference.h
-libcxx/include/__type_traits/remove_volatile.h
-libcxx/include/__type_traits/result_of.h
-libcxx/include/__type_traits/strip_signature.h
-libcxx/include/__type_traits/type_identity.h
-libcxx/include/__type_traits/type_list.h
-libcxx/include/__type_traits/underlying_type.h
-libcxx/include/__type_traits/unwrap_ref.h
-libcxx/include/__type_traits/void_t.h
libcxx/include/uchar.h
libcxx/include/unordered_map
libcxx/include/unordered_set
More information about the libcxx-commits
mailing list