+ 2
does nothrow applicable to delete as well?
Hi I have used nothrow in below code: https://code.sololearn.com/c4A2a24A7a20 but it does not build with no throw used accordance to delete. does it only applicable to new only?
3 Réponses
+ 4
Delete operator never throws an exception.
But still there is exists a nothrow version of delete operator which is only used by system when the `new`(nothrow version) operator fails to allocate required memory, then nothrow version of delete is called implicitly to clean the mess.
+ 2
Ketan Lalcheta yes.
+ 1
Does this mean we don't have to do anything specific like nothrow in case we allocated memory using nothrow ? Perfect than ...just allocate with noththrow and simply delete