hashtable (_Hashtable<>::cbegin(size_type), [...]): Add per DR 691.

2008-06-11  Paolo Carlini  <paolo.carlini@oracle.com>

	* include/tr1_impl/hashtable (_Hashtable<>::cbegin(size_type),
	cend(size_type)): Add per DR 691. 
	* testsuite/23_containers/unordered_map/requirements/cliterators.cc:
	New.
	* testsuite/23_containers/unordered_multimap/requirements/
	cliterators.cc: Likewise.
	* testsuite/23_containers/unordered_set/requirements/cliterators.cc:
	Likewise.
	* testsuite/23_containers/unordered_multiset/requirements/
	cliterators.cc: Likewise.
	* doc/xml/manual/intro.xml: Add an entry for DR 691.

From-SVN: r136685
This commit is contained in:
Paolo Carlini 2008-06-11 22:56:51 +00:00 committed by Paolo Carlini
parent 5f836cbbc1
commit 64bd554cdc
7 changed files with 248 additions and 4 deletions

View File

@ -1,3 +1,17 @@
2008-06-11 Paolo Carlini <paolo.carlini@oracle.com>
* include/tr1_impl/hashtable (_Hashtable<>::cbegin(size_type),
cend(size_type)): Add per DR 691.
* testsuite/23_containers/unordered_map/requirements/cliterators.cc:
New.
* testsuite/23_containers/unordered_multimap/requirements/
cliterators.cc: Likewise.
* testsuite/23_containers/unordered_set/requirements/cliterators.cc:
Likewise.
* testsuite/23_containers/unordered_multiset/requirements/
cliterators.cc: Likewise.
* doc/xml/manual/intro.xml: Add an entry for DR 691.
2008-06-11 Matthias Klose <doko@ubuntu.com>
* testsuite/30_threads/lock_error, testsuite/30_threads/once_flag:

View File

@ -635,6 +635,13 @@
<listitem><para>Add the missing operations.
</para></listitem></varlistentry>
<varlistentry><term><ulink url="../ext/lwg-active.html#691">691</ulink>:
<emphasis>const_local_iterator cbegin, cend missing from TR1</emphasis>
</term>
<listitem><para>In C++0x mode add cbegin(size_type) and cend(size_type)
to the unordered containers.
</para></listitem></varlistentry>
<varlistentry><term><ulink url="../ext/lwg-defects.html#693">693</ulink>:
<emphasis>std::bitset::all() missing</emphasis>
</term>

View File

