diff --git a/include/graphqlservice/GraphQLClient.h b/include/graphqlservice/GraphQLClient.h index a1f5b5d7..13ce6cdf 100644 --- a/include/graphqlservice/GraphQLClient.h +++ b/include/graphqlservice/GraphQLClient.h @@ -168,9 +168,16 @@ struct ModifiedVariable response::Value result { response::Type::List }; result.reserve(listValue.size()); - std::ranges::for_each(listValue, [&result](auto& value) { - result.emplace_back(serialize(std::move(value))); - }); + if constexpr(std::is_same_v){ + for (auto const v: listValue) + result.emplace_back(Variable::serialize(bool{v})); + } + else{ + std::ranges::for_each(listValue, [&result](auto& value) { + result.emplace_back(serialize(std::move(value))); + }); + } + listValue.clear(); return result; @@ -217,11 +224,19 @@ struct ModifiedVariable duplicate(const typename VariableTraits::type& listValue) requires ListModifier { - typename VariableTraits::type result(listValue.size()); - - std::ranges::transform(listValue, result.begin(), duplicate); - - return result; + if constexpr(std::is_same_v){ + typename VariableTraits::type result; + result.reserve(listValue.size()); + for (auto const v: listValue) + result.push_back(v); + return result; + } + else + { + typename VariableTraits::type result(listValue.size()); + std::ranges::transform(listValue, result.begin(), duplicate); + return result; + } } }; diff --git a/include/graphqlservice/GraphQLService.h b/include/graphqlservice/GraphQLService.h index b6c6eac2..dacf9ce5 100644 --- a/include/graphqlservice/GraphQLService.h +++ b/include/graphqlservice/GraphQLService.h @@ -795,11 +795,19 @@ struct ModifiedArgument duplicate(const typename ArgumentTraits::type& listValue) requires ListModifier { - typename ArgumentTraits::type result(listValue.size()); - - std::ranges::transform(listValue, result.begin(), duplicate); - - return result; + if constexpr(std::is_same_v){ + typename ArgumentTraits::type result; + result.reserve(listValue.size()); + for (auto const v: listValue) + result.push_back(v); + return result; + } + else + { + typename ArgumentTraits::type result(listValue.size()); + std::ranges::transform(listValue, result.begin(), duplicate); + return result; + } } };