Skip to content

Commit 2c7fb86

Browse files
committed
Use [[maybe_unused]] (#66)
1 parent 93c7ad2 commit 2c7fb86

File tree

3 files changed

+3
-6
lines changed

3 files changed

+3
-6
lines changed

include/cpp-sort/detail/memory.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -143,13 +143,12 @@ namespace cppsort::detail
143143
}
144144

145145
template<typename T>
146-
auto return_temporary_buffer(T* ptr, std::size_t count) noexcept
146+
auto return_temporary_buffer(T* ptr, [[maybe_unused]] std::size_t count) noexcept
147147
-> void
148148
{
149149
#ifdef __cpp_sized_deallocation
150150
::operator delete(ptr, count * sizeof(T));
151151
#else
152-
(void)count;
153152
::operator delete(ptr);
154153
#endif
155154
}

include/cpp-sort/detail/swap_ranges.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,7 @@ namespace cppsort::detail
7676
{
7777
CPPSORT_ASSERT(first1 <= last1);
7878

79-
auto last2 = first2 + (last1 - first1);
80-
(void)last2;
79+
[[maybe_unused]] auto last2 = first2 + (last1 - first1);
8180
CPPSORT_ASSERT(not (first2 >= first1 && first2 < last1));
8281
CPPSORT_ASSERT(not (last2 > first1 && last2 <= last1));
8382

include/cpp-sort/utility/apply_permutation.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,13 @@
1717
namespace cppsort::utility
1818
{
1919
template<typename RandomAccessIterator1, typename RandomAccessIterator2>
20-
auto apply_permutation(RandomAccessIterator1 first, RandomAccessIterator1 last,
20+
auto apply_permutation(RandomAccessIterator1 first, [[maybe_unused]] RandomAccessIterator1 last,
2121
RandomAccessIterator2 indices_first, RandomAccessIterator2 indices_last)
2222
-> void
2323
{
2424
using difference_type = cppsort::detail::difference_type_t<RandomAccessIterator1>;
2525
using utility::iter_move;
2626
CPPSORT_ASSERT( (last - first) == (indices_last - indices_first) );
27-
(void)last;
2827

2928
auto size = indices_last - indices_first;
3029
for (difference_type idx = 0; idx < size; ++idx) {

0 commit comments

Comments
 (0)