Boost logo

Boost :

From: Jesse Jones (jesjones_at_[hidden])
Date: 2000-10-21 06:50:01


>Yes, it compiles, and instantiates Copy<int *, int *>. Template
>parameter deduction strips top level cv-qualifiers.

By God you're right. Section 14.8.2p3 is pretty clear about this. So my
example really only applies when the Copy function is explicitly
instantiated which is a bit of a stretch...

>Consider what would
>happen if Copy was defined as
>
>template <typename InputIter, typename ForwardIter>
> inline ForwardIter Copy(InputIter first, InputIter last, ForwardIter
>result)
>{
> for(; first != last; ++first, ++result) *result = *first;
>}
>
>and InputIter was int * const. ++first wouldn't compile.

Hmm, it's a bit counter-intuitive, but I think it does make a twisted
sort of sense.

  -- Jesse


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk