This is an archive of the discontinued LLVM Phabricator instance.

Add <experimental/memory_resource>
ClosedPublic

Authored by EricWF on May 5 2016, 6:13 PM.

Diff Detail

Event Timeline

EricWF updated this revision to Diff 56373.May 5 2016, 6:13 PM
EricWF retitled this revision from to Add <experimental/memory_resource>.
EricWF updated this object.
EricWF added a reviewer: mclow.lists.
EricWF added a subscriber: cfe-commits.
EricWF updated this revision to Diff 56380.May 5 2016, 8:50 PM

Fix subtle dangling reference in polymorphic_allocator

EricWF updated this revision to Diff 56464.May 6 2016, 2:30 PM

Address @mclows offline comments

  1. I added the polymorphic_allocator<T>::max_size() function.
  2. polymorphic_allocator<T>::allocate(size) now throws bad_alloc when size > size_type(~0) / sizeof(T).
  3. polymorphic_allocator<T>::deallocate(ptr, size) checks size is valid using _LIBCPP_ASSERT.
  4. resource_adaptor<A>::do_allocate(bytes) now throws bad_alloc when bytes > size_type(~0) - alignof(max_align_t).
  5. resource_adaptor<A>::do_deallocate(ptr, bytes) checks that bytes is valid using _LIBCPP_ASSERT.
EricWF updated this revision to Diff 56484.May 6 2016, 5:28 PM

Address @mclow.lists comments.

  1. 'allocate' now throws length_error instead of 'bad_alloc'.
EricWF updated this revision to Diff 56485.May 6 2016, 5:30 PM

Fix typo.

EricWF accepted this revision.May 6 2016, 5:49 PM
EricWF added a reviewer: EricWF.

Accepting before committing.

This revision is now accepted and ready to land.May 6 2016, 5:49 PM
EricWF closed this revision.May 6 2016, 6:10 PM
src/experimental/memory_resource.cpp