On 12/02/2018 8:35 AM, Nathan S. wrote:
For example in std.container.rbtree:
---
auto equalRange(this This)(Elem e)
{
auto beg = _firstGreaterEqual(e);
alias RangeType = RBRange!(typeof(beg));
if (beg is _end || _less(e, beg.value))
// no values are equal
return RangeType(beg, beg);
static if (allowDuplicates)
{
return RangeType(beg, _firstGreater(e));
}
else
{
// no sense in doing a full search, no duplicates are allowed,
// so we just get the next node.
return RangeType(beg, beg.next);
}
}
---
https://dlang.org/spec/template.html#TemplateThisParameter