#pragma once #include "DI/interfaces/wrapper.hpp" #include "DI/concepts.hpp" #include "DI/object_type.hpp" #include #include #include class Container; template class BindingBuilder { public: explicit BindingBuilder(Container *container) noexcept; template requires std::derived_from void to() noexcept; void to_factory(Interface func) noexcept; private: Container *_container; }; class Container { public: Container() noexcept = default; template using Ptr = std::shared_ptr; template auto bind() noexcept -> BindingBuilder; template requires Abstract auto get() const noexcept -> Ptr; template requires Function auto get() const noexcept -> Interface; void add(BaseObjectType type, const Ptr &wrapper) noexcept; private: std::unordered_map, ObjectTypeHasher> _bindings; }; #include "container.tpp"