From: Paolo Carlini Date: Wed, 11 Jun 2008 22:56:51 +0000 (+0000) Subject: hashtable (_Hashtable<>::cbegin(size_type), [...]): Add per DR 691. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=64bd554cdc44869758d580dec245f61ae5af2a98;p=gcc.git hashtable (_Hashtable<>::cbegin(size_type), [...]): Add per DR 691. 2008-06-11 Paolo Carlini * 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 --- 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 + + * 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 * 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 @@ Add the missing operations. + 691: + const_local_iterator cbegin, cend missing from TR1 + + In C++0x mode add cbegin(size_type) and cend(size_type) + to the unordered containers. + + 693: std::bitset::all() missing 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 + +// 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 +#include + +// DR 691. +void test01() +{ + bool test __attribute__((unused)) = true; + + typedef std::unordered_map 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 + +// 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 +#include + +// DR 691. +void test01() +{ + bool test __attribute__((unused)) = true; + + typedef std::unordered_multimap 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 + +// 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 +#include + +// DR 691. +void test01() +{ + bool test __attribute__((unused)) = true; + + typedef std::unordered_multiset 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 + +// 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 +#include + +// DR 691. +void test01() +{ + bool test __attribute__((unused)) = true; + + typedef std::unordered_set 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; +}