Is there a way to write a template constraint that matches any specialization of a given type?

For example can the following be done without having to write out every combination of feature1 and feature2:

  class Foo(bool feature1, bool feature2) { ... }

  void useFoo(T)(T foo)
  if (is(T == Foo!(false, false)) || is(T == Foo!(false, true)) ||
      is(T == Foo!(true, false)) || is(T == Foo!(true, true)))
  {
     // call methods of foo that don't change based on feature1/feature2
  }

Thanks,

--Ed

Reply via email to