This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: std::string<ThrowOnCopy> behavior


Tim,

thank you for the answer, this helps me a lot.

Regards,
Ivan

On 04/14/2017 10:13 PM, Tim Song wrote:
> On Fri, Apr 14, 2017 at 9:07 AM, Ivan Baravy <i.baravy@samsung.com> wrote:
>> Hello,
>>
>> I attached an example where I expect an exception on the line 77, but
>> nothing happens. GDB reports that memmove is used and thus the
>> ThrowOnCopy objects are moved inside of a std::string and no exceptions
>> are thrown.
>>
>> Is this behavior intentional?
>>
>> Regards,
>> Ivan
> 
> [strings.general]/1:
> 
> This Clause describes components for manipulating sequences of any
> non-array POD type. Such types are called char-like types, and objects
> of char-like types are called char-like objects or simply characters.
> 
> Your ThrowOnCopy isn't a POD. PODs don't throw exceptions when copied.
> 
> 
> 


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]