Apache C++ Standard Library Reference Guide

## operator delete

Library: Language support

    Function

- Local Index
- Summary
- Synopsis
- Description
- Global Operators
- See Also
- Standards Conformance

### Local Index

#### Non-Members

delete() |

### Summary

Storage deallocation functions implicitly called by the corresponding delete expressions to deallocate storage previously allocated by one of the matching allocation functions

### Synopsis

    #include <new>

    namespace std {
        struct nothrow_t {};
        extern const nothrow_t nothrow;
    }

    void operator delete(void*) throw();
    void operator delete(void*, const std::nothrow_t&) throw();
    void operator delete[](void*) throw();
    void operator delete[](void*, const std::nothrow_t&) throw();
    void operator delete(void*, void*) throw();
    void operator delete[](void*, void*) throw();

### Description

The library provides definitions for six overloads of the global operator `delete`. The functions are implicitly called as the second step (after the call to the destructor, if any) during the evaluation of the corresponding `delete` expression to deallocate storage previously allocated by one of the matching allocation functions (`::operator new`). Replacements for the replaceable forms of the functions should always paired with the replacements for the corresponding overload of operator `new`.

### Global Operators

    void operator delete(void*) throw();
    void operator delete(void*, const std::nothrow_t&) throw();

Deallocation functions implicitly called by a `delete` expression to deallocate storage previously allocated by the matching `::operator new (std::size_t)` or `::operator new (std::size_t, std::nothrow&)`, respectively. A C++ program may replace these functions.

    void operator delete[](void*) throw();
    void operator delete[](void*, const std::nothrow_t&) throw();

Deallocation functions implicitly called by a `delete` expression to deallocate storage previously allocated by the matching `::operator new[] (std::size_t)` or `::operator new[] (std::size_t, std::nothrow&)`, respectively. A C++ program may replace these functions.

    void operator delete(void*, void*) throw();
    void operator delete[](void*, void*) throw();

Default functions implicitly called when the initialization in a placement `new` expression that invokes the placement form of operator `new` terminates by throwing an exception. A C++ program may not replace these functions.

### See Also

<new>, bad_alloc, operator new

### Standards Conformance

ISO/IEC 14882:1998 -- International Standard for Information Systems -- Programming Language C++, Section 18.4