|
Boost : |
From: jsiek_at_[hidden]
Date: 2000-06-12 21:50:46
This seems like the right solution to me... it worked well just now
for the iterator adaptor implementation I just posted. I suggest we
add a new file, boost/iterator.hpp with this workaround. A first cut
at this file is in iterator_adaptor.zip in the vault.
Cheers,
Jeremy
Dietmar Kuehl writes:
> Hi,
>
> > From: <jsiek_at_[hidden]>
> > > Oh, and on a separate note... there's an issue to be addressed with
> > > std::iterator and the old g++ lib. I've noticed that in recent
> > > revisions of boost/operators.hpp some #define's have been appearing
> > > removing the iterator helpers that use std::iterator. How about
> > > instead of removing the iterator helpers (which will break all of
> > my
> > > code that uses it) we provide std::iterator in boost. I know all
> > the
> > > reasons for not putting in std::iterator in boost, but again, its
> > just
> > > a workaround for a broken implementation.
>
> My preferred solution to this is a different one, namely what I'm using
> currently for my directory iterator rewrite:
>
> namespace boost
> {
> #if defined(__GNUG__) && !defined(_CXXRT_STD)
> template <class Category, class T,
> class Distance = BOOST_CSTD ptrdiff_t,
> class Pointer = T*, class Reference = T&>
> struct iterator
> {
> typedef T value_type;
> typedef Distance difference_type;
> typedef Pointer pointer;
> typedef Reference reference;
> typedef Category iterator_category;
> };
> #else
> template <class Category, class T,
> class Distance = BOOST_CSTD ptrdiff_t,
> class Pointer = T*, class Reference = T&>
> struct BOOST_DECL iterator:
> # if defined(_MSC_VER)
> std::iterator<Category, T, Distance>
> # else
> std::iterator<Category, T, Distance, Pointer, Reference>
> # endif
> {
> };
> #endif
> }
>
> The reason for this hack is that neither the library shipping with
> gcc nor the library shipping with MSVC++ provide a usable version of
> 'std::iterator'. Thus, this code defines a 'boost::iterator' which does
> something suitable... Of course, the if/defs need to be extended to
> cover more compilers (my preferred solution to *this* problem would be
> the use of autoconf but I think we were through this and rejected
> autoconf mainly because most people didn't like it, if I remember
> correctly...).
>
> Regards,
> Dietmar
>
> =====
> <mailto:dietmar_kuehl_at_[hidden]>
> <http://www.dietmar-kuehl.de/>
>
> __________________________________________________
> Do You Yahoo!?
> Yahoo! Photos -- now, 100 FREE prints!
> http://photos.yahoo.com
>
> ------------------------------------------------------------------------
> IT Professionals: Match your unique skills with the best IT projects at
> http://click.egroups.com/1/3381/3/_/9351/_/960849452/
> ------------------------------------------------------------------------
>
>
>
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk