[PATCH] D43773: Implement the container bits of P0805R1

Tim Song via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Feb 26 13:10:10 PST 2018


tcanens added a comment.

Hmm, for `vector` and `deque`, we define a temporary variable, check that sizes match and then use range-and-a-half `equal`:

  const typename vector<_Tp1, _Allocator1>::size_type __sz = __x.size();
  return __sz == __y.size() && _VSTD::equal(__x.begin(), __x.end(), __y.begin());

For `list` we check that sizes match and then use range-and-a-half `equal`, but don't use a temporary variable:

  return __x.size() == __y.size() && _VSTD::equal(__x.begin(), __x.end(), __y.begin());

For `array` we check that sizes match and then use dual-range `equal`:

  if (_Size1 != _Size2)
      return false;
  return _VSTD::equal(__x.begin(), __x.end(), __y.begin(), __y.end());

Is there a subtle reason for this inconsistency that I'm not seeing?


https://reviews.llvm.org/D43773





More information about the cfe-commits mailing list