Boost logo

Boost :

From: Peter Dimov (pdimov_at_[hidden])
Date: 2000-10-20 08:26:02


From: "Jesse Jones" <jejones_at_[hidden]>

[...]

> Brave man. :-) Here's an example of using is_pointer without regard to
> cv-qualifiers. A std::copy implementation written using
meta-programming
> idioms:
>
> #include <string>
>
> // is_pointer (const pointers are considered to be pointers)
> template <typename T> struct is_pointer { static const bool value =
false; };
> template <typename T> struct is_pointer<T*> { static const bool value
=
> true; };
> template <typename T> struct is_pointer<const T*> { static const bool
value
> = true; };

This does not reflect what the comment says. is_pointer<T *
const>::value is false...

[...]

> // Copy
> template <typename InputIter, typename ForwardIter>
> inline ForwardIter Copy(InputIter first, InputIter last, ForwardIter
result)

... and in any event, your InputIter and ForwardIter types can't be
cv-qualified anyway, unless you explicitly provide them...

> int main()
> {
> int i[10];
> int j[10];
> Copy(i, i+10, j);

... and you don't. :)

--
Peter Dimov
Multi Media Ltd.

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