On Thursday, 11 August 2022 at 19:33:31 UTC, bachmeier wrote:
std.string does a public import of std.algorithm.cmp.

That was it! Thanks!

Conclusion: This is how to overload cmp()
```d

//this is the only place from where all other modules can see these std modules
public import std.string, std.uni, std.algorithm, std.math;

import std.range, std.traits;

//create function overload group
public import std.algorithm : cmp;
public import std.math      : cmp;

auto cmp(A, B)(in A a, in B b) //the custom cmp() function if(!(isInputRange!A && isInputRange!B) //exclude std.algorithm.cmp && !(isFloatingPoint!A && isFloatingPoint!B)) //exclude std.math.cmp
{
  return a==b ? 0 : a<b ? -1 : 1;
}
```

Reply via email to