Boost logo

Boost :

From: Peter Dimov (pdimov_at_[hidden])
Date: 2001-03-07 09:09:39


From: "David Abrahams" <abrahams_at_[hidden]>

> Yes. Base = int, Value = int
> default reference= int&
> default pointer = int*
> default difference_type = iterator_traits<int>::difference_type, so it
must
> be specified
>
> (see counting_iterator.hpp)

In the CVS, I presume... OK, saw it, doesn't make much sense for someone
that is not on the right frequency. Let me ask some clarifying questions -
hope it doesn't annoy you.

There are two fundamental cases I see: (1) Base is an iterator, (2) it's
not.

In the first case, don't the defaults come from std::iterator_traits<Base>?

In the second case, are the defaults that would come from my hypothetical
default_iterator_traits<ValueType> OK? (reference = ValueType &, pointer =
ValueType *, difference_type = std::ptrdiff_t.) counting_iterator would
redefine only difference_type.

> But, sometimes reference = value_type, though pointer can be deduced.

reference = value_type? Example?

> There
> is simply no single order for parameters which always lets you use the
> default. Sometimes the expression for the default is quite complicated.

I think that some concrete examples would help us move the discussion in a
more practical direction. :-) Examples where the 'named parameters' approach
has significant advantages over the current 'positional' status quo. I'll
try to construct the equivalent traits using inheritance.

--
Peter Dimov
Multi Media Ltd.

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk