Commit Graph

596 Commits

Author SHA1 Message Date
Daniel James
2f8492d720 Fix libc++ configuration 2017-05-03 04:21:52 +01:00
Daniel James
7911f491f6 Try using own allocator_traits with Sun compiler
The good news is that the old Sun workarounds aren't needed any more.
Unfortunately, there are a lot of exception test errors for
unordered_map and unordered_multimap when using libstdc++, which
probably means that std::pair isn't exception safe, which is a bit odd.
But first try using our allocator_traits implementation instead of the
standard one to see if that makes a difference. If it doesn't then I'll
probably just disable C++11 construction on this compiler, which should
fix the problem but will make allocators less useful.
2017-05-03 04:21:52 +01:00
Daniel James
b8c754d230 Set the high bit in bucket_info_ to false for first node in group
And true for the reset, so that in containers with unique keys
bucket_info_ is always just the bucket index.
2017-05-01 21:03:11 +01:00
Daniel James
338a94e577 Better rvalue emulation support in extractors
Means that inserting rvalues into unordered_set/unordered_map won't
create a node if no insert is required.
2017-05-01 21:03:11 +01:00
Daniel James
2e14c340a8 Reformat 2017-05-01 21:03:11 +01:00
Daniel James
35522d3ee0 Fix merging between containers with different hash/equality
This reverts commit 20b0c0a6d8.
2017-04-30 14:29:05 +01:00
Daniel James
7b5f73f6c2 Disable all sunpro workarounds on latest version
I have no idea if they're still working. I wasn't able to run the latest
solaris in a virtual machine on my computer, so this is the only way to
test.
2017-04-30 10:44:54 +01:00
Daniel James
e7a3487df4 Remove policy template parameter from local iterators 2017-04-30 10:44:54 +01:00
Daniel James
c243895fc0 Remove odd check that should never be true
I think it was left over from the old grouped node implementation.
2017-04-30 10:44:54 +01:00
Daniel James
451d0f2fc5 Constructing nodes is nothrow, so no need to track 2017-04-30 10:43:06 +01:00
Daniel James
c75b332240 Cleaner create_buckets implementation 2017-04-30 10:43:06 +01:00
Daniel James
899248acbf Avoid shadow warning on older versions off GCC 2017-04-29 09:31:17 +01:00
Daniel James
bfcdd51b4a Fix try_emplace overload 2017-04-28 09:53:50 +01:00
Daniel James
10b736d407 Remove BOOST_UNORDERED_CALL_CONSTRUCT0 2017-04-28 09:53:50 +01:00
Daniel James
0b61e6defb Stop using allocators to construct/destroy internal types
The standard doesn't allow it. I should have known that.
2017-04-27 19:02:10 +01:00
Daniel James
6466ce0b51 Make table the same for unique and equivalent keys 2017-04-27 18:22:44 +01:00
Daniel James
03baef8b28 Remove Types::is_unique 2017-04-27 18:22:44 +01:00
Daniel James
f1435d53d4 Remove 'init' method from nodes 2017-04-27 18:22:44 +01:00
Daniel James
20b0c0a6d8 Only consider one node from each group in merge_unique 2017-04-27 18:22:44 +01:00
Daniel James
a1b1df84a0 Store bucket + whether first in group in node
Instead of the hash value.
2017-04-27 18:22:44 +01:00
Daniel James
408ebd0a0a Add node_bucket function 2017-04-27 18:22:44 +01:00
Daniel James
e9c4696544 Get rid of node_algo 2017-04-27 18:22:43 +01:00
Daniel James
ea64f2e46e Remove the grouped node stuff 2017-04-27 18:22:43 +01:00
Daniel James
da27ae4de6 Group together similar overloads of try_emplace 2017-04-25 20:20:11 +01:00
Daniel James
ed326e2c87 Expand out more preprocessor repeats 2017-04-25 20:20:11 +01:00
Daniel James
bea4c6e29b undef some macros 2017-04-25 20:20:11 +01:00
Daniel James
61df9479e5 Rename unique_node 2017-04-25 20:20:11 +01:00
Daniel James
e3ab7b5d2e Remove BOOST_UNORDERED_EMPLACE_ARGSn macros
They're not used anywhere now.
2017-04-25 20:20:11 +01:00
Daniel James
679b73098e Option to use grouped nodes everywhere
Seems to work okay, but I'm not happy with and of the options. So I'm
going to look into doing something else before the next release.
2017-04-25 09:54:28 +01:00
Daniel James
cba643fc51 Make setting max_load_ a tad more consistent 2017-04-25 09:54:28 +01:00
Daniel James
1c8edf0298 Remove early exit for empty containers 2017-04-25 09:54:28 +01:00
Daniel James
07b9a7d60e Fix incorrect try_emplace call 2017-04-25 01:39:30 +01:00
Daniel James
b070bb5e49 Move everything from table_unique/table_equiv into table 2017-04-24 09:46:05 +01:00
Daniel James
e518120104 Rename some copy/assign/move methods
But with a hack so that the static casts will work until there's a
better method.
2017-04-24 09:46:05 +01:00
Daniel James
84f1ef6d2d Move constructor implementation into containers 2017-04-24 09:46:05 +01:00
Daniel James
77bf2b5e33 Rename methods to be different for unique/equiv keys
So that the implementation can be moved into a single class. Still some
other methods to rename. Some methods didn't need to be renamed (e.g.
try_emplace is only used with unique keys), but still renamed for
consistency.
2017-04-24 09:46:05 +01:00
Daniel James
fc08f62d6a Remove a TODO 2017-04-23 10:51:17 +01:00
Daniel James
7941771d61 Expand calls to at implementation 2017-04-23 10:09:18 +01:00
Daniel James
4f1c6e1ebf Expand calls to init/move_init 2017-04-23 10:09:18 +01:00
Daniel James
13ff1e7fb1 Expand calls to count and equal_range implementation 2017-04-23 10:09:18 +01:00
Daniel James
25b0b66e52 Expand calls to erase implementation
Doesn't work as well as the previous changes.
2017-04-23 10:09:18 +01:00
Daniel James
da835e88b8 Expand calls to insert_range 2017-04-23 10:09:18 +01:00
Daniel James
b6c229e2bb Expand calls to reserve implementation 2017-04-23 10:09:18 +01:00
Daniel James
19a45e028a Expand calls to generic_find_node 2017-04-23 10:09:18 +01:00
Daniel James
435b7450d4 Expand calls to max_size implementation 2017-04-23 10:09:18 +01:00
Daniel James
a41a0f3a06 Expand calls to load_factor implementation 2017-04-23 10:09:18 +01:00
Daniel James
814926ef31 Expand calls to clear implementation 2017-04-23 10:09:18 +01:00
Daniel James
f6f5ecdc00 Expand calls to emplace implementation
Also manually call the emplace macro up to 9 arguments, nicer error
messages for little effort.

