[LLVMbugs] [Bug 24075] New: scoped_allocator_adaptor lacks the std::pair construct() overloads!

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Thu Jul 9 09:07:34 PDT 2015


https://llvm.org/bugs/show_bug.cgi?id=24075

            Bug ID: 24075
           Summary: scoped_allocator_adaptor lacks the std::pair
                    construct() overloads!
           Product: libc++
           Version: 3.6
          Hardware: Macintosh
                OS: MacOS X
            Status: NEW
          Severity: normal
          Priority: P
         Component: All Bugs
          Assignee: unassignedclangbugs at nondot.org
          Reporter: ehh.patrick at gmail.com
                CC: llvmbugs at cs.uiuc.edu, mclow.lists at gmail.com
    Classification: Unclassified

The overload that actually gets used is the std::uses_allocator -> false
overload, which just forwards all received arguments into the std::pair
constructor.  This will default construct all inner allocators for any
allocator aware containers inside of a std::pair instead of copy constructing
the allocators from the scoped_allocator_adaptor that gets passed to the outer
container.

For example ...

struct Alloc { STATE WHAT NEEDS COPYIN' };

using outer = Alloc<std::pair<char, std::vector<int, Alloc<int>>>>;
using inner = Alloc<int>;
using saa = std::scoped_allocator_adaptor<outer, inner>;

std::vector<
   std::pair<char, std::vector<int, Alloc<int>>>,
   saa
> vec(saa(outer(123), inner(432)));

vec.emplace_back(); // default constructs the allocator in the pair's
std::vector
                    // instead of copying from inner(432)

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20150709/a9d695c4/attachment.html>


More information about the llvm-bugs mailing list