diff options
Diffstat (limited to 'src/DI/container.tpp')
-rw-r--r-- | src/DI/container.tpp | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/src/DI/container.tpp b/src/DI/container.tpp index e5bf7f7..ed7f34f 100644 --- a/src/DI/container.tpp +++ b/src/DI/container.tpp @@ -8,13 +8,14 @@ #include <iostream> template <class Interface> -BindingBuilder<Interface>::BindingBuilder(Container *container) : _container(container) +BindingBuilder<Interface>::BindingBuilder(Container *container) noexcept + : _container(container) { } template <class Interface> template <class ObjectImpl, class> -void BindingBuilder<Interface>::to() +void BindingBuilder<Interface>::to() noexcept { _container->bindings.emplace( ObjectType<Interface>(), @@ -23,7 +24,7 @@ void BindingBuilder<Interface>::to() } template <class Interface> -void BindingBuilder<Interface>::to_factory(Interface func) +void BindingBuilder<Interface>::to_factory(Interface func) noexcept { _container->bindings.emplace(ObjectType<Interface>(), std::dynamic_pointer_cast<IGenericWrapper>( @@ -31,13 +32,13 @@ void BindingBuilder<Interface>::to_factory(Interface func) } template <class Interface> -BindingBuilder<Interface> Container::bind() +BindingBuilder<Interface> Container::bind() noexcept { return BindingBuilder<Interface>(this); } template <class Interface, class> -std::shared_ptr<Interface> Container::get() const +std::shared_ptr<Interface> Container::get() const noexcept { ObjectType<Interface> interface_type; @@ -56,7 +57,7 @@ std::shared_ptr<Interface> Container::get() const } template <typename Interface, typename> -Interface Container::get() const +Interface Container::get() const noexcept { auto wrapper = std::dynamic_pointer_cast<IWrapper<Interface>>( bindings.at(ObjectType<Interface>())); |