Skip to content

Commit c4cbcb8

Browse files
committed
Replace any/all with fold expressions
1 parent 0a68255 commit c4cbcb8

File tree

6 files changed

+11
-55
lines changed

6 files changed

+11
-55
lines changed

include/cpp-sort/adapters/hybrid_adapter.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
#include <cpp-sort/sorter_facade.h>
1717
#include <cpp-sort/sorter_traits.h>
1818
#include <cpp-sort/utility/adapter_storage.h>
19-
#include "../detail/any_all.h"
2019
#include "../detail/checkers.h"
2120
#include "../detail/iterator_traits.h"
2221
#include "../detail/type_traits.h"
@@ -224,7 +223,7 @@ namespace cppsort
224223
detail::check_is_always_stable<Sorters...>,
225224
detail::sorter_facade_fptr<
226225
hybrid_adapter_impl<Sorters...>,
227-
detail::all(std::is_empty<Sorters>::value...)
226+
(std::is_empty<Sorters>::value && ...)
228227
>
229228
{
230229
private:

include/cpp-sort/adapters/small_array_adapter.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
#include <utility>
1515
#include <cpp-sort/sorter_facade.h>
1616
#include <cpp-sort/sorter_traits.h>
17-
#include "../detail/any_all.h"
1817
#include "../detail/type_traits.h"
1918

2019
namespace cppsort
@@ -62,7 +61,7 @@ namespace cppsort
6261
fixed_sorter_traits<FixedSizeSorter>,
6362
detail::sorter_facade_fptr<
6463
small_array_adapter<FixedSizeSorter, std::index_sequence<Indices...>>,
65-
detail::all(std::is_empty<FixedSizeSorter<Indices>>::value...)
64+
(std::is_empty<FixedSizeSorter<Indices>>::value && ...)
6665
>
6766
{
6867
template<typename T, std::size_t N, typename... Args>

include/cpp-sort/detail/any_all.h

Lines changed: 0 additions & 39 deletions
This file was deleted.

include/cpp-sort/detail/checkers.h

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
////////////////////////////////////////////////////////////
1111
#include <type_traits>
1212
#include <cpp-sort/sorter_traits.h>
13-
#include "any_all.h"
1413
#include "raw_checkers.h"
1514

1615
namespace cppsort
@@ -34,7 +33,7 @@ namespace detail
3433
template<typename... Sorters>
3534
struct check_iterator_category:
3635
check_iterator_category_impl<
37-
all(has_iterator_category<sorter_traits<Sorters>>::value...),
36+
(has_iterator_category<sorter_traits<Sorters>>::value && ...),
3837
Sorters...
3938
>
4039
{};
@@ -46,14 +45,14 @@ namespace detail
4645
struct check_is_always_stable_impl<true, Sorters...>
4746
{
4847
using is_always_stable = std::bool_constant<
49-
all(typename sorter_traits<Sorters>::is_always_stable{}()...)
48+
(typename sorter_traits<Sorters>::is_always_stable{}() && ...)
5049
>;
5150
};
5251

5352
template<typename... Sorters>
5453
struct check_is_always_stable:
5554
check_is_always_stable_impl<
56-
all(has_is_always_stable<sorter_traits<Sorters>>::value...),
55+
(has_is_always_stable<sorter_traits<Sorters>>::value && ...),
5756
Sorters...
5857
>
5958
{};

include/cpp-sort/detail/raw_checkers.h

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
// Headers
1010
////////////////////////////////////////////////////////////
1111
#include <type_traits>
12-
#include "any_all.h"
1312
#include "type_traits.h"
1413

1514
namespace cppsort
@@ -47,7 +46,7 @@ namespace detail
4746
template<typename... Sorters>
4847
struct raw_check_iterator_category:
4948
raw_check_iterator_category_impl<
50-
all(has_iterator_category<Sorters>::value...),
49+
(has_iterator_category<Sorters>::value && ...),
5150
Sorters...
5251
>
5352
{};
@@ -72,14 +71,14 @@ namespace detail
7271
struct raw_check_is_always_stable_impl<true, Sorters...>
7372
{
7473
using is_always_stable = std::bool_constant<
75-
all(typename Sorters::is_always_stable{}()...)
74+
(typename Sorters::is_always_stable{}() && ...)
7675
>;
7776
};
7877

7978
template<typename... Sorters>
8079
struct raw_check_is_always_stable:
8180
raw_check_is_always_stable_impl<
82-
all(has_is_always_stable<Sorters>::value...),
81+
(has_is_always_stable<Sorters>::value && ...),
8382
Sorters...
8483
>
8584
{};
@@ -112,7 +111,7 @@ namespace detail
112111
template<typename... TT>
113112
struct raw_check_is_transparent:
114113
raw_check_is_transparent_impl<
115-
all(has_is_transparent<TT>::value...)
114+
(has_is_transparent<TT>::value && ...)
116115
>
117116
{};
118117
}}

include/cpp-sort/detail/schwartz_small_array.h

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2016-2023 Morwenn
2+
* Copyright (c) 2016-2025 Morwenn
33
* SPDX-License-Identifier: MIT
44
*/
55
#ifndef CPPSORT_ADAPTERS_SCHWARTZ_SMALL_ARRAY_H_
@@ -14,7 +14,6 @@
1414
#include <utility>
1515
#include <cpp-sort/sorter_facade.h>
1616
#include <cpp-sort/sorter_traits.h>
17-
#include "any_all.h"
1817
#include "type_traits.h"
1918

2019
namespace cppsort
@@ -29,7 +28,7 @@ namespace cppsort
2928
fixed_sorter_traits<FixedSizeSorter>,
3029
detail::sorter_facade_fptr<
3130
schwartz_adapter<small_array_adapter<FixedSizeSorter, std::index_sequence<Indices...>>>,
32-
detail::all(std::is_empty<FixedSizeSorter<Indices>>::value...)
31+
(std::is_empty<FixedSizeSorter<Indices>>::value && ...)
3332
>
3433
{
3534
template<typename T, std::size_t N, typename... Args>

0 commit comments

Comments
 (0)