class MyFactory {
using CentralType = MyService;
using ResolutionKeysPack = meta::Pack<ServiceKey, MyService>;
static constexpr ConfigType CONFIG_TYPE = ConfigType::CREATIONAL;
std::expected<RuntimeRef<MyService>, Error> do_resolve(ServiceKey key) const {
return RuntimeRef(create_service(key));
}
};
#ifndef CREATIONAL_CONFIG_HPP_
#define CREATIONAL_CONFIG_HPP_
{
template<typename Config>
concept CreationalConfig = requires() {
typename Config::CentralType;
typename Config::ResolutionKeysPack;
Config::CONFIG_TYPE;
}
&& std::same_as<std::remove_cv_t<
decltype(Config::CONFIG_TYPE)>,
ConfigType>
template<typename Config>
struct IsCreationalConfig
{
static constexpr bool value = CreationalConfig<Config>;
};
template<CreationalConfig Config>
template<CreationalConfig Config>
template<CreationalConfig Config>
}
#endif
Configuration type enumeration for the dependency injection system.
Compile-time type pack utilities and metaprogramming foundations.
Definition Decorator.hpp:19
typename Config::DependenciesPack dependencies_pack_t
Definition CreationalConfig.hpp:82
typename Config::ResolutionKeysPack resolution_keys_pack_t
Helper alias to extract the resolution keys from a CreationalConfig.
Definition CreationalConfig.hpp:79
ConfigType
Categorization of configuration strategies in the DI container.
Definition ConfigType.hpp:24
@ CREATIONAL
Creational configs handle object instantiation and factory patterns. These are responsible for creati...
Definition ConfigType.hpp:27
typename Config::CentralType central_type_t
Helper alias to extract the central type from a CreationalConfig.
Definition CreationalConfig.hpp:75
static constexpr bool value
Definition CreationalConfig.hpp:70