Skip to content

Commit d2a7527

Browse files
author
Hana Dusíková
committed
remove optional (to support older xcode)
1 parent 5a30fc8 commit d2a7527

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

tests/cnttp.cpp

+4-6
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,19 @@
11
#include <iostream>
22
#include <ctre.hpp>
33
#include <string_view>
4-
#include <optional>
54

5+
struct name { bool has; std::string_view first, family; };
66

7-
struct name { std::string_view first, family; };
8-
9-
std::optional<name> extract(std::string_view sv) noexcept {
7+
name extract(std::string_view sv) noexcept {
108
#if __cpp_nontype_template_parameter_class
119
if (auto [re,f,l] = ctre::match<"([A-Za-z]+?),([A-Za-z]+?)">(sv); re) {
1210
#else
1311
using namespace ctre::literals;
1412
if (auto [re,f,l] = "([A-Za-z]+?),([A-Za-z]+?)"_ctre.match(sv); re) {
1513
#endif
16-
return name{f,l};
14+
return name{true, f,l};
1715
} else {
18-
return std::nullopt;
16+
return name{false, std::string_view(), std::string_view()};
1917
}
2018
}
2119

0 commit comments

Comments
 (0)