diff options
Diffstat (limited to 'src/DI/container.tpp')
-rw-r--r-- | src/DI/container.tpp | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/src/DI/container.tpp b/src/DI/container.tpp index 13397bc..d81a0cc 100644 --- a/src/DI/container.tpp +++ b/src/DI/container.tpp @@ -22,8 +22,10 @@ void BindingBuilder<Interface>::to() noexcept auto wrapper = Container::WrapperPtr<Wrapper>(new Wrapper(*_container)); - _container->add(ObjectType<Interface>(), - std::dynamic_pointer_cast<IGenericWrapper>(wrapper)); + _container->add( + ObjectType<Interface>(), + std::dynamic_pointer_cast<IGenericWrapper>(wrapper) + ); } template <typename Interface> @@ -35,8 +37,10 @@ void BindingBuilder<Interface>::to_factory(FactoryFunc factory) noexcept auto wrapper = Container::WrapperPtr<Wrapper>(new Wrapper(factory)); - _container->add(ObjectType<Interface>(), - std::dynamic_pointer_cast<IGenericWrapper>(wrapper)); + _container->add( + ObjectType<Interface>(), + std::dynamic_pointer_cast<IGenericWrapper>(wrapper) + ); } template <typename Interface> @@ -60,7 +64,8 @@ auto Container::get() const noexcept -> std::unique_ptr<Interface> } auto wrapper = std::dynamic_pointer_cast<IWrapper<std::unique_ptr<Interface>>>( - _bindings.at(interface_type)); + _bindings.at(interface_type) + ); return wrapper->get(); } @@ -69,8 +74,9 @@ template <typename AFactory> requires IsFactory<AFactory> auto Container::get() const noexcept -> AFactory { - auto wrapper = std::dynamic_pointer_cast<IWrapper<AFactory>>( - _bindings.at(ObjectType<AFactory>())); + auto wrapper = + std::dynamic_pointer_cast<IWrapper<AFactory>>(_bindings.at(ObjectType<AFactory>()) + ); return wrapper->get(); } |