llvm-project/libcxx/test/std/containers/unord/unord.multimap
Eric Fiselier fcd0221118 Teach __hash_table how to handle unordered_map's __hash_value_type.
This patch is fairly large and contains a number of changes. The main change
is teaching '__hash_table' how to handle '__hash_value_type'. Unfortunately
this change is a rampant layering violation, but it's required to make
unordered_map conforming without re-writing all of __hash_table.
After this change 'unordered_map' can delegate to '__hash_table' in almost all cases.

The major changes found in this patch are:

  * Teach __hash_table to differentiate between the true container value type
    and the node value type by introducing the "__container_value_type" and
    "__node_value_type" typedefs. In the case of unordered_map '__container_value_type'
    is 'pair<const Key, Value>' and '__node_value_type' is '__hash_value_type'.
    
  * Switch almost all overloads in '__hash_table' previously taking 'value_type'
    (AKA '__node_value_type) to take  '__container_value_type' instead. Previously
    'pair<K, V>' would be implicitly converted to '__hash_value_type<K, V>' because
    of the function signature.
    
  * Add '__get_key', '__get_value', '__get_ptr', and '__move' static functions to
    '__key_value_types'. These functions allow '__hash_table' to unwrap
    '__node_value_type' objects into '__container_value_type' and its sub-parts.

  * Pass  '__hash_value_type::__value_'  to 'a.construct(p, ...)' instead of
    '__hash_value_type' itself. The C++14 standard requires that 'a.construct()'
    and 'a.destroy()' are only ever instantiated for the containers value type.

  * Remove '__hash_value_type's constructors and destructors. We should never
    construct an instance of this type.
    (TODO this is UB but we already do it in plenty of places).
  
  * Add a generic "try-emplace" function to '__hash_table' called
    '__emplace_unique_key_args(Key const&, Args...)'.

  
The following changes were done as cleanup:

  * Introduce the '_LIBCPP_CXX03_LANG' macro to be used in place of
    '_LIBCPP_HAS_NO_VARIADICS' or '_LIBCPP_HAS_NO_RVALUE_REFERENCE'.
    
  * Cleanup C++11 only overloads that assume an incomplete C++11 implementation.
    For example this patch removes the __construct_node overloads that do
    manual pack expansion.
    
  * Forward 'unordered_map::emplace' to '__hash_table' and remove dead code
    resulting from the change. This includes almost all
    'unordered_map::__construct_node' overloads.


The following changes are planed for future revisions:

  * Fix LWG issue #2469 by delegating 'unordered_map::operator[]' to use
    '__emplace_unique_key_args'.
    
  * Rewrite 'unordered_map::try_emplace' in terms of '__emplace_unique_key_args'.
  
  * Optimize '__emplace_unique' to call '__emplace_unique_key_args' when possible.
    This prevent unneeded allocations when inserting duplicate entries.


The additional follow up work needed after this patch:

  * Respect the lifetime rules for '__hash_value_type' by actually constructing it.
  * Make '__insert_multi' act similar to '__insert_unique' for objects of type
    'T&' and 'T const &&' with 'T = __container_value_type'.
  
  

llvm-svn: 260513
2016-02-11 11:59:44 +00:00
..
unord.multimap.cnstr Add a bunch of missing includes in the test suite to make it more portable. Fixes bugs #26120 and #26121. Thanks to Jonathan Wakely for the reports and the patches. 2016-01-12 14:51:04 +00:00
unord.multimap.modifiers Teach __hash_table how to handle unordered_map's __hash_value_type. 2016-02-11 11:59:44 +00:00
unord.multimap.swap Remove undefined behavior from tests; specifically, ensure that the value type of the allocators match the value type of the containers 2015-11-24 22:10:51 +00:00
allocator_mismatch.fail.cpp 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. 2015-11-26 01:24:04 +00:00
bucket.pass.cpp
bucket_count.pass.cpp
bucket_size.pass.cpp
count.pass.cpp
db_iterators_7.pass.cpp
db_iterators_8.pass.cpp
db_local_iterators_7.pass.cpp
db_local_iterators_8.pass.cpp
eq.pass.cpp
equal_range_const.pass.cpp
equal_range_non_const.pass.cpp
find_const.pass.cpp
find_non_const.pass.cpp
incomplete.pass.cpp Recommit r260012 - Cleanup node-type handling in the unordered containers. 2016-02-10 20:46:23 +00:00
iterators.fail.cpp
iterators.pass.cpp
load_factor.pass.cpp Add a bunch of missing includes in the test suite to make it more portable. Fixes bugs #26120 and #26121. Thanks to Jonathan Wakely for the reports and the patches. 2016-01-12 14:51:04 +00:00
local_iterators.fail.cpp
local_iterators.pass.cpp
max_bucket_count.pass.cpp
max_load_factor.pass.cpp
max_size.pass.cpp
rehash.pass.cpp Add a bunch of missing includes in the test suite to make it more portable. Fixes bugs #26120 and #26121. Thanks to Jonathan Wakely for the reports and the patches. 2016-01-12 14:51:04 +00:00
reserve.pass.cpp Fix compile error in test. Can't use `operator[]` for multimap. 2015-11-16 23:40:27 +00:00
scary.pass.cpp
swap_member.pass.cpp
types.pass.cpp