Opened 12 years ago

Closed 12 years ago

Last modified 12 years ago

#4643 closed Bugs (invalid)

Does array operator== behave as excpected

Reported by: pontus.ekh@… Owned by: No-Maintainer
Milestone: To Be Determined Component: array
Version: Boost 1.44.0 Severity: Problem
Keywords: Cc:

Description

this is the body of method operator==:

return std::equal(x.begin(), x.end(), y.begin());

If x is of size n doesn't this just compare if y's first n elements are equal to n. What if y is bigger than x? Is this really the expected behavior?

Change History (2)

comment:1 by anonymous, 12 years ago

Resolution: invalid
Status: newclosed

comment:2 by Marshall Clow, 12 years ago

Just adding a comment here (in case someone is wondering down the road): The operator == compares two arrays of the same size.

    template<class T, std::size_t N>
    bool operator== (const array<T,N>& x, const array<T,N>& y) {
        return std::equal(x.begin(), x.end(), y.begin());
    }
Note: See TracTickets for help on using tickets.