Sort an array of composite structures: Difference between revisions
Content deleted Content added
Updated D code |
|||
Line 475: | Line 475: | ||
static struct Pair { string name, value; } |
static struct Pair { string name, value; } |
||
Pair[] pairs = [{"Joe", "5531"}, |
|||
{"Adam", "2341"}, |
|||
{"Bernie", "122"}, |
|||
{"Walter", "1234"}, |
|||
{"David", "19"}]; |
|||
⚫ | |||
sort!q{ a.name < b.name }(pairs); |
|||
⚫ | |||
writeln(pairs); |
writeln(pairs); |
||
}</lang> |
}</lang> |