1 | // |
2 | // immer: immutable data structures for C++ |
3 | // Copyright (C) 2016, 2017, 2018 Juan Pedro Bolivar Puente |
4 | // |
5 | // This software is distributed under the Boost Software License, Version 1.0. |
6 | // See accompanying file LICENSE or copy at http://boost.org/LICENSE_1_0.txt |
7 | // |
8 | |
9 | #pragma once |
10 | |
11 | #include <cstdlib> |
12 | |
13 | namespace immer { |
14 | |
15 | /*! |
16 | * A heap that simply passes on to the parent heap. |
17 | */ |
18 | template <typename Base> |
19 | struct identity_heap : Base |
20 | { |
21 | template <typename... Tags> |
22 | static void* allocate(std::size_t size, Tags... tags) |
23 | { |
24 | return Base::allocate(size, tags...); |
25 | } |
26 | |
27 | template <typename... Tags> |
28 | static void deallocate(std::size_t size, void* data, Tags... tags) |
29 | { |
30 | Base::deallocate(size, data, tags...); |
31 | } |
32 | }; |
33 | |
34 | } // namespace immer |
35 | |