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

--- Comment #3 from 康桓瑋 <hewillk at gmail dot com> ---
(In reply to Patrick Palka from comment #1)
> I thought that too about _InputIterator constraints, but it seems it's
> allowed by [container.reqmnts]/69:
> 
>     The behavior of certain container member functions and deduction guides
>     depends on whether types qualify as input iterators or allocators.
>     The extent to which an implementation determines that a type cannot be
>     an input iterator is unspecified, except that as a minimum integral
>     types shall not qualify as input iterators.

But it is inconsistent with the constraints of the corresponding member
function of std::flat_map, which requires __has_input_iter_cat.

If libstdc++ intends to make these seemingly-legacy-iterator-pair members
support C++20 iterators, then at least we may need to do things differently
depending on the iterator system, for example:

  if constexpr (input_iterator<_InputIterator>) {
    // perform ranges::xxx operations
  }
  else if constexpr (__has_input_iter_cat<_InputIterator>) {
    // perform std::xxx operations
  }

Reply via email to