@@ -189,14 +189,26 @@ template <class T, bool POCCAValue>
189
189
class MaybePOCCAAllocator {
190
190
int id_ = 0 ;
191
191
bool * copy_assigned_into_ = nullptr ;
192
+
193
+ template <class , bool > friend class MaybePOCCAAllocator ;
194
+
192
195
public:
193
196
typedef std::integral_constant<bool , POCCAValue> propagate_on_container_copy_assignment;
194
197
typedef T value_type;
195
198
199
+ template <class U >
200
+ struct rebind {
201
+ typedef MaybePOCCAAllocator<U, POCCAValue> other;
202
+ };
203
+
196
204
MaybePOCCAAllocator () = default ;
197
205
MaybePOCCAAllocator (int id, bool * copy_assigned_into)
198
206
: id_(id), copy_assigned_into_(copy_assigned_into) {}
199
207
208
+ template <class U >
209
+ MaybePOCCAAllocator (const MaybePOCCAAllocator<U, POCCAValue>& that)
210
+ : id_(that.id_), copy_assigned_into_(that.copy_assigned_into_) {}
211
+
200
212
MaybePOCCAAllocator (const MaybePOCCAAllocator&) = default ;
201
213
MaybePOCCAAllocator& operator =(const MaybePOCCAAllocator& a)
202
214
{
@@ -218,12 +230,14 @@ class MaybePOCCAAllocator {
218
230
219
231
int id () const { return id_; }
220
232
221
- friend bool operator ==(const MaybePOCCAAllocator& lhs, const MaybePOCCAAllocator& rhs)
233
+ template <class U >
234
+ friend bool operator ==(const MaybePOCCAAllocator& lhs, const MaybePOCCAAllocator<U, POCCAValue>& rhs)
222
235
{
223
236
return lhs.id () == rhs.id ();
224
237
}
225
238
226
- friend bool operator !=(const MaybePOCCAAllocator& lhs, const MaybePOCCAAllocator& rhs)
239
+ template <class U >
240
+ friend bool operator !=(const MaybePOCCAAllocator& lhs, const MaybePOCCAAllocator<U, POCCAValue>& rhs)
227
241
{
228
242
return !(lhs == rhs);
229
243
}
0 commit comments