@@ -884,6 +884,10 @@ concept ObjectBaseType = std::is_base_of_v<Object, Type>;
884
884
template <typename Type>
885
885
concept ObjectDerivedType = ObjectBaseType<Type> && !ObjectType<Type>;
886
886
887
+ // Test if a nullable type is std::shared_ptr<Type> or std::optional<T>.
888
+ template <typename Type, TypeModifier... Other>
889
+ concept NullableSharedPtr = OnlyNoneModifiers<Other...> && ObjectBaseType<Type>;
890
+
887
891
// Test if this method should std::static_pointer_cast an ObjectDerivedType to
888
892
// std::shared_ptr<const Object>.
889
893
template <typename Type, TypeModifier Modifier, TypeModifier... Other>
@@ -914,8 +918,8 @@ struct ModifiedResult
914
918
struct ResultTraits
915
919
{
916
920
using type = typename std::conditional_t <NullableModifier<Modifier>,
917
- typename std::conditional_t <OnlyNoneModifiers< Other...> && ObjectBaseType <U>,
918
- std::shared_ptr<U>, std:: optional<typename ResultTraits<U, Other...>::type>>,
921
+ typename std::conditional_t <NullableSharedPtr<U, Other...>, std::shared_ptr <U>,
922
+ std::optional<typename ResultTraits<U, Other...>::type>>,
919
923
typename std::conditional_t <ListModifier<Modifier>,
920
924
std::vector<typename ResultTraits<U, Other...>::type>,
921
925
typename std::conditional_t <ObjectBaseType<U>, std::shared_ptr<U>, U>>>;
0 commit comments