This is an archive of the discontinued LLVM Phabricator instance.

[libcxx] Add <experimental/tuple>
AbandonedPublic

Authored by EricWF on Feb 2 2015, 1:03 PM.

Details

Summary

This patch adds <experimental/tuple>. <experimental/tuple> contains tuple_size_v and apply(F&&, Tuple&&).

In order to implement apply the existing functionality of __invoke in <__functional_base> is used. In order for apply to be constexpr all of the existing __invoke overloads were marked as constexpr.

Because __invoke is used apply supports all function types specified in the INVOKE macro specification. This means apply has extended support for pointers to member functions and pointers to member objects. This extension is tested in libcxx/test/libcxx/experimental/utilities/tuple/tuple.apply/extended_types.pas.cpp.

Diff Detail

Event Timeline

EricWF updated this revision to Diff 19182.Feb 2 2015, 1:03 PM
EricWF retitled this revision from to [libcxx] Add <experimental/tuple>.
EricWF updated this object.
EricWF edited the test plan for this revision. (Show Details)
EricWF added a subscriber: Unknown Object (MLST).

LGW just moved an issue to define this is terms of INVOKE. So this implementation using invoke no longer an extension.

mclow.lists accepted this revision.Mar 17 2015, 8:38 AM
mclow.lists edited edge metadata.

This looks good to me.

include/experimental/tuple
54

I just added a new config macro: _LIBCPP_HAS_NO_VARIABLE_TEMPLATES
Please use that instead.

This revision is now accepted and ready to land.Mar 17 2015, 8:38 AM
EricWF updated this revision to Diff 22097.Mar 17 2015, 9:02 AM
EricWF edited edge metadata.
  1. Address @mclow.lists comments about _LIBCPP_HAS_NO_VARIABLE_TEMPLATES.
  2. Move some tests from test/libcxx to test/std because they no longer test extensions.
  3. Remove test for feature macro.
EricWF abandoned this revision.Mar 18 2015, 7:27 AM

I'm not quite sure what happened here but I somehow had two different code reviews out for the same thing. This was reviewed as D4512.