voile.attr

UDA
template getParameterUDAs(alias Func, size_t i)
template getParameterUDAs(alias Func, size_t i, alias attr)
関数のパラメータに付与されたUDAを取り出す。
Parameters:
Func 関数
i 引数の番号(最初の引数は0番目)
attr UDAの種類を指定できます(指定しないとすべて返します)
Returns: UDAのタプルが返ります
Examples:
@(30) struct S {}
enum Test;
alias lambda = (@(10) int x, @(15) @(Test) long y, int z, S s) => x;

alias uda1 = getParameterUDAs!(lambda, 0);
static assert(uda1.length == 1);
static assert(uda1[0] == 10);
alias uda2 = getParameterUDAs!(lambda, 1);
static assert(uda2.length == 2);
static assert(uda2[0] == 15);
static assert(is(uda2[1] == Test));
alias uda3 = getParameterUDAs!(lambda, 2);
static assert(uda3.length == 0);
alias uda4 = getParameterUDAs!(lambda, 3);
static assert(uda4.length == 1);
static assert(uda4[0] == 30);

static assert(getParameterUDAs!(lambda, 0, int).length  == 1);
static assert(getParameterUDAs!(lambda, 0, Test).length == 0);
static assert(getParameterUDAs!(lambda, 1, Test).length == 1);
template getParameterTypeUDAs(alias Func, size_t i)
template getParameterTypeUDAs(alias Func, size_t i, alias attr)
関数のパラメータに付与されたUDAのうち、型についたUDAを取り出す。
Parameters:
Func 関数
i 引数の番号(最初の引数は0番目)
attr UDAの種類を指定できます(指定しないとすべて返します)
Returns: UDAのタプルが返ります
Examples:
@(30) struct S {}
enum Test;
alias lambda = (@(10) int x, @(15) @(Test) long y, int z, S s) => x;

alias uda1 = getParameterTypeUDAs!(lambda, 0);
static assert(uda1.length == 0);
alias uda2 = getParameterTypeUDAs!(lambda, 1);
static assert(uda2.length == 0);
alias uda3 = getParameterTypeUDAs!(lambda, 2);
static assert(uda3.length == 0);
alias uda4 = getParameterTypeUDAs!(lambda, 3);
static assert(uda4.length == 1);
static assert(uda4[0] == 30);
template getParameterArgUDAs(alias Func, size_t i)
template getParameterArgUDAs(alias Func, size_t i, alias attr)
関数のパラメータに付与されたUDAのうち、引数についたUDAを取り出す。
Parameters:
Func 関数
i 引数の番号(最初の引数は0番目)
attr UDAの種類を指定できます(指定しないとすべて返します)
Returns: UDAのタプルが返ります
Examples:
@(30) struct S {}
enum Test;
alias lambda = (@(10) int x, @(15) @(Test) long y, int z, S s) => x;

alias uda1 = getParameterArgUDAs!(lambda, 0);
static assert(uda1.length == 1);
static assert(uda1[0] == 10);
alias uda2 = getParameterArgUDAs!(lambda, 1);
static assert(uda2.length == 2);
static assert(uda2[0] == 15);
static assert(is(uda2[1] == Test));
alias uda3 = getParameterArgUDAs!(lambda, 2);
static assert(uda3.length == 0);
alias uda4 = getParameterArgUDAs!(lambda, 3);
static assert(uda4.length == 0);

static assert(getParameterUDAs!(lambda, 0, int).length  == 1);
static assert(getParameterUDAs!(lambda, 0, Test).length == 0);
static assert(getParameterUDAs!(lambda, 1, Test).length == 1);
enum bool hasParameterUDA(alias Func, size_t i, alias attr);
関数のパラメータにUDAが付与されているか確認します
Parameters:
Func 関数
i 引数の番号(最初の引数は0番目)
attr チェックするUDA
Returns: UDAがあったらtrue
Examples:
@(30) struct S {}
enum Test;
alias lambda = (@(10) int x, @(15) @Test long y, int z, S s) => x;

static assert( hasParameterUDA!(lambda, 0, 10));
static assert(!hasParameterUDA!(lambda, 0, 15));
static assert( hasParameterUDA!(lambda, 1, 15));
static assert( hasParameterUDA!(lambda, 1, Test));
static assert(!hasParameterUDA!(lambda, 2, 15));
static assert( hasParameterUDA!(lambda, 3, 30));
enum bool hasParameterTypeUDA(alias Func, size_t i, alias attr);
関数のパラメータに付与されたUDAのうち、型にUDAがついているか確認します
Parameters:
Func 関数
i 引数の番号(最初の引数は0番目)
attr チェックするUDA
Returns: UDAがあったらtrue
Examples:
@(30) struct S {}
enum Test;
alias lambda = (@(10) int x, @(15) @Test long y, int z, S s) => x;

