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

Ed Smith-Rowland 3dw4rd@verizon.net
Wed Dec 23 02:47:00 GMT 2009


Paolo Carlini wrote:
> 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.
>
>   
Here is a fixed patch with a simpler test.

Just so you know, I used another test as an example (1.cc in bitset/ctor 
IIRC).
There are probably lot's of over complicated tests out there.

Ed

-------------- next part --------------
A non-text attachment was scrubbed...
Name: CL_bitset_0x
Type: video/x-flv
Size: 173 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/libstdc++/attachments/20091223/2be759d2/attachment.flv>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: bitset_0x.patch
URL: <http://gcc.gnu.org/pipermail/libstdc++/attachments/20091223/2be759d2/attachment.ksh>


More information about the Libstdc++ mailing list