Dash Core Source Documentation (0.16.0.1)

Find detailed information regarding the Dash Core source code.

heap_policy.hpp
Go to the documentation of this file.
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 
15 #include <immer/config.hpp>
16 
17 #include <cstdlib>
18 #include <algorithm>
19 
20 namespace immer {
21 
25 template <typename Heap>
27 {
28  using type = Heap;
29 
30  template <std::size_t>
31  struct optimized
32  {
33  using type = Heap;
34  };
35 };
36 
37 template <typename Deriv, typename HeapPolicy>
39 {
40  static void* operator new (std::size_t size)
41  {
42  using heap_type = typename HeapPolicy
43  ::template optimized<sizeof(Deriv)>::type;
44 
45  return heap_type::allocate(size);
46  }
47 
48  static void operator delete (void* data, std::size_t size)
49  {
50  using heap_type = typename HeapPolicy
51  ::template optimized<sizeof(Deriv)>::type;
52 
53  heap_type::deallocate(size, data);
54  }
55 };
56 
102 template <typename Heap,
105 {
107 
108  template <std::size_t Size>
109  struct optimized
110  {
111  using type = split_heap<
112  Size,
115  Size,
116  Limit,
118  Size, Limit,
121  };
122 };
123 
129 template <typename Heap,
132 {
133  using type = Heap;
134 
135  template <std::size_t Size>
136  struct optimized
137  {
138  using type = split_heap<
139  Size,
142  Size, Limit,
145  };
146 };
147 
148 } // namespace immer
std::size_t size_t
Definition: bits.hpp:21
const auto default_free_list_size
Definition: config.hpp:64
Released under the MIT license