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

libstdc++: Remove duplicated __mdspan::__is_constant_wrapper.

Removes a duplicated `__is_constant_wrapper` in libstdc++, replacing it with `std::__is_constant_wrapper_v` from the `utility` header.

The __mdspan implementation in libstdc++ contained a duplicate of the __is_constant_wrapper utility. This commit removes the duplicated implementation and replaces its uses with std::__is_constant_wrapper_v from the <utility> header, thus avoiding code duplication.

In Details

The libstdc++ mdspan implementation defines numerous internal utilities (e.g. __is_constant_wrapper, __acceptable_slice_type) to support compile-time checking of index and slice types. This commit eliminates a duplicated definition of __is_constant_wrapper by using the standard std::__is_constant_wrapper_v instead. This is a straightforward cleanup within the mdspan implementation.

For Context

libstdc++ is the C++ standard library implementation that ships with GCC. mdspan is a new feature in recent C++ standards that provides a way to represent multi-dimensional arrays without owning the underlying data. __is_constant_wrapper is a type trait that checks if a type is a constant wrapper (e.g., std::integral_constant). This commit simplifies the mdspan implementation by removing a duplicated utility and using the standard library's version instead.

Filed Under: libstdc++mdspancleanupc++