@@ -32,7 +32,7 @@ void Schema::AddType(response::StringType name, std::shared_ptr<object::__Type>
32
32
_types.push_back ({ std::move (name), std::move (type) });
33
33
}
34
34
35
- std::shared_ptr<object::__Type> Schema::LookupType (const response::StringType& name) const
35
+ const std::shared_ptr<object::__Type>& Schema::LookupType (const response::StringType& name) const
36
36
{
37
37
auto itr = _typeMap.find (name);
38
38
@@ -323,14 +323,9 @@ UnionType::UnionType(response::StringType name, response::StringType description
323
323
{
324
324
}
325
325
326
- void UnionType::AddPossibleTypes (std::vector<std::shared_ptr <object::__Type>> possibleTypes)
326
+ void UnionType::AddPossibleTypes (std::vector<std::weak_ptr <object::__Type>> possibleTypes)
327
327
{
328
- _possibleTypes.resize (possibleTypes.size ());
329
- std::transform (possibleTypes.cbegin (), possibleTypes.cend (), _possibleTypes.begin (),
330
- [](const std::shared_ptr<object::__Type>& shared)
331
- {
332
- return shared;
333
- });
328
+ _possibleTypes = std::move (possibleTypes);
334
329
}
335
330
336
331
std::future<__TypeKind> UnionType::getKind (const std::shared_ptr<service::RequestState>&) const
@@ -462,10 +457,10 @@ std::future<std::unique_ptr<std::vector<std::shared_ptr<object::__InputValue>>>>
462
457
return promise.get_future ();
463
458
}
464
459
465
- WrapperType::WrapperType (__TypeKind kind, std::shared_ptr<object::__Type> ofType)
460
+ WrapperType::WrapperType (__TypeKind kind, const std::shared_ptr<object::__Type>& ofType)
466
461
: BaseType(response::StringType())
467
462
, _kind(kind)
468
- , _ofType(std::move( ofType) )
463
+ , _ofType(ofType)
469
464
{
470
465
}
471
466
@@ -487,12 +482,12 @@ std::future<std::shared_ptr<object::__Type>> WrapperType::getOfType(const std::s
487
482
return promise.get_future ();
488
483
}
489
484
490
- Field::Field (response::StringType name, response::StringType description, std::unique_ptr<response::StringType>&& deprecationReason, std::vector<std::shared_ptr<InputValue>> args, std::shared_ptr<object::__Type> type)
485
+ Field::Field (response::StringType name, response::StringType description, std::unique_ptr<response::StringType>&& deprecationReason, std::vector<std::shared_ptr<InputValue>> args, const std::shared_ptr<object::__Type>& type)
491
486
: _name(std::move(name))
492
487
, _description(std::move(description))
493
488
, _deprecationReason(std::move(deprecationReason))
494
489
, _args(std::move(args))
495
- , _type(std::move( type) )
490
+ , _type(type)
496
491
{
497
492
}
498
493
@@ -556,10 +551,10 @@ std::future<std::unique_ptr<response::StringType>> Field::getDeprecationReason(c
556
551
return promise.get_future ();
557
552
}
558
553
559
- InputValue::InputValue (response::StringType name, response::StringType description, std::shared_ptr<object::__Type> type, response::StringType defaultValue)
554
+ InputValue::InputValue (response::StringType name, response::StringType description, const std::shared_ptr<object::__Type>& type, response::StringType defaultValue)
560
555
: _name(std::move(name))
561
556
, _description(std::move(description))
562
- , _type(std::move( type) )
557
+ , _type(type)
563
558
, _defaultValue(std::move(defaultValue))
564
559
{
565
560
}
0 commit comments