From: Dave Abrahams (abrahams_at_[hidden])
Date: 2000-01-12 20:27:27
This is beautiful...
> The reference type does not have to be a real C++ reference. The
> requirements of the reference type depend on the context within which
> the Collection is being used. Specifically it depends on the
> requirements the context places on the value type of the Collection.
> The reference type of the Collection must meet the same requirements
> as the value type. Note that it is permissable for the reference type
> to be a Proxy class,
...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?
> 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?
I think there are probably a couple of other details like the first one
above lurking along the edge between proxies and real references.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk