|
Boost : |
From: David Abrahams (dave_at_[hidden])
Date: 2004-04-13 21:50:54
"Neal D. Becker" <ndbecker2_at_[hidden]> writes:
> OK, I think I have answered my own question. Here is an adaptation of
> cycle_iterator to new boost iterator adaptors:
>
> // (C) Copyright Gennadiy Rozental 2002.
> // Permission to copy, use, modify, sell and distribute this software
> // is granted provided this copyright notice appears in all copies.
> // This software is provided "as is" without express or implied warranty,
> // and with no claim as to its suitability for any purpose.
> //
> // See http://www.boost.org for most recent version including documentation.
>
>
>
> #ifndef CYCLE_ITERATOR_HPP
> #define CYCLE_ITERATOR_HPP
>
> #include<boost/iterator/iterator_adaptor.hpp>
> #include<utility>
>
> namespace boost {
>
> template<typename BaseIterator>
> class cycle_iterator : public boost::iterator_adaptor<
> cycle_iterator<BaseIterator>,
> BaseIterator> {
>
> friend class iterator_core_access;
If you're going to make the core functions public, there's really no
reason to make iterator_core_access a friend. Why not make increment
et al private?
-- 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