From dc6222611ad14a33f642396558ba84ecba9d6605 Mon Sep 17 00:00:00 2001 From: HampusM Date: Mon, 14 Mar 2022 18:02:18 +0100 Subject: perf: add noexcept almost everywhere --- src/DI/container.tpp | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'src/DI/container.tpp') 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 template -BindingBuilder::BindingBuilder(Container *container) : _container(container) +BindingBuilder::BindingBuilder(Container *container) noexcept + : _container(container) { } template template -void BindingBuilder::to() +void BindingBuilder::to() noexcept { _container->bindings.emplace( ObjectType(), @@ -23,7 +24,7 @@ void BindingBuilder::to() } template -void BindingBuilder::to_factory(Interface func) +void BindingBuilder::to_factory(Interface func) noexcept { _container->bindings.emplace(ObjectType(), std::dynamic_pointer_cast( @@ -31,13 +32,13 @@ void BindingBuilder::to_factory(Interface func) } template -BindingBuilder Container::bind() +BindingBuilder Container::bind() noexcept { return BindingBuilder(this); } template -std::shared_ptr Container::get() const +std::shared_ptr Container::get() const noexcept { ObjectType interface_type; @@ -56,7 +57,7 @@ std::shared_ptr Container::get() const } template -Interface Container::get() const +Interface Container::get() const noexcept { auto wrapper = std::dynamic_pointer_cast>( bindings.at(ObjectType())); -- cgit v1.2.3-18-g5258