aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaolo Carlini <paolo.carlini@oracle.com>2008-06-13 07:35:22 +0000
committerPaolo Carlini <paolo@gcc.gnu.org>2008-06-13 07:35:22 +0000
commit6a4533e55451309198c5d36558a4b875b5555c88 (patch)
tree6b936e95bb98471dbf016b73c78dc4956e81008a
parentc3e9b6abf80f91814ad173cafd0d6a5fb8151f11 (diff)
downloadgcc-6a4533e55451309198c5d36558a4b875b5555c88.zip
gcc-6a4533e55451309198c5d36558a4b875b5555c88.tar.gz
gcc-6a4533e55451309198c5d36558a4b875b5555c88.tar.bz2
array (array<>::assign): Do not define in C++0x mode, per DR 776...
2008-06-13 Paolo Carlini <paolo.carlini@oracle.com> * include/tr1_impl/array (array<>::assign): Do not define in C++0x mode, per DR 776... (array<>::fill): ... define instead. * doc/xml/manual/intro.xml: Add an entry for DR 776. * testsuite/23_containers/array/requirements/fill.cc: New. From-SVN: r136741
-rw-r--r--libstdc++-v3/ChangeLog8
-rw-r--r--libstdc++-v3/doc/xml/manual/intro.xml9
-rw-r--r--libstdc++-v3/include/tr1_impl/array11
-rw-r--r--libstdc++-v3/testsuite/23_containers/array/requirements/fill.cc47
4 files changed, 71 insertions, 4 deletions
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog
index 933bff8..2d1681c 100644
--- a/libstdc++-v3/ChangeLog
+++ b/libstdc++-v3/ChangeLog
@@ -1,3 +1,11 @@
+2008-06-13 Paolo Carlini <paolo.carlini@oracle.com>
+
+ * include/tr1_impl/array (array<>::assign): Do not define in
+ C++0x mode, per DR 776...
+ (array<>::fill): ... define instead.
+ * doc/xml/manual/intro.xml: Add an entry for DR 776.
+ * testsuite/23_containers/array/requirements/fill.cc: New.
+
2008-06-12 Paolo Carlini <paolo.carlini@oracle.com>
* include/std/complex (pow(const complex<>&, int)): Do not define in
diff --git a/libstdc++-v3/doc/xml/manual/intro.xml b/libstdc++-v3/doc/xml/manual/intro.xml
index e30e81d..fb23f3d 100644
--- a/libstdc++-v3/doc/xml/manual/intro.xml
+++ b/libstdc++-v3/doc/xml/manual/intro.xml
@@ -666,8 +666,15 @@
<listitem><para>Implement the int -> size_t replacements.
</para></listitem></varlistentry>
+ <varlistentry><term><ulink url="../ext/lwg-active.html#776">776</ulink>:
+ <emphasis>Undescribed assign function of std::array</emphasis>
+ </term>
+ <listitem><para>In C++0x mode, remove assign, add fill.
+ </para></listitem></varlistentry>
+
<varlistentry><term><ulink url="../ext/lwg-active.html#778">778</ulink>:
- <emphasis>std::bitset does not have any constructor taking a string literal</emphasis>
+ <emphasis>std::bitset does not have any constructor taking a string
+ literal</emphasis>
</term>
<listitem><para>Add it.
</para></listitem></varlistentry>
diff --git a/libstdc++-v3/include/tr1_impl/array b/libstdc++-v3/include/tr1_impl/array
index a904743..66dc9a2 100644
--- a/libstdc++-v3/include/tr1_impl/array
+++ b/libstdc++-v3/include/tr1_impl/array
@@ -56,11 +56,16 @@ _GLIBCXX_BEGIN_NAMESPACE_TR1
// No explicit construct/copy/destroy for aggregate type.
- void
+ void
+#ifdef _GLIBCXX_INCLUDE_AS_CXX0X
+ // DR 776.
+ fill(const value_type& __u)
+#else
assign(const value_type& __u)
+#endif
{ std::fill_n(begin(), size(), __u); }
- void
+ void
swap(array& __other)
{ std::swap_ranges(begin(), end(), __other.begin()); }
@@ -74,7 +79,7 @@ _GLIBCXX_BEGIN_NAMESPACE_TR1
{ return const_iterator(&_M_instance[0]); }
iterator
- end()
+ end()
{ return iterator(&_M_instance[_Nm]); }
const_iterator
diff --git a/libstdc++-v3/testsuite/23_containers/array/requirements/fill.cc b/libstdc++-v3/testsuite/23_containers/array/requirements/fill.cc
new file mode 100644
index 0000000..45b81b6
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/array/requirements/fill.cc
@@ -0,0 +1,47 @@
+// { dg-options "-std=gnu++0x" }
+
+// 2008-06-13 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, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+// USA.
+
+#include <array>
+#include <testsuite_hooks.h>
+
+// DR 776. Undescribed assign function of std::array.
+void test01()
+{
+ bool test __attribute__((unused)) = true;
+
+ const size_t len = 3;
+ typedef std::array<int, len> array_type;
+
+ array_type a = { { 0, 1, 2 } };
+ const int value = 5;
+
+ a.fill(value);
+ VERIFY( a[0] == value );
+ VERIFY( a[1] == value );
+ VERIFY( a[2] == value );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}