Boost logo

Boost :

From: jsiek_at_[hidden]
Date: 2000-01-12 20:32:38


Dave Abrahams writes:
> This is beautiful...
>

Thanks

 [ good part ... ]
>
> ...up to this point...
>
> > but only in contexts where there are not
> > requirements for member access on the value type, since it is
> > impossible for a proxy class to provide member access due to the lack
> > of an overloadable member access operator.
>
> C'mon, suppose I provide a reference type which reflects all of the members
> of the value type that are required by the context?

Ok, good point.

> > Also note it is
> > permissable for the reference type to be the value type itself. It
> > would not be appropriate to use the reference type for a function
> > argument with the intent that the argument will be pass-by-reference.
>
> Hmm. There may be some subtle issues here, which I'd rather not discuss.
> Against my better judgement:
>
> If you return a proxy by value you can pass it to a function accepting a
> const proxy&, but not to a function accepting a non-const proxy&. This would
> only matter in the case where the reference type was identical to the value
> type, since otherwise (in theory at least) the client code doesn't know
> anything about the reference type.
>
> Do you need two separate proxy types for const and non-const references?
>

Yes, often they do need to be different types. Also, sometimes you
don't need a proxy for the const reference, but you do for the
reference (this is the case for sparse vectors/matrices in MTL).
Good thing there are two different typedefs to handle this :)

Ciao,

Jeremy


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