Sequoia
Loading...
Searching...
No Matches
PartitionedDataAllocationTestingUtilities.hpp
Go to the documentation of this file.
1
2// Copyright Oliver J. Rosten 2020. //
3// Distributed under the GNU GENERAL PUBLIC LICENSE, Version 3.0. //
4// (See accompanying file LICENSE.md or copy at //
5// https://www.gnu.org/licenses/gpl-3.0.en.html) //
7
8#pragma once
9
14
15namespace sequoia::testing
16{
17 template
18 <
19 class T,
20 bool PropagateCopy=true,
21 bool PropagateMove=false,
22 bool PropagateSwap=false
23 >
25 {
26 using value_type = T;
27
28 template<class S>
30
31 template<class S>
32 using allocator_type
33 = std::scoped_allocator_adaptor<
36 >;
37
38 using bucket_type = std::vector<T, allocator_template<T>>;
40 };
41
42 template
43 <
44 class T,
45 bool PropagateCopy = true,
46 bool PropagateMove = false,
47 bool PropagateSwap = false
48 >
50 {
51 using storage_type
53 std::vector<T, shared_counting_allocator<T, PropagateCopy, PropagateMove, PropagateSwap>>,
55 std::size_t,
56 std::ranges::greater,
57 std::vector<std::size_t, shared_counting_allocator<std::size_t, PropagateCopy, PropagateMove, PropagateSwap>>>>;
58 };
59
60 template<class Storage>
62 {
63 using allocator = typename Storage::allocator_type;
65
66 [[nodiscard]]
67 allocator operator()(const Storage& s) const
68 {
69 return s.get_allocator();
70 }
71 };
72
73 template<class Storage>
75 {
76 using allocator = typename Storage::allocator_type;
78
79 [[nodiscard]]
80 allocator operator()(const Storage& s) const
81 {
82 return s.get_allocator();
83 }
84 };
85
86 template<class Storage>
88 {
89 using allocator = typename Storage::partitions_allocator_type;
91
92 [[nodiscard]]
93 allocator operator()(const Storage& s) const
94 {
95 return s.get_partitions_allocator();
96 }
97 };
98}
Extension for checking allocations for types with regular semantics, see here.
Storage for partitioned data such that data within each partition is contiguous.
Definition: PartitionedData.hpp:63
Definition: PartitionedData.hpp:991
Definition: MonotonicSequence.hpp:248
Somewhat similar to std::allocator but logs (de)allocations via an counter which is shared upon copyi...
Definition: AllocationTestUtilities.hpp:41
Definition: PartitionedDataAllocationTestingUtilities.hpp:62
Definition: PartitionedDataAllocationTestingUtilities.hpp:75
Definition: PartitionedDataAllocationTestingUtilities.hpp:25
Definition: PartitionedDataAllocationTestingUtilities.hpp:50
Definition: PartitionedDataAllocationTestingUtilities.hpp:88