| 23 | }; |
| 24 | |
| 25 | int main() |
| 26 | { |
| 27 | MyAllocator<64> a; |
| 28 | |
| 29 | // allocate a char |
| 30 | char* p1 = a.aligned_alloc<char>(); |
| 31 | if (p1) |
| 32 | *p1 = 'a'; |
| 33 | std::cout << "allocated a char at " << (void*)p1 << '\n'; |
| 34 | |
| 35 | // allocate an int |
| 36 | int* p2 = a.aligned_alloc<int>(); |
| 37 | if (p2) |
| 38 | *p2 = 1; |
| 39 | std::cout << "allocated an int at " << (void*)p2 << '\n'; |
| 40 | |
| 41 | // allocate an int, aligned at 32-byte boundary |
| 42 | int* p3 = a.aligned_alloc<int>(32); |
| 43 | if (p3) |
| 44 | *p3 = 2; |
| 45 | std::cout << "allocated an int at " << (void*)p3 << " (32 byte alignment)\n"; |
| 46 | } |
nothing calls this directly
no outgoing calls
no test coverage detected