#pragma once /* Motivation: consider you have a template class with many parameters with default associations template class TExample { }; consider you would like to provide easy to use interface to tune all these parameters in position independed manner, In that case TTune would be helpful for you. How to use: First step: declare a struct with all default associations struct TDefaultTune { using TStructA = TDefA; using TStructB = TDefB; using TStructC = TDefC; using TStructD = TDefD; }; Second step: declare helper names visible to a user DeclareTuneTypeParam(TTuneParamA, TStructA); DeclareTuneTypeParam(TTuneParamB, TStructB); DeclareTuneTypeParam(TTuneParamC, TStructC); DeclareTuneTypeParam(TTuneParamD, TStructD); Third step: declare TExample this way: template class TExample { using TMyParams = TTune; using TActualA = TMyParams::TStructA; using TActualB = TMyParams::TStructB; ... }; TTune is a struct with the default parameteres taken from TDefaultTune and overridden from "TParams...". for example: "TTune>" will be virtually the same as: struct TTunedClass { using TStructA = TDefA; using TStructB = TDefB; using TStructC = TUserClass; using TStructD = TDefD; }; From now on you can tune your TExample in the following manner: using TCustomClass = TExample , TTuneParamD>; You can also tweak constant expressions in your TDefaultTune. Consider you have: struct TDefaultTune { static constexpr ui32 MySize = 42; }; declare an interface to modify the parameter this way: DeclareTuneValueParam(TStructSize, ui32, MySize); and tweak your class: using TTwiceBigger = TExample>; */ #define DeclareTuneTypeParam(TParamName, InternalName) \ template \ struct TParamName { \ template \ struct TApply: public TBase { \ using InternalName = TNewType; \ }; \ } #define DeclareTuneValueParam(TParamName, TValueType, InternalName) \ template \ struct TParamName { \ template \ struct TApply: public TBase { \ static constexpr TValueType InternalName = NewValue; \ }; \ } #define DeclareTuneContainer(TParamName, InternalName) \ template