From: Jonathan Turkanis (technews_at_[hidden])
Date: 2004-01-24 20:19:39


"Daryle Walker" <darylew_at_[hidden]> wrote in message
news:BC3875FB.576B%darylew_at_hotmail.com...
> On 1/21/04 5:25 PM, "Howard Hinnant" <hinnant_at_[hidden]> wrote:
>
> [SNIP]
> > With move_ptr<T[]> you (or at least I) immediately think: Ok, a
smart
> > pointer to an array.
> [TRUNCATE]
>
> I forgot; will "T[]" resolve to an array type? In function
parameters, it
> reduces to "T*", which is something unsuitable here if the same
thing
> happens.
>

Hi Daryle,

Are you thinking of something like this:

    template<typename T>
    void f(T t)
    {
        BOOST_STATIC_ASSERT((boost::is_same<T, int* >::value));
    }

    int main()
    {
        int a[100];
        f(a);
    }

?

Here 'a' is converted to int* before template argument deduction, so T
is deduced to be int*. This applies only to function templates, and
doesn't happen at all if the template argument is explicitly
specified.

Jonathan