This is an archive of the discontinued LLVM Phabricator instance.

[libcxx] Add <experimental/tuple> header for LFTS.
ClosedPublic

Authored by EricWF on Jul 15 2014, 12:03 AM.

Details

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.

Diff Detail

Event Timeline

EricWF updated this revision to Diff 11419.Jul 15 2014, 12:03 AM
EricWF retitled this revision from to [libcxx] Add <experimental/tuple> header for LFTS..
EricWF updated this object.
EricWF edited the test plan for this revision. (Show Details)
EricWF added a reviewer: mclow.lists.
EricWF set the repository for this revision to rL LLVM.
EricWF added a subscriber: Unknown Object (MLST).
EricWF updated this revision to Diff 14368.Oct 2 2014, 9:55 PM

I changed apply to not depend on decltype(auto) at all and to just use a macro to put decltype(<function-body>) as the trailing return type.

mclow.lists added inline comments.Mar 17 2015, 10:56 AM
include/experimental/tuple
52

cppreference.com says:

a value of at least `201402` indicates that the tuple apply() function is supported
EricWF updated this revision to Diff 22106.Mar 17 2015, 11:13 AM
EricWF updated this object.
  1. Remove feature check macro.
  2. Move to decltype auto and remove the macro.
mclow.lists accepted this revision.Mar 17 2015, 11:26 AM
mclow.lists edited edge metadata.

LGTM

This revision is now accepted and ready to land.Mar 17 2015, 11:26 AM
EricWF closed this revision.Mar 17 2015, 11:30 AM