darling-libcxx/include
Eric Fiselier 13858ee056 [libcxx] Add <experimental/tuple> header for LFTS.
Summary:
This patch adds the `<experimental/tuple>` header (almost) as specified in the latest draft of the library fundamentals TS.

The main changes in this patch are:

1. Added variable template `tuple_size_v`
2. Added function `apply(Func &&, Tuple &&)`.
3. Changed `__invoke` to be `_LIBCPP_CONSTEXPR_AFTER_CXX11`.

The `apply(...)` implementation uses `__invoke` to invoke the given function. `__invoke` already provides the required functionality. Using `__invoke` also allows `apply` to be used on pointers to member function/objects as an extension. In order to facilitate this `__invoke` has to be marked `constexpr`. 



Test Plan:
Each new feature was tested. 

The test cases for `tuple_size_v` are as follows:
1. tuple_size_v.pass.cpp
  - Check `tuple_size_v` on cv qualified tuples, pairs and arrays.
2. tuple_size_v.fail.cpp
  - Test on reference type.
3. tuple_size_v_2.fail.cpp
  - Test on non-tuple
4. tuple_size_v_3.fail.cpp
  - Test on pointer type.

The test cases for tuple.apply are as follows:

1. arg_type.pass.cpp
   - Ensure that ref/pointer/cv qualified types are properly passed.
2. constexpr_types.pass.cpp
   - Ensure constexpr evaluation of apply is possible for `tuple` and `pair`.
3. extended_types.pass.cpp
   - Test apply on function types permitted by extension.
4. large_arity.pass.cpp
   - Test that apply can evaluated on tuples and arrays with large sizes.
5. ref_qualifiers.pass.cpp
   - Test that apply respects ref qualified functions.
6. return_type.pass.cpp
   - Test that apply returns the proper type.
7. types.pass.cpp
   - Test apply on function types as required by LFTS.

Reviewers: mclow.lists

Reviewed By: mclow.lists

Subscribers: cfe-commits

