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

  foo(*it);

, 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
ncm_at_[hidden]

------------------------------------------------------------------------
et the most popular downloads on the Web. They9re new!
They9re hot! They're FREE! Utilities, drivers, games.
It's all here. http://clickhere.egroups.com/click/1610

-- Create a poll/survey for your group!
-- http://www.egroups.com/vote?listname=boost&m=1


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