static assert(!hasParameterTypeUDA!(lambda, 0, 10));
static assert(!hasParameterTypeUDA!(lambda, 0, 15));
static assert(!hasParameterTypeUDA!(lambda, 1, 15));
static assert(!hasParameterTypeUDA!(lambda, 1, Test));
static assert(!hasParameterTypeUDA!(lambda, 2, 15));
static assert( hasParameterTypeUDA!(lambda, 3, 30));
enum bool hasParameterArgUDA(alias Func, size_t i, alias attr);
関数のパラメータに付与されたUDAのうち、引数にUDAがついているか確認します
Parameters:
Func 関数
i 引数の番号(最初の引数は0番目)
attr チェックするUDA
Returns: UDAがあったらtrue
Examples:
@(30) struct S {}
enum Test;
alias lambda = (@(10) int x, @(15) @Test long y, int z, S s) => x;

static assert( hasParameterArgUDA!(lambda, 0, 10));
static assert(!hasParameterArgUDA!(lambda, 0, 15));
static assert( hasParameterArgUDA!(lambda, 1, 15));
static assert( hasParameterArgUDA!(lambda, 1, Test));
static assert(!hasParameterArgUDA!(lambda, 2, 15));
static assert(!hasParameterArgUDA!(lambda, 3, 30));
enum Ignore ignore;
Attribute marking ignore data
enum bool hasIgnore(alias value);
Examples:
struct A { int test; @ignore int foo; }
struct B { int test; }
A a;
B b;
static assert(!hasIgnore!(a.test));
static assert(!hasIgnore!(b.test));
static assert( hasIgnore!(a.foo));
template ignoreIf(alias func)
Attribute marking conditional ignore data
enum bool isIgnoreIf(alias uda);
template hasIgnoreIf(alias symbol, Args...)
template getPredIgnoreIf(alias value, Args...)
enum Essential essential;
Attribute marking essential field
enum bool hasEssential(alias value);
Examples:
struct A { int test; @essential int foo; }
struct B { int test; }
A a;
B b;
static assert(!hasEssential!(a.test));
static assert(!hasEssential!(b.test));
static assert( hasEssential!(a.foo));
enum Key key;
Attribute marking essential field
enum bool hasKey(alias value);
enum bool isKeyMember(T, string member);
template getKeyMemberNames(T)
enum bool hasKeyMember(T);
enum string getKeyMemberName(T);
Examples:
struct A { int test; @key int foo; }
struct B { int test; }
A a;
B b;
static assert(!hasKey!(a.test));
static assert(!hasKey!(b.test));
static assert( hasKey!(a.foo));
static assert( hasKeyMember!A);
static assert(!hasKeyMember!B);
static assert(getKeyMemberNames!A == AliasSeq!("foo"));
static assert(getKeyMemberName!A == "foo");
pure nothrow @nogc @safe Name name(string name);
enum Name name(string n);
Attribute forcing field name
enum bool hasName(alias value);
template getName(alias value) if (hasName!value)
Examples:
struct A { int test; @name("test") int foo; }
struct B { @name!"foo" int test; }
A a;
B b;
static assert(!hasName!(a.test));
static assert( hasName!(a.foo));
static assert( hasName!(b.test));
static assert(getName!(a.foo) == "test");
static assert(getName!(b.test) == "foo");
pure nothrow @nogc @safe Value!T value(T)(T val);
enum Value!(typeof(v)) value(alias v);
Attribute forcing field value
template hasValue(args...)
template getValues(args...)
template getValue(alias value) if (hasValue!value)
Examples:
struct A { int test; @value("test") int foo; }
struct B { @value!1 int test; }
A a;
B b;
static assert(!hasValue!(a.test));
static assert( hasValue!(a.foo));
static assert( hasValue!(b.test));
static assert( hasValue!(b.test, int));
static assert(getValue!(a.foo) == "test");
static assert(getValue!(b.test) == 1);
struct ConvBy(alias T);
alias convBy = ConvBy(alias T);
template isConvByAttr(alias Attr)
template getConvByAttr(alias Attr) if (isConvByAttr!Attr)
template ProxyList(alias value)
template getConvBy(alias value)
enum bool hasConvBy(alias value);
template canConvTo(alias value, T, P = void)
template convTo(alias value, Dst, P = void) if (canConvTo!(value, Dst, P))
template getConvFromStyle(alias value, Src, P = void) if (hasConvBy!value)
template canConvFrom(alias value, T, P = void)
template convFrom(alias value, Src, P = void) if (canConvFrom!(value, Src, P))
template convertTo(alias value)
template convertFrom(alias value)
enum auto isConvertible(alias value, T, P = void);