[patch] Apply DR434 resolution to <debug/bitset>

Jonathan Wakely cow@compsoc.man.ac.uk
Fri May 6 09:54:00 GMT 2005


Found this while looking at the vector<bool> issue I posted earlier.

The resolution to DR434 was not applied to <debug/bitset> which causes
testsuite/23_containers/bitset/to_string/1.cc to FAIL in debug mode.

The attached patch fixes the FAIL on 4.0 and mainline, OK for both?
(DR434 resolution is not on the 3.4 branch)

Should I use the DR ChangeLog format like this?

2005-05-05  Jonathan Wakely  <redi@gcc.gnu.org>

        DR 434. bitset::to_string() hard to use [Ready]
        * include/debug/bitset (to_string): Add three overloads, taking
        fewer template arguments.

I'm not sure if this patch follows C++STYLE correctly, I'll revise it if
there's a preferred way to break the template arguments in the return
value.

jon

-------------- next part --------------
Index: include/debug/bitset
===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/include/debug/bitset,v
retrieving revision 1.4
diff -u -p -r1.4 bitset
--- include/debug/bitset	16 Apr 2004 19:04:04 -0000	1.4
+++ include/debug/bitset	6 May 2005 02:02:59 -0000
@@ -1,6 +1,6 @@
 // Debugging bitset implementation -*- C++ -*-
 
-// Copyright (C) 2003, 2004
+// Copyright (C) 2003, 2004, 2005
 // Free Software Foundation, Inc.
 //
 // This file is part of the GNU ISO C++ Library.  This library is free
@@ -239,6 +239,28 @@ namespace __gnu_debug_def
         to_string() const
         { return _M_base().template to_string<_CharT, _Traits, _Allocator>(); }
 
+      // _GLIBCXX_RESOLVE_LIB_DEFECTS
+      // 434. bitset::to_string() hard to use.
+      template<typename _CharT, typename _Traits>
+        std::basic_string<_CharT, _Traits, std::allocator<_CharT> >
+        to_string() const
+        { return to_string<_CharT, _Traits, std::allocator<_CharT> >(); }
+
+      template<typename _CharT>
+        std::basic_string<_CharT, std::char_traits<_CharT>,
+                          std::allocator<_CharT> >
+        to_string() const
+        {
+          return to_string<_CharT, std::char_traits<_CharT>,
+                           std::allocator<_CharT> >();
+        }
+
+      std::basic_string<char, std::char_traits<char>, std::allocator<char> >
+        to_string() const
+        {
+          return to_string<char,std::char_traits<char>,std::allocator<char> >();
+        }
+
       using _Base::count;
       using _Base::size;
 


More information about the Libstdc++ mailing list