www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - How to create a vitual struct?


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

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.
May 26 2014