accessByString

mixin template accessByString (
size_t N
T
string data
string AS
string VVASES = " "
string VVASVS = "|"
) if (
isCompatibleArrayAccessStrings(N, AS, VVASES, VVASVS)
) {}

Examples

1 struct NF
2 {
3     ivec2 data;
4     this(E...)( E e ) if( is(typeof(ivec2(e))) ) { data = ivec2(e); }
5     mixin accessByString!( 2,int,"data", "near far|n f" );
6 }
7 
8 auto b = NF(1,100);
9 assert( eq( b.near, b.n ) );
10 assert( eq( b.far, b.f ) );
11 
12 b.nf = ivec2( 10,20 );
13 assert( eq( b.near, 10 ) );
14 assert( eq( b.far, 20 ) );

Meta