Boost logo

Boost :

From: Greg Colvin (gcolvin_at_[hidden])
Date: 1999-12-08 02:56:54

How does this square with Howards experience with making the
algorithms work for vector<bool>?

----- Original Message -----
From: Nathan Myers <ncm_at_[hidden]>
To: <boost_at_[hidden]>
Sent: Tuesday, December 07, 1999 7:07 PM
Subject: [boost] Re: graph structure interface (proxies and forward iterators)

Greg Colvin wrote:
> ... 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.

The problem solved by requiring operator* to return an actual T&
is that template argument matching and type deduction cannot look
past conversions or other apparatus. I.e., if you have a template

  template <typename T>
    void foo(T&);

and you say


, then it.operator*() had better return a T&, or you get a compile
error. Casts are no help here, because the caller of foo() is little
more likely to know T than foo() is, and in any case it may not work
to convert it to a T&. (Typically, if it would, you would have
returned T& directly from operator*()).

Nathan Myers

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

-- Create a poll/survey for your group!

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