Dynamic memory management

< cpp
Revision as of 18:19, 2 November 2012 by P12bot (Talk | contribs)

Utilities library
Type support (basic types, RTTI, type traits)
Dynamic memory management
Error handling
Program utilities
Variadic functions
Date and time
Function objects
Relational operators
Optional and any
Pairs and tuples
Swap, forward and move
Type operations


Smart pointers

Smart pointers enable automatic, exception-safe, object lifetime management.

Template:cpp/memory/dcl list unique ptrTemplate:cpp/memory/dcl list shared ptrTemplate:cpp/memory/dcl list weak ptrTemplate:cpp/memory/dcl list auto ptrTemplate:cpp/memory/dcl list owner lessTemplate:cpp/memory/dcl list enable shared from thisTemplate:cpp/memory/dcl list bad weak ptrTemplate:cpp/memory/dcl list default delete
Defined in header <memory>
Pointer categories
Helper classes


Allocators are class templates encapsulating memory allocation strategy. This allows generic containers to decouple memory management from the data itself.

Template:cpp/memory/dcl list allocatorTemplate:cpp/memory/dcl list allocator traitsTemplate:cpp/memory/dcl list allocator arg tTemplate:cpp/memory/dcl list allocator argTemplate:cpp/memory/dcl list uses allocatorTemplate:cpp/memory/dcl list scoped allocator adaptor
Defined in header <memory>
Defined in header <scoped_allocator>

Uninitialized storage

Several utilities are provided to create and access raw storage

Template:cpp/memory/dcl list uninitialized copyTemplate:cpp/memory/dcl list uninitialized copy nTemplate:cpp/memory/dcl list uninitialized fillTemplate:cpp/memory/dcl list uninitialized fill nTemplate:cpp/memory/dcl list raw storage iteratorTemplate:cpp/memory/dcl list get temporary bufferTemplate:cpp/memory/dcl list return temporary buffer
Defined in header <memory>

Garbage collector support

Template:cpp/memory/gc/dcl list declare reachableTemplate:cpp/memory/gc/dcl list undeclare reachableTemplate:cpp/memory/gc/dcl list declare no pointersTemplate:cpp/memory/gc/dcl list undeclare no pointersTemplate:cpp/memory/gc/dcl list pointer safetyTemplate:cpp/memory/gc/dcl list get pointer safety
Defined in header <memory>


Template:cpp/memory/dcl list pointer traitsTemplate:cpp/memory/dcl list addressofTemplate:cpp/memory/dcl list align
Defined in header <memory>

C-style memory management

Includes e.g. std::malloc, std::free

Low level memory management

Includes e.g. operator new , operator delete , std::set_new_handler