Namespaces
Variants
Views
Actions

Difference between revisions of "cpp/memory/new"

From cppreference.com
< cpp‎ | memory
(various updates. Perhaps this could be merged into cpp/memory? It's a major topic.)
(dcl templates)
Line 7: Line 7:
 
{{dcl list header |new}}
 
{{dcl list header |new}}
 
{{dcl list h2 | Functions}}
 
{{dcl list h2 | Functions}}
{{dcl list fun | cpp/memory/new/operator_new | title=operator new<br>operator new[] | allocation functions }}
+
{{dcl list template | cpp/memory/new/dcl list operator_new}}
{{dcl list fun | cpp/memory/new/operator_delete | title=operator delete<br>operator delete[] | deallocation functions }}
+
{{dcl list template | cpp/memory/new/dcl list operator_delete}}
{{dcl list fun | cpp/memory/new/get_new_handler | obtains the current new handler | notes={{mark c++11}}}}
+
{{dcl list template | cpp/memory/new/dcl list get_new_handler}}
{{dcl list fun | cpp/memory/new/set_new_handler | registers a different new handler}}
+
{{dcl list template | cpp/memory/new/dcl list set_new_handler}}
 
{{dcl list h2 | Classes }}
 
{{dcl list h2 | Classes }}
{{dcl list class | cpp/memory/new/bad_alloc | exception thrown when memory allocation fails }}
+
{{dcl list template | cpp/memory/new/dcl list bad_alloc}}
{{dcl list class | cpp/memory/new/bad_array_new_length | exception thrown on allocation of array with invalid length | notes={{mark c++11}} }}
+
{{dcl list template | cpp/memory/new/dcl list bad_array_new_length}}
{{dcl list class | cpp/memory/new/nothrow_t | tag type used to select an non-throwing ''allocation function'' }}
+
{{dcl list template | cpp/memory/new/dcl list nothrow_t}}
 
{{dcl list h2 | Types }}
 
{{dcl list h2 | Types }}
{{dcl list typedef | cpp/memory/new/new_handler | function pointer type of the new handler }}
+
{{dcl list template | cpp/memory/new/dcl list new_handler}}
 
{{dcl list h2 | Objects}}
 
{{dcl list h2 | Objects}}
{{dcl list const | cpp/memory/new/nothrow | an object of type {{tt|nothrow_t}} used to select an non-throwing ''allocation function'' }}
+
{{dcl list template | cpp/memory/new/dcl list nothrow}}
 
{{dcl list end}}
 
{{dcl list end}}

Revision as of 07:16, 28 October 2011

Template:cpp/memory/new/sidebar

The new-expression is the only way to create an object or an array of objects with dynamic storage duration, that is, with lifetime not restricted to the scope in which it is created. A new-expression obtains storage by calling an allocation function. A delete-expression destroys a most derived object or an array created by a new-expression and calls the deallocation function. The default allocation and deallocation functions, along with related functions, types, and objects, are declared in the header <new>.

Template:cpp/memory/new/dcl list operator newTemplate:cpp/memory/new/dcl list operator deleteTemplate:cpp/memory/new/dcl list get new handlerTemplate:cpp/memory/new/dcl list set new handlerTemplate:cpp/memory/new/dcl list bad allocTemplate:cpp/memory/new/dcl list bad array new lengthTemplate:cpp/memory/new/dcl list nothrow tTemplate:cpp/memory/new/dcl list new handlerTemplate:cpp/memory/new/dcl list nothrow
Defined in header <new>

Contents

Functions
Classes
Types
Objects