Skip to content

Commit

Permalink
constexpr drop_merge_adapter (#58)
Browse files Browse the repository at this point in the history
  • Loading branch information
Morwenn committed Jan 7, 2024
1 parent e9163ac commit d48b6fc
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 8 deletions.
6 changes: 3 additions & 3 deletions include/cpp-sort/adapters/drop_merge_adapter.h
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2022 Morwenn
* Copyright (c) 2022-2024 Morwenn
* SPDX-License-Identifier: MIT
*/
#ifndef CPPSORT_ADAPTERS_DROP_MERGE_ADAPTER_H_
Expand Down Expand Up @@ -42,8 +42,8 @@ namespace cppsort
typename Projection = std::identity
>
requires is_projection_iterator_v<Projection, Iterator, Compare>
auto operator()(Iterator first, Sentinel last,
Compare compare={}, Projection projection={}) const
constexpr auto operator()(Iterator first, Sentinel last,
Compare compare={}, Projection projection={}) const
-> Iterator
{
return drop_merge_sort(std::move(first), std::move(last),
Expand Down
6 changes: 3 additions & 3 deletions include/cpp-sort/detail/drop_merge_sort.h
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2017-2022 Morwenn
* Copyright (c) 2017-2024 Morwenn
* SPDX-License-Identifier: MIT
*/

Expand Down Expand Up @@ -44,8 +44,8 @@ namespace cppsort::detail
typename Projection,
typename Sorter
>
auto drop_merge_sort(BidirectionalIterator first, Sentinel last,
Compare compare, Projection projection, Sorter&& sorter)
constexpr auto drop_merge_sort(BidirectionalIterator first, Sentinel last,
Compare compare, Projection projection, Sorter&& sorter)
-> BidirectionalIterator
{
using difference_type = mstd::iter_difference_t<BidirectionalIterator>;
Expand Down
5 changes: 3 additions & 2 deletions tests/adapters/every_adapter_constexpr.cpp
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2022 Morwenn
* Copyright (c) 2022-2024 Morwenn
* SPDX-License-Identifier: MIT
*/
#include <cstddef>
Expand Down Expand Up @@ -28,7 +28,8 @@ namespace
}

TEMPLATE_TEST_CASE( "test most adapters in a constexpr context", "[adapters][constexpr]",
cppsort::hybrid_adapter<cppsort::insertion_sorter> )
cppsort::hybrid_adapter<cppsort::insertion_sorter>,
cppsort::drop_merge_adapter<cppsort::insertion_sorter> )
{
constexpr bool is_sorted = test_constexpr_sorter<TestType>();
STATIC_CHECK( is_sorted );
Expand Down

0 comments on commit d48b6fc

Please sign in to comment.