llvm-project/libcxx/include/experimental
Eric Fiselier ea10d2477a [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

llvm-svn: 232515
2015-03-17 18:28:14 +00:00
..
__config Add pragma system header to some experimental headers and add newlines to files. 2015-02-10 17:32:49 +00:00
chrono Define a new macro: _LIBCPP_HAS_NO_VARIABLE_TEMPLATES and use it. No functionality change. 2015-03-17 15:30:22 +00:00
dynarray Handle function name conflicts in _LIBCPP_MSVCRT mode 2015-02-13 22:15:32 +00:00
optional Add all the relational operators to std::experimental::optional. Also update bad_optional_access to match the Library Fundamentals draft standard. This is not all of the upcoming changes to optional, though. 2014-12-09 14:49:17 +00:00
ratio Define a new macro: _LIBCPP_HAS_NO_VARIABLE_TEMPLATES and use it. No functionality change. 2015-03-17 15:30:22 +00:00
string_view Change string_view::at to make it work with gcc and VC++. Thanks to K-ballo for the bug report, and Jonathan Wakeley for the code review in the bar. 2015-02-23 21:12:02 +00:00
system_error Define a new macro: _LIBCPP_HAS_NO_VARIABLE_TEMPLATES and use it. No functionality change. 2015-03-17 15:30:22 +00:00
tuple [libcxx] Add <experimental/tuple> header for LFTS. 2015-03-17 18:28:14 +00:00
type_traits Define a new macro: _LIBCPP_HAS_NO_VARIABLE_TEMPLATES and use it. No functionality change. 2015-03-17 15:30:22 +00:00
utility Add pragma system header to some experimental headers and add newlines to files. 2015-02-10 17:32:49 +00:00