| Thread overview | |||||
|---|---|---|---|---|---|
|
May 02, 2015 Builtin Support for Comparison Function for Primitive Types | ||||
|---|---|---|---|---|
| ||||
Why doesn't std.algorithm.comparison.cmp support primitive types such as
assert(cmp(0,1) == true);
?
| ||||
May 02, 2015 Re: Builtin Support for Comparison Function for Primitive Types | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Per Nordlöw | On Saturday, 2 May 2015 at 08:29:11 UTC, Per Nordlöw wrote:
> Why doesn't std.algorithm.comparison.cmp support primitive types such as
>
> assert(cmp(0,1) == true);
>
> ?
Correction if mean
assert(cmp(0,1) == -1);
| |||
May 02, 2015 Re: Builtin Support for Comparison Function for Primitive Types | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Per Nordlöw | On Saturday, 2 May 2015 at 08:29:11 UTC, Per Nordlöw wrote:
> Why doesn't std.algorithm.comparison.cmp support primitive types such as
>
> assert(cmp(0,1) == true);
>
> ?
I just found some forgotten code of my that solves it through
import std.range: only;
assert(cmp(only(0), only(1)) == -1);
Why the detour over std.range.only()?
| |||
Copyright © 1999-2021 by the D Language Foundation
Permalink
Reply