Does it matter that there's no longer a nice backend for
`please_ignore_this_overload`? I don't think so, I was worried that it
would be confusing if triggered, but I'm not really aware of that ever
happening.
2017-04-23 10:09:18 +01:00
Daniel James
42b6b13943 Use the preprocessor to increment emplace limit
So that there's no need to add one.
2017-04-23 10:04:28 +01:00
Daniel James
cfe4c26f99 Explicitly write out boost::tuple template arguments
GCC 4.6 doesn't support using variadic arguments for a fixed length template.
There's a config macro for this, but might as well use the same code
everywhere.
2017-04-23 09:31:18 +01:00
Daniel James
3117611a55 New tuple implementation
Adjusts to use less arguments on Visual C++ 11, which will hopefully fix
it on that compiler. Also changed to be a little less preprocessor
heavy. I'm not sure about the __SUNPRO_CC support, hopefully recent
versions of that compiler will have better support, and can use the
normal implementation. Will check that later.
2017-04-22 18:31:10 +01:00
Daniel James
1e491533fa More consistent std::tuple configuration
Was getting a weird test failure for Visual C++ 11,
BOOST_NO_CXX11_HDR_TUPLE is defined, so the code doesn't support
std::tuple, but BOOST_UNORDERED_HAVE_PIECEWISE_CONSTRUCT was also
true, and so there are functions for constructing using
std::piecewise_construct/std::tuple, which don't work.

