++Phobos
jmh530
john.michael.hall at gmail.com
Thu Oct 17 20:50:54 UTC 2019
On Thursday, 17 October 2019 at 19:37:38 UTC, Meta wrote:
> [snip]
>
> Correct me if I'm wrong, but would using this with std.range be
> as simple as:
>
> import std.range;
>
> @implements!(MyCoolRange, InputRange)
> struct MyCoolRange(T)
> {
> ....
> }
>
> long sum(R)(R range)
> if (implements!(R, InputRange))
> {
> ....
> }
implements is for an interface. You would actually use models
(with the isInputRange from the concepts library, not phobos), so
change
@implements!(MyCoolRange, InputRange)
to
@models!(MyCoolRange, isInputRange)
and you don't need models for below, just change
if (implements!(R, InputRange))
to
if (isInputRange!R)
but make sure you are using the one from the concepts library.
More information about the Digitalmars-d
mailing list