Common System 0.2.0
Common interfaces and patterns for system integration
Loading...
Searching...
No Matches
kcenon::common::concepts::SimpleServiceFactory Concept Reference

A callable that creates service instances without container access. More...

#include <service.h>

Concept definition

template<typename F, typename T>
concept kcenon::common::concepts::SimpleServiceFactory = std::invocable<F> &&
std::convertible_to<std::invoke_result_t<F>, std::shared_ptr<T>>
A callable that creates service instances without container access.
Definition service.h:118

Detailed Description

A callable that creates service instances without container access.

Simple factories don't need container access for dependency resolution. They're useful for services without dependencies or with external dependencies.

Example usage:

template<ServiceInterface T, SimpleServiceFactory<T> F>
void register_simple(IServiceContainer& container, F&& factory) {
container.register_simple_factory<T>(std::forward<F>(factory));
}

Definition at line 118 of file service.h.