79826853

Date: 2025-11-21 18:39:12
Score: 1
Natty:
Report link

My goal is to reproduce the ASP.NET core IServiceCollection.

The idea behind the dynamic tuple is to have it constructed with structure containing all the "settings" as template parameters:

std::tuple<Service<ServiceType::Singleton, Interface, Implementation /*, ...*/> /*, ... */>;

and then using reflection on this tuple type to later generate the different container when calling a build function.

What I call "container" is the structure containing all the information about the service and the different builder callback. (equivalent of instantiating Service<...>)

I give up on this idea (this is currently not feasible) and will use an IService (base interface of Service<...>) in combination of std::meta::identifier_of and some other c++26 reflection features to generate the container directly with meta-information. When needed during DI, I will use the already existing meta-information, to retrieve all the necessary type, to then cast the interface to it's original type using std::static_pointer_cast and do the rest of the instantiation of the service.

You can check it out on my github

At the time of writing, I'm still working on the implementation

Reasons:
  • Blacklisted phrase (0.5): check it out
  • Contains signature (1):
  • Long answer (-1):
  • Has code block (-0.5):
  • Self-answer (0.5):
  • Low reputation (0.5):
Posted by: DipStax