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; }
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; }
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; }
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); }); }