Makefile.am: Add new header.

* 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
This commit is contained in:
Jonathan Wakely 2014-10-06 13:26:45 +01:00 committed by Jonathan Wakely
parent c1d62412c3
commit 22274fac01
8 changed files with 140 additions and 6 deletions

View 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

View 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>

View 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>

View 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)

View 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.

View File

@ -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

View 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

View File

@ -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();
}