Cell* find(bool delegate(Cell*) predicate)
{
auto cell = this.first;
- while (cell) {
+ while (cell !is null) {
if (predicate(cell))
return cell;
cell = cell.next;
{
Cell* prev = null;
auto cell = this.first;
- while (cell) {
+ while (cell !is null) {
if (predicate(cell)) {
- if (prev)
- prev.next = cell.next;
- else
+ if (prev is null)
this.first = cell.next;
+ else
+ prev.next = cell.next;
return cell;
}
prev = cell;
{
int result = 0;
auto cell = this.first;
- while (cell) {
+ while (cell !is null) {
// this is necessary to allow removing a node while iterating
auto next = cell.next;
result = dg(cell);
unittest // List
{
List l;
- assert (l.first == null);
+ assert (l.first is null);
assert (l.find(cast(void*) null) is null);
assert (l.find(cast(void*) &l) is null);
Cell[5] cells;