The Author Online Book Forums are Moving

The Author Online Book Forums will soon redirect to Manning's liveBook and liveVideo. All book forum content will migrate to liveBook's discussion forum and all video forum content will migrate to liveVideo. Log in to liveBook or liveVideo with your Manning credentials to join the discussion!

Thank you for your engagement in the AoF over the years! We look forward to offering you a more enhanced forum experience.

ambs (22) [Avatar] Offline
Although it is not a specific detail on functional programming, a little could be talked about iterators. Specially if the reader, like myself, is not really a C++ programmer, trying to learn C++ from the functional point of view.

Usually, on other languages, iterators iterate up until the end of the iterator. looking to the book, I would say every function receives the iterator, and the last element, so it knows when to end.

I confess this is not very 'functional', where lists (and lazy ones) are the usual data structure, where it doesn't make much sense to specify where the list ends...
Ivan Cukic (104) [Avatar] Offline
In C++, functions like these receive pairs of iterators - one to the start of the collection, and another to the position after the last element in the collection - the collection is then [ begin, end )

With lists, if the list structure does not remember its end, the end iterator would be a sentinel value, not a 'proper' iterator. This should be covered a bit in the chapter on Ranges.