If you, like me, are modernising your C++ knowledge (or learning it for the first time) and have discovered the C++ modules feature, you probably thought: how cool - it’s like self-contained libraries/assemblies/packages/crates from my favourite language X, which has had them forever! No more #includes, which have been the source of all sorts of problems. But the first thing you’ll likely encounter is that this feature is still not fully supported across compilers. And even when it is supported, the library that should lead this transition - the standard library - may not yet be available as a ready-to-use module. This is currently the case with Clang: the standard library is not shipped as a precompiled module (as of the time of writing). Instead, it is provided as source code, typically located at a path such as /usr/share/libc++/v1/ or /opt/homebrew/opt/llvm/share/libc++/v1, depending on how Clang is installed (e.g. via Xcode or Homebrew LLVM). ...
Using Decorator pattern with .Net Core dependency injection container
TL;DR Configure a decorator with DI as simple as this: services.AddDecorator<IEmailMessageSender, EmailMessageSenderWithRetryDecorator>( decorateeServices => { decorateeServices.AddScoped<IEmailMessageSender, SmtpEmailMessageSender>(); }); You can find the full code as well as demo application at https://github.com/andriysavin/Blog/tree/main/DecoratorAndDotNetDI. Main() Imagine you need to wrap some service with a decorator to add some functionality over it, and you need to do this by configuring your DI container. While many popular DI/IoC containers provide this functionality out of the box, this is not true for .Net Core’s DI (IServiceCollection). Let’s consider particular example. ...