Hi Adam,
1. front() returning the reference to the first element precondition (assert): !empty(rng)
return *begin(rng);
2. back() returning the reference to the last element precondition (assert): !empty(rng)
For BidirectionalRange return *(--end(rng));
In 99% of all cases above implementations will work just fine. However, there may be rare cases where the lifetime of the reference is bound to the lifetime of the iterator: [iterator.requirements.general] 9. Destruction of an iterator may invalidate pointers and references previously obtained from that iterator. Valentin -- Valentin Ziegler | vziegler@think-cell.com Senior Software Engineer We are looking for C++ Developers: http://www.think-cell.com/career think-cell Software GmbH | Chausseestr. 8/E | 10115 Berlin | Germany http://www.think-cell.com | phone +49 30 666473-10 | US phone +1 800 891 8091 Amtsgericht Berlin-Charlottenburg, HRB 85229 | European Union VAT Id DE813474306 Directors: Dr. Markus Hannebauer, Dr. Arno Sch?dl