diff options
author | HampusM <hampus@hampusmat.com> | 2022-03-14 18:02:18 +0100 |
---|---|---|
committer | HampusM <hampus@hampusmat.com> | 2022-06-13 17:56:56 +0200 |
commit | dc6222611ad14a33f642396558ba84ecba9d6605 (patch) | |
tree | d759020233b66be62c5539209a03842d283b67a9 /src/DI/container.tpp | |
parent | dbab54ebf134b6ab2cf719d7c26a191fbffeed34 (diff) |
perf: add noexcept almost everywhere
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>())); |