===================================================== 582484 Algorithm Libraries ===================================================== -------------------- Exercise 2 solutions -------------------- 1. int_range_iterator now models the random access iterator concept completely. Conformance is tested using the Boost `concept check`_ library. .. include:: teht1.cpp :literal: 2. adjacent_find a. .. include:: teht2.cpp :literal: b. Because of input iterators, we have to return an iterator to the latter one of the two adjacent values. The original version of adjacent_find required its value type to be equality comparable. Our new version requires, in addition, the assignable concept. 3. reverse_word_order .. include:: teht3.cpp :literal: 4. If we use the ready made algorithms *distance* and *advance*, we don't have to care about tag dispatching: the STL does it for us. .. include:: teht4.cpp :literal: .. _concept check: http://www.boost.org/libs/concept_check/concept_check.htm .. _Koenig lookup: http://en.wikipedia.org/wiki/Koenig_lookup