Can you come up with a D library solution to the following C++11 proposal:

  http://www.open-std.org/JTC1/SC22/WG21/docs/papers/2014/n3950.html

The idea is to be able to have standard comparison behavior for structs without boilerplate. For example, if the ordering should consider all members of the following struct one after the other (first 'i', then 'l', and finally 's'):

struct S
{
    int i;
    long l;
    string s;

    mixin DefaultComparisons!();    // something like this?
}

Or perhaps with an explicit comparison order? For example, to use 'l' as the primary key instead, and 'i' as the secondary key, and to ignore 'buffer' altogether:

struct S
{
    @Order(2)    int i;
    @Order(1)    long l;
    @OrderIgnore string buffer;

    mixin DefaultComparisons!();    // ?
}

Thank you,
Ali

Reply via email to