Example Program
Allocators
Examples for memory allocation.
File "allocator.cpp"
1 | |
2 | |
3 | |
4 | |
5 | |
6 | |
7 | |
8 | |
9 | |
10 |
The following code creates 100 instances of MyClass on the heap.
The allocator object used is a temporary Default .
11 | |
12 | |
13 |
Before the storage is deallocated, the MyClass objects must be destroyed.
14 | |
15 |
We can use any kind of object as allocator, but dedicated allocators offer more advanced functionality, e.g. clear.
16 | |
17 | |
18 | |
19 | |
20 | |
21 | |
22 | |
23 | |
24 | |
25 |
SeqAn - Sequence Analysis Library - www.seqan.de