GCC Newspaper
JUNE 15, 2026
Date
/
Architectures
Components
Topics
News & Policy
Other
libstdc++

libstdc++: Include range_access.h from <optional> and <stacktrace>

libstdc++ now includes range_access.h in <optional> and <stacktrace> to implement resolutions for LWG4131 and LWG3625 related to range support.

This commit implements resolutions for LWG4131 and LWG3625, which are part of the P3016R6 proposal, by including range_access.h from <optional> and <stacktrace>. This change is applied as a defect report (DR) for the oldest applicable standards: C++26 for <optional> (since optional range support) and C++23 for <stacktrace> (since its introduction).

In Details

This commit modifies <optional> and <stacktrace> in libstdc++ to include <bits/range_access.h> instead of <bits/stl_iterator.h>. This change is to implement resolutions for LWG4131 and LWG3625 (part of P3016R6), relating to range support in these libraries. It's a fairly isolated change within libstdc++ to align with the C++ standard.

For Context

The C++ Standard Library (libstdc++) provides a set of commonly used classes and functions. <optional> is a library component that represents a value that may or may not be present. <stacktrace> is a library component that provides a way to capture the call stack of a program. This commit updates these components to include range_access.h, which is related to supporting ranges (a new way to represent sequences of data in C++). These changes are driven by the Library Working Group (LWG) to address specific issues and align the library with the evolving C++ standard.

Filed Under: libstdc++rangesoptionalstacktracec++23