|
|
|
|
|
by asveikau
3536 days ago
|
|
> I think objectively it's hard to argue that "item != market.end()" is superior to "iter.hasNext()" Until you realize the purpose of the weird syntax in the former. Namely: you can write algorithms where an iterator is a drop-in replacement for a simple loop through all items in an array via pointer arithmetic, if you write it to take a start and an end iterator as templates. Plus said algorithm can take sub-ranges instead of requiring it to loop through all items. I thought c++ iterators were very strange for many years until I understood this and other rationales. |
|