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
This commit is contained in:
François Dumont 2012-01-05 20:59:17 +00:00
parent 866622072a
commit f7d6ad0a5c
7 changed files with 133 additions and 3 deletions

View File

@ -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

View File

@ -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.

View File

@ -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&

View File

@ -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();
}

View File

@ -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();
}

View File

@ -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();
}

View File

@ -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();
}