Tech Off Post

Single Post Permalink

View Thread: What's the reasoning behind the behavior of c++ "std::equal"?
  • User profile image
    Sven Groot

    @McMaiersen: Well, it does test two ranges for equality, it's just that the length of the range to be checked is determined by the first iterator pair. Perhaps it is a peculiar design, but it is in line with how most STL functions that operate on two ranges only require you to specify the end of one of them.

    Also note that this function crashes (or at least has undefined behavior) if the second range is shorter than the first one, so you have to do sanity checking of the lengths before hand anyway.