[Bug libstdc++/70472] is_copy_constructible<vector<unique_ptr<int>>>::value is true

redi at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Tue Apr 19 10:34:00 GMT 2016


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70472

--- Comment #6 from Jonathan Wakely <redi at gcc dot gnu.org> ---
(In reply to TC from comment #5)
> In any event, it would be wrong to SFINAE on
> std::is_copy_constructible<value_type>. The requirement is CopyInsertable,
> not CopyConstructible. The allocator's construct() can mutilate the
> constructor arguments to its heart's content before passing them on, and I
> don't see a way to check this.

<bits/alloc_traits.h> has this:

  // true if _Alloc::value_type is CopyInsertable into containers using _Alloc
  template<typename _Alloc>
    struct __is_copy_insertable
    : __is_copy_insertable_impl<_Alloc>::type
    { };

But using it requires that std::vector::~vector() is defined as defaulted,
which would not be a simple change.

We used to use that for the unordered containers until r204790.


More information about the Gcc-bugs mailing list