February 10, 2019
Is it possible to make a comparison predicate with different argument types? For instance, suppose I have a struct like this:

struct Attribute {
    string name;
    variant value;
}

Also, suppose I have a sorted vector of such values. So I can quickly find one by its name field and I have index-based random access to elements at the same time. Therefore I have something like this:

Attribute[] attributes;

Now, imagine I try to find an insertion position for a new element:

--------
string name; // input data

auto sorted = object_.assumeSorted!((a, b) => a.name < b.name);
Attribute dummy;
dummy.name = name;
auto pos = sorted.lowerBound(dummy);
--------

It works fine but is there a way to get rid of the 'dummy' object? I can easily achieve that in C++ since STL allows to have a predicate with different argument types. Ideally, I'd like something like this:

--------
string name; // input data

auto sorted = object_.assumeSorted!((a, b) => a.name < name);
auto pos = sorted.lowerBound(name);
--------

Thanks.
February 10, 2019
> auto sorted = object_.assumeSorted!((a, b) => a.name < b.name);

Sorry for the copy-paste. It should be "attributes" in place of "object_" here, of course:

auto sorted = attributes.assumeSorted!((a, b) => a.name < b.name);