@@ -60,8 +60,8 @@ const std::shared_ptr<const BaseType>& Schema::LookupType(std::string_view name)
60
60
return _types[itr->second ].second ;
61
61
}
62
62
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)
65
65
{
66
66
auto & wrappers = (kind == introspection::TypeKind::LIST) ? _listWrappers : _nonNullWrappers;
67
67
auto itr = wrappers.find (ofType);
@@ -387,18 +387,18 @@ const std::vector<std::shared_ptr<const InputValue>>& InputObjectType::inputFiel
387
387
struct WrapperType ::init
388
388
{
389
389
introspection::TypeKind kind;
390
- const std::shared_ptr <const BaseType>& ofType;
390
+ std::weak_ptr <const BaseType> ofType;
391
391
};
392
392
393
393
std::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)
395
395
{
396
- return std::make_shared<WrapperType>(init { kind, ofType });
396
+ return std::make_shared<WrapperType>(init { kind, std::move ( ofType) });
397
397
}
398
398
399
399
WrapperType::WrapperType (init&& params)
400
400
: BaseType(params.kind, std::string_view())
401
- , _ofType(params.ofType)
401
+ , _ofType(std::move( params.ofType) )
402
402
{
403
403
}
404
404
@@ -412,15 +412,15 @@ struct Field::init
412
412
std::string_view name;
413
413
std::string_view description;
414
414
std::optional<std::string_view> deprecationReason;
415
- const std::shared_ptr <const BaseType>& type;
415
+ std::weak_ptr <const BaseType> type;
416
416
std::vector<std::shared_ptr<const InputValue>> args;
417
417
};
418
418
419
419
std::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,
421
421
std::initializer_list<std::shared_ptr<InputValue>> args)
422
422
{
423
- init params { name, description, deprecationReason, type };
423
+ init params { name, description, deprecationReason, std::move ( type) };
424
424
425
425
params.args .resize (args.size ());
426
426
std::copy (args.begin (), args.end (), params.args .begin ());
@@ -432,7 +432,7 @@ Field::Field(init&& params)
432
432
: _name(params.name)
433
433
, _description(params.description)
434
434
, _deprecationReason(params.deprecationReason)
435
- , _type(params.type)
435
+ , _type(std::move( params.type) )
436
436
, _args(std::move(params.args))
437
437
{
438
438
}
@@ -466,20 +466,20 @@ struct InputValue::init
466
466
{
467
467
std::string_view name;
468
468
std::string_view description;
469
- const std::shared_ptr <const BaseType>& type;
469
+ std::weak_ptr <const BaseType> type;
470
470
std::string_view defaultValue;
471
471
};
472
472
473
473
std::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)
475
475
{
476
- return std::make_shared<InputValue>(init { name, description, type, defaultValue });
476
+ return std::make_shared<InputValue>(init { name, description, std::move ( type) , defaultValue });
477
477
}
478
478
479
479
InputValue::InputValue (init&& params)
480
480
: _name(params.name)
481
481
, _description(params.description)
482
- , _type(params.type)
482
+ , _type(std::move( params.type) )
483
483
, _defaultValue(params.defaultValue)
484
484
{
485
485
}
0 commit comments