struct,template arguments, C++ I am writing color model logic in C++. I ask review in  defining limits for the color model, by saying Limits I mean this.
Consider a struct which represents RGB color model.
template&lt;typename T&gt;
struct RGB {
   T r,g,b;
};

So I declared a type RGB&lt;T&gt; where T can be any arithmetic type (the assertion is done, don't worry). So now I can create types using RGB_Float = RGB&lt;flaot&gt; or using RGB_888 = RGB&lt;unsigned char&gt; and so on.
As you already guessed I am doing image processing and sometimes there comes a time where I want a type RGB&lt;float&gt; where each component limits are [0-1] and sometimes I want same RGB&lt;float&gt; with the limits [10-20] (An example) . Also I need each type to know its limits, at compile time. Syntax is like RGB_Float::Limits::max() \\Returns max RGB_Float and RGB_Float::Limits::min() \\ Returns min RGB_Float. So I need to change my struct RGB&lt;T&gt; this way.
template&lt;typename T, typename LIMITS&gt;
struct RGB {
    using Limits = LIMITS;
    T r,g,b;

}

And before declaring any RGB&lt;T,LIMITS&gt; type I need to create a struct like
RGB_FloatLimits {
     static RGB&lt;float,RGB_FloatLimits&gt; max( return {1.0f,1.0f,1.0f};
     ... // min implementation too.
}

And then using RGB_Float = RGB&lt;float,RGB_FloatLimits&gt;;
I know that this is a bad solution but I think it's the only if you use C++17. I spent a week trying to pass the limits as a template argument to a color model. Please review this solution and I am 90% sure that there is a better way to do this. Thx in advance.
Note In any implementation of the limits sizeof the color model must remain the same.(So we must store the max and min statically)
C++11
Pre C++20 you have to use the type traits based approach, which is essentially what you have done. I dont think this is a bad solution, but probably the way to go if you need to.
C++20 solution (if integral min and max are ok also for C++11 )
In C++ 20 this all becomes easier as it finally allows for class and float non-type template arguments.
template&lt;typename T, T min, T max&gt;
struct RGB {
    T r,g,b; 
}

works for T = int, T = char, T = float and so on.
This is the most straightforward solution I could think of that does not need any helper classes. If you only need min and max this is probably good.
If you could live with integer min and max then this also works pre C++20. Simply use int for the min and max template arguments.
The drawback is that in every function that accepts an RGB you need three  template parameters (T, min and max), which could create a lot of noise in the code and make it less readable.
In case you need more than two config parameters
In case min and max is not a sufficient description of the number range, you could add addtional template parameters. However I would not advise this but make the parameters now a class.
In C++20 this is very straightforward again, as you can also use class values as template parameters. This is a bit more clear than the previous type based traits approach (which is also the one you are using).
template &lt;class T&gt;
struct RGBconfig&lt;T&gt; {
   T min, max;
}

template&lt;typename T, RGBconfig&lt;T&gt; config&gt;
struct RGB {
    T r,g,b; 
}

use as
constexpr RGBconfig&lt;float&gt; float1020 = {10, 20}  

using RGBfloat1020 = RGB&lt;float, float1020&gt;  

alternatively one could do
using RGBfloat1020 = RGB&lt;float, RGBconfig&lt;float&gt; {10,20} &gt;  

Reduce to one template parameter =&gt; include type in RGBconfig
Perhaps it is even possible to reduce it down to one template argument
template &lt;class T&gt;
struct RGBconfig&lt;T&gt; {
   using type = T;
   T min, max;
}

template&lt;auto config&gt;
struct RGB {
    typename decltype(config)::type    r,g,b; 
}

then use as
constexpr RGBconfig&lt;float&gt; float1020 = {10, 20};
using RGBfloat1020 = RGB&lt;float1020&gt;;

or
using RGBfloat1020 = RGB&lt;RGBconfig&lt;float&gt; {10,20} &gt;;