__traits(allMembers) gives you *all* members, including methods (even implicit). As soon as you define opAssign for your Decimal, it gets defined for OrderDb too, and then you try to assign to it :)

What you need is something like this:

void execute(T)(T struc){
        Variant[] arr = new Variant[](2);

        foreach(i, member; struc.tupleof) {
                static if (isInstanceOf!(Decimal, typeof(member))){
                        // Store decimals as string
                        arr[i] = member.toString();
                } else {
                        // Store other values with their types
                        arr[i] = member;
                }
        }
}


Reply via email to