Documentation of memory
This is the documentation of
New allocator concepts:
RawAllocatorthat is similar to an
Allocatorbut easier to use and write
BlockAllocatorthat is an allocator for huge memory blocks
- virtual memory allocators
- allocator using a static memory block located on the stack
- memory stack
- different memory pools
- a portable, improved
alloca()in the form of
Adapters, wrappers and storage classes:
- incredible powerful
std_allocatorto make a
- adapters for the memory resource TS
allocator_deleterclasses for smart pointers
- (optionally type-erased)
allocator_referenceand other storage classes
- memory tracking wrapper
- container node size debuggers that obtain information about the node size of an STL container at compile-time to specify node sizes for pools
- debugging options for leak checking, double-free checks or buffer overflows
- customizable error handling routines that can work with exceptions disabled
- everything except the STL adapters works on a freestanding environment
example/ for more.
This library can be used as [CMake] subdirectory. It is tested on GCC 4.7-4.9, Clang 3.4-3.5 and Visual Studio 2013. Newer versions should work too.
- Fetch it, e.g. using [git submodules]
git submodule add https://github.com/foonathan/memory ext/memoryand
git submodule update --init --recursive.
add_subdirectory(ext/memory)or whatever your local path is to make it available in CMake.
- Simply call
target_link_libraries(your_target PUBLIC foonathan_memory)to link this library and setups the include search path.
- You need to activate C++11 at your target, if not already done, you can use [foonathan/compatibility] already available through
comp_target_features(your_target PUBLIC CPP11).
Note: If during CMake you see an error message that compatibility is not on the newest version, run
git submodule update --recursive --remote to force the compatiblity submodule of memory to update to the latest version.
You can also install the library:
cmake -DCMAKE_BUILD_TYPE="buildtype" -DFOONATHAN_MEMORY_BUILD_EXAMPLES=OFF -DFOONATHAN_MEMORY_BUILD_TESTS=OFF .inside the library sources.
cmake --build . -- installto install the library under
- Repeat 1 and 2 for each build type/configuration you want to have (like
Releaseor custom names).
The use an installed library:
find_package(foonathan_memory major.minor REQUIRED)to find the library.
target_link_libraries(your_target PUBLIC foonathan_memory)and activate C++11 to link to the library.
See http://foonathan.github.io/doc/memory/md_doc_installation.html for a detailed guide.
About this documentation
This documentation is written in a similar way as the C++ standard itself, although not that formal.
Concepts are documented using the names of the template parameters, for example the following class:
Unless explicitly stated otherwise, it is not allowed to call a function that modifies state from two different threads. Functions that modify state are non-
const member functions, functions taking a non-
const reference to objects or functions where it is explictly documented that they change some hidden state.
If a function is documented as
noexcept, it does not throw anything. Otherwise it has a Throws: clause specifying what it throws, or if it is a forwarding function, the information can be found there (see below).
If a class is described as RawAllocator it automatically has certain semantically information which are not explictly mentioned. This is especially true for the member functions of an allocator_traits specialization.
If a function is described as returning the value of another function or forwarding to it, it implicitly has the requirements and effects from the called function and can also throw the same things.
Generated by 1.8.12