<html>
<head>
<base href="http://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 --- - is_partitioned should not apply a predicate more than (last - first) times"
href="http://llvm.org/bugs/show_bug.cgi?id=22433">22433</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>is_partitioned should not apply a predicate more than (last - first) times
</td>
</tr>
<tr>
<th>Product</th>
<td>libc++
</td>
</tr>
<tr>
<th>Version</th>
<td>unspecified
</td>
</tr>
<tr>
<th>Hardware</th>
<td>All
</td>
</tr>
<tr>
<th>OS</th>
<td>All
</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>kariya_mitsuru@hotmail.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>Created <span class=""><a href="attachment.cgi?id=13792" name="attach_13792" title="clang++ -v">attachment 13792</a> <a href="attachment.cgi?id=13792&action=edit" title="clang++ -v">[details]</a></span>
clang++ -v
Please see the sample code below.
================================= sample code =================================
#include <iostream>
#include <algorithm>
int main()
{
int v[] = { 1, 3, 5, 7, 9, 2, 4, 6, 8, 10 };
int c = 0;
std::cout << std::boolalpha
<< std::is_partitioned(v, v + 10, [&c](int x) { return ++c, (x & 1) !=
0; })
<< std::endl;
std::cout << c << " times" << std::endl;
}
================================= sample code =================================
================================= output =================================
true
11 times
================================= output =================================
cf. <a href="http://melpon.org/wandbox/permlink/MY2gv2r3dbH7AvZG">http://melpon.org/wandbox/permlink/MY2gv2r3dbH7AvZG</a>
The C++11 standard 25.3.13[alg.partitions]/p.3 says, "At most last - first
applications of pred."
So the sample code above should output
================================= output =================================
true
10 times
================================= output =================================</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>