Solved!

Lloyd Dupont ld-REMOVE at galador.net
Thu Jun 16 05:42:51 PDT 2011


work with typeinfo!! :)

=====
void SETTER(T, string member)(Object target, Variant value)
{
    T tt = cast(T)target;
    if (!tt)
        throw new ReflectionException("target is null or not " ~T.stringof 
~" value: " ~target.toString());

    if(!value.convertsTo!( typeof(__traits(getMember, T, member)) ))
        throw new ReflectionException("Can't convert " ~value.stringof ~" to 
" ~typeof(__traits(getMember, T, member)).stringof);
    __traits(getMember, tt, member) = value.coerce!( 
typeof(__traits(getMember, T, member)) );
}
======



More information about the Digitalmars-d-learn mailing list