Makefile.am: Add new header.
authorJonathan Wakely <jwakely@redhat.com>
Mon, 6 Oct 2014 12:26:45 +0000 (13:26 +0100)
committerJonathan Wakely <redi@gcc.gnu.org>
Mon, 6 Oct 2014 12:26:45 +0000 (13:26 +0100)
* include/Makefile.am: Add new header.
* include/Makefile.in: Regenerate.
* include/experimental/tuple: New
* doc/xml/manual/status_cxx2014.xml: Update.
* doc/html/manual/status.html: Regenerate.
* testsuite/experimental/feat-lib-fund.cc: Test for new header.
* testsuite/experimental/tuple/apply.cc: New.

From-SVN: r215930

libstdc++-v3/ChangeLog
libstdc++-v3/doc/html/manual/status.html
libstdc++-v3/doc/xml/manual/status_cxx2014.xml
libstdc++-v3/include/Makefile.am
libstdc++-v3/include/Makefile.in
libstdc++-v3/include/experimental/tuple [new file with mode: 0644]
libstdc++-v3/testsuite/experimental/feat-lib-fund.cc
libstdc++-v3/testsuite/experimental/tuple/apply.cc [new file with mode: 0644]

index 1cc81da8aaee78ed85b6825dc25d9e4d4d27cb0d..9ebe1f7f4feecc6b9686da05856e417ac0f54e8a 100644 (file)
@@ -1,3 +1,13 @@
+2014-10-06  Jonathan Wakely  <jwakely@redhat.com>
+
+       * include/Makefile.am: Add new header.
+       * include/Makefile.in: Regenerate.
+       * include/experimental/tuple: New
+       * doc/xml/manual/status_cxx2014.xml: Update.
+       * doc/html/manual/status.html: Regenerate.
+       * testsuite/experimental/feat-lib-fund.cc: Test for new header.
+       * testsuite/experimental/tuple/apply.cc: New.
+
 2014-10-05  François Dumont  <fdumont@gcc.gnu.org>
 
        PR libstdc++/63456
index e6e27f83440dfc0442527d53ea75da7a96bf392c..a90b435b5816eb42d60fcf90da37591ecb71ebad 100644 (file)
@@ -391,11 +391,11 @@ not in any particular release.
        <a class="link" href="" target="_top">
          N3905
        </a>
-      </td><td align="left">Faster string searching (Boyer-Moore et al.)</td><td align="left">N</td><td align="left">Library Fundamentals TS</td></tr><tr bgcolor="#C8B0B0"><td align="left">
+      </td><td align="left">Faster string searching (Boyer-Moore et al.)</td><td align="left">N</td><td align="left">Library Fundamentals TS</td></tr><tr><td align="left">
        <a class="link" href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2014/n3915.pdf" target="_top">
          N3915
        </a>
-      </td><td align="left">apply() call a function with arguments from a tuple</td><td align="left">N</td><td align="left">Library Fundamentals TS</td></tr><tr bgcolor="#C8B0B0"><td align="left">
+      </td><td align="left">apply() call a function with arguments from a tuple</td><td align="left">Y</td><td align="left">Library Fundamentals TS</td></tr><tr bgcolor="#C8B0B0"><td align="left">
        <a class="link" href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2014/n3916.pdf" target="_top">
          N3916
        </a>
index 11254d6efc4b986b1081adc69a8b4a736af194bb..b7ed7ed72f640a8729ea448689120a1534f9399c 100644 (file)
@@ -353,14 +353,13 @@ not in any particular release.
     </row>
 
     <row>
-      <?dbhtml bgcolor="#C8B0B0" ?>
       <entry>
        <link xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2014/n3915.pdf">
          N3915
        </link>
       </entry>
       <entry>apply() call a function with arguments from a tuple</entry>
-      <entry>N</entry>
+      <entry>Y</entry>
       <entry>Library Fundamentals TS</entry>
     </row>
 
index 5476a378b67b3afa15ae70408a8bcbe8093e79e1..dee4a3fc6f8b9985f00969a4bb868c5ed8ad32a2 100644 (file)
@@ -642,7 +642,8 @@ experimental_headers = \
        ${experimental_srcdir}/any \
        ${experimental_srcdir}/optional \
        ${experimental_srcdir}/string_view \
