Boost logo

Boost :

Subject: [boost] [iterator] Constness of counting_iterator
From: Claas (claas.koehler_at_[hidden])
Date: 2013-02-01 10:31:44


Hi all!

I was wondering why the dereference operator of counting_iterator<T> returns a constant reference to
T instead of a reference to T.

Naively I would expect counting_iterator<T>::reference to be T& and counting_iterator<const
T>::reference to be const T&.

I suppose however that there was good reason to implement counting_iterator the way it is
implemented. Could anyone kindly point this reason out to me?

Regards
Claas


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