cmdopt2/arg: add bind support to more string types
This commit is contained in:
parent
6ed70a4839
commit
cd2b6be6e8
@ -8,9 +8,10 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <cruft/util/cast.hpp>
|
||||
#include <cruft/util/concepts/string.hpp>
|
||||
#include <cruft/util/debug/assert.hpp>
|
||||
#include <cruft/util/parse/value.hpp>
|
||||
#include <cruft/util/cast.hpp>
|
||||
|
||||
#include <optional>
|
||||
#include <string>
|
||||
@ -38,7 +39,7 @@ namespace cruft::cmdopt2 {
|
||||
bind (ValueT &ref)
|
||||
{
|
||||
CHECK (!acceptor1);
|
||||
if constexpr (std::is_same_v<ValueT, std::string> or std::is_same_v<ValueT, char const*>) {
|
||||
if constexpr (cruft::concepts::stringy<ValueT>) {
|
||||
acceptor1 = [&ref] (std::string_view str) { ref = str; };
|
||||
} else {
|
||||
acceptor1 = [&ref] (std::string_view str) { ref = parse::from_string<ValueT> (str); };
|
||||
|
Loading…
Reference in New Issue
Block a user