Skip to content

Commit 2281bdb

Browse files
committed
static_assert without a message
1 parent 9cd70c6 commit 2281bdb

File tree

4 files changed

+15
-15
lines changed

4 files changed

+15
-15
lines changed

docs/Sorter-traits.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ When a sorter adapter is used, the *resulting sorter* is considered always stabl
153153
template<typename>
154154
struct is_stable;
155155

156-
template<typename Sorter, typename Args>
156+
template<typename Sorter, typename Args>
157157
struct is_stable<Sorter(Args...)>:
158158
sorter_traits<Sorter>::is_always_stable
159159
{};
@@ -166,7 +166,7 @@ This trait is a more flexible version of [`is_always_stable`][is-always-stable]:
166166
167167
```cpp
168168
using sorter = self_sort_adapter<heap_sorter>;
169-
static_assert(is_stable<sorter(std::list<int>&)>, "");
169+
static_assert(is_stable<sorter(std::list<int>&)>);
170170
```
171171

172172
[`self_sort_adapter`][self-sort-adapter] is a [*sorter adapter*][sorter-adapters] that checks whether a container can sort itself and, if so, uses the container's sorting method instead of the *adapted sorter*. As a matter of fact, [`std::list::sort`][std-list-sort] implements a stable sorting algorithm and **cpp-sort** specializes `is_stable` to take that information into account, so `is_stable_v<sorter(std::list<int>&)>` is `true` despite `is_always_stable_v<sorter>` being `false`. However, `is_stable_v<sorter(std::vector<int>&)>` and `is_stable_v<sorter(std::list<int>::iterator, std::list<int>::iterator)>` remain `false`.

include/cpp-sort/detail/memcpy_cast.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2017 Morwenn
2+
* Copyright (c) 2017-2025 Morwenn
33
* SPDX-License-Identifier: MIT
44
*/
55
#ifndef CPPSORT_DETAIL_MEMCPY_CAST_H_
@@ -20,9 +20,9 @@ namespace detail
2020
auto memcpy_cast(const From& value)
2121
-> To
2222
{
23-
static_assert(std::is_trivially_copyable<From>::value, "");
24-
static_assert(std::is_trivially_copyable<To>::value, "");
25-
static_assert(sizeof(From) == sizeof(To), "");
23+
static_assert(std::is_trivially_copyable<From>::value);
24+
static_assert(std::is_trivially_copyable<To>::value);
25+
static_assert(sizeof(From) == sizeof(To));
2626

2727
To result;
2828
std::memcpy(std::addressof(result),

include/cpp-sort/detail/spreadsort/detail/common.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2015-2022 Morwenn
2+
* Copyright (c) 2015-2025 Morwenn
33
* SPDX-License-Identifier: MIT
44
*/
55

@@ -65,13 +65,13 @@ namespace detail
6565
constexpr unsigned min_size = log_mean_bin_size + log_min_split_count;
6666
//Assuring that constants have valid settings
6767
static_assert(log_min_split_count <= max_splits &&
68-
log_min_split_count > 0, "");
68+
log_min_split_count > 0);
6969
static_assert(max_splits > 1 &&
70-
max_splits < (8 * sizeof(unsigned)), "");
70+
max_splits < (8 * sizeof(unsigned)));
7171
static_assert(max_finishing_splits >= max_splits &&
72-
max_finishing_splits < (8 * sizeof(unsigned)), "");
73-
static_assert(log_mean_bin_size >= 0, "");
74-
static_assert(log_finishing_count >= 0, "");
72+
max_finishing_splits < (8 * sizeof(unsigned)));
73+
static_assert(log_mean_bin_size >= 0);
74+
static_assert(log_finishing_count >= 0);
7575
//if we can complete in one iteration, do so
7676
//This first check allows the compiler to optimize never-executed code out
7777
if (log_finishing_count < min_size) {

include/cpp-sort/detail/spreadsort/detail/string_sort.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2015-2022 Morwenn
2+
* Copyright (c) 2015-2025 Morwenn
33
* SPDX-License-Identifier: MIT
44
*/
55

@@ -109,7 +109,7 @@ namespace spreadsort
109109

110110
std::size_t minSize = (std::min)(proj_x.size(), proj_y.size());
111111
for (std::size_t u = std::get<0>(data); u < minSize; ++u) {
112-
static_assert(sizeof(proj_x[u]) == sizeof(Unsigned_char_type), "");
112+
static_assert(sizeof(proj_x[u]) == sizeof(Unsigned_char_type));
113113
if (static_cast<Unsigned_char_type>(proj_x[u]) != static_cast<Unsigned_char_type>(proj_y[u])) {
114114
return static_cast<Unsigned_char_type>(proj_x[u]) <
115115
static_cast<Unsigned_char_type>(proj_y[u]);
@@ -140,7 +140,7 @@ namespace spreadsort
140140

141141
std::size_t minSize = (std::min)(proj_x.size(), proj_y.size());
142142
for (std::size_t u = std::get<0>(data); u < minSize; ++u) {
143-
static_assert(sizeof(proj_x[u]) == sizeof(Unsigned_char_type), "");
143+
static_assert(sizeof(proj_x[u]) == sizeof(Unsigned_char_type));
144144
if (static_cast<Unsigned_char_type>(proj_x[u]) != static_cast<Unsigned_char_type>(proj_y[u])) {
145145
return static_cast<Unsigned_char_type>(proj_x[u]) >
146146
static_cast<Unsigned_char_type>(proj_y[u]);

0 commit comments

Comments
 (0)