From: Eric Niebler (eric_at_[hidden])
Date: 2007-08-06 01:03:40


chun ping wang wrote:
> reply thanks. Sort of off topic but does foreach need access to iterator
> (and not const_iterator).. like i have class B deriving from private
> std::vector<int> i allow const_iterator but not iterator. I get compile
> time error.

FOREACH uses Boost.Range. If your type doesn't naturally meet the
requirements for a range (and it sounds like it doesn't), you must hook
Boost.Range's customization points. Check the documentation.

http://boost.org/doc/html/foreach/extensibility.html

-- 
Eric Niebler
Boost Consulting
www.boost-consulting.com
The Astoria Seminar ==> http://www.astoriaseminar.com