Boost logo

Boost :

From: David B. Held (dheld_at_[hidden])
Date: 2002-10-02 13:11:21

"Peter Dimov" <pdimov_at_[hidden]> wrote in message
> [...]
> typedef foo * foo_ptr;
> > void g(foo_ptr const& p)
> > {
> > p->bar();
> > p->baz(3); // No Error!
> Ditto.
> > }

True, but people generally don't pass T* const&, and are generally happy
to pass around T* and specify T const* in a function call. Whereas,
smart pointer types tend to be verbose, and I, for one, always typedef
them. I guess the solution is to create a ptr<T const> typedef as well,
and use that in functions. You pay a copy for const-correctness, but I
guess that's just the way it is. Too bad there is no way to force a cast
that changes the type but does not introduce a copy, like builtin pointers.


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