
27 Jan
2004
27 Jan
'04
5:39 p.m.
"Jonathan Turkanis" <technews@kangaroologic.com> 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