nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1From f871b10396270cfd09ffddc4b6ead07722e9c232 Mon Sep 17 00:00:00 2001
2From: Matt Liberty <mliberty@precisioninno.com>
3Date: Wed, 13 Nov 2024 03:48:00 +0000
4Subject: [PATCH] Update for c++20
5
6Signed-off-by: Matt Liberty <mliberty@precisioninno.com>
7---
8 lemon/bits/array_map.h | 27 ++++++++++++++-------------
9 1 file changed, 14 insertions(+), 13 deletions(-)
10
11diff --git a/lemon/bits/array_map.h b/lemon/bits/array_map.h
12index 355ee00..f8a7133 100644
13--- a/lemon/bits/array_map.h
14+++ b/lemon/bits/array_map.h
15@@ -75,6 +75,7 @@ namespace lemon {
16 typedef typename Notifier::ObserverBase Parent;
17
18 typedef std::allocator<Value> Allocator;
19+ typedef std::allocator_traits<Allocator> AllocatorTraits;
20
21 public:
22
23@@ -88,7 +89,7 @@ namespace lemon {
24 Item it;
25 for (nf->first(it); it != INVALID; nf->next(it)) {
26 int id = nf->id(it);;
27- allocator.construct(&(values[id]), Value());
28+ AllocatorTraits::construct(allocator, &(values[id]), Value());
29 }
30 }
31
32@@ -102,7 +103,7 @@ namespace lemon {
33 Item it;
34 for (nf->first(it); it != INVALID; nf->next(it)) {
35 int id = nf->id(it);;
36- allocator.construct(&(values[id]), value);
37+ AllocatorTraits::construct(allocator, &(values[id]), value);
38 }
39 }
40
41@@ -121,7 +122,7 @@ namespace lemon {
42 Item it;
43 for (nf->first(it); it != INVALID; nf->next(it)) {
44 int id = nf->id(it);;
45- allocator.construct(&(values[id]), copy.values[id]);
46+ AllocatorTraits::construct(allocator, &(values[id]), copy.values[id]);
47 }
48 }
49
50@@ -218,15 +219,15 @@ namespace lemon {
51 for (nf->first(it); it != INVALID; nf->next(it)) {
52 int jd = nf->id(it);;
53 if (id != jd) {
54- allocator.construct(&(new_values[jd]), values[jd]);
55- allocator.destroy(&(values[jd]));
56+ AllocatorTraits::construct(allocator, &(new_values[jd]), values[jd]);
57+ AllocatorTraits::destroy(allocator, &(values[jd]));
58 }
59 }
60 if (capacity != 0) allocator.deallocate(values, capacity);
61 values = new_values;
62 capacity = new_capacity;
63 }
64- allocator.construct(&(values[id]), Value());
65+ AllocatorTraits::construct(allocator, &(values[id]), Value());
66 }
67
68 // \brief Adds more new keys to the map.
69@@ -260,8 +261,8 @@ namespace lemon {
70 }
71 }
72 if (found) continue;
73- allocator.construct(&(new_values[id]), values[id]);
74- allocator.destroy(&(values[id]));
75+ AllocatorTraits::construct(allocator, &(new_values[id]), values[id]);
76+ AllocatorTraits::destroy(allocator, &(values[id]));
77 }
78 if (capacity != 0) allocator.deallocate(values, capacity);
79 values = new_values;
80@@ -269,7 +270,7 @@ namespace lemon {
81 }
82 for (int i = 0; i < int(keys.size()); ++i) {
83 int id = nf->id(keys[i]);
84- allocator.construct(&(values[id]), Value());
85+ AllocatorTraits::construct(allocator, &(values[id]), Value());
86 }
87 }
88
89@@ -279,7 +280,7 @@ namespace lemon {
90 // and it overrides the erase() member function of the observer base.
91 virtual void erase(const Key& key) {
92 int id = Parent::notifier()->id(key);
93- allocator.destroy(&(values[id]));
94+ AllocatorTraits::destroy(allocator, &(values[id]));
95 }
96
97 // \brief Erase more keys from the map.
98@@ -289,7 +290,7 @@ namespace lemon {
99 virtual void erase(const std::vector<Key>& keys) {
100 for (int i = 0; i < int(keys.size()); ++i) {
101 int id = Parent::notifier()->id(keys[i]);
102- allocator.destroy(&(values[id]));
103+ AllocatorTraits::destroy(allocator, &(values[id]));
104 }
105 }
106
107@@ -303,7 +304,7 @@ namespace lemon {
108 Item it;
109 for (nf->first(it); it != INVALID; nf->next(it)) {
110 int id = nf->id(it);;
111- allocator.construct(&(values[id]), Value());
112+ AllocatorTraits::construct(allocator, &(values[id]), Value());
113 }
114 }
115
116@@ -317,7 +318,7 @@ namespace lemon {
117 Item it;
118 for (nf->first(it); it != INVALID; nf->next(it)) {
119 int id = nf->id(it);
120- allocator.destroy(&(values[id]));
121+ AllocatorTraits::destroy(allocator, &(values[id]));
122 }
123 allocator.deallocate(values, capacity);
124 capacity = 0;
125--
1262.52.0
127