Differential Revision: http://reviews.llvm.org/D4512

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@232515 91177308-0d34-0410-b5e6-96231b3b80d8
2015-03-17 18:28:14 +00:00
..
experimental [libcxx] Add <experimental/tuple> header for LFTS. 2015-03-17 18:28:14 +00:00
ext Do not derive __gnu_cxx::hash<T> from std::hash<T>. 2014-03-06 04:11:10 +00:00
support cmath: account for MSVCRT 12.0 changes 2015-02-28 20:18:39 +00:00
__bit_reference Get tests running with warnings. Fix warnings in headers and tests 2015-02-05 20:28:37 +00:00
__config Define a new macro: _LIBCPP_HAS_NO_VARIABLE_TEMPLATES and use it. No functionality change. 2015-03-17 15:30:22 +00:00
__debug Print log/error messages on stderr, not stdout 2015-03-10 07:57:43 +00:00
__functional_03 [libcxx] Fix PR 22468 - std::function<void()> does not accept non-void-returning functions 2015-02-10 16:48:45 +00:00
__functional_base [libcxx] Add <experimental/tuple> header for LFTS. 2015-03-17 18:28:14 +00:00
__functional_base_03 [libcxx] Fix PR 22468 - std::function<void()> does not accept non-void-returning functions 2015-02-10 16:48:45 +00:00
__hash_table Remove several unused forward declarations. Fixes PR22605. 2015-02-18 19:28:35 +00:00
__locale Fix ctype_byname<wchar_t>::do_is() mask checking.... again 2015-03-11 17:00:28 +00:00
__mutex_base Allow libc++ to be built on systems without POSIX threads 2014-09-05 19:45:05 +00:00
__refstring Fix some -Wundef issues. 2015-02-05 02:34:59 +00:00
__split_buffer
__sso_allocator Handle function name conflicts in _LIBCPP_MSVCRT mode 2015-02-13 22:15:32 +00:00
__std_stream
__tree Fix another -Wunused-local-typedef warning in include/__tree. 2015-03-09 21:39:02 +00:00
__tuple [libcxx] Move tuple_size and tuple_element overloads for pair and array out of !defined(_LIBCPP_HAS_NO_VARIADICS) block. 2015-03-17 15:08:03 +00:00
__undef___deallocate Handle function name conflicts in _LIBCPP_MSVCRT mode 2015-02-13 22:15:32 +00:00
__undef_min_max
algorithm Fix PR 22541: When values are equal, minmax should return the rightmost one in the initializer_list 2015-02-11 15:41:34 +00:00
array [libcxx] Move tuple_size and tuple_element overloads for pair and array out of !defined(_LIBCPP_HAS_NO_VARIADICS) block. 2015-03-17 15:08:03 +00:00
atomic Change a couple more template parameter names from 'T' to '_Tp', etc. Thanks to Ondřej Majerech for the patch, but I did a bit more. 2015-01-11 06:15:59 +00:00
bitset Make locales (and transitively, std::endl) work reliably with gcc. 2014-06-04 15:46:56 +00:00
cassert
ccomplex
cctype cctype: tweak inclusions for _LIBCPP_MSVCRT case 2015-02-13 22:15:28 +00:00
cerrno
cfenv
cfloat
chrono Partially address a FIXME in steady_clock::now() 2014-09-02 21:14:38 +00:00
cinttypes Make *abs() and *div() work on CloudABI. 2015-03-16 14:27:44 +00:00
ciso646
climits
clocale
CMakeLists.txt Add option to turn off installation of headers. 2014-12-12 22:52:58 +00:00
cmath cmath: account for MSVCRT 12.0 changes 2015-02-28 20:18:39 +00:00
codecvt
complex
complex.h
condition_variable Allow libc++ to be built on systems without POSIX threads 2014-09-05 19:45:05 +00:00
csetjmp
csignal
cstdarg
cstdbool
cstddef Update cstddef after clang r207606. 2014-05-16 01:45:02 +00:00
cstdint
cstdio Add option to disable access to the global filesystem namespace. 2015-03-12 15:44:39 +00:00
cstdlib Make *abs() and *div() work on CloudABI. 2015-03-16 14:27:44 +00:00
cstring
ctgmath
ctime
cwchar
cwctype
deque Fix an exception-safety bug in <deque>. Reference: PR#22650. Not closing the bug because there's more work to do here 2015-03-09 17:08:51 +00:00
exception Fix a problem when calling throw_with_nested with a class marked 'final'. Thanks to STL @ Microsoft for the bug report. 2015-03-16 15:10:28 +00:00
forward_list Move the default template arguments into the forward declarations for the containers: deque, forwardlist and list. References PR#22605. 2015-02-18 17:24:08 +00:00
fstream Add option to disable access to the global filesystem namespace. 2015-03-12 15:44:39 +00:00
functional Add trailing return types (and noexcept specifications) to the 'diamond operators'. Fixes PR#22600. 2015-02-25 12:20:52 +00:00
future Remove use of _[A-Z] identifiers and poison them to detect usage 2015-02-05 23:01:40 +00:00
initializer_list
iomanip Implement LWG #2344: quoted()'s interaction with padding is unclear. I think that anyone using quoted with padding is really confused, but it should work the way the rest of iostreams works. 2014-03-07 21:45:32 +00:00
ios Address some post-commit review comments on r217261 2014-09-05 20:28:44 +00:00
iosfwd Revert: Revert r227804: Use fseek/ftell instead of fseeko/ftello when Newlib is the libc 2015-02-03 15:34:17 +00:00
iostream
istream K-ballo pointed out *another* mistype in my change 2014-09-17 01:58:15 +00:00
iterator Rework reverse_iterator::operator[] so as not to use the base iterators operator [], which can cause constness problems. Fixes PR17883 2015-03-05 16:07:37 +00:00
limits libc++: integral types trap on PNaCl 2014-11-26 17:51:58 +00:00
list Move the default template arguments into the forward declarations for the containers: deque, forwardlist and list. References PR#22605. 2015-02-18 17:24:08 +00:00
locale Disable cat*() on CloudABI. Also make tiny cleanups. 2015-03-11 16:39:36 +00:00
map Allow declaration of map and multimap iterator with incomplete mapped type. Patch from eugenis 2015-03-03 20:10:01 +00:00
memory Handle function name conflicts in _LIBCPP_MSVCRT mode 2015-02-13 22:15:32 +00:00
module.modulemap Handle function name conflicts in _LIBCPP_MSVCRT mode 2015-02-13 22:15:32 +00:00
mutex Explicitly include <sched.h> for sched_yield() 2014-12-08 14:50:21 +00:00
new More on adding sized deallocation functions in libc++: Continuing from r229281, this adds version guards and test cases. 2015-02-20 06:13:05 +00:00
numeric [libcxx] Fix use of operator comma where the types can be user defined 2014-10-27 19:28:20 +00:00
ostream K-ballo pointed out *another* mistype in my change 2014-09-17 01:58:15 +00:00
queue Move the default template arguments into the forward declarations for the container adapters: stack and queue. References PR#22605. 2015-02-18 17:51:56 +00:00
random Add support for arc4random() to random_device. 2015-03-10 07:46:06 +00:00
ratio
regex Fix for PR22061 by K-ballo 2015-01-28 22:22:35 +00:00
scoped_allocator
set Fix bug 20740 - std::set/std::map don't support heterogeneous lookup for count(). Thanks to Jim Porter for the bug report 2014-08-24 23:54:16 +00:00
shared_mutex Allow libc++ to be built on systems without POSIX threads 2014-09-05 19:45:05 +00:00
sstream Fix a bug in the move-assigment operator for basic_stringbuf. Thanks to Johnathan Wakeley for the bug report 2014-09-16 18:57:52 +00:00
stack Move the default template arguments into the forward declarations for the container adapters: stack and queue. References PR#22605. 2015-02-18 17:51:56 +00:00
stdexcept Fix unused private field warning in stdexcept after r207695. 2015-02-05 07:40:48 +00:00
streambuf Make basic_streambuf::xsputn write characters in chunks whenever possible, instead of one at a time. References PR#10193 2015-02-19 16:17:46 +00:00
string Rooting out more undefined behavior in char_traits. 2015-02-13 16:04:42 +00:00
strstream
system_error
tgmath.h
thread Explicitly include <sched.h> for sched_yield() 2014-12-08 14:50:21 +00:00
tuple [libc++] Try and prevent evaluation of is_default_constructible on tuples default constructor if it is not needed. 2015-02-21 02:30:41 +00:00
type_traits [libcxx] Add <experimental/tuple> header for LFTS. 2015-03-17 18:28:14 +00:00
typeindex
typeinfo RTTI Uniqueness: remove __name_for_load function. 2014-04-03 09:12:38 +00:00
unordered_map NFC. Move definition of _LIBCPP_ASSERT into __debug header and remove external include guards. 2014-08-10 23:53:08 +00:00
unordered_set NFC. Move definition of _LIBCPP_ASSERT into __debug header and remove external include guards. 2014-08-10 23:53:08 +00:00
utility [libcxx] Move tuple_size and tuple_element overloads for pair and array out of !defined(_LIBCPP_HAS_NO_VARIADICS) block. 2015-03-17 15:08:03 +00:00
valarray Handle function name conflicts in _LIBCPP_MSVCRT mode 2015-02-13 22:15:32 +00:00
vector [libcxx] Fix __RAII_IncreaseAnnotator for increases >= 1 2015-03-10 00:25:20 +00:00