Skip to content

Commit b0e77fb

Browse files
committed
Remove template diamond when unneeded
1 parent 95d8ae0 commit b0e77fb

File tree

63 files changed

+507
-507
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

63 files changed

+507
-507
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,8 @@ int main()
6969
> sorter;
7070

7171
// Sort li and vec in reverse order using their value member
72-
sorter(li, std::greater<>{}, &wrapper::value);
73-
sorter(vec, std::greater<>{}, &wrapper::value);
72+
sorter(li, std::greater{}, &wrapper::value);
73+
sorter(vec, std::greater{}, &wrapper::value);
7474

7575
assert(std::equal(
7676
li.begin(), li.end(),

docs/Comparator-adapters.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ It is accompanied by a `make_projection_compare` function template to avoid havi
103103
```cpp
104104
// Sort a family from older to younger member
105105
std::vector<Person> family = { /* ... */ };
106-
std::sort(family.begin(), family.end(), cppsort::make_projection_compare(std::greater<>{}, &Person::age));
106+
std::sort(family.begin(), family.end(), cppsort::make_projection_compare(std::greater{}, &Person::age));
107107
```
108108
109109
`projection_compare<C, P>` has the following member functions:

docs/Library-nomenclature.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
* *Comparison function*: most of the sorting algorithms in the library are comparison sorts. It means that the algorithm uses a comparison function to know the order of the elements and sort them accordingly; such a comparison function shall take two values and have a return type convertible to `bool`. The available sorting algorithms transform comparison functions on the fly so that some pointers to member functions can also be used as comparison functions, as if called with [`std::invoke`][std-invoke]. The default comparison function used by the sorting algorithms is [`std::less<>`][std-less-void]. Many sorters can take a comparison function as an additional parameter. For example, using `std::greater<>` instead of the default comparison function would sort a collection in descending order.
1010

11-
cppsort::heap_sort(collection, std::greater<>{});
11+
cppsort::heap_sort(collection, std::greater{});
1212

1313
Some algorithms don't accept such an additional parameter. It may be because they implement a non-comparison sort instead, a sorting algorithm that uses other properties of the elements to perform the sort rather than a comparison function (for example a [radix sort][radix-sort]).
1414

@@ -43,7 +43,7 @@
4343
* *Sorter*: [sorters][sorters] are the protagonists in this library. They are function objects implementing specific sorting algorithms. Their `operator()` is overloaded so that it can handle iterables or pairs of iterators, and conditionally overloaded so that it can handle user-provided comparison and/or projection functions (see *unified sorting interface*).
4444

4545
cppsort::pdq_sorter{}(std::begin(collection), std::end(collection),
46-
std::greater<>{}, &wrapper::value);
46+
std::greater{}, &wrapper::value);
4747

4848
* *Sorter adapter*: [sorter adapters][sorter-adapters] are class templates that take one or several sorters and produce a new sorter from the parameters. What a sorter adapter can do is not constrained, but they are generally expected to behave like sorters themselves. For example, **cpp-sort** contains adapters to count the number of comparisons performed by a sorting algorithms or to aggregate several sorters together. The best way to learn more about them is still to read the dedicated section of the documentation.
4949

docs/Measures-of-presortedness.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,8 @@ In **cpp-sort**, measures of presortedness are implemented as instances of some
4343
using namespace cppsort;
4444
auto a = probe::inv(collection);
4545
auto b = probe::rem(vec.begin(), vec.end());
46-
auto c = probe::ham(li, std::greater<>{});
47-
auto d = probe::runs(integers, std::negate<>{});
46+
auto c = probe::ham(li, std::greater{});
47+
auto d = probe::runs(integers, std::negate{});
4848
```
4949

5050
Note however that most of these algorithms can be expensive. Using them before an actual sorting algorithm has little interest if any. They are instead meant to be profiling tools: when sorting is a critical part of your application, you can use these measures on typical data and check whether it is mostly sorted according to one measure or another, then you may be able to find a sorting algorithm known to be optimal with regard to this specific measure.

docs/Quickstart.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,11 +51,11 @@ int main()
5151
// Sort using operator<(Person, Person)
5252
quick_sort(persons);
5353
// Sort in reverse order usinig operator<(Person, Person)
54-
quick_sort(persons, cppsort::flip(std::less<>{}));
54+
quick_sort(persons, cppsort::flip(std::less{}));
5555
// Sort the first half of the collection from youngest to oldest
5656
quick_sort(std::begin(persons), persons+50, &Person::age);
5757
// Sort the second half of the collection from older to youngest
58-
quick_sort(persons+50, std::end(persons), std::greater<>{}, &Person::age);
58+
quick_sort(persons+50, std::end(persons), std::greater{}, &Person::age);
5959

6060
std::list<Person> li(std::begin(persons), std::end(persons));
6161
// quick_sort also works on bidirectional (and forward) iterators

docs/Writing-a-sorter.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ This kind of comparison sorters help to compare things that don't have an overlo
153153
154154
```cpp
155155
// Sort collection in reverse order with std::sort
156-
cppsort::std_sort(collection, std::greater<>{});
156+
cppsort::std_sort(collection, std::greater{});
157157
```
158158

159159
It is worth noting that every *comparison sorter* provided by the library transforms the comparison parameter with [`utility::as_function`][utility-as-function] before actually using it. It allows to use pointers to member functions of the `lhs.compare_to(rhs)` kind out-of-the-box.
@@ -278,7 +278,7 @@ struct counting_sorter_impl
278278
Until there, everything is fine. However, imagine that the library where we found the `counting_sort` function also provides its evil twin, to which we will give the inventive name of `reverse_counting_sort`, meant to sort a collection of integers in descending order. We would like to take advantage of this function too, but all the rules defined in the previous sections make it pretty clear that we can't write a `reverse_counting_sorter` since such a sorter wouldn't satisfy the `std::is_sorted` guarantee that every sorter should satisfy. Note however that, after having reverse-sorted a collection of integers, the following assertion should hold:
279279

280280
```cpp
281-
assert( std::is_sorted(std::begin(collection), std::end(collection), std::greater<>{}) );
281+
assert( std::is_sorted(std::begin(collection), std::end(collection), std::greater{}) );
282282
```
283283

284284
We would like our `counting_sorter` to reverse-sort a collection when given `std::greater<>` as a comparison function, but there is no way it can handle arbitrary comparison functions. Well... let's just make it handle specific comparison functions then:

examples/bubble_sorter.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,6 @@ int main()
121121
// Bubble sort the collection
122122
bubble_sort(to_sort, projection);
123123
// Check that it is sorted in descending order
124-
assert(std::is_sorted(to_sort.begin(), to_sort.end(), std::greater<>{}));
124+
assert(std::is_sorted(to_sort.begin(), to_sort.end(), std::greater{}));
125125
} while (std::next_permutation(collection.begin(), collection.end()));
126126
}

examples/readme_example.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ int main()
2525
> sorter;
2626

2727
// Sort li and vec in reverse order using their value member
28-
sorter(li, std::greater<>{}, &wrapper::value);
29-
sorter(vec, std::greater<>{}, &wrapper::value);
28+
sorter(li, std::greater{}, &wrapper::value);
29+
sorter(vec, std::greater{}, &wrapper::value);
3030

3131
assert(std::equal(
3232
li.begin(), li.end(),

include/cpp-sort/adapters/container_aware_adapter.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -201,12 +201,12 @@ namespace cppsort
201201
Stability,
202202
std::false_type,
203203
decltype(detail::adl_despair{}(this->get(), iterable,
204-
std::less<>{}, std::move(projection)))
204+
std::less{}, std::move(projection)))
205205
>
206206
>
207207
{
208208
return detail::adl_despair{}(this->get(), iterable,
209-
std::less<>{}, std::move(projection));
209+
std::less{}, std::move(projection));
210210
}
211211

212212
template<
@@ -227,12 +227,12 @@ namespace cppsort
227227
Stability,
228228
std::false_type,
229229
decltype(detail::adl_despair{}(this->get(), iterable,
230-
make_projection_compare(std::less<>{}, std::move(projection))))
230+
make_projection_compare(std::less{}, std::move(projection))))
231231
>
232232
>
233233
{
234234
return detail::adl_despair{}(this->get(), iterable,
235-
make_projection_compare(std::less<>{}, std::move(projection)));
235+
make_projection_compare(std::less{}, std::move(projection)));
236236
}
237237

238238
template<

include/cpp-sort/detail/container_aware/insertion_sort.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2016-2021 Morwenn
2+
* Copyright (c) 2016-2025 Morwenn
33
* SPDX-License-Identifier: MIT
44
*/
55
#ifndef CPPSORT_DETAIL_CONTAINER_AWARE_INSERTION_SORT_H_
@@ -116,7 +116,7 @@ namespace cppsort
116116
auto operator()(std::list<Args...>& iterable) const
117117
-> void
118118
{
119-
detail::list_insertion_sort(iterable, std::less<>{}, utility::identity{});
119+
detail::list_insertion_sort(iterable, std::less{}, utility::identity{});
120120
}
121121

122122
template<typename Compare, typename... Args>
@@ -134,7 +134,7 @@ namespace cppsort
134134
is_projection_v<Projection, std::list<Args...>>
135135
>
136136
{
137-
detail::list_insertion_sort(iterable, std::less<>{}, std::move(projection));
137+
detail::list_insertion_sort(iterable, std::less{}, std::move(projection));
138138
}
139139

140140
template<
@@ -159,7 +159,7 @@ namespace cppsort
159159
auto operator()(std::forward_list<Args...>& iterable) const
160160
-> void
161161
{
162-
detail::flist_insertion_sort(iterable, std::less<>{}, utility::identity{});
162+
detail::flist_insertion_sort(iterable, std::less{}, utility::identity{});
163163
}
164164

165165
template<typename Compare, typename... Args>
@@ -177,7 +177,7 @@ namespace cppsort
177177
is_projection_v<Projection, std::forward_list<Args...>>
178178
>
179179
{
180-
detail::flist_insertion_sort(iterable, std::less<>{}, std::move(projection));
180+
detail::flist_insertion_sort(iterable, std::less{}, std::move(projection));
181181
}
182182

183183
template<

0 commit comments

Comments
 (0)