File tree Expand file tree Collapse file tree 1 file changed +4
-6
lines changed Expand file tree Collapse file tree 1 file changed +4
-6
lines changed Original file line number Diff line number Diff line change 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
You can’t perform that action at this time.
0 commit comments