Whats the proper way to write a Range next function

Christian Köstlin christian.koestlin at gmail.com
Wed Jun 15 13:52:24 UTC 2022


the naive version would look like

```d
auto next(Range)(Range r) {
     r.popFront;
     return r.front;
}
```

But looking at a mature library e.g. 
https://github.com/submada/btl/blob/9cc599fd8495215d346ccd62d6e9f1f7ac140937/source/btl/vector/package.d#L229 
is looks like there should be tons of annotations/attributes on it.

Kind regards,
Christian



More information about the Digitalmars-d-learn mailing list