|
Boost : |
From: David Abrahams (dave_at_[hidden])
Date: 2004-01-27 12:39:58
"Jonathan Turkanis" <technews_at_[hidden]> writes:
> If pointers to objects and pointers to arrays need different
> treatment, one can use:
>
> template<class X> void f(S_ptr<X> px);
> template<class X> void f(S_ptr<X[]> px);
>
> If one only wants to support pointers to objects, but forgets that the
> array case is subsumed by
>
> template<class X> void f(S_ptr<X> px);
>
> I think there will almost certianly be a compiler error if somepone
> tries to pass an array pointer, since the dereferencing operations are
> not supported.
Seriously? Why not? It seems as though dereferencing should be
fine. And incidentally, upcasting should be fine, too:
S_ptr<D[]> -> S_ptr<B>
;-)
-- Dave Abrahams Boost Consulting www.boost-consulting.com
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk