std.container.RedBlackTree versus C++ std::set

Jonathan M Davis jmdavisProg at gmx.com
Fri Feb 15 15:40:41 PST 2013


On Friday, February 15, 2013 23:49:53 monarch_dodra wrote:
> On Friday, 15 February 2013 at 22:06:55 UTC, Steven Schveighoffer
> 
> wrote:
> > With opcmp:
> > 
> > int opCmp(int a, int b)
> > {
> > 
> > return a - b;
> > 
> > }
> 
> Genius!
> 
> Now I feel bad for every time I've done integral opCmp with
> double ternary operators :(

Except that you have to worry about overflow if you use subtraction, so it's 
actually a bad idea in the general case.

- Jonathan M Davis


More information about the Digitalmars-d-learn mailing list