@@ -60,8 +60,8 @@ const std::shared_ptr<const BaseType>& Schema::LookupType(std::string_view name)
6060 return _types[itr->second ].second ;
6161}
6262
63- const std::shared_ptr<const BaseType>& Schema::WrapType (
64- introspection::TypeKind kind, const std::shared_ptr<const BaseType>& ofType)
63+ std::shared_ptr<const BaseType> Schema::WrapType (
64+ introspection::TypeKind kind, std::shared_ptr<const BaseType> ofType)
6565{
6666 auto & wrappers = (kind == introspection::TypeKind::LIST) ? _listWrappers : _nonNullWrappers;
6767 auto itr = wrappers.find (ofType);
@@ -387,18 +387,18 @@ const std::vector<std::shared_ptr<const InputValue>>& InputObjectType::inputFiel
387387struct WrapperType ::init
388388{
389389 introspection::TypeKind kind;
390- const std::shared_ptr <const BaseType>& ofType;
390+ std::weak_ptr <const BaseType> ofType;
391391};
392392
393393std::shared_ptr<WrapperType> WrapperType::Make (
394- introspection::TypeKind kind, const std::shared_ptr <const BaseType>& ofType)
394+ introspection::TypeKind kind, std::weak_ptr <const BaseType> ofType)
395395{
396- return std::make_shared<WrapperType>(init { kind, ofType });
396+ return std::make_shared<WrapperType>(init { kind, std::move ( ofType) });
397397}
398398
399399WrapperType::WrapperType (init&& params)
400400 : BaseType(params.kind, std::string_view())
401- , _ofType(params.ofType)
401+ , _ofType(std::move( params.ofType) )
402402{
403403}
404404
@@ -412,15 +412,15 @@ struct Field::init
412412 std::string_view name;
413413 std::string_view description;
414414 std::optional<std::string_view> deprecationReason;
415- const std::shared_ptr <const BaseType>& type;
415+ std::weak_ptr <const BaseType> type;
416416 std::vector<std::shared_ptr<const InputValue>> args;
417417};
418418
419419std::shared_ptr<Field> Field::Make (std::string_view name, std::string_view description,
420- std::optional<std::string_view> deprecationReason, const std::shared_ptr <const BaseType>& type,
420+ std::optional<std::string_view> deprecationReason, std::weak_ptr <const BaseType> type,
421421 std::initializer_list<std::shared_ptr<InputValue>> args)
422422{
423- init params { name, description, deprecationReason, type };
423+ init params { name, description, deprecationReason, std::move ( type) };
424424
425425 params.args .resize (args.size ());
426426 std::copy (args.begin (), args.end (), params.args .begin ());
@@ -432,7 +432,7 @@ Field::Field(init&& params)
432432 : _name(params.name)
433433 , _description(params.description)
434434 , _deprecationReason(params.deprecationReason)
435- , _type(params.type)
435+ , _type(std::move( params.type) )
436436 , _args(std::move(params.args))
437437{
438438}
@@ -466,20 +466,20 @@ struct InputValue::init
466466{
467467 std::string_view name;
468468 std::string_view description;
469- const std::shared_ptr <const BaseType>& type;
469+ std::weak_ptr <const BaseType> type;
470470 std::string_view defaultValue;
471471};
472472
473473std::shared_ptr<InputValue> InputValue::Make (std::string_view name, std::string_view description,
474- const std::shared_ptr <const BaseType>& type, std::string_view defaultValue)
474+ std::weak_ptr <const BaseType> type, std::string_view defaultValue)
475475{
476- return std::make_shared<InputValue>(init { name, description, type, defaultValue });
476+ return std::make_shared<InputValue>(init { name, description, std::move ( type) , defaultValue });
477477}
478478
479479InputValue::InputValue (init&& params)
480480 : _name(params.name)
481481 , _description(params.description)
482- , _type(params.type)
482+ , _type(std::move( params.type) )
483483 , _defaultValue(params.defaultValue)
484484{
485485}
0 commit comments