Skip to content

Commit d4345b9

Browse files
committed
Make three_way_compare constructor explicit
1 parent 51ac3e8 commit d4345b9

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

include/cpp-sort/detail/three_way_compare.h

+7-7
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2016-2020 Morwenn
2+
* Copyright (c) 2016-2025 Morwenn
33
* SPDX-License-Identifier: MIT
44
*/
55
#ifndef CPPSORT_DETAIL_THREE_WAY_COMPARE_H_
@@ -83,7 +83,7 @@ namespace detail
8383
{
8484
public:
8585

86-
constexpr three_way_compare(Compare compare):
86+
constexpr explicit three_way_compare(Compare compare):
8787
compare(std::move(compare))
8888
{}
8989

@@ -102,7 +102,7 @@ namespace detail
102102
struct three_way_compare<Compare, true>:
103103
three_way_compare_base<three_way_compare<Compare>>
104104
{
105-
constexpr three_way_compare(Compare) {}
105+
constexpr explicit three_way_compare(Compare) {}
106106

107107
using three_way_compare_base<three_way_compare<Compare>>::operator();
108108

@@ -118,7 +118,7 @@ namespace detail
118118
struct three_way_compare<std::less<>, true>:
119119
three_way_compare_base<three_way_compare<std::less<>>>
120120
{
121-
constexpr three_way_compare(std::less<>) {}
121+
constexpr explicit three_way_compare(std::less<>) {}
122122

123123
using three_way_compare_base<three_way_compare<std::less<>>>::operator();
124124

@@ -146,7 +146,7 @@ namespace detail
146146
struct three_way_compare<std::ranges::less, true>:
147147
three_way_compare_base<three_way_compare<std::ranges::less>>
148148
{
149-
constexpr three_way_compare(std::ranges::less) {}
149+
constexpr explicit three_way_compare(std::ranges::less) {}
150150

151151
using three_way_compare_base<three_way_compare<std::ranges::less>>::operator();
152152

@@ -174,7 +174,7 @@ namespace detail
174174
struct three_way_compare<std::greater<>, true>:
175175
three_way_compare_base<three_way_compare<std::greater<>>>
176176
{
177-
constexpr three_way_compare(std::greater<>) {}
177+
constexpr explicit three_way_compare(std::greater<>) {}
178178

179179
using three_way_compare_base<three_way_compare<std::greater<>>>::operator();
180180

@@ -203,7 +203,7 @@ namespace detail
203203
struct three_way_compare<std::ranges::greater, true>:
204204
three_way_compare_base<three_way_compare<std::ranges::greater>>
205205
{
206-
constexpr three_way_compare(std::ranges::greater) {}
206+
constexpr explicit three_way_compare(std::ranges::greater) {}
207207

208208
using three_way_compare_base<three_way_compare<std::ranges::greater>>::operator();
209209

0 commit comments

Comments
 (0)