<html>
<head>
<base href="https://llvm.org/bugs/" />
</head>
<body><table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Bug ID</th>
<td><a class="bz_bug_link
bz_status_NEW " title="NEW --- - scoped_allocator_adaptor lacks the std::pair construct() overloads!" href="https://urldefense.proofpoint.com/v2/url?u=https-3A__llvm.org_bugs_show-5Fbug.cgi-3Fid-3D24075&d=AwMBaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=pF93YEPyB-J_PERP4DUZOJDzFVX5ZQ57vQk33wu0vio&m=-qgVGeB8G-A1HTUYbR7Xo1e_VNfy3zuxclDPGZqRT84&s=KfmTWl1yHFjQj2_3OLtFmzzJZnjqLT79FuxWMdgvujw&e=">24075</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>scoped_allocator_adaptor lacks the std::pair construct() overloads!
</td>
</tr>
<tr>
<th>Product</th>
<td>libc++
</td>
</tr>
<tr>
<th>Version</th>
<td>3.6
</td>
</tr>
<tr>
<th>Hardware</th>
<td>Macintosh
</td>
</tr>
<tr>
<th>OS</th>
<td>MacOS X
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>normal
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>All Bugs
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>ehh.patrick@gmail.com
</td>
</tr>
<tr>
<th>CC</th>
<td>llvmbugs@cs.uiuc.edu, mclow.lists@gmail.com
</td>
</tr>
<tr>
<th>Classification</th>
<td>Unclassified
</td>
</tr></table>
<p>
<div>
<pre>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
<span class="quote">> vec(saa(outer(123), inner(432)));</span >
vec.emplace_back(); // default constructs the allocator in the pair's
std::vector
// instead of copying from inner(432)</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are on the CC list for the bug.</li>
</ul>
</body>
</html>