-       ${experimental_srcdir}/string_view.tcc
+       ${experimental_srcdir}/string_view.tcc \
+       ${experimental_srcdir}/tuple
 
 # This is the common subset of C++ files that all three "C" header models use.
 c_base_srcdir = $(C_INCLUDE_DIR)
index bea586ea61370919b91fd2dc093d6c12d4353e6d..83dcefbd2df5539c807b1fcd817725bdb0db4fe6 100644 (file)
@@ -908,7 +908,8 @@ experimental_headers = \
        ${experimental_srcdir}/any \
        ${experimental_srcdir}/optional \
        ${experimental_srcdir}/string_view \
-       ${experimental_srcdir}/string_view.tcc
+       ${experimental_srcdir}/string_view.tcc \
+       ${experimental_srcdir}/tuple
 
 
 # This is the common subset of C++ files that all three "C" header models use.
diff --git a/libstdc++-v3/include/experimental/tuple b/libstdc++-v3/include/experimental/tuple
new file mode 100644 (file)
index 0000000..bbfbdfa
--- /dev/null
@@ -0,0 +1,70 @@
+// <experimental/tuple> -*- C++ -*-
+
+// 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.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file experimental/tuple
+ *  This is a TS C++ Library header.
+ */
+
+#ifndef _GLIBCXX_EXPERIMENTAL_TUPLE
+#define _GLIBCXX_EXPERIMENTAL_TUPLE 1
+
+#pragma GCC system_header
+
+#if __cplusplus <= 201103L
+# include <bits/c++14_warning.h>
+#else
+
+#include <tuple>
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+namespace experimental
+{
+inline namespace fundamentals_v1
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+  template <typename _Fn, typename _Tuple, std::size_t... _Idx>
+    constexpr decltype(auto)
+    __apply_impl(_Fn&& f, _Tuple&& t, std::index_sequence<_Idx...>)
+    { return std::forward<_Fn>(f)(get<_Idx>(forward<_Tuple>(t))...); }
+
+  template <typename _Fn, typename _Tuple>
+    constexpr decltype(auto)
+    apply(_Fn&& f, _Tuple&& t)
+    {
+      using _Indices =
+       std::make_index_sequence<std::tuple_size<std::decay_t<_Tuple>>::value>;
+      return __apply_impl(std::forward<_Fn>(f), std::forward<_Tuple>(t),
+                         _Indices{});
+    }
+
+_GLIBCXX_END_NAMESPACE_VERSION
+} // namespace fundamentals_v1
+} // namespace experimental
+} // namespace std
+
+#endif // C++14
+
+#endif // _GLIBCXX_EXPERIMENTAL_TUPLE
index 50d1ce247f057d9b8700cb21d6538b33562be14a..0c73f097a10263fdd2fba8ad171cc5e633683c1d 100644 (file)
@@ -23,3 +23,7 @@
 #if !__has_include(<experimental/string_view>)
 #  error "<experimental/string_view>"
 #endif
+
+#if !__has_include(<experimental/tuple>)
+#  error "<experimental/tuple>"
+#endif
diff --git a/libstdc++-v3/testsuite/experimental/tuple/apply.cc b/libstdc++-v3/testsuite/experimental/tuple/apply.cc
new file mode 100644 (file)
index 0000000..170a8d9
--- /dev/null
@@ -0,0 +1,49 @@
+// 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 <experimental/tuple>
+#include <testsuite_hooks.h>
+
+void
+test01()
+{
+  auto t = std::make_tuple(1, '2', 3.0);
+  std::experimental::apply( [&](int& i, char& c, double& d) {
+      VERIFY(&i == &std::get<int>(t));
+      VERIFY(&c == &std::get<char>(t));
+      VERIFY(&d == &std::get<double>(t));
+    }, t);
+}
+
+constexpr int func(int i, int j) { return i + j; }
+
+void
+test02()
+{
+  constexpr auto t = std::make_tuple(1, 2);
+  constexpr int i = std::experimental::apply(func, t);
+  VERIFY( i == 3 );
+}
+
+int
+main()
+{
+  test01();
+  test02();
+}