42 static constexpr auto value = [] {
43 constexpr std::string_view view{S};
44 constexpr auto group_count =
45 std::count_if(S.begin(), S.end(), [](
char c) { return Delimiter.contains(c); }) + 1;
46 std::array<std::string_view, group_count> result{};
48 auto iter = result.begin();
50 for (std::size_t start_index = 0, end_index = view.find_first_of(Delimiter);;
51 start_index = end_index + 1, end_index = view.find_first_of(Delimiter, start_index)) {
52 *(iter++) = view.substr(start_index, end_index - start_index);
54 if (end_index == std::string_view::npos) {
78 static constexpr std::string_view view{S};
79 static constexpr auto value = [] {
80 constexpr auto group_count = [] {
84 while ((index = view.find(Delimiter, index)) != std::string_view::npos) {
86 index += Delimiter.size();
91 std::array<std::string_view, group_count> result{};
93 auto iter = result.begin();
95 for (std::size_t start_index = 0, end_index = view.find(Delimiter);;
96 start_index = end_index + Delimiter.size(), end_index = view.find(Delimiter, start_index)) {
97 *(iter++) = view.substr(start_index, end_index - start_index);
99 if (end_index == std::string_view::npos) {
123 static constexpr auto value = [] {
124 struct removal_metadata {
126 std::size_t actual_size;
129 constexpr auto metadata = [] {
131 auto removal_end = std::remove(result.begin(), result.end(), C);
133 return removal_metadata{
134 .result = std::move(result),
135 .actual_size =
static_cast<std::size_t
>(removal_end - result.begin()),
141 std::copy(metadata.result.begin(), metadata.result.begin() + metadata.actual_size, result.begin());
162 static constexpr auto groups = split_v<S, Removal>;
163 static constexpr auto value = [] {
164 return []<std::size_t... Is>(std::index_sequence<Is...>) {
166 std::span<
const char, groups[Is].size()>{groups[Is].data(), groups[Is].size()}...};
167 }(std::make_index_sequence<groups.size()>{});