Boost logo

Boost :

From: Daryle Walker (darylew_at_[hidden])
Date: 2001-01-07 13:15:25

on 1/6/01 11:37 AM, Howard Hinnant at hinnant_at_[hidden] wrote:

> template <class Y>
> struct auto_ptr_ref<Y[]>
> {
> Y* ptr_;
> };
> And have the specialization refer to auto_ptr_ref<X[]> instead of
> auto_ptr_ref<X>. I believe it has the same effect.

Something about that template syntax has been bothering me: is that the
right way to specialize on an array type? Doesn't each array amount count
as a separate type (i.e. float[3] != float[8])? In that case, using
"template <typename Y> class whatever<Y[]>;" is wrong. In fact, wouldn't
"Y[]" be interpreted as "Y*", like in function arguments, which is
definitely NOT what we want? The alternative syntax could be:

template <typename Y, std::size_t N>
struct auto_ptr_ref<Y[N]>

Daryle Walker
Mac, Internet, and Video Game Junkie
darylew AT mac DOT com

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