Boost logo

Boost :

From: David Abrahams (dave_at_[hidden])
Date: 2004-05-13 09:08:54


"Neal D. Becker" <ndbecker2_at_[hidden]> writes:

> I wonder if there is a more elegant approach?

Yeah: cache a value in the iterator with boost::optional<value_type>.
Put a new value in the cache when the iterator is incremented.

-- 
Dave Abrahams
Boost Consulting
http://www.boost-consulting.com

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk