concepts 0.0.5

Concepts for D


To use this package, run the following command in your project's root directory:

Concepts for D

Build Status

Right now there's only models, which can be used as a UDA or in a static assert:

    void checkFoo(T)()
    {
        T t = T.init;
        t.foo();
    }

    enum isFoo(T) = is(typeof(checkFoo!T));

    @models!(Foo, isFoo) //as a UDA
    struct Foo
    {
        void foo() {}
        static assert(models!(Foo, isFoo)); //as a static assert
    }

Here a template constraint isFoo is guaranteed to be true for type Foo. The difference between this and a regular static assert is that when the predicate fails the code for checkFoo is instantiated anyway so that the user knows why it failed to compile.

Authors:
  • Atila Neves
Dependencies:
none
Versions:
0.0.8 2018-Nov-11
0.0.7 2017-Sep-02
0.0.6 2017-May-04
0.0.5 2017-Apr-07
0.0.4 2017-Feb-16
Show all 9 versions
Download Stats:
  • 17 downloads today

  • 50 downloads this week

  • 163 downloads this month

  • 6859 downloads total

Score:
2.9
Short URL:
concepts.dub.pm