#pragma region CPL License /* Nuclex Native Framework Copyright (C) 2002-2023 Nuclex Development Labs This library is free software; you can redistribute it and/or modify it under the terms of the IBM Common Public License as published by the IBM Corporation; either version 1.0 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the IBM Common Public License for more details. You should have received a copy of the IBM Common Public License along with this library */ #pragma endregion // CPL License #if !defined(NUCLEX_SUPPORT_SERVICES_LAZYSERVICEINJECTOR_H) #error This header must be included via LazyServiceInjector.h #endif #include // for std::is_class, std::is_abstract #include // for std::shared_ptr namespace Nuclex { namespace Support { namespace Services { // ------------------------------------------------------------------------------------------- // namespace Private { /// Determines whether the specified argument uses std::shared_ptr /// Type that will be checked /// /// The default case, always 'no' /// template class IsSharedPtr : public std::false_type {}; /// Determines whether the specified argument uses std::shared_ptr /// Type that will be checked /// /// Specialization for std::shared_ptr types, produces 'yes' /// template class IsSharedPtr> : public std::true_type {}; } // namespace Private // ------------------------------------------------------------------------------------------- // namespace Private { /// Checks whether a constructor argument can potentially be injected /// Constructor argument that will be checked /// /// Any services provided by the dependency injector are wrapped in std::shared_ptr to /// control the lifetime of the service implementation. /// template class IsInjectableArgument : public std::integral_constant< bool, ( std::is_class::value && !std::is_abstract::value && IsSharedPtr::value ) > {}; } // namespace Private // ------------------------------------------------------------------------------------------- // }}} // namespace Nuclex::Support::Services