Boost logo

Boost :

From: Greg Colvin (gcolvin_at_[hidden])
Date: 1999-12-07 18:34:07

I'm not competent to comment on the substance of this debate,
but I will agree with Jeremy that being a stickler for the
return type of operator*() is not worth it. I'm not sure
whether we have a library issue or not, but given that we
have vector<bool> we will need to fix the ForwardIterator
requirements so that vector<bool>::interator conforms. That
fix might well apply to GGCL iterators.

Greg Colvin

----- Original Message -----
From: <jsiek_at_[hidden]>
To: <boost_at_[hidden]>
Cc: <lums_at_[hidden]>; <llee1_at_[hidden]>
Sent: Tuesday, December 07, 1999 4:29 PM
Subject: [boost] graph structure interface (proxies and forward iterators)

Hi Dietmar,

I now understand your complaint about operator*() and proxies (or any
non-reference type). The requirements for ForwardIterator specify the
return type of operator*() to be T&. This means that the iterators in
GGCL are not completely conformant to ForwardIterator. They do not
return a reference type, they return an actual object.

I suppose this is one of the reasons that motivated you in moving away
from operator*().

I would still argue that even a non-conformant operator*() is better
than something else. First, there are already other examples in the
standard library of non-conformant forward iterators
(vector<bool>). But most importantly, the operator*() is necessary to
inter-operate with STL algorithms.

For instance, with GGCL one can write:

for_each(adj(v).begin(), adj(v).end(), print_color());

struct print_color {
  template <class Vertex>
  void operator()(const Vertex& v) {
    cout << color[v] << endl;

This would not be possible without operator*.

And finally, I think the number of situations where the return type
not being a reference causes an error will be very small. The
sad fact of the matter is that this is a dirty little corner of
the C++ language where things didn't work out quite right.



et the most popular downloads on the Web. They9re new!
They9re hot! They're FREE! Utilities, drivers, games.
It's all here. Home: - Simplifying group communications

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