Eric Fiselier
0594ad713b
Remove all usages of "const" node pointer typedefs in the assoc containers.
...
The "const" pointer typedefs such as "__node_const_pointer" and
"__node_base_const_pointer" are identical to their non-const pointer types.
This patch changes all usages of "const" pointer type names to their respective
non-const typedef.
Since "fancy pointers to const" cannot be converted back to a non-const pointer
type according to the allocator requirements it is important that we never
actually use "const" pointers.
Furthermore since "__node_const_pointer" and "__node_pointer" already
name the same type, it's very confusing to use both names. Especially
when defining const/non-const overloads for member functions.
llvm-svn: 261419
2016-02-20 07:12:17 +00:00
Eric Fiselier
089a7cc5de
Cleanup node-type handling in the associative containers.
...
This patch is very similar to r260431.
This patch is the first in a series of patches that's meant to better
support map. map has a special "value_type" that
differs from pair<const Key, Value>. In order to meet the EmplaceConstructible
and CopyInsertable requirements we need to teach __tree about this
special value_type.
This patch creates a "__tree_node_types" traits class that contains
all of the typedefs needed by the associative containers and their iterators.
These typedefs include ones for each node type and node pointer type,
as well as special typedefs for "map"'s value type.
Although the associative containers already supported incomplete types, this
patch makes it official by adding tests.
This patch will be followed up shortly with various cleanups within __tree and
fixes for various map bugs and problems.
llvm-svn: 261416
2016-02-20 05:28:30 +00:00
Marshall Clow
afc9ff99ec
First half of LWG#2354: 'Unnecessary copying when inserting into maps with braced-init syntax'
...
llvm-svn: 256859
2016-01-05 19:32:41 +00:00
Eric Fiselier
934b092186
Use __rebind_pointer to avoid #ifdef block
...
llvm-svn: 256654
2015-12-30 21:52:00 +00:00
Marshall Clow
94f89aeec5
Add static_assert to set/multiset/map/multimap/forward_list/deque that the allocator's value_type match the container's value_type. vector/unordered/list/string already do this. Add tests for all the containers to verify this.
...
llvm-svn: 254119
2015-11-26 01:24:04 +00:00
Dimitry Andric
251c629117
Fix warnings about pessimizing return moves for C++11 and higher
...
Summary:
Throughout the libc++ headers, there are a few instances where
_VSTD::move() is used to return a local variable. Howard commented in
r189039 that these were there "for non-obvious reasons such as to help
things limp along in C++03 language mode".
However, when compiling these headers with warnings on, and in C++11 or
higher mode (like we do in FreeBSD), they cause the following complaints
about pessimizing moves:
In file included from tests.cpp:26:
In file included from tests.hpp:29:
/usr/include/c++/v1/map:1368:12: error: moving a local object in a return statement prevents copy elision [-Werror,-Wpessimizing-move]
return _VSTD::move(__h); // explicitly moved for C++03
^
/usr/include/c++/v1/__config:368:15: note: expanded from macro '_VSTD'
#define _VSTD std::_LIBCPP_NAMESPACE
^
Attempt to fix this by adding a _LIBCPP_EXPLICIT_MOVE() macro to
__config, which gets defined to _VSTD::move for pre-C++11, and to
nothing for C++11 and later.
I am not completely satisfied with the macro name (I also considered
_LIBCPP_COMPAT_MOVE and some other variants), so suggestions are
welcome. :)
Reviewers: mclow.lists, howard.hinnant, EricWF
Subscribers: arthur.j.odwyer, cfe-commits
Differential Revision: http://reviews.llvm.org/D11394
llvm-svn: 245421
2015-08-19 06:43:33 +00:00
Marshall Clow
e3fbe1433b
Implement the first part of N4258: 'Cleaning up noexcept in the Library'. This patch deals with swapping containers, and implements a more strict noexcept specification (a conforming extension) than the standard mandates.
...
llvm-svn: 242056
2015-07-13 20:04:56 +00:00
Marshall Clow
8aaf517db7
Implement N4279 and LWG#2664 for <map>. Reviewed as http://reviews.llvm.org/D10669
...
llvm-svn: 241539
2015-07-07 03:37:33 +00:00
Marshall Clow
f8457a0735
Add tests for LWG#2299. While doing so, I noticed that the tests we have for the transparent comparators don't actually call them. Fix those tests, too. Now one of them is failing, due to a missing const in <map>. Add that (twice). Next step is to do the same for <unordered_map>
...
llvm-svn: 241091
2015-06-30 18:15:41 +00:00
Eric Fiselier
ee187e247b
[libcxx] Fix detection of __is_final.
...
Summary: Currently we only enable the use of __is_final(...) with Clang. GCC also provides __is_final(...) since 4.7 in all standard modes. This patch creates the macro _LIBCPP_HAS_IS_FINAL to note the availability of `__is_final`.
Reviewers: danalbert, mclow.lists
Reviewed By: mclow.lists
Subscribers: cfe-commits
Differential Revision: http://reviews.llvm.org/D8795
llvm-svn: 239664
2015-06-13 07:08:02 +00:00
Marshall Clow
ec39296875
Fix for LWG Issue 2059: C++0x ambiguity problem with map::erase
...
llvm-svn: 236950
2015-05-10 13:35:00 +00:00
Marshall Clow
1f508014df
In many places, there was an #ifdef/#else block that selected one of two implmentations of rebind_alloc based on whether or not we had template aliases. Create a helper struct to encapsulate that bit of logic, and replace all the ifdefs with uses of that struct. No functionality change intented.
...
llvm-svn: 234296
2015-04-07 05:21:38 +00:00
Eric Fiselier
b3be398c67
Allow declaration of map and multimap iterator with incomplete mapped type. Patch from eugenis
...
llvm-svn: 231119
2015-03-03 20:10:01 +00:00
Marshall Clow
0aacbc92df
Fix bug 20740 - std::set/std::map don't support heterogeneous lookup for count(). Thanks to Jim Porter for the bug report
...
llvm-svn: 216353
2014-08-24 23:54:16 +00:00
Marshall Clow
c303bba184
Remove some unnecessary noexcept conditions. Thanks to Richard Smith for the catch.
...
llvm-svn: 206424
2014-04-16 23:12:55 +00:00
Marshall Clow
415a24e41f
Fix bug I introduced (enabling implicit conversions from compare function to map) in r202994. Thanks to Sebastian Redl for the catch.
...
llvm-svn: 203443
2014-03-10 04:50:10 +00:00
Marshall Clow
78a87e8a68
Implement LWG 2193. Default constructors for standard library containers are explicit. Note that libc++ already did this for string/deque/forward_list/list/vector and the unordered containers; implement it for set/multiset/map/multimap. Add tests for all the containers. Two drive-by fixes as well: add a missing explicit in <deque>, and remove a tab that snuck into a container test. This issue is also LLVM bug 15724, and resolves it.
...
llvm-svn: 202994
2014-03-05 19:06:20 +00:00
Marshall Clow
74cf6ff5e5
Fix for PR18735 - self-assignment for map/multimap gives incorrect results in C++03
...
llvm-svn: 201021
2014-02-08 04:03:14 +00:00
Howard Hinnant
9fd9f84f48
SCARY/N2913 iterator support between the multi and non-multi versions of the associative and unordered containers. I beleive lack of support for this was accidentally recently introduced (by me) and this is fixing a regression. This time tests are put in to prevent such a regression in the future.
...
llvm-svn: 191692
2013-09-30 19:08:22 +00:00
Howard Hinnant
872ac4b5f0
A collection of minor type-o fixes. The first two aren't testable, but all tests pass with them. I stumbled across them while experimenting with a std::move that checks its argument for non-const. The third corrects a test that is currently failing.
...
llvm-svn: 190563
2013-09-12 00:10:44 +00:00
Marshall Clow
fbc317d480
LWG Issue #2210 Part 5 - map/multimap; no, really - the last one was set/multiset. THIS is map/multimap
...
llvm-svn: 190474
2013-09-11 01:15:47 +00:00
Howard Hinnant
179b1f8cf2
Zhihao Yuan noted that there were a few unneeded statements. Eliminated the unnecessary ones, and commented the ones that are there for non-obvious reasons such as to help things limp along in C++03 language mode.
...
llvm-svn: 189039
2013-08-22 18:29:50 +00:00
Marshall Clow
2585835c3b
Second half (map/multimap) of N3657
...
llvm-svn: 188320
2013-08-13 22:18:47 +00:00
Howard Hinnant
f0544c2086
Nico Rieck: this patch series fixes visibility issues on Windows as explained in < http://lists.cs.uiuc.edu/pipermail/cfe-dev/2013-August/031214.html >.
...
llvm-svn: 188192
2013-08-12 18:38:34 +00:00
Howard Hinnant
abb160e689
Remove implicit conversion from __value_type to value_type in [unordered_][multi]map. This fixes http://llvm.org/bugs/show_bug.cgi?id=16549
...
llvm-svn: 185711
2013-07-05 18:06:00 +00:00
Howard Hinnant
4a95f9eb7e
Removed extension in [unordered_][multi]map which allowed one to emplace using just an argument for the key, as opposed to using piecewise_construct. However a bug report exposed that this created an unfortunate ambiguity. People who are currently using the extension will be notified the next time they compile, and will have to change to using piecewise_construct. There are no ABI issues with the removal of this extension. This fixes http://llvm.org/bugs/show_bug.cgi?id=16542
...
llvm-svn: 185666
2013-07-04 20:59:16 +00:00
Howard Hinnant
bbdf669bde
Simplify comparators of [unordered_][multi]map. This fixes http://llvm.org/bugs/show_bug.cgi?id=16538
...
llvm-svn: 185665
2013-07-04 19:46:35 +00:00
Howard Hinnant
07d3eccd26
Implement full support for non-pointer types in custom allocators. This is for the associative containers only. This work still needs to be done on the unordered and sequence containers. Fixes http://llvm.org/bugs/show_bug.cgi?id=15978
...
llvm-svn: 184358
2013-06-19 21:29:40 +00:00
Howard Hinnant
6e41256f68
No functionality change at this time. I've split _LIBCPP_VISIBLE up into two flags: _LIBCPP_TYPE_VIS and _LIBCPP_FUNC_VIS. This is in preparation for taking advantage of clang's new __type_visibility__ attribute.
...
llvm-svn: 176593
2013-03-06 23:30:19 +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
42b8bb5033
Fix http://llvm.org/bugs/show_bug.cgi?id=11461 . Credit Alberto Ganesh Barbati.
...
llvm-svn: 146345
2011-12-11 20:31:33 +00:00
Howard Hinnant
c003db1fca
Further macro protection by replacing _[A-Z] with _[A-Z]p
...
llvm-svn: 145410
2011-11-29 18:15:50 +00:00
Howard Hinnant
073458b1ab
Windows support by Ruben Van Boxem.
...
llvm-svn: 142235
2011-10-17 20:05:10 +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
5a33687da0
Correct for new rules regarding implicitly deleted special members. http://llvm.org/bugs/show_bug.cgi?id=10191
...
llvm-svn: 134248
2011-07-01 19:24:36 +00:00
Howard Hinnant
ce48a1137d
_STD -> _VSTD to avoid macro clash on windows
...
llvm-svn: 134190
2011-06-30 21:18:19 +00:00
Howard Hinnant
a945a32981
More fixes: One of my fixes to type_traits earlier today was incorrect, so that is reverted. Recently clang appears to have tightened up its definition of is_convertible and that has caused some failures in [unordered_][multi]map. I've switched to using is_constructible to restablish the desired functionality in [unordered_][multi]map. Specifically, inserting rvalues of move-only types for the keys.
...
llvm-svn: 133402
2011-06-19 21:45:00 +00:00
Howard Hinnant
ce53420e37
Provide names for template and function parameters in forward declarations. The purpose is to aid automated documentation tools.
...
llvm-svn: 133008
2011-06-14 19:58:17 +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
40dab2ce86
http://llvm.org/bugs/show_bug.cgi?id=9672
...
llvm-svn: 129266
2011-04-11 02:18:41 +00:00
Howard Hinnant
73736effce
Fixed two problems found by Chris Jefferson: Made operator>> for char consistent with gcc. Opened an LWG issue on this one. 2) Renamed some private typedefs which are causing boost grief.
...
llvm-svn: 126576
2011-02-27 18:02:02 +00:00
Howard Hinnant
a0fe8c436e
Chris Jefferson noted many places where function calls needed to be qualified (thanks Chris).
...
llvm-svn: 125510
2011-02-14 19:12:38 +00:00
Howard Hinnant
72c5e14203
Qualify calls to addressof with std::. Bug 9106
...
llvm-svn: 124726
2011-02-02 17:36:20 +00:00
Howard Hinnant
ab061a656d
Marshall Clow's fix for Bug 8421.
...
llvm-svn: 122825
2011-01-04 19:21:05 +00:00
Howard Hinnant
412dbebe1b
license change
...
llvm-svn: 119395
2010-11-16 22:09:02 +00:00
Howard Hinnant
848a5374d0
visibility-decoration.
...
llvm-svn: 114551
2010-09-22 16:48:34 +00:00
Howard Hinnant
959cf8aede
Fix whitespace
...
llvm-svn: 113089
2010-09-04 23:46:48 +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
b3371f6f49
Fixing whitespace problems
...
llvm-svn: 111750
2010-08-22 00:02:43 +00:00