So, I'm assuming that if BOOST_UNORDERED_HAVE_PIECEWISE_CONSTRUCT is true,
then there must be a std::tuple. I guess it doesn't have full C++11 support,
which is why BOOST_NO_CXX11_HDR_TUPLE is defined, but it appears to be
good enough for us. If not, this will break things.
2017-04-21 20:32:56 +01:00
Daniel James
b067e65731 Clean table forward declarations 2017-04-20 22:59:00 +01:00
Daniel James
f3b179d451 Remove pointless duplication of move constructor 2017-04-20 22:59:00 +01:00
Daniel James
de5373413b Missing rvalue overload of at 2017-04-20 22:59:00 +01:00
Daniel James
fedf533699 Move index functions into place 2017-04-20 22:59:00 +01:00
Daniel James
9cd673c71d Specify clear as noexcept 2017-04-20 22:59:00 +01:00
Daniel James
85a834cf62 Comment on changes needed for C++17 support 2017-04-20 22:59:00 +01:00
Daniel James
5167c970af Swap order of swap/clear to match standard 2017-04-20 22:59:00 +01:00
Daniel James
bf7a65010c Add new erase(iterator) overloads
Not for unordered_set/unordered_multiset as they use the same type for
iterator and const_iterator.
2017-04-20 22:59:00 +01:00
Daniel James
461ac96a2c Reorder insert_or_assign to match standard 2017-04-20 22:59:00 +01:00
Daniel James
5eb10fd0b2 Move extract into place 2017-04-20 22:59:00 +01:00
Daniel James
e2e9959389 Split up emplace and emplace_hint code
Busywork I guess, but I think it's more readable this way. The emplace
macros are still unreadable, but I think they're rarely used.

