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

libstdc++: Make is_exhaustive const for layout_(left/right)_padded

The `is_exhaustive` member function for `layout_left_padded` and `layout_right_padded` in libstdc++ is now correctly marked as `const`.

The C++ standard requires the is_exhaustive member function to be const for layout mapping types. This patch marks is_exhaustive as const for layout_left_padded and layout_right_padded in libstdc++. This allows calling is_exhaustive on mdspan with these layouts, which was previously ill-formed.

In Details

The layout_left_padded and layout_right_padded classes in libstdc++ are used to represent memory layouts with padding on the left or right side of each row. The is_exhaustive member function determines whether the layout covers the entire memory space. The standard requires this function to be const. This patch fixes a conformance issue in the implementation.

For Context

The C++ standard library provides tools for working with multi-dimensional arrays, including the mdspan class and layout mapping types. Layout mapping types define how the elements of a multi-dimensional array are arranged in memory. This commit fixes a standard conformance issue in libstdc++ related to the is_exhaustive member function, which checks if a layout covers the entire memory space. Marking the function as const ensures that it can be called on constant objects.

Filed Under: libstdc++mdspanc++23standard conformance