How to create a vitual struct?
bioinfornatics via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Mon May 26 07:44:07 PDT 2014
Hi,
I would like to create a virtual struct, i mean as Input Range.
You can create a new struct type and to be an input range. i know
that use duck typing :-)
In my case i would like to use duck typing if a stuct of any type
have an a given attribute. By exbample if at least on field as
@MyUDA
with this i could send any type of struct to a function
struct MyUDA {}
struct A {
@MyUDA int a;
}
strct B {
@MyUDA string b;
}
foo( A );
foo( B );
I hope that is enough clear.
More information about the Digitalmars-d-learn
mailing list