Boost logo

Boost :

Subject: [boost] [array] assignement operator
From: vicente.botet (vicente.botet_at_[hidden])
Date: 2009-05-15 07:28:46


Boost.Array defines an assignement operator with the following prototype

template<typename T, std::size_t N>
class array {
public:
    /...
    template<typename U>
    array& operator=(const array<U, N>& rhs);
    // Effects:std::copy(rhs.begin(),rhs.end(), begin())
};

I was wondering if this can be extended to manage with arrays of different sizes, having as effect the copying of the minimum of N and M elements from the source to the target.

template<typename T, std::size_t N>
class array {
public:
    /...
    template<typename U, std::size_t M>
    array& operator=(const array<U, M>& rhs);
    // Effects:std::copy(rhs.begin(),rhs.begin()+min(N,M), begin())
};

Is there anything wrong with this interface?

Best,
_____________________
Vicente Juan Botet Escribá


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