diff options
author | Eric Fiselier <eric@efcs.ca> | 2016-02-10 20:46:23 +0000 |
---|---|---|
committer | Eric Fiselier <eric@efcs.ca> | 2016-02-10 20:46:23 +0000 |
commit | 774c7c5ca8c3d224830bcd9a23c7d9ae52b91bcd (patch) | |
tree | 1985be7ab9cdf333cdf911bd62287f29be0287ad /test/std/containers/unord/unord.multimap | |
parent | f8865b62c38f744c845389567eed0a98e8c88d97 (diff) | |
download | external_libcxx-774c7c5ca8c3d224830bcd9a23c7d9ae52b91bcd.tar.gz external_libcxx-774c7c5ca8c3d224830bcd9a23c7d9ae52b91bcd.tar.bz2 external_libcxx-774c7c5ca8c3d224830bcd9a23c7d9ae52b91bcd.zip |
Recommit r260012 - Cleanup node-type handling in the unordered containers.
This time I kept <ext/hash_map> working!
This patch is the first in a series of patches that's meant to better
support unordered_map. unordered_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 __hash_table about this
special value_type.
This patch creates a "__hash_node_types" traits class that contains
all of the typedefs needed by the unordered containers and it's iterators.
These typedefs include ones for each node type and node pointer type,
as well as special typedefs for "unordered_map"'s value type.
As a result of this change all of the unordered containers now all support
incomplete types.
As a drive-by fix I changed the difference_type in __hash_table to always
be ptrdiff_t. There is a corresponding change to size_type but it cannot
take affect until an ABI break.
This patch will be followed up shortly with fixes for various unordered_map
bugs and problems.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@260431 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/std/containers/unord/unord.multimap')
-rw-r--r-- | test/std/containers/unord/unord.multimap/incomplete.pass.cpp | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/test/std/containers/unord/unord.multimap/incomplete.pass.cpp b/test/std/containers/unord/unord.multimap/incomplete.pass.cpp new file mode 100644 index 000000000..7822224e7 --- /dev/null +++ b/test/std/containers/unord/unord.multimap/incomplete.pass.cpp @@ -0,0 +1,37 @@ + +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// <unordered_map> + +// Check that std::unordered_multimap and it's iterators can be instantiated with an incomplete +// type. + +#include <unordered_map> + +template <class Tp> +struct MyHash { + MyHash() {} + std::size_t operator()(Tp const&) const {return 42;} +}; + +struct A { + typedef std::unordered_multimap<A, A, MyHash<A> > Map; + Map m; + Map::iterator it; + Map::const_iterator cit; + Map::local_iterator lit; + Map::const_local_iterator clit; +}; + +inline bool operator==(A const& L, A const& R) { return &L == &R; } + +int main() { + A a; +} |