https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114149

--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> ---
We would need something like this to ensure we don't use memcmp for insane
iterators that use exceptions for flow control to exit algorithms early:

  // N.B. this is not the same as nothrow-forward-iterator, which doesn't
  // require noexcept operations, it just says it's undefined if they throw.
  // Here we require them to be actually noexcept.
  template<typename _Iter>
    concept __nothrow_contiguous_iterator
      = contiguous_iterator<_Iter> && requires (_Iter __i) {
       // If these operations can throw then the iterator could cause
       // the algorithm to exit early via an exception, in which case
       // we can't use memcmp, memcpy, etc.
       { *__i } noexcept;
       { ++__i } noexcept;
      };

Reply via email to