[libcxx] Add <experimental/tuple> header for LFTS.
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:
- Added variable template tuple_size_v
- Added function apply(Func &&, Tuple &&).
- 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.
Each new feature was tested.
The test cases for tuple_size_v are as follows:
- Check tuple_size_v on cv qualified tuples, pairs and arrays.
- Test on reference type.
- Test on non-tuple
- Test on pointer type.
The test cases for tuple.apply are as follows:
- Ensure that ref/pointer/cv qualified types are properly passed.
- Ensure constexpr evaluation of apply is possible for tuple and pair.
- Test apply on function types permitted by extension.
- Test that apply can evaluated on tuples and arrays with large sizes.
- Test that apply respects ref qualified functions.
- Test that apply returns the proper type.
- Test apply on function types as required by LFTS.
Reviewed By: mclow.lists
Differential Revision: http://reviews.llvm.org/D4512