concepts 0.0.5

Concepts for D


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

Manual usage
Put the following dependency into your project's dependences section:

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.1.0 2023-Feb-07
0.0.9 2022-Oct-04
0.0.8 2018-Nov-11
0.0.7 2017-Sep-02
0.0.6 2017-May-04
Show all 12 versions
Download Stats:
  • 16 downloads today

  • 116 downloads this week

  • 556 downloads this month

  • 166703 downloads total

Score:
4.4
Short URL:
concepts.dub.pm