// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. #include "HeroData.h" #include "DroidData.h" #include "HumanData.h" #include "CharacterObject.h" namespace graphql::learn { std::shared_ptr make_hero(const SharedHero& hero) noexcept { return std::visit( [](const auto& hero) noexcept { using hero_t = std::decay_t; if constexpr (std::is_same_v, hero_t>) { return std::make_shared(std::make_shared(hero)); } else if constexpr (std::is_same_v, hero_t>) { return std::make_shared(std::make_shared(hero)); } }, hero); } std::shared_ptr make_hero(const WeakHero& hero) noexcept { return std::visit( [](const auto& hero) noexcept { using hero_t = std::decay_t; if constexpr (std::is_same_v, hero_t>) { return std::make_shared( std::make_shared(hero.lock())); } else if constexpr (std::is_same_v, hero_t>) { return std::make_shared( std::make_shared(hero.lock())); } }, hero); } } // namespace graphql::learn