Topic: N2315: incorrect specification of std::basic_string::operator=


Author: howard.hinnant@gmail.com (Howard Hinnant)
Date: Mon, 6 Aug 2007 03:13:21 GMT
Raw View
In article <U3uqi.75743$%k.216556@twister2.libero.it>,
 AlbertoBarbati@libero.it (Alberto Ganesh Barbati) wrote:

> Hi,
>
> in paper N2315 [string.cons], paragraph 18 specifies that both
> signatures of the assignment operator:
>
>   basic_string<charT,traits,Allocator>&
>     operator=(const basic_string<charT,traits,Allocator>& str );
>   basic_string<charT,traits,Allocator>&
>     operator=(const basic_string<charT,traits,Allocator>&& str );
>
> do not throw exceptions. Of course, that cannot be possible for the
> first signature, as it may need to perform an allocation. I suggest to
> replace paragraph 18 with:
>
>   Throws: The second form throws nothing.
>
> For reference, see paragraph 3 about the copy constructors, with the
> only difference being that assignment operators do not copy the allocators.
>
> Just my 2 eurocent,

Thanks.  This should be fixed in an upcoming draft.

-Howard

---
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://www.comeaucomputing.com/csc/faq.html                      ]





Author: AlbertoBarbati@libero.it (Alberto Ganesh Barbati)
Date: Fri, 27 Jul 2007 23:42:07 GMT
Raw View
Hi,

in paper N2315 [string.cons], paragraph 18 specifies that both
signatures of the assignment operator:

  basic_string<charT,traits,Allocator>&
    operator=(const basic_string<charT,traits,Allocator>& str );
  basic_string<charT,traits,Allocator>&
    operator=(const basic_string<charT,traits,Allocator>&& str );

do not throw exceptions. Of course, that cannot be possible for the
first signature, as it may need to perform an allocation. I suggest to
replace paragraph 18 with:

  Throws: The second form throws nothing.

For reference, see paragraph 3 about the copy constructors, with the
only difference being that assignment operators do not copy the allocators.

Just my 2 eurocent,

Ganesh

---
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://www.comeaucomputing.com/csc/faq.html                      ]