Is there a way to create your own enable_if like condition?
I have a template class: Foo<int, int, int>
and I have another template class which takes a type: Template <T> class Bar
.
I'd like to constrain the Bar
class such that the type it takes may only be any of the Foo
class specialisations. Eg, can take Foo<0, 0 ,1>
but can't take type int.
Is there a short and neat way of requiring this constraint through a user-defined enable_if? Is there a better method I haven't considered? Ideally the solution would be relatively compact and clear, possibly in the way std::is_arithmetic works.
Thanks for your time and suggestions.