@ -1,6 +1,6 @@
// Internal header for TR1 unordered_set and unordered_map -*- C++ -*-
// Copyright (C) 2007 Free Software Foundation, Inc.
// Copyright (C) 2007, 2008 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
@ -339,6 +339,17 @@ _GLIBCXX_BEGIN_NAMESPACE_TR1
end(size_type) const
{ return const_local_iterator(0); }
#ifdef _GLIBCXX_INCLUDE_AS_CXX0X
// DR 691.
const_local_iterator
cbegin(size_type __n) const
{ return const_local_iterator(_M_buckets[__n]); }
const_local_iterator
cend(size_type) const
{ return const_local_iterator(0); }
#endif
float
load_factor() const
{

View File

@ -0,0 +1,53 @@
// { dg-options "-std=gnu++0x" }
// 2008-06-11 Paolo Carlini <paolo.carlini@oracle.com>
// Copyright (C) 2008 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 2, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even 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 COPYING. If not, write to the Free
// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
// USA.
// As a special exception, you may use this file as part of a free software
// library without restriction. Specifically, if other files instantiate
// templates or use macros or inline functions from this file, or you compile
// this file and link it with other files to produce an executable, this
// file does not by itself cause the resulting executable to be covered by
// the GNU General Public License. This exception does not however
// invalidate any other reasons why the executable file might be covered by
// the GNU General Public License.
#include <unordered_map>
#include <testsuite_hooks.h>
// DR 691.
void test01()
{
bool test __attribute__((unused)) = true;
typedef std::unordered_map<int, int> um_type;
um_type um;
um[1] = 1;
VERIFY( um.cbegin(0) == um.begin(0) );
VERIFY( um.cend(0) == um.end(0) );
const um_type::size_type bn = um.bucket(1);
VERIFY( um.cbegin(bn) != um.cend(bn) );
}
int main()
{
test01();
return 0;
}

View File

@ -0,0 +1,53 @@
// { dg-options "-std=gnu++0x" }
// 2008-06-11 Paolo Carlini <paolo.carlini@oracle.com>
// Copyright (C) 2008 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 2, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even 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 COPYING. If not, write to the Free
// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
// USA.
// As a special exception, you may use this file as part of a free software
// library without restriction. Specifically, if other files instantiate
// templates or use macros or inline functions from this file, or you compile
// this file and link it with other files to produce an executable, this
// file does not by itself cause the resulting executable to be covered by
// the GNU General Public License. This exception does not however
// invalidate any other reasons why the executable file might be covered by
// the GNU General Public License.
#include <unordered_map>
#include <testsuite_hooks.h>
// DR 691.
void test01()
{
bool test __attribute__((unused)) = true;
typedef std::unordered_multimap<int, int> umm_type;
umm_type umm;
umm.insert(umm_type::value_type(1, 1));
VERIFY( umm.cbegin(0) == umm.begin(0) );
VERIFY( umm.cend(0) == umm.end(0) );
const umm_type::size_type bn = umm.bucket(1);
VERIFY( umm.cbegin(bn) != umm.cend(bn) );
}
int main()
{
test01();
return 0;
}

View File

@ -0,0 +1,53 @@
// { dg-options "-std=gnu++0x" }
// 2008-06-11 Paolo Carlini <paolo.carlini@oracle.com>
// Copyright (C) 2008 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 2, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even 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 COPYING. If not, write to the Free
// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
// USA.
// As a special exception, you may use this file as part of a free software
// library without restriction. Specifically, if other files instantiate
// templates or use macros or inline functions from this file, or you compile
// this file and link it with other files to produce an executable, this
// file does not by itself cause the resulting executable to be covered by
// the GNU General Public License. This exception does not however
// invalidate any other reasons why the executable file might be covered by
// the GNU General Public License.
#include <unordered_set>
#include <testsuite_hooks.h>
// DR 691.
void test01()
{
bool test __attribute__((unused)) = true;
typedef std::unordered_multiset<int> ums_type;
ums_type ums;
ums.insert(1);
VERIFY( ums.cbegin(0) == ums.begin(0) );
VERIFY( ums.cend(0) == ums.end(0) );
const ums_type::size_type bn = ums.bucket(1);
VERIFY( ums.cbegin(bn) != ums.cend(bn) );
}
int main()
{
test01();
return 0;
}

View File

@ -0,0 +1,53 @@
// { dg-options "-std=gnu++0x" }
// 2007-06-11 Paolo Carlini <paolo.carlini@oracle.com>
// Copyright (C) 2008 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 2, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even 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 COPYING. If not, write to the Free
// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
// USA.
// As a special exception, you may use this file as part of a free software
// library without restriction. Specifically, if other files instantiate
// templates or use macros or inline functions from this file, or you compile
// this file and link it with other files to produce an executable, this
// file does not by itself cause the resulting executable to be covered by
// the GNU General Public License. This exception does not however
// invalidate any other reasons why the executable file might be covered by
// the GNU General Public License.
#include <unordered_set>
#include <testsuite_hooks.h>
// DR 691.
void test01()
{
bool test __attribute__((unused)) = true;
typedef std::unordered_set<int> us_type;
us_type us;
us.insert(1);
VERIFY( us.cbegin(0) == us.begin(0) );
VERIFY( us.cend(0) == us.end(0) );
const us_type::size_type bn = us.bucket(1);
VERIFY( us.cbegin(bn) != us.cend(bn) );
}
int main()
{
test01();
return 0;
}