From f7d6ad0a5c2b3759f1952aa23bf5941013fec280 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Fran=C3=A7ois=20Dumont?= Date: Thu, 5 Jan 2012 20:59:17 +0000 Subject: [PATCH] hashtable_policy.h (_Hashtable_base<>::_M_eq()): protected rather than private, use it... MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit 2012-01-05 François Dumont * 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 --- libstdc++-v3/ChangeLog | 12 ++++++++- libstdc++-v3/include/bits/hashtable.h | 2 +- libstdc++-v3/include/bits/hashtable_policy.h | 2 +- .../23_containers/unordered_map/observers.cc | 30 ++++++++++++++++++++++ .../23_containers/unordered_multimap/observers.cc | 30 ++++++++++++++++++++++ .../23_containers/unordered_multiset/observers.cc | 30 ++++++++++++++++++++++ .../23_containers/unordered_set/observers.cc | 30 ++++++++++++++++++++++ 7 files changed, 133 insertions(+), 3 deletions(-) create mode 100644 libstdc++-v3/testsuite/23_containers/unordered_map/observers.cc create mode 100644 libstdc++-v3/testsuite/23_containers/unordered_multimap/observers.cc create mode 100644 libstdc++-v3/testsuite/23_containers/unordered_multiset/observers.cc create mode 100644 libstdc++-v3/testsuite/23_containers/unordered_set/observers.cc 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 +2012-01-05 François Dumont + + * 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 * 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 +// . + +#include + +void +test01() +{ + std::unordered_map 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 +// . + +#include + +void +test01() +{ + std::unordered_multimap 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 +// . + +#include + +void +test01() +{ + std::unordered_multiset 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 +// . + +#include + +void +test01() +{ + std::unordered_set us; + + auto ke = us.key_eq(); + auto h = us.hash_function(); +} -- 2.7.4