Skip to content

Commit 29376f2

Browse files
authored
Merge pull request #329 from wravery/next
fix: Object::_stitched can only have 1 or 2 entries
2 parents abb31c3 + 4d7ba4f commit 29376f2

File tree

2 files changed

+6
-7
lines changed

2 files changed

+6
-7
lines changed

include/graphqlservice/GraphQLService.h

+2-1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
#include "internal/DllExports.h"
1414
#include "internal/SortedMap.h"
1515

16+
#include <array>
1617
#include <chrono>
1718
#include <condition_variable>
1819
#include <coroutine>
@@ -853,7 +854,7 @@ class [[nodiscard("unnecessary construction")]] Object : public std::enable_shar
853854
private:
854855
TypeNames _typeNames;
855856
ResolverMap _resolvers;
856-
std::vector<std::shared_ptr<const Object>> _stitched;
857+
std::array<std::shared_ptr<const Object>, 2> _stitched;
857858
};
858859

859860
// Test if this Type inherits from Object.

src/GraphQLService.cpp

+4-6
Original file line numberDiff line numberDiff line change
@@ -1270,17 +1270,15 @@ std::shared_ptr<Object> Object::StitchObject(const std::shared_ptr<const Object>
12701270
hasStitchedResolvers = resolvers.emplace(name, resolver).second || hasStitchedResolvers;
12711271
}
12721272

1273-
std::vector<std::shared_ptr<const Object>> stitched { shared_from_this() };
1273+
auto object = std::make_shared<Object>(std::move(typeNames), std::move(resolvers));
1274+
1275+
object->_stitched[0] = shared_from_this();
12741276

12751277
if (hasStitchedResolvers)
12761278
{
1277-
stitched.push_back(added);
1279+
object->_stitched[1] = added;
12781280
}
12791281

1280-
auto object = std::make_shared<Object>(std::move(typeNames), std::move(resolvers));
1281-
1282-
object->_stitched = std::move(stitched);
1283-
12841282
return object;
12851283
}
12861284

0 commit comments

Comments
 (0)