I need to have a way to remove a class member field at compile time based on some condition. I've been trying a few things, such as this:
template <bool Condition, class FieldType> struct Conditional { FieldType Value; };
template <class FieldType> struct Conditional<false, FieldType> {};
But my problem is that members declared this way still use space on the total class size. My goal is to reduce total class size by removing some members depending on compile time condition. Is this possible without class inheritance?
I have access to C++20 if that matters.