cmdopt2/args: acceptor should take a char*
This commit is contained in:
parent
11dc485c88
commit
86eafa366d
@ -24,7 +24,7 @@ namespace cruft::cmdopt2 {
|
||||
std::optional<std::string> description;
|
||||
bool required_ = false;
|
||||
|
||||
using acceptor1_t = std::function<void(std::string_view)>;
|
||||
using acceptor1_t = std::function<void(char const *)>;
|
||||
std::optional<acceptor1_t> acceptor1;
|
||||
};
|
||||
|
||||
@ -44,9 +44,9 @@ namespace cruft::cmdopt2 {
|
||||
{
|
||||
CHECK (!acceptor1);
|
||||
if constexpr (parseable<ValueT>) {
|
||||
acceptor1 = [&ref] (std::string_view str) { ref = str; };
|
||||
acceptor1 = [&ref] (char const* str) { ref = parse::from_string<ValueT> (str); };
|
||||
} else {
|
||||
acceptor1 = [&ref] (std::string_view str) { ref = parse::from_string<ValueT> (str); };
|
||||
acceptor1 = [&ref] (char const* str) { ref = str; };
|
||||
}
|
||||
return get ();
|
||||
}
|
||||
@ -58,9 +58,9 @@ namespace cruft::cmdopt2 {
|
||||
CHECK (!acceptor1);
|
||||
|
||||
if constexpr (parseable<ValueT>) {
|
||||
acceptor1 = [&ref] (std::string_view str) { ref = str; };
|
||||
acceptor1 = [&ref] (char const* str) { ref = parse::from_string<ValueT> (str); };
|
||||
} else {
|
||||
acceptor1 = [&ref] (std::string_view str) { ref = parse::from_string<ValueT> (str); };
|
||||
acceptor1 = [&ref] (char const* str) { ref = str; };
|
||||
}
|
||||
|
||||
return get ();
|
||||
|
Loading…
Reference in New Issue
Block a user