[PATCH] D10998: Refactor the POCXX allocator-handling into some common routines, and try them out in vector
Marshall Clow
mclow.lists at gmail.com
Tue Jul 7 14:00:05 PDT 2015
In http://reviews.llvm.org/D10998#200662, @EricWF wrote:
> The direction of the patch LGTM but I would like to understand the need for the noexcept specifications on `__swap_allocator` before I approve it.
There are four cases:
- If POCS is true, then in C++14 and beyond, swapping the allocators is required not to throw [allocator.requirements]/4
- If POCS is true, in C++11 and before, we have to check if the swapping can throw
- if POCS is false, we're not going to swap anything, so it can be noexcept.
================
Comment at: include/memory:5551
@@ +5550,3 @@
+#if _LIBCPP_STD_VER >= 14
+ _NOEXCEPT
+#else
----------------
EricWF wrote:
> Do we need these `_NOEXCEPT` decorators at all? I don't see where they are used or visible to the user.
We may not, but in an ideal world, I'd like to define `vector::swap`s noexcept in terms of the operations, rather than by fiat.
================
Comment at: include/memory:5556
@@ +5555,3 @@
+{
+ __swap_alloc(__a1, __a2,
+ _VSTD::allocator_traits<_Alloc>::propagate_on_container_swap());
----------------
EricWF wrote:
> Shouldn't this call be `__swap_allocator`?
Yes.
http://reviews.llvm.org/D10998
More information about the cfe-commits
mailing list