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

            Bug ID: 97512
           Summary: Move std::ranges::subrange structured bindings stuff
                    from <ranges> to <ranges_util.h>
           Product: gcc
           Version: 11.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: hewillk at gmail dot com
  Target Milestone: ---

In commit 160061a: libstdc++: Introduce new headers for C++20 ranges
components, structured bindings stuff of std::ranges::subrange is move into
<ranges> header itself, this will make following code failed in gcc-trunk
(https://godbolt.org/z/az5bfc):

#include <vector>
#include <algorithm>

int main() {
  std::vector v{1, 1, 2};
  auto [first, last] = std::ranges::unique(v);
}


error: cannot decompose inaccessible member 'std::ranges::subrange

Put structured bindings stuff together with subrange's definition should be
convenient for users, since std::ranges::remove/unique return a subrange, for a
user like me usually want to structurally bind it without extra including
<ranges>, or it would make sense to have these tuple-related specializations
close to the get functions, which are already in the <bits/ranges_util.h>
header.

Reply via email to