Skip to content

Commit d79d6b6

Browse files
committed
Fix handling of std::vector<bool> specialization
1 parent 1c69481 commit d79d6b6

File tree

1 file changed

+16
-3
lines changed

1 file changed

+16
-3
lines changed

include/graphqlservice/GraphQLService.h

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -569,10 +569,23 @@ struct ModifiedResult
569569

570570
wrappedParams.errorPath.push(size_t { 0 });
571571

572-
for (auto& entry : wrappedResult)
572+
if constexpr (!std::is_reference_v<typename std::decay_t<decltype(wrappedResult)>::reference>)
573573
{
574-
children.push(convert<Other...>(std::move(entry), ResolverParams(wrappedParams)));
575-
++std::get<size_t>(wrappedParams.errorPath.back());
574+
// Special handling for std::vector<> specializations which don't return a reference to the underlying type,
575+
// i.e. std::vector<bool> on many platforms. Copy the values from the std::vector<> rather than moving them.
576+
for (auto entry : wrappedResult)
577+
{
578+
children.push(convert<Other...>(entry, ResolverParams(wrappedParams)));
579+
++std::get<size_t>(wrappedParams.errorPath.back());
580+
}
581+
}
582+
else
583+
{
584+
for (auto& entry : wrappedResult)
585+
{
586+
children.push(convert<Other...>(std::move(entry), ResolverParams(wrappedParams)));
587+
++std::get<size_t>(wrappedParams.errorPath.back());
588+
}
576589
}
577590

578591
response::Value data(response::Type::List);

0 commit comments

Comments
 (0)