// can't assert that, e.g. !models!(Bar, isFoo) -
// the whole point of `models` is that it doesn't compile
// when the template constraint is not satisfied
static assert(!__traits(compiles, models!(Bar, isFoo)));
static assert(!__traits(compiles, models!(Foo, isBar, byte)));
A static assertion that a type satisfies a given template constraint. It can be used as a UDA or in a static assert to make sure that a type conforms to the compile-time interface the user expects it to. The difference between using models and a simple static assert with the template contraint is that models will instantiate the failing code when the constraint is not satisfied, yielding compiler error messages to aid the user.
The template contraint predicate must start with the word is (e.g. isInputRange) and an associated template function with the "is" replaced by "check" should exist (e.g. checkInputRange) and be defined in the same module.