...
This commit is contained in:
parent
4d7e830798
commit
962504ed98
@ -129,6 +129,13 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
value = r;
|
value = r;
|
||||||
|
} else if constexpr (mcc::traits::mcc_time_duration_c<value_t>) {
|
||||||
|
typename value_t::rep vd;
|
||||||
|
|
||||||
|
bool ok = self(str, vd);
|
||||||
|
if (ok) {
|
||||||
|
value = value_t{vd};
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -231,8 +238,8 @@ public:
|
|||||||
|
|
||||||
if constexpr (std::convertible_to<v_t, T>) {
|
if constexpr (std::convertible_to<v_t, T>) {
|
||||||
res = static_cast<T>(std::forward<decltype(val)>(val));
|
res = static_cast<T>(std::forward<decltype(val)>(val));
|
||||||
} else if constexpr (std::constructible_from<T, v_t>) {
|
// } else if constexpr (std::constructible_from<T, v_t>) {
|
||||||
res = T{std::forward<decltype(val)>(val)};
|
// res = T{std::forward<decltype(val)>(val)};
|
||||||
} else {
|
} else {
|
||||||
res = std::unexpected(std::make_error_code(std::errc::invalid_argument));
|
res = std::unexpected(std::make_error_code(std::errc::invalid_argument));
|
||||||
}
|
}
|
||||||
@ -707,16 +714,9 @@ protected:
|
|||||||
|
|
||||||
bool ok = true;
|
bool ok = true;
|
||||||
|
|
||||||
if constexpr (std::is_arithmetic_v<value_t> || std::ranges::output_range<value_t, char> ||
|
if constexpr (std::is_arithmetic_v<value_t> || mcc::traits::mcc_output_char_range<value_t> ||
|
||||||
std::ranges::range<value_t>) {
|
std::ranges::range<value_t> || mcc::traits::mcc_time_duration_c<value_t>) {
|
||||||
return base_t::defaultDeserializeFunc(str, value);
|
return base_t::defaultDeserializeFunc(str, value);
|
||||||
} else if constexpr (mcc::traits::mcc_time_duration_c<value_t>) {
|
|
||||||
typename value_t::rep vd;
|
|
||||||
|
|
||||||
ok = base_t::defaultDeserializeFunc(str, vd);
|
|
||||||
if (ok) {
|
|
||||||
value = value_t{vd};
|
|
||||||
}
|
|
||||||
} else if constexpr (std::same_as<value_t, mcc::MccAngle>) { // assume here all angles are in degrees
|
} else if constexpr (std::same_as<value_t, mcc::MccAngle>) { // assume here all angles are in degrees
|
||||||
double vd;
|
double vd;
|
||||||
ok = base_t::defaultDeserializeFunc(str, vd);
|
ok = base_t::defaultDeserializeFunc(str, vd);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user