aboutsummaryrefslogtreecommitdiff
path: root/libstdc++-v3
diff options
context:
space:
mode:
authorFrançois Dumont <fdumont@gcc.gnu.org>2012-01-05 20:59:17 +0000
committerFrançois Dumont <fdumont@gcc.gnu.org>2012-01-05 20:59:17 +0000
commitf7d6ad0a5c2b3759f1952aa23bf5941013fec280 (patch)
tree6ae30463ff4ad8d0e4bd5e536d11d54e8cade6c7 /libstdc++-v3
parent866622072a274051c473d913e606d9076226ce59 (diff)
downloadgcc-f7d6ad0a5c2b3759f1952aa23bf5941013fec280.zip
gcc-f7d6ad0a5c2b3759f1952aa23bf5941013fec280.tar.gz
gcc-f7d6ad0a5c2b3759f1952aa23bf5941013fec280.tar.bz2
hashtable_policy.h (_Hashtable_base<>::_M_eq()): protected rather than private, use it...
2012-01-05 François Dumont <fdumont@gcc.gnu.org> * include/bits/hashtable_policy.h (_Hashtable_base<>::_M_eq()): protected rather than private, use it... * include/bits/hashtable.h (_Hashtable<>::key_eq()): ... here. * testsuite/23_containers/unordered_set/observers.cc: New. * testsuite/23_containers/unordered_multiset/observers.cc: New. * testsuite/23_containers/unordered_map/observers.cc: New. * testsuite/23_containers/unordered_multimap/observers.cc: New. From-SVN: r182928
Diffstat (limited to 'libstdc++-v3')
-rw-r--r--libstdc++-v3/ChangeLog12
-rw-r--r--libstdc++-v3/include/bits/hashtable.h2
-rw-r--r--libstdc++-v3/include/bits/hashtable_policy.h2
-rw-r--r--libstdc++-v3/testsuite/23_containers/unordered_map/observers.cc30
-rw-r--r--libstdc++-v3/testsuite/23_containers/unordered_multimap/observers.cc30
-rw-r--r--libstdc++-v3/testsuite/23_containers/unordered_multiset/observers.cc30
-rw-r--r--libstdc++-v3/testsuite/23_containers/unordered_set/observers.cc30
7 files changed, 133 insertions, 3 deletions
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog
index aebe091..56350fe 100644
--- a/libstdc++-v3/ChangeLog
+++ b/libstdc++-v3/ChangeLog
@@ -1,4 +1,14 @@
-2012-01-03 François Dumont <fdumont@gcc.gnu.org>
+2012-01-05 François Dumont <fdumont@gcc.gnu.org>
+
+ * include/bits/hashtable_policy.h (_Hashtable_base<>::_M_eq()):
+ protected rather than private, use it...
+ * include/bits/hashtable.h (_Hashtable<>::key_eq()): ... here.
+ * testsuite/23_containers/unordered_set/observers.cc: New.
+ * testsuite/23_containers/unordered_multiset/observers.cc: New.
+ * testsuite/23_containers/unordered_map/observers.cc: New.
+ * testsuite/23_containers/unordered_multimap/observers.cc: New.
+
+2012-01-03 François Dumont <fdumont@gcc.gnu.org>
* include/bits/hashtable_policy.h (_Ebo_helper<>): Rename to the more
specific _Hashtable_ebo_helper. Hide this implementation detail thanks
diff --git a/libstdc++-v3/include/bits/hashtable.h b/libstdc++-v3/include/bits/hashtable.h
index aeb330c..c9f3419 100644
--- a/libstdc++-v3/include/bits/hashtable.h
+++ b/libstdc++-v3/include/bits/hashtable.h
@@ -371,7 +371,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
// Observers
key_equal
key_eq() const
- { return this->_M_eq; }
+ { return this->_M_eq(); }
// hash_function, if present, comes from _Hash_code_base.
diff --git a/libstdc++-v3/include/bits/hashtable_policy.h b/libstdc++-v3/include/bits/hashtable_policy.h
index 66386e8..993f630 100644
--- a/libstdc++-v3/include/bits/hashtable_policy.h
+++ b/libstdc++-v3/include/bits/hashtable_policy.h
@@ -876,7 +876,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
std::swap(_M_eq(), __x._M_eq());
}
- private:
+ protected:
const _Equal&
_M_eq() const { return _EboEqual::_S_cget(*this); }
_Equal&
diff --git a/libstdc++-v3/testsuite/23_containers/unordered_map/observers.cc b/libstdc++-v3/testsuite/23_containers/unordered_map/observers.cc
new file mode 100644
index 0000000..4a6847e
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/unordered_map/observers.cc
@@ -0,0 +1,30 @@
+// { dg-do compile }
+// { dg-options "-std=gnu++0x" }
+
+// Copyright (C) 2012 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without Pred the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+#include <unordered_map>
+
+void
+test01()
+{
+ std::unordered_map<int, int> um;
+
+ auto ke = um.key_eq();
+ auto h = um.hash_function();
+}
diff --git a/libstdc++-v3/testsuite/23_containers/unordered_multimap/observers.cc b/libstdc++-v3/testsuite/23_containers/unordered_multimap/observers.cc
new file mode 100644
index 0000000..634bd9d
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/unordered_multimap/observers.cc
@@ -0,0 +1,30 @@
+// { dg-do compile }
+// { dg-options "-std=gnu++0x" }
+
+// Copyright (C) 2012 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without Pred the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+#include <unordered_map>
+
+void
+test01()
+{
+ std::unordered_multimap<int, int> um;
+
+ auto ke = um.key_eq();
+ auto h = um.hash_function();
+}
diff --git a/libstdc++-v3/testsuite/23_containers/unordered_multiset/observers.cc b/libstdc++-v3/testsuite/23_containers/unordered_multiset/observers.cc
new file mode 100644
index 0000000..0ea3e5b
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/unordered_multiset/observers.cc
@@ -0,0 +1,30 @@
+// { dg-do compile }
+// { dg-options "-std=gnu++0x" }
+
+// Copyright (C) 2012 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without Pred the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+#include <unordered_set>
+
+void
+test01()
+{
+ std::unordered_multiset<int> us;
+
+ auto ke = us.key_eq();
+ auto h = us.hash_function();
+}
diff --git a/libstdc++-v3/testsuite/23_containers/unordered_set/observers.cc b/libstdc++-v3/testsuite/23_containers/unordered_set/observers.cc
new file mode 100644
index 0000000..c18b059
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/unordered_set/observers.cc
@@ -0,0 +1,30 @@
+// { dg-do compile }
+// { dg-options "-std=gnu++0x" }
+
+// Copyright (C) 2012 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without Pred the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+#include <unordered_set>
+
+void
+test01()
+{
+ std::unordered_set<int> us;
+
+ auto ke = us.key_eq();
+ auto h = us.hash_function();
+}