Boost logo

Boost :

From: Jesse Jones (jesjones_at_[hidden])
Date: 2000-10-21 23:23:21


>Jesse Jones wrote on 10/21/2000 8:19 PM
>>Right, there's one trivial error (is_POD needs a const int
>>specialization) and a more serious one where I try to get the value_type
>>using iterator_traits (because int* const is not a valid iterator type).
>
>Not that this has anything to do with is_pointer, but there's at least
>one more bug in Copy. Consider:
>
>int main()
>{
> int i[10];
> double j[10];
> Copy(i, i+10, j);
>}

Thanks for pointing this out (I was thinking of using code like this at
work :-)). The fix is pretty easy of course:

    typedef std::iterator_traits<InputIter>::value_type T0;
    typedef std::iterator_traits<ForwardIter>::value_type T1;

    enum {optimize = is_pointer<InputIter>::value*
                     is_pointer<ForwardIter>::value*
                     is_POD<T0>::value*
                     is_same<T0, T1>::value};

  -- Jesse


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