summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpaolo <paolo@138bc75d-0d04-0410-961f-82ee72b054a4>2008-06-11 22:56:51 +0000
committerpaolo <paolo@138bc75d-0d04-0410-961f-82ee72b054a4>2008-06-11 22:56:51 +0000
commit9e13b5851aff928608c32ec5632c832d8b02c4d0 (patch)
tree97b4078e94f24646dfb7549230aacaec34d63e69
parent9ead5ba09452820435a61778a944899a0254e021 (diff)
downloadgcc-9e13b5851aff928608c32ec5632c832d8b02c4d0.tar.gz
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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@136685 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--libstdc++-v3/ChangeLog14
-rw-r--r--libstdc++-v3/doc/xml/manual/intro.xml7
-rw-r--r--libstdc++-v3/include/tr1_impl/hashtable19
-rw-r--r--libstdc++-v3/testsuite/23_containers/unordered_map/requirements/cliterators.cc53
-rw-r--r--libstdc++-v3/testsuite/23_containers/unordered_multimap/requirements/cliterators.cc53
-rw-r--r--libstdc++-v3/testsuite/23_containers/unordered_multiset/requirements/cliterators.cc53
-rw-r--r--libstdc++-v3/testsuite/23_containers/unordered_set/requirements/cliterators.cc53
7 files changed, 248 insertions, 4 deletions
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog
index d02d1ae1aa8..94cbefa52ff 100644
--- a/libstdc++-v3/ChangeLog
+++ b/libstdc++-v3/ChangeLog
@@ -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:
diff --git a/libstdc++-v3/doc/xml/manual/intro.xml b/libstdc++-v3/doc/xml/manual/intro.xml
index 1f6708dac9a..309871b5c32 100644
--- a/libstdc++-v3/doc/xml/manual/intro.xml
+++ b/libstdc++-v3/doc/xml/manual/intro.xml
@@ -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>
diff --git a/libstdc++-v3/include/tr1_impl/hashtable b/libstdc++-v3/include/tr1_impl/hashtable
index 9a3ecbd094f..55056ef3da8 100644
--- a/libstdc++-v3/include/tr1_impl/hashtable
+++ b/libstdc++-v3/include/tr1_impl/hashtable
@@ -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
@@ -326,19 +326,30 @@ _GLIBCXX_BEGIN_NAMESPACE_TR1
local_iterator
begin(size_type __n)
{ return local_iterator(_M_buckets[__n]); }
-
+
local_iterator
end(size_type)
{ return local_iterator(0); }
-
+
const_local_iterator
begin(size_type __n) const
{ return const_local_iterator(_M_buckets[__n]); }
-
+
const_local_iterator
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
{
diff --git a/libstdc++-v3/testsuite/23_containers/unordered_map/requirements/cliterators.cc b/libstdc++-v3/testsuite/23_containers/unordered_map/requirements/cliterators.cc
new file mode 100644
index 00000000000..1699a2b40b0
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/unordered_map/requirements/cliterators.cc
@@ -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;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/unordered_multimap/requirements/cliterators.cc b/libstdc++-v3/testsuite/23_containers/unordered_multimap/requirements/cliterators.cc
new file mode 100644
index 00000000000..947e2a7807a
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/unordered_multimap/requirements/cliterators.cc
@@ -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;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/unordered_multiset/requirements/cliterators.cc b/libstdc++-v3/testsuite/23_containers/unordered_multiset/requirements/cliterators.cc
new file mode 100644
index 00000000000..51b32564444
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/unordered_multiset/requirements/cliterators.cc
@@ -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;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/unordered_set/requirements/cliterators.cc b/libstdc++-v3/testsuite/23_containers/unordered_set/requirements/cliterators.cc
new file mode 100644
index 00000000000..944514a653f
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/unordered_set/requirements/cliterators.cc
@@ -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;
+}