@@ -279,13 +279,26 @@ inline bool operator==(const allocator<Left>& left,
279
279
280
280
using byte_allocator = allocator<uint8_t >;
281
281
282
- #define CREATE (Type, allocate, ...) \
283
- allocate.new_object<Type>(__VA_ARGS__), allocate.deleter<Type>(), allocate
282
+ // If Type accepts an allocator on construct (e.g. vector) then
283
+ // std::uses_allocator_construction_args supplies the allocator.
284
+
285
+ // Create a pointer to an instance of Type presumed to be allocated and
286
+ // constructed by allocator, and pass it and deleter and allocator as:
287
+ // shared_ptr<Type>(Type*, allocate.deleter<Type>(), allocate)
284
288
#define POINTER (Type, allocate, ptr ) \
285
289
ptr, allocate.deleter<Type>(), allocate
286
- #define INPLACE (ptr, Type, allocate, ...) \
287
- allocate.construct<std::shared_ptr<const Type>>(ptr, __VA_ARGS__, \
288
- allocate.deleter<Type>(), allocate)
290
+
291
+ // Create a pointer to an instance of Type allocated and constructed by
292
+ // allocator, and pass it and deleter and allocator as:
293
+ // shared_ptr<Type>(allocate.new_object<Type>(...), allocate.deleter<Type>(), allocate)
294
+ #define CREATE (Type, allocate, ...) \
295
+ POINTER (Type, allocate, allocate.new_object<Type>(__VA_ARGS__))
296
+
297
+ // Construct a shared_ptr to allocated instance (ptr) of const Type on an
298
+ // allocated address (at) passing deleter and allocator to shared_ptr construct.
299
+ #define INPLACE (at, Type, allocate, ptr ) \
300
+ allocate.construct<std::shared_ptr<const Type>>( \
301
+ at, ptr, allocate.deleter<Type>(), allocate)
289
302
290
303
// TODO: replace above macros with parameter pack expansion.
291
304
// //template <typename Type, typename Allocator, typename... Args>
0 commit comments