Commit Graph

34 Commits

Author SHA1 Message Date
Howard Hinnant 397717b7c8 constexpr applied to <array>.
llvm-svn: 160564
2012-07-20 19:20:49 +00:00
Howard Hinnant 38b99b025c Add test for self-referencing emplace test.
llvm-svn: 159921
2012-07-09 02:47:43 +00:00
Howard Hinnant 4cb38a82a2 This commit establishes a new bucket_count policy in the unordered containers: The policy now allows a power-of-2 number of buckets to be requested (and that request honored) by the client. And if the number of buckets is set to a power of 2, then the constraint of the hash to the number of buckets uses & instead of %. If the client does not specify a number of buckets, then the policy remains unchanged: a prime number of buckets is selected. The growth policy is that the number of buckets is roughly doubled when needed. While growing, either the prime, or the power-of-2 strategy will be preserved. There is a small run time cost for putting in this switch. For very cheap hash functions, e.g. identity for int, the cost can be as high as 18%. However with more typical use cases, e.g. strings, the cost is in the noise level. I've measured cases with very cheap hash functions (int) that using a power-of-2 number of buckets can make look up about twice as fast. However I've also noted that a power-of-2 number of buckets is more susceptible to accidental catastrophic collisions. Though I've also noted that accidental catastrophic collisions are also possible when using a prime number of buckets (but seems far less likely). In short, this patch adds an extra tuning knob for those clients trying to get the last bit of performance squeezed out of their hash containers. Casual users of the hash containers will not notice the introduction of this tuning knob. Those clients who swear by power-of-2 hash containers can now opt-in to that strategy. Clients who prefer a prime number of buckets can continue as they have.
llvm-svn: 159836
2012-07-06 17:31:14 +00:00
Howard Hinnant 8b805c915a The rules for emplace in map, multimap, unordered_map and unordered_multimap changed a while back and I'm just now updating to these new rules. In a nutshell, you've got to know you're emplacing to a pair and use one of pair's constructors. I made one extension: If you want to emplace the key and default construct the mapped_type, you can just emplace(key), as opposed to emplace(piecewise_construct, forward_as_tuple(key), forward_as_tuple()).
llvm-svn: 157503
2012-05-25 22:04:21 +00:00
Howard Hinnant 1196716270 unord test fixes by Edward Meewis
llvm-svn: 145707
2011-12-02 21:23:14 +00:00
Howard Hinnant 920b56ca88 Another installment on debug mode. This addresses list. However this should be considered a temporary state. The API of the debug database and how vector and list use it, is unsatisfactory at the moment. It is both inefficient and overly verbose. I wanted to get this functionality checked in though. In the next day or so I'll refactor what is there in an attempt to streamline things.
llvm-svn: 140660
2011-09-27 23:55:03 +00:00
Howard Hinnant 0695db06d7 The vector test suite now passes for no-debug, debug-lite and debug-regular
llvm-svn: 139930
2011-09-16 18:41:29 +00:00
Howard Hinnant 54976f2619 Fixed PR10574: http://llvm.org/bugs/show_bug.cgi?id=10574
llvm-svn: 137522
2011-08-12 21:56:02 +00:00
Howard Hinnant bd0c160078 noexcept for <stack>. This completes noexcept for Chapter 23 [containers].
llvm-svn: 132652
2011-06-04 22:09:19 +00:00
Howard Hinnant 6971d82668 noexcept for <queue>.
llvm-svn: 132650
2011-06-04 21:32:33 +00:00
Howard Hinnant 557da866a3 noexcept for <unordered_set>.
llvm-svn: 132647
2011-06-04 20:18:37 +00:00
Howard Hinnant 3714107ed6 noexcept for <unordered_map>.
llvm-svn: 132646
2011-06-04 18:54:24 +00:00
Howard Hinnant 0e9f71c13f noexcept for <set>. Plus a few fixes to noexcept for <map>.
llvm-svn: 132640
2011-06-04 15:22:34 +00:00
Howard Hinnant 1052ee39cb noexcept for <map>.
llvm-svn: 132639
2011-06-04 14:31:57 +00:00
Howard Hinnant 3297ed7065 noexcept for <vector>. This also includes installing move_if_noexcept() into vector.
llvm-svn: 132577
2011-06-03 19:40:40 +00:00
Howard Hinnant 4590010473 noexcept for <list>.
llvm-svn: 132562
2011-06-03 17:30:28 +00:00
Howard Hinnant 91a4750733 noexcept for <forward_list>.
llvm-svn: 132553
2011-06-03 16:20:53 +00:00
Howard Hinnant 801291139c After sleeping on it I've decided that all special members that can be noexcept, should be declared so. The client has the traits to detect and branch on this information, and it is often an important optimization. Give deque() a noexcept. Add test for deque default constructor and deque destructor.
llvm-svn: 132549
2011-06-03 15:16:49 +00:00
Howard Hinnant 60954bbbbc Add noexcept tests for deque.
llvm-svn: 132523
2011-06-03 01:46:22 +00:00
Howard Hinnant a7fa0710cb Suppress some warings in the tests.
llvm-svn: 131326
2011-05-13 23:59:50 +00:00
Howard Hinnant e4b11156d7 Corrected tests for http://llvm.org/bugs/show_bug.cgi?id=9351
llvm-svn: 128807
2011-04-04 01:42:30 +00:00
Howard Hinnant e4bafbee25 ... And these wonderful tests.
llvm-svn: 128797
2011-04-03 20:06:31 +00:00
Howard Hinnant 2774545736 Bug 9096 - list::iterator not default constructible
llvm-svn: 124508
2011-01-28 23:46:28 +00:00
Howard Hinnant 601afb30ec LWG 1191
llvm-svn: 119545
2010-11-17 19:52:17 +00:00
Howard Hinnant 412dbebe1b license change
llvm-svn: 119395
2010-11-16 22:09:02 +00:00
Howard Hinnant c1ef47986b Fix two test bugs
llvm-svn: 116515
2010-10-14 21:08:32 +00:00
Howard Hinnant 1c1620b269 Updated by-chapter-summary with weekly test results, and fixed up some bad paths in some tests caused by aligning the test suite with N3126.
llvm-svn: 113403
2010-09-08 20:31:42 +00:00
Howard Hinnant cbf93f3959 sync with N3126
llvm-svn: 113101
2010-09-05 01:14:30 +00:00
Howard Hinnant 7609c9b665 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.
llvm-svn: 113086
2010-09-04 23:28:19 +00:00
Howard Hinnant 8f2f7e7c79 Fixing whitespace problems
llvm-svn: 111755
2010-08-22 00:15:28 +00:00
Howard Hinnant 3db88036f6 US 117
llvm-svn: 111745
2010-08-21 20:58:44 +00:00
Howard Hinnant e57dc14c44 LWG 1278
llvm-svn: 111532
2010-08-19 17:40:04 +00:00
Howard Hinnant 5b08a8a432 Wiped out some non-ascii characters that snuck into the copyright.
llvm-svn: 103516
2010-05-11 21:36:01 +00:00
Howard Hinnant 3e519524c1 libcxx initial import
llvm-svn: 103490
2010-05-11 19:42:16 +00:00