|
Boost : |
From: Dietmar Kuehl (dietmar_kuehl_at_[hidden])
Date: 2000-06-12 17:37:59
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
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk