$include_dir="/home/hyper-archives/boost/include"; include("$include_dir/msg-header.inc") ?>
From: Howard Hinnant (hinnant_at_[hidden])
Date: 2001-01-07 14:51:57
Daryle Walker wrote on 1/7/2001 1:15 PM
>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]>
>{
>    //...
>};
I don't believe that introducing the size_t into the type would be the 
correct thing to do.  Whatever we're calling this beast, its job is to 
handle a _dynamically_ sized array.  N will not be known until runtime.  
Furthermore, that information is not needed (unless perhaps we wanted to 
implement array bounds checking).
However, it is a fact that Y[] is an incomplete type (3.9/7).  This type 
is different from Y[N] for any N.  And also different from any pointer 
type to Y.  Your question raised a concern with me as to whether 
incomplete types could be used as template parameters.  But 14.3.1/2 
confirms that incomplete types can indeed be used as template parameters, 
up to the point that incomplete types can be used in non-templated code.
-Howard