1287518Sdim// -*- C++ -*- 2287518Sdim//===----------------------------- tuple ----------------------------------===// 3287518Sdim// 4287518Sdim// The LLVM Compiler Infrastructure 5287518Sdim// 6287518Sdim// This file is dual licensed under the MIT and the University of Illinois Open 7287518Sdim// Source Licenses. See LICENSE.TXT for details. 8287518Sdim// 9287518Sdim//===----------------------------------------------------------------------===// 10287518Sdim 11287518Sdim#ifndef _LIBCPP_EXPERIMENTAL_TUPLE 12287518Sdim#define _LIBCPP_EXPERIMENTAL_TUPLE 13287518Sdim 14287518Sdim/* 15287518Sdim experimental/tuple synopsis 16287518Sdim 17287518Sdim// C++1y 18287518Sdim 19287518Sdim#include <tuple> 20287518Sdim 21287518Sdimnamespace std { 22287518Sdimnamespace experimental { 23287518Sdiminline namespace fundamentals_v1 { 24287518Sdim 25287518Sdim // See C++14 20.4.2.5, tuple helper classes 26287518Sdim template <class T> constexpr size_t tuple_size_v 27287518Sdim = tuple_size<T>::value; 28287518Sdim 29287518Sdim // 3.2.2, Calling a function with a tuple of arguments 30287518Sdim template <class F, class Tuple> 31287518Sdim constexpr decltype(auto) apply(F&& f, Tuple&& t); 32287518Sdim 33287518Sdim} // namespace fundamentals_v1 34287518Sdim} // namespace experimental 35287518Sdim} // namespace std 36287518Sdim 37287518Sdim */ 38287518Sdim 39287518Sdim# include <experimental/__config> 40287518Sdim 41287518Sdim#if _LIBCPP_STD_VER > 11 42287518Sdim 43287518Sdim# include <tuple> 44287518Sdim# include <utility> 45287518Sdim# include <__functional_base> 46287518Sdim 47287518Sdim#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) 48287518Sdim#pragma GCC system_header 49287518Sdim#endif 50287518Sdim 51287518Sdim_LIBCPP_BEGIN_NAMESPACE_LFTS 52287518Sdim 53287518Sdim#ifndef _LIBCPP_HAS_NO_VARIABLE_TEMPLATES 54287518Sdimtemplate <class _Tp> 55287518Sdim_LIBCPP_CONSTEXPR size_t tuple_size_v = tuple_size<_Tp>::value; 56287518Sdim#endif 57287518Sdim 58287518Sdimtemplate <class _Fn, class _Tuple, size_t ..._Id> 59287518Sdiminline _LIBCPP_INLINE_VISIBILITY 60287518Sdimdecltype(auto) __apply_tuple_impl(_Fn && __f, _Tuple && __t, 61287518Sdim integer_sequence<size_t, _Id...>) { 62287518Sdim return _VSTD::__invoke( 63287518Sdim _VSTD::forward<_Fn>(__f), 64287518Sdim _VSTD::get<_Id>(_VSTD::forward<_Tuple>(__t))... 65287518Sdim ); 66287518Sdim} 67287518Sdim 68287518Sdimtemplate <class _Fn, class _Tuple> 69287518Sdiminline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 70287518Sdimdecltype(auto) apply(_Fn && __f, _Tuple && __t) { 71287518Sdim return _VSTD_LFTS::__apply_tuple_impl( 72287518Sdim _VSTD::forward<_Fn>(__f), _VSTD::forward<_Tuple>(__t), 73287518Sdim make_index_sequence<tuple_size<typename decay<_Tuple>::type>::value>() 74287518Sdim ); 75287518Sdim} 76287518Sdim 77287518Sdim_LIBCPP_END_NAMESPACE_LFTS 78287518Sdim 79287518Sdim#endif /* _LIBCPP_STD_VER > 11 */ 80287518Sdim 81287518Sdim#endif /* _LIBCPP_EXPERIMENTAL_TUPLE */ 82