]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
libstdc++: provide debug impl of P2697 ctor [PR119742]
authorNathan Myers <ncm@cantrip.org>
Mon, 7 Jul 2025 20:54:26 +0000 (16:54 -0400)
committerNathan Myers <ncm@cantrip.org>
Mon, 28 Jul 2025 09:34:32 +0000 (05:34 -0400)
This adds the new bitset constructor from string_view
defined in P2697 to the debug version of the type.

libstdc++-v3/Changelog:
PR libstdc++/119742
* include/debug/bitset: Add new ctor.

libstdc++-v3/include/debug/bitset

index ad9b7b5c4b06637170f637cf61a8728295cba1fa..e4d3e6619c96c1e6ae06d3f812400b78e1dca623 100644 (file)
@@ -164,6 +164,17 @@ namespace __debug
               _CharT __zero, _CharT __one = _CharT('1'))
        : _Base(__str, __pos, __n, __zero, __one) { }
 
+#ifdef __cpp_lib_bitset // ... from string_view
+      template<class _CharT, class _Traits>
+       constexpr explicit
+       bitset(std::basic_string_view<_CharT, _Traits> __s,
+         std::basic_string_view<_CharT, _Traits>::size_type __position = 0,
+         std::basic_string_view<_CharT, _Traits>::size_type __n =
+           std::basic_string_view<_CharT, _Traits>::npos,
+         _CharT __zero = _CharT('0'), _CharT __one = _CharT('1'))
+       : _Base(__s, __position, __n, __zero, __one) { }
+#endif
+
       _GLIBCXX23_CONSTEXPR
       bitset(const _Base& __x) : _Base(__x) { }