http://llvm.org/bugs/show_bug.cgi?id=22433
Bug ID: 22433
Summary: is_partitioned should not apply a predicate more than
(last - first) times
Product: libc++
Version: unspecified
Hardware: All
OS: All
Status: NEW
Severity: normal
Priority: P
Component: All Bugs
Assignee: [email protected]
Reporter: [email protected]
CC: [email protected], [email protected]
Classification: Unclassified
Created attachment 13792
--> http://llvm.org/bugs/attachment.cgi?id=13792&action=edit
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. http://melpon.org/wandbox/permlink/MY2gv2r3dbH7AvZG
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 =================================
--
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs