Beispiel #1
0
 inline Pointer allocate(const Tx tx, Alloc& alloc)
 {
     Pointer result = AllocTraits::allocate(alloc, 1);
     tx.after_fail(
         [ alloc, result ]() mutable noexcept { AllocTraits::deallocate(alloc, result, 1); });
     return result;
 }
Beispiel #2
0
 inline Pointer allocate(const Tx tx, Alloc& alloc, const std::size_t count)
 {
     Pointer result = AllocTraits::allocate(alloc, count);
     tx.after_fail([ alloc, result, count ]() mutable noexcept {
         AllocTraits::deallocate(alloc, result, count);
     });
     return result;
 }
Beispiel #3
0
 inline Pointer allocate_construct(const Tx tx, Alloc& alloc, Args&&... args)
 {
     Pointer result = AllocTraits::allocate(alloc, 1);
     AllocTraits::construct(alloc, detail::to_raw_pointer(result), (Args &&) args...);
     tx.after_fail([ alloc, result ]() mutable noexcept {
         AllocTraits::deallocate(alloc, std::move(result), 1);
     });
     return result;
 }
Beispiel #4
0
 inline void construct(const Tx tx, Alloc& alloc, T* t, Args&&... args)
 {
     AllocTraits::construct(alloc, t, (Args &&) args...);
     tx.after_fail([ alloc, t ]() mutable noexcept { AllocTraits::destroy(alloc, t); });
 }