bool empty() const for ranges
Salih Dincer
salihdb at hotmail.com
Fri Nov 26 10:44:10 UTC 2021
Hi All;
I have two questions that make each other redundant. Please
answer one of them. I'm implementing ```bool empty() const``` for
ranges as below:
```d
bool empty() // const
{
bool result;
if(!head)
{
result = true;
fastRewind();
}
return result; // head ? false : true;
}
```
* Is the const essential for ranges?
* Is it possible to rewind the pointer (```Node * head;```) when
my head is empty by the const?
Thanks...
More information about the Digitalmars-d-learn
mailing list