std.socket.Address not allowed in tuples
Neia Neutuladh
neia at ikeran.org
Thu Jan 24 02:07:39 UTC 2019
On Thu, 24 Jan 2019 01:35:57 +0000, Steven O wrote:
> Is there any documentation or examples of how to do that? The
> RedBlackTree documentation gives trivial examples like
You define a function implementing the "less" operation for a pair of
Tuple!(Address, int) (or whatever you have).
---
alias V = Tuple!(Address, int);
bool less(V a, V b)
{
if (a[0].classinfo != b[0].classinfo)
{
return a[0].classinfo < b[0].classinfo;
}
// do something for InternetAddress, Internet6Address, etc
return 0;
}
---
Then pass that to RedBlackTree:
---
alias VTree = RedBlackTree!(V, less);
VTree tree = new VTree();
---
More information about the Digitalmars-d-learn
mailing list