Dash Core Source Documentation (0.16.0.1)

Find detailed information regarding the Dash Core source code.

memory_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 
11 #include <immer/heap/cpp_heap.hpp>
18 #include <type_traits>
19 
20 namespace immer {
21 
26 template <typename RefcountPolicy>
28  : std::conditional<std::is_same<RefcountPolicy,
29  no_refcount_policy>::value,
30  gc_transience_policy,
31  no_transience_policy>
32 {};
33 
34 template <typename T>
36 
41 template <typename HeapPolicy>
43  : std::integral_constant<bool,
44  std::is_same<
45  HeapPolicy,
46  heap_policy<cpp_heap>
47  >::value>
48 {};
49 
50 template <typename T>
53 
58 template <typename RefcountPolicy>
60  : std::integral_constant<bool,
61  !std::is_same<
62  RefcountPolicy,
63  no_refcount_policy>::value>
64 {};
65 
66 template <typename T>
68 
87 template <typename HeapPolicy,
88  typename RefcountPolicy,
89  typename TransiencePolicy = get_transience_policy_t<RefcountPolicy>,
90  bool PreferFewerBiggerObjects = get_prefer_fewer_bigger_objects_v<HeapPolicy>,
91  bool UseTransientRValues = get_use_transient_rvalues_v<RefcountPolicy>>
93 {
94  using heap = HeapPolicy;
95  using refcount = RefcountPolicy;
96  using transience = TransiencePolicy;
97 
98  static constexpr bool prefer_fewer_bigger_objects =
99  PreferFewerBiggerObjects;
100 
101  static constexpr bool use_transient_rvalues =
102  UseTransientRValues;
103 
104  using transience_t = typename transience::template apply<heap>::type;
105 };
106 
112 #if IMMER_NO_FREE_LIST
114 #else
115 #if IMMER_NO_THREAD_SAFETY
117 #else
119 #endif
120 #endif
121 
125 #if IMMER_NO_THREAD_SAFETY
127 #else
129 #endif
130 
137 
138 } // namespace immer
constexpr auto get_prefer_fewer_bigger_objects_v
static constexpr bool use_transient_rvalues
constexpr auto get_use_transient_rvalues_v
TransiencePolicy transience
static constexpr bool prefer_fewer_bigger_objects
typename get_transience_policy< T >::type get_transience_policy_t
RefcountPolicy refcount
typename transience::template apply< heap >::type transience_t
free_list_heap_policy< cpp_heap > default_heap_policy
Released under the MIT license