@@ -66,7 +66,7 @@ struct ResolverParams
6666 const web::json::object& variables;
6767};
6868
69- using Resolver = std::function<web::json::value(ResolverParams)>;
69+ using Resolver = std::function<web::json::value(ResolverParams&& )>;
7070using ResolverMap = std::unordered_map<std::string, Resolver>;
7171
7272// Types be wrapped non-null or list types in GraphQL. Since nullability is a more special case
@@ -100,7 +100,7 @@ struct ModifiedArgument
100100 >::type;
101101
102102 // Peel off the none modifier. If it's included, it should always be last in the list.
103- static type require (typename std::conditional<TypeModifier::None == _Modifier, std::string, DisableNone>::type name,
103+ static type require (const typename std::conditional<TypeModifier::None == _Modifier, std::string, DisableNone>::type& name,
104104 const web::json::object& arguments)
105105 {
106106 static_assert (TypeModifier::None == _Modifier, " this is the empty version" );
@@ -111,7 +111,7 @@ struct ModifiedArgument
111111 }
112112
113113 // Peel off nullable modifiers.
114- static type require (typename std::conditional<TypeModifier::Nullable == _Modifier, std::string, DisableNullable>::type name,
114+ static type require (const typename std::conditional<TypeModifier::Nullable == _Modifier, std::string, DisableNullable>::type& name,
115115 const web::json::object& arguments)
116116 {
117117 static_assert (TypeModifier::Nullable == _Modifier, " this is the nullable version" );
@@ -140,7 +140,7 @@ struct ModifiedArgument
140140 }
141141
142142 // Peel off list modifiers.
143- static type require (typename std::conditional<TypeModifier::List == _Modifier, std::string, DisableList>::type name,
143+ static type require (const typename std::conditional<TypeModifier::List == _Modifier, std::string, DisableList>::type& name,
144144 const web::json::object& arguments)
145145 {
146146 static_assert (TypeModifier::List == _Modifier, " this is the list version" );
@@ -171,7 +171,7 @@ struct ModifiedArgument
171171 }
172172 }
173173
174- static std::pair<type, bool > find (std::string name, const web::json::object& arguments) noexcept
174+ static std::pair<type, bool > find (const std::string& name, const web::json::object& arguments) noexcept
175175 {
176176 try
177177 {
@@ -193,7 +193,7 @@ struct ModifiedArgument<_Type, TypeModifier::None>
193193 using type = _Type;
194194
195195 // Call convert on this type without any other modifiers.
196- static _Type require (std::string name, const web::json::object& arguments)
196+ static _Type require (const std::string& name, const web::json::object& arguments)
197197 {
198198 try
199199 {
@@ -209,7 +209,7 @@ struct ModifiedArgument<_Type, TypeModifier::None>
209209 }
210210
211211 // Wrap require in a try/catch block.
212- static std::pair<_Type, bool > find (std::string name, const web::json::object& arguments) noexcept
212+ static std::pair<_Type, bool > find (const std::string& name, const web::json::object& arguments) noexcept
213213 {
214214 try
215215 {
@@ -248,7 +248,7 @@ using TypeNames = std::unordered_set<std::string>;
248248class Object : public std ::enable_shared_from_this<Object>
249249{
250250public:
251- explicit Object (TypeNames typeNames, ResolverMap resolvers);
251+ explicit Object (TypeNames&& typeNames, ResolverMap&& resolvers);
252252
253253 web::json::value resolve (const ast::SelectionSet& selection, const FragmentMap& fragments, const web::json::object& variables) const ;
254254
@@ -283,7 +283,7 @@ struct ModifiedResult
283283
284284 // Peel off the none modifier. If it's included, it should always be last in the list.
285285 static web::json::value convert (const typename std::conditional<TypeModifier::None == _Modifier, type, DisableNone>::type& result,
286- ResolverParams params)
286+ ResolverParams&& params)
287287 {
288288 static_assert (TypeModifier::None == _Modifier, " this is the empty version" );
289289 static_assert (sizeof ...(_Other) == 0 , " TypeModifier::None should always be last in the list of modifiers if it's included at all" );
@@ -295,7 +295,7 @@ struct ModifiedResult
295295 // Peel off nullable modifiers for std::shared_ptr<Object>.
296296 static web::json::value convert (const typename std::conditional<TypeModifier::Nullable == _Modifier
297297 && std::is_same<std::shared_ptr<_Type>, typename ModifiedResult<_Type, _Other...>::type>::value, type, DisableNullableSharedPtr>::type& result,
298- ResolverParams params)
298+ ResolverParams&& params)
299299 {
300300 static_assert (TypeModifier::Nullable == _Modifier, " this is the nullable version" );
301301 static_assert (std::is_same<std::shared_ptr<_Type>, typename ModifiedResult<_Type, _Other...>::type>::value, " this is the shared_ptr version" );
@@ -311,7 +311,7 @@ struct ModifiedResult
311311 // Peel off nullable modifiers for anything else, which should all be std::unique_ptr.
312312 static web::json::value convert (const typename std::conditional<TypeModifier::Nullable == _Modifier
313313 && !std::is_same<std::shared_ptr<_Type>, typename ModifiedResult<_Type, _Other...>::type>::value, type, DisableNullable>::type& result,
314- ResolverParams params)
314+ ResolverParams&& params)
315315 {
316316 static_assert (TypeModifier::Nullable == _Modifier, " this is the nullable version" );
317317 static_assert (!std::is_same<std::shared_ptr<_Type>, typename ModifiedResult<_Type, _Other...>::type>::value, " this is the unique_ptr version" );
@@ -326,7 +326,7 @@ struct ModifiedResult
326326
327327 // Peel off list modifiers.
328328 static web::json::value convert (const typename std::conditional<TypeModifier::List == _Modifier, type, DisableList>::type& result,
329- ResolverParams params)
329+ ResolverParams&& params)
330330 {
331331 static_assert (TypeModifier::List == _Modifier, " this is the list version" );
332332
@@ -335,7 +335,7 @@ struct ModifiedResult
335335 std::transform (result.cbegin (), result.cend (), value.as_array ().begin (),
336336 [params](const typename ModifiedResult<_Type, _Other...>::type& element)
337337 {
338- return ModifiedResult<_Type, _Other...>::convert (element, params);
338+ return ModifiedResult<_Type, _Other...>::convert (element, ResolverParams ( params) );
339339 });
340340
341341 return value;
@@ -352,7 +352,7 @@ struct ModifiedResult<_Type, TypeModifier::None>
352352
353353 // Convert a subclass of Object and call that specialization.
354354 static web::json::value convert (const typename std::conditional<!std::is_same<Object, _Type>::value && std::is_base_of<Object, _Type>::value,
355- type, DisableNone>::type& result, ResolverParams params)
355+ type, DisableNone>::type& result, ResolverParams&& params)
356356 {
357357 static_assert (std::is_same<std::shared_ptr<_Type>, type>::value, " this is the derived object type" );
358358
@@ -361,7 +361,7 @@ struct ModifiedResult<_Type, TypeModifier::None>
361361
362362 // Convert a single value of the specified type to JSON.
363363 static web::json::value convert (const typename std::conditional<!std::is_same<Object, _Type>::value && std::is_base_of<Object, _Type>::value,
364- DisableNone, type>::type& result, ResolverParams params);
364+ DisableNone, type>::type& result, ResolverParams&& params);
365365};
366366
367367// Convenient type aliases for testing, generated code won't actually use these. These are also
@@ -381,7 +381,7 @@ template <TypeModifier... _Modifiers> using ObjectResult = ModifiedResult<Object
381381class Request : public std ::enable_shared_from_this<Request>
382382{
383383public:
384- explicit Request (TypeMap operationTypes);
384+ explicit Request (TypeMap&& operationTypes);
385385
386386 web::json::value resolve (const ast::Node& document, const std::string& operationName, const web::json::object& variables) const ;
387387
0 commit comments