This commit is contained in:
Mark Gillard 2023-04-03 21:32:40 +03:00
parent 3abe096513
commit 82c3b90697
3 changed files with 20 additions and 20 deletions

View File

@ -13,7 +13,7 @@ TOML_IMPL_NAMESPACE_START
template <typename T>
TOML_NODISCARD
TOML_ATTR(returns_nonnull)
auto* make_node_impl_specialized(T && val, [[maybe_unused]] value_flags flags)
auto* make_node_impl_specialized(T && val, value_flags flags)
{
using unwrapped_type = unwrap_node<remove_cvref<T>>;
static_assert(!std::is_same_v<unwrapped_type, node>);
@ -70,10 +70,10 @@ TOML_IMPL_NAMESPACE_START
}
else
out = new value_type{ static_cast<T&&>(val) };
}
if (flags != preserve_source_value_flags)
out->flags(flags);
if (flags != preserve_source_value_flags)
out->flags(flags);
}
return out;
}

View File

@ -195,13 +195,11 @@ TOML_IMPL_NAMESPACE_START
}
template <typename...>
struct is_val_ctor_with_flags : std::false_type
struct value_variadic_ctor_allowed : std::true_type
{};
template <typename T, typename U>
struct is_val_ctor_with_flags<T, U> : std::bool_constant< //
(is_node<T> && is_value<T>) //
&&(std::is_same_v<remove_cvref<U>, value_flags>)>
template <typename T, typename... Args>
struct value_variadic_ctor_allowed<value<T>, value<T>, Args...> : std::false_type
{};
}
TOML_IMPL_NAMESPACE_END;
@ -264,7 +262,9 @@ TOML_NAMESPACE_START
///
/// \tparam Args Constructor argument types.
/// \param args Arguments to forward to the internal value's constructor.
TOML_HIDDEN_CONSTRAINT(!impl::is_val_ctor_with_flags<Args...>::value, typename... Args)
TOML_HIDDEN_CONSTRAINT(
(impl::value_variadic_ctor_allowed<value<ValueType>, impl::remove_cvref<Args>...>::value),
typename... Args)
TOML_NODISCARD_CTOR
explicit value(Args&&... args) noexcept(noexcept(value_type(
impl::native_value_maker<value_type, std::decay_t<Args>...>::make(static_cast<Args&&>(args)...))))

View File

@ -4723,13 +4723,11 @@ TOML_IMPL_NAMESPACE_START
}
template <typename...>
struct is_val_ctor_with_flags : std::false_type
struct value_variadic_ctor_allowed : std::true_type
{};
template <typename T, typename U>
struct is_val_ctor_with_flags<T, U> : std::bool_constant< //
(is_node<T> && is_value<T>) //
&&(std::is_same_v<remove_cvref<U>, value_flags>)>
template <typename T, typename... Args>
struct value_variadic_ctor_allowed<value<T>, value<T>, Args...> : std::false_type
{};
}
TOML_IMPL_NAMESPACE_END;
@ -4769,7 +4767,9 @@ TOML_NAMESPACE_START
std::string_view,
std::conditional_t<impl::is_one_of<value_type, double, int64_t, bool>, value_type, const value_type&>>);
TOML_HIDDEN_CONSTRAINT(!impl::is_val_ctor_with_flags<Args...>::value, typename... Args)
TOML_HIDDEN_CONSTRAINT(
(impl::value_variadic_ctor_allowed<value<ValueType>, impl::remove_cvref<Args>...>::value),
typename... Args)
TOML_NODISCARD_CTOR
explicit value(Args&&... args) noexcept(noexcept(value_type(
impl::native_value_maker<value_type, std::decay_t<Args>...>::make(static_cast<Args&&>(args)...))))
@ -5639,7 +5639,7 @@ TOML_IMPL_NAMESPACE_START
template <typename T>
TOML_NODISCARD
TOML_ATTR(returns_nonnull)
auto* make_node_impl_specialized(T && val, [[maybe_unused]] value_flags flags)
auto* make_node_impl_specialized(T && val, value_flags flags)
{
using unwrapped_type = unwrap_node<remove_cvref<T>>;
static_assert(!std::is_same_v<unwrapped_type, node>);
@ -5696,10 +5696,10 @@ TOML_IMPL_NAMESPACE_START
}
else
out = new value_type{ static_cast<T&&>(val) };
}
if (flags != preserve_source_value_flags)
out->flags(flags);
if (flags != preserve_source_value_flags)
out->flags(flags);
}
return out;
}