@@ -591,15 +591,14 @@ enum class TypeModifier
591
591
List,
592
592
};
593
593
594
+ // Used by ModifiedArgument to special-case an innermost nullable INPUT_OBJECT type.
595
+ template <TypeModifier... Other>
596
+ constexpr bool onlyNoneModifiers = (... && (Other == TypeModifier::None));
597
+
598
+ // Specialized as true for all INPUT_OBJECT types.
594
599
template <typename Type>
595
600
constexpr bool isInputType = false ;
596
601
597
- template <TypeModifier Modifier>
598
- constexpr bool isNoneModifier = (Modifier == TypeModifier::None);
599
-
600
- template <TypeModifier... Other>
601
- constexpr bool trailingNoneModifiers = (... && isNoneModifer<Other>);
602
-
603
602
// Extract individual arguments with chained type modifiers which add nullable or list wrappers.
604
603
// If the argument is not optional, use require and let it throw a schema_exception when the
605
604
// argument is missing or not the correct type. If it's optional, use find and check the second
@@ -613,7 +612,7 @@ struct ModifiedArgument
613
612
{
614
613
// Peel off modifiers until we get to the underlying type.
615
614
using type = typename std::conditional_t <TypeModifier::Nullable == Modifier,
616
- typename std::conditional_t <isInputType<U> && trailingNoneModifiers <Other...>,
615
+ typename std::conditional_t <isInputType<U> && onlyNoneModifiers <Other...>,
617
616
std::unique_ptr<U>, std::optional<typename ArgumentTraits<U, Other...>::type>>,
618
617
typename std::conditional_t <TypeModifier::List == Modifier,
619
618
std::vector<typename ArgumentTraits<U, Other...>::type>, U>>;
@@ -693,7 +692,7 @@ struct ModifiedArgument
693
692
694
693
auto result = require<Other...>(name, arguments);
695
694
696
- if constexpr (isInputType<Type> && trailingNoneModifiers <Other...>)
695
+ if constexpr (isInputType<Type> && onlyNoneModifiers <Other...>)
697
696
{
698
697
return std::make_unique<decltype (result)>(std::move (result));
699
698
}
0 commit comments