llvm-project/libcxx/test/std/containers/container.adaptors/priority.queue
Eric Fiselier 69a4f66114 [libc++] Fix stack_allocator
Summary:
To quote STL the problems with stack allocator are"

>"stack_allocator<T, N> is seriously nonconformant to N4582 17.6.3.5 [allocator.requirements].
> First, it lacks a rebinding constructor. (The nested "struct rebind" isn't sufficient.)
> Second, it lacks templated equality/inequality.
> Third, it completely ignores alignment.
> Finally, and most severely, the Standard forbids its existence. Allocators are forbidden from returning memory "inside themselves". This requirement is implied by the Standard's requirements for rebinding and equality. It's permitted to return memory from a separate buffer object on the stack, though."

This patch attempts to address all of those issues.

First, instead of storing the buffer inside the allocator I've change `stack_allocator` to accept the buffer as an argument.

Second, in order to fix rebinding I changed the parameter list from `<class T, size_t NumElements>` to `<class T, size_t NumBytes>`. This allows allocator rebinding
between types that have different sizes. 

Third, I added copy and rebinding constructors and assignment operators.

And finally I fixed the allocation logic to always return properly aligned storage.



Reviewers: mclow.lists, howard.hinnant, STL_MSFT

Subscribers: cfe-commits

Differential Revision: https://reviews.llvm.org/D25154

llvm-svn: 283631
2016-10-08 00:56:22 +00:00
..
priqueue.cons [libc++] Fix stack_allocator 2016-10-08 00:56:22 +00:00
priqueue.cons.alloc Mark LWG issue 2537 as complete 2016-05-31 01:11:20 +00:00
priqueue.members
priqueue.special Make swap_noexcept.pass.cpp tests more portable. Patch from STL@microsoft.com. 2016-07-25 00:15:29 +00:00
types.fail.cpp Add failing tests that I forgot to add to the last commit 2016-03-14 17:58:54 +00:00
types.pass.cpp Add includes in test. Patch from STL@microsoft.com 2016-07-18 02:05:31 +00:00