Btw. a bit weird that clang format has removed the indentation on the
'// emplace' comment, not sure why that is.
2017-04-20 22:59:00 +01:00
Daniel James
d8969c71fc Move 'try_emplace' into same order as draft standard 2017-04-20 22:59:00 +01:00
Daniel James
ab76814aa6 Move 'insert_or_assign' into same order as draft standard 2017-04-20 22:59:00 +01:00
Daniel James
1a18cd2196 Move capacity functions to match order in standard 2017-04-20 22:59:00 +01:00
Daniel James
e4a00980f8 Commented out noexcept for move assignment 2017-04-20 22:59:00 +01:00
Daniel James
af94e6a40e Reorder the constructors to match the draft standard
In order to make it easier to check against the standard.  This includes
collapsing some of the input iterator overloads into one constructor.
2017-04-20 22:59:00 +01:00
Daniel James
6bdf1ba244 Fix a comment 2017-04-19 10:21:13 +01:00
Daniel James
cee94e9fcb Fix unused parameter warning 2017-04-19 09:20:31 +01:00
Daniel James
e0054c7dd0 Remove alloc parameter from construct_value 2017-04-18 10:14:26 +01:00
Daniel James
3414e6628a Use allocator to construct/destroy nodes 2017-04-18 10:14:26 +01:00
Daniel James
08ce2c98e0 Rename call_construct to construct_value 2017-04-18 10:14:26 +01:00
Daniel James
6d79a322e2 Use macros to reduce call chain 2017-04-18 10:14:26 +01:00
Daniel James
9e70680044 Bypass construct_value/call_destroy_in a few places 2017-04-18 10:14:26 +01:00
Daniel James
7de8c91301 Remove calls to const_cast_pointer
It was needed because std::allocator_traits::construct doesn't work with
a const pointer (e.g. pointer to the first member of a std::pair). But
now we're only calling construct if BOOST_UNORDERED_CXX11_CONSTRUCTION
is true, so the allocator_traits::construct is no longer used here.
2017-04-18 10:14:26 +01:00
Daniel James
c333a7f9fc Use piecewise construction where possible 2017-04-18 10:14:26 +01:00
Daniel James
bc36a06a2d Comment about call_construct 2017-04-18 10:14:26 +01:00
Daniel James
e62ac22f0b Replace BOOST_UNORDERED_DETAIL_FULL_CONSTRUCT with BOOST_UNORDERED_CXX11_CONSTRUCTION
Require good construct support and piecewise construction. I don't know
if there are any platforms with good construct support, but no piecewise
construction, if there are then they'll no longer use
'allocator_traits::construct'/'allocator_traits::destruct'.
2017-04-18 10:14:26 +01:00
Daniel James
1092c972c9 Use allocator_traits to construct/destruct buckets 2017-04-18 10:14:26 +01:00
Daniel James
2b01bdbc25 More general deprecated check
`__has_cpp_attribute(deprecated)` returns true for C++11, but then warns
that it's a C++14 attribute, so only check in C++14 mode.
2017-04-16 16:34:22 +01:00
Daniel James
64a3be7d3e Use aligned_storage's address method to get pointer 2017-04-16 10:37:10 +01:00
Daniel James
ed8c0f9ecd Add deprecated attributes to deprecated functions 2017-04-15 17:35:09 +01:00
Daniel James
2bfc59c461 Make node_handler constructor private + additional compile tests 2017-04-15 17:35:09 +01:00
Daniel James
727e36e6a6 Comment about clear_buckets/create_buckets awkwardness.
They both leave the container in an invalid state that needs to be
cleaned up immediately. This confused me slightly.
2017-04-15 17:35:09 +01:00
Daniel James
09bddd8df4 Clear buckets before deleting nodes in clear.
The order shouldn't really matter as nothing throws an exception, but it
seems cleaner to never have any dangling pointers.
2017-04-15 17:35:08 +01:00
Daniel James
f089adc160 Change get_key to have node parameter 2017-04-15 17:35:08 +01:00
Daniel James
97b68ea05e Rename (grouped_)table_impl to table_unique/equiv
The old names don't make sense any more as either style can be used for
containers with equivalent keys, due to the use of node_algo.
2017-04-15 17:35:08 +01:00
Daniel James
972ac220f5 Add missing insert(P&&) methods to unordered_map/unordered_multimap 2017-04-15 17:35:08 +01:00
Daniel James
5d98f3d0f0 Noexcept specs for swap free functions 2017-04-15 17:35:08 +01:00
Daniel James
c18f57f62b Add missing copyright/license to a couple of files 2017-04-04 22:06:15 +01:00
Daniel James
91bbd5fcb2 Make emplace_args1 constructor explicit 2017-03-01 16:46:18 +00:00
Daniel James
b6e3f2303f Fix call to try_emplace_impl 2017-03-01 00:13:02 +00:00
Daniel James
da370a6a1a Avoid Visual C++ warning C4127 2017-02-27 12:20:37 +00:00
Daniel James
4aa74e5feb Merge between set/multiset and map/multimap 2017-02-27 03:59:02 +00:00
Daniel James
13322fe858 Option to use same node type everywhere.
Will allow me to implement merge and extract fully.
2017-02-27 03:59:02 +00:00
Daniel James
0645700b33 Separate out some of the node manipulation code 2017-02-27 03:59:02 +00:00
Daniel James
d89aadc56c Implement merge 2017-02-27 03:59:02 +00:00
Daniel James
21a24d6cd7 Support node_handle 2017-02-27 03:59:02 +00:00
Daniel James
9c4c3a754a Const methods in value_base. 2017-02-27 03:59:02 +00:00