capydi
Loading...
Searching...
No Matches
capy::di::DI< Configs > Class Template Reference

Primary dependency injection container managing configurations and resolution. More...

#include <Container.hpp>

Public Member Functions

constexpr DI (Configs &&... configs)
template<typename Type, typename KeyPack = meta::Pack<Type>, typename InputType = std::tuple<>>
constexpr Resolution< Type, Error > auto resolve (InputType &&input=std::tuple{}) const

Detailed Description

template<typename... Configs>
class capy::di::DI< Configs >

Primary dependency injection container managing configurations and resolution.

Template Parameters
ConfigsParameter pack of config types satisfying the DiConfig concept. These are automatically classified as either CreationalConfig or ChainableConfig.

The DI container stores two internal dispatchers that handle different aspects:

  • CreationalDispatcher: Manages creation and lifetime of dependencies
  • ChainableDispatcher: Applies decorators and transformations to created objects

All resolution happens with compile-time type safety via concepts and template specialization. The container filters the input configs into two groups and rebinds them to their respective dispatchers, creating a type-safe, zero-overhead abstraction.

Note
The container is constexpr-compatible, enabling compile-time DI setup where possible.

Constructor & Destructor Documentation

◆ DI()

template<typename... Configs>
capy::di::DI< Configs >::DI ( Configs &&... configs)
inlineexplicitconstexpr

Member Function Documentation

◆ resolve()

template<typename... Configs>
template<typename Type, typename KeyPack = meta::Pack<Type>, typename InputType = std::tuple<>>
Resolution< Type, Error > auto capy::di::DI< Configs >::resolve ( InputType && input = std::tuple{}) const
inlinenodiscardconstexpr

The documentation for this class was generated from the following file: