New const char* ctor for C++-0x

Paolo Carlini paolo.carlini@oracle.com
Tue Dec 22 16:21:00 GMT 2009


On 12/22/2009 05:07 PM, Ed Smith-Rowland wrote:
> OK?
Not yet.

+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+      /**
+       *  @brief  Construct from a string.
+       *  @param  str  A string of '0' and '1' characters.
+       *  @throw  std::invalid_argument  If a character appears in the string
+       *                                 which is neither '0' nor '1'.
+       */
+      explicit
+      bitset(const char* __str)
+      : _Base()
+      {
+	size_t __len = 0;

???

+	if (__str)
+	  {
+	    const size_t __len = __builtin_strlen(__str);
+	    _M_copy_from_ptr<char,std::char_traits<char>>

Always a space after the comma.

Also, please try to simplify the testcase: I can't believe that in order
to test such a small feature we need <algorithm>, <cstring>, etc!

Paolo.



More information about the Libstdc++ mailing list