Commit Graph

23 Commits

Author SHA1 Message Date
Marshall Clow
f0f1bca861 Fix PR#202520 - predicate called too many times in list::remove_if. Add tests for list, forward_list, and the std::remove_if algorithm
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@214736 91177308-0d34-0410-b5e6-96231b3b80d8
2014-08-04 17:32:25 +00:00
David Majnemer
cb8757aca7 Fix std::make_heap's worst case time complexity
std::make_heap is currently implemented by iteratively applying a
siftup-type algorithm.  Since sift-up is O(ln n), this gives
std::make_heap a worst case time complexity of O(n ln n).

The C++ standard mandates that std::make_heap make no more than O(3n)
comparisons, this makes our std::make_heap out of spec.

Fix this by introducing an implementation of __sift_down and switch
std::make_heap to create the heap using it.
This gives std::make_heap linear time complexity in the worst case.

This fixes PR20161.


git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@213615 91177308-0d34-0410-b5e6-96231b3b80d8
2014-07-22 06:07:09 +00:00
Marshall Clow
c8c7abae66 Add checking for the complexity guarantees in the standard
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@212017 91177308-0d34-0410-b5e6-96231b3b80d8
2014-06-30 05:04:20 +00:00
Nico Weber
d32add4a48 fix typo
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@209819 91177308-0d34-0410-b5e6-96231b3b80d8
2014-05-29 14:58:38 +00:00
Marshall Clow
52a708fbca Fix bug 19840, where some tests were not testing what we wanted. Thanks to Eric for the bug report
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@209520 91177308-0d34-0410-b5e6-96231b3b80d8
2014-05-23 15:30:23 +00:00
Marshall Clow
34b571bd88 Added some tests for equal elements in min_element and max_element. Bug #19547 was invalid, but we weren't testing that case
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@207232 91177308-0d34-0410-b5e6-96231b3b80d8
2014-04-25 15:50:54 +00:00
Marshall Clow
37a9ca6fb2 More LWG issues. Mark #2182, #2323 and #2213 as complete. Add a test for #2339, and mark that as complete. No actual changes to the libc++ code; all of these were already in place.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@202407 91177308-0d34-0410-b5e6-96231b3b80d8
2014-02-27 16:13:36 +00:00
Marshall Clow
9d9463a355 Implement LWG2350: min, max, and minmax should be constexpr.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@201697 91177308-0d34-0410-b5e6-96231b3b80d8
2014-02-19 16:51:35 +00:00
Howard Hinnant
56dcf0b809 Taking another swing at correctly optimizing fill_n.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@187587 91177308-0d34-0410-b5e6-96231b3b80d8
2013-08-01 17:29:28 +00:00
Anders Carlsson
b8e0d9086e Fix a bug in std::fill_n where memset would end up being called in cases when it shouldn’t.
Reviewed by Howard.



git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@186875 91177308-0d34-0410-b5e6-96231b3b80d8
2013-07-22 21:08:00 +00:00
Howard Hinnant
171771a9f5 War on tabs.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@185865 91177308-0d34-0410-b5e6-96231b3b80d8
2013-07-08 21:06:38 +00:00
Marshall Clow
b30abdd07a Implement n3607: 'equal', 'mismatch', and 'is_permutation'
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@181548 91177308-0d34-0410-b5e6-96231b3b80d8
2013-05-09 21:14:23 +00:00
Howard Hinnant
128f7bf4fa Somehow search_n never got tested, so of course it had a bug in it. This fixes http://llvm.org/bugs/show_bug.cgi?id=15667.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@178764 91177308-0d34-0410-b5e6-96231b3b80d8
2013-04-04 15:40:48 +00:00
Marshall Clow
83e2c4d877 Move common header files into a 'support' directory; make 'testit' include -I to that directory; rename 'iterators.h' to 'iterator_test.h'; remove hard-coded paths to include files from more than 350 source files
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@171594 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-05 03:21:01 +00:00
Marshall Clow
8226d0b7c5 ...and then there was one. Only one copy of 'iterators.h' in the test tree for libc++
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@171479 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-04 18:24:04 +00:00
Howard Hinnant
e3e3291f3a Fixed PR10574: http://llvm.org/bugs/show_bug.cgi?id=10574
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@137522 91177308-0d34-0410-b5e6-96231b3b80d8
2011-08-12 21:56:02 +00:00
Howard Hinnant
b64f8b07c1 license change
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@119395 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-16 22:09:02 +00:00
Howard Hinnant
73d21a4f07 Changed __config to react to all of clang's currently documented has_feature flags, and renamed _LIBCPP_MOVE to _LIBCPP_HAS_NO_RVALUE_REFERENCES to be more consistent with the rest of the libc++'s flags, and with clang's nomenclature.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@113086 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-04 23:28:19 +00:00
Howard Hinnant
eb564e76cc Fixing whitespace problems
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@111753 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-22 00:08:10 +00:00
Howard Hinnant
98e5d97400 US 122, N3106
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@111742 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-21 20:10:01 +00:00
Howard Hinnant
c326721e65 Completed [alg.random.shuffle].
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@104708 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-26 17:49:34 +00:00
Howard Hinnant
f5256e16df Wiped out some non-ascii characters that snuck into the copyright.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@103516 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-11 21:36:01 +00:00
Howard Hinnant
bc8d3f97eb libcxx initial import
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@103490 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-11 19:42:16 +00:00