Skip to content

Commit dd47090

Browse files
committed
Constrain remove_none to require a value type that is optional-like
1 parent 7806294 commit dd47090

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

source/containers/algorithms/remove_none.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,8 +150,14 @@ struct remove_none_iterator {
150150
[[no_unique_address]] data_t m_data;
151151
};
152152

153+
template<typename T>
154+
concept optional_type = requires(T value) {
155+
*value;
156+
value ? void() : void();
157+
};
158+
153159
// This goes from range<optional<T>> to range<T>
154-
export template<range Range>
160+
export template<range Range> requires optional_type<containers::range_reference_t<Range>>
155161
struct remove_none {
156162
constexpr explicit remove_none(Range && input):
157163
m_data(OPERATORS_FORWARD(input))

0 commit comments

Comments
 (0)