Boost logo

Boost :

From: David Abrahams (abrahams_at_[hidden])
Date: 2000-12-29 13:01:55

----- Original Message -----
From: "Jeremy Siek" <jsiek_at_[hidden]>

> I tried changing to return by reference, but ran into really nasty
> VC++ compiler bug.

How bizarre!

> This was the cause of some of the headaches of
> using iterator adaptors in the graph library. I suppose we could
> return by reference as long as the compiler isn't VC++.
> As for the concept checking, yes the concept checks would catch
> the reference return type problem, at least on compilers that
> have iterator_traits. Though perhaps there is a way around that...

If you look at boost/detail/iterator.hpp in my proposed binary_search
library you will find boost::detail::iterator_traits<> which will correctly
supply iterator_category and difference_type on all compilers, even for

> template <class TT>
> struct ForwardIteratorConcept
> {
> void constraints() {
> function_requires< InputIteratorConcept<TT> >();
> function_requires< ConvertibleConcept<
> typename std::iterator_traits<TT>::iterator_category,
> std::forward_iterator_tag> >();
> typedef typename std::iterator_traits<TT>::reference reference;
> reference r = *i;
> ignore_unused_variable_warning(r);
> #endif
> }
> TT i;
> };

Looks good to me.

Boost list run by bdawes at, gregod at, cpdaniel at, john at