Skip to content

Commit 6715802

Browse files
fix blur_until in string_parse
1 parent aaea7dc commit 6715802

File tree

1 file changed

+16
-6
lines changed

1 file changed

+16
-6
lines changed

string_parse.hpp

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -140,16 +140,26 @@ namespace mlib
140140
}(std::make_index_sequence<str.size()>{});
141141
}
142142

143+
template<auto blur, auto other, auto until, auto index>
144+
constexpr auto when_less_than_idx() const noexcept
145+
{
146+
if constexpr (index < X)
147+
{
148+
return blur;
149+
}
150+
else
151+
{
152+
return other;
153+
}
154+
}
155+
143156
template<char c, int X>
144157
constexpr auto blur_until() const noexcept
145158
{
146-
/*
147-
constexpr auto first_string = [&]<std::size_t... indexes>(std::index_sequence<indexes...>)
159+
return [] <std::size_t... indexes>(std::index_sequence<indexes...>)
148160
{
149-
return std::array{(function_return_index<c, indexes>())..., '\0'};
150-
}(std::make_index_sequence<X>{});
151-
constexpr auto second_string = substr<X, str.size()>();
152-
*/
161+
return std::array{ (when_less_than_idx<c, s.data[indexes], X, indexes>{})... };
162+
}(std::make_index_sequence<str.size()>{});
153163
}
154164

155165
template<auto lambda>

0 commit comments

Comments
 (0)