aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonathan Wakely <jwakely@redhat.com>2014-12-12 13:35:55 +0000
committerJonathan Wakely <redi@gcc.gnu.org>2014-12-12 13:35:55 +0000
commitdb62401dee8e69024392d9a4525414785df63523 (patch)
tree09f52687a0a2c801c78074992dd5bedc1b7886a8
parent3597c8dec2504eb400f64639ce4a563ea657c599 (diff)
downloadgcc-db62401dee8e69024392d9a4525414785df63523.zip
gcc-db62401dee8e69024392d9a4525414785df63523.tar.gz
gcc-db62401dee8e69024392d9a4525414785df63523.tar.bz2
stl_iterator.h (make_reverse_iterator): LWG DR 2285.
* include/bits/stl_iterator.h (make_reverse_iterator): LWG DR 2285. * include/std/tuple: Add feature-test macro. * testsuite/24_iterators/reverse_iterator/make.cc: New. From-SVN: r218670
-rw-r--r--libstdc++-v3/ChangeLog6
-rw-r--r--libstdc++-v3/include/bits/stl_iterator.h12
-rw-r--r--libstdc++-v3/include/std/tuple2
-rw-r--r--libstdc++-v3/testsuite/24_iterators/reverse_iterator/make.cc35
4 files changed, 55 insertions, 0 deletions
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog
index 68e3c14..ba90672 100644
--- a/libstdc++-v3/ChangeLog
+++ b/libstdc++-v3/ChangeLog
@@ -1,3 +1,9 @@
+2014-12-12 Jonathan Wakely <jwakely@redhat.com>
+
+ * include/bits/stl_iterator.h (make_reverse_iterator): LWG DR 2285.
+ * include/std/tuple: Add feature-test macro.
+ * testsuite/24_iterators/reverse_iterator/make.cc: New.
+
2014-12-12 Kyrylo Tkachov <kyrylo.tkachov@arm.com>
* testsuite/lib/libstdc++.exp: Include target-utils.exp.
diff --git a/libstdc++-v3/include/bits/stl_iterator.h b/libstdc++-v3/include/bits/stl_iterator.h
index f4522a4..15014d5 100644
--- a/libstdc++-v3/include/bits/stl_iterator.h
+++ b/libstdc++-v3/include/bits/stl_iterator.h
@@ -388,6 +388,18 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
{ return __y.base() - __x.base(); }
//@}
+#if __cplusplus > 201103L
+#define __cpp_lib_make_reverse_iterator 201402
+
+ // _GLIBCXX_RESOLVE_LIB_DEFECTS
+ // DR 2285. make_reverse_iterator
+ /// Generator function for reverse_iterator.
+ template<typename _Iterator>
+ inline reverse_iterator<_Iterator>
+ make_reverse_iterator(_Iterator __i)
+ { return reverse_iterator<_Iterator>(__i); }
+#endif
+
// 24.4.2.2.1 back_insert_iterator
/**
* @brief Turns assignment into insertion.
diff --git a/libstdc++-v3/include/std/tuple b/libstdc++-v3/include/std/tuple
index 6be7f23..01ab5fe 100644
--- a/libstdc++-v3/include/std/tuple
+++ b/libstdc++-v3/include/std/tuple
@@ -687,6 +687,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
};
#if __cplusplus > 201103L
+#define __cpp_lib_tuple_element_t 201402
+
template<std::size_t __i, typename _Tp>
using tuple_element_t = typename tuple_element<__i, _Tp>::type;
#endif
diff --git a/libstdc++-v3/testsuite/24_iterators/reverse_iterator/make.cc b/libstdc++-v3/testsuite/24_iterators/reverse_iterator/make.cc
new file mode 100644
index 0000000..a0f70de
--- /dev/null
+++ b/libstdc++-v3/testsuite/24_iterators/reverse_iterator/make.cc
@@ -0,0 +1,35 @@
+// Copyright (C) 2014 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 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 COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// { dg-options "-std=gnu++14" }
+
+#include <iterator>
+#include <testsuite_hooks.h>
+
+void
+test01()
+{
+ int a[2]{ 1, 2 };
+ auto b = std::make_reverse_iterator(a);
+ VERIFY( b == std::reverse_iterator<int*>(a) );
+}
+
+int
+main()
+{
+ test01();
+}