@@ -32,7 +32,7 @@ void Schema::AddType(response::StringType name, std::shared_ptr<object::__Type>
3232 _types.push_back ({ std::move (name), std::move (type) });
3333}
3434
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
3636{
3737 auto itr = _typeMap.find (name);
3838
@@ -323,14 +323,9 @@ UnionType::UnionType(response::StringType name, response::StringType description
323323{
324324}
325325
326- void UnionType::AddPossibleTypes (std::vector<std::shared_ptr <object::__Type>> possibleTypes)
326+ void UnionType::AddPossibleTypes (std::vector<std::weak_ptr <object::__Type>> possibleTypes)
327327{
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);
334329}
335330
336331std::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>>>>
462457 return promise.get_future ();
463458}
464459
465- WrapperType::WrapperType (__TypeKind kind, std::shared_ptr<object::__Type> ofType)
460+ WrapperType::WrapperType (__TypeKind kind, const std::shared_ptr<object::__Type>& ofType)
466461 : BaseType(response::StringType())
467462 , _kind(kind)
468- , _ofType(std::move( ofType) )
463+ , _ofType(ofType)
469464{
470465}
471466
@@ -487,12 +482,12 @@ std::future<std::shared_ptr<object::__Type>> WrapperType::getOfType(const std::s
487482 return promise.get_future ();
488483}
489484
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)
491486 : _name(std::move(name))
492487 , _description(std::move(description))
493488 , _deprecationReason(std::move(deprecationReason))
494489 , _args(std::move(args))
495- , _type(std::move( type) )
490+ , _type(type)
496491{
497492}
498493
@@ -556,10 +551,10 @@ std::future<std::unique_ptr<response::StringType>> Field::getDeprecationReason(c
556551 return promise.get_future ();
557552}
558553
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)
560555 : _name(std::move(name))
561556 , _description(std::move(description))
562- , _type(std::move( type) )
557+ , _type(type)
563558 , _defaultValue(std::move(defaultValue))
564559{
565560}
0 commit comments