[PATCH] [libcxx] Create <__invoke> header that generates the __invoke and __invoke_constexpr functions.
Eric Fiselier
eric at efcs.ca
Tue May 12 17:25:49 PDT 2015
Hi mclow.lists, danalbert, jroelofs,
`std::experimental::apply` requires a constexpr implementation of `INVOKE(...)`. Simply marking the current implementation of `__invoke` as constexpr will break existing code due to CWG issue #1581. For this reason we should add a separate function called `__invoke_constexpr` to be used where constexpr is required.
To supply two almost identical `INVOKE(...)` we use the `<__invoke>` header to generate the declarations and definitions by defining the required macros and including the `<__invoke>` header inline. The `<__invoke>` header can be included multiple times.
The macros used are:
* `_LIBCPP_INVOKE_NAME`: The name of the invoke function to be created.
* `_LIBCPP_INVOKE_CONSTEXPR`: The optional `constexpr` decorator for the invoke function.
* `_LIBCPP_DECLARE_INVOKE`: Declare the required invoke function.
* `_LIBCPP_DEFINE_INVOKE`: Define the required invoke function.
I chose not to generate invoke functions using macros because of the amount of code that would have to be within a macro block. It also is likely to yield bad error messages.
This patch also re-enables constexpr support for `std::experimental::apply`.
http://reviews.llvm.org/D9730
Files:
include/__functional_base
include/__invoke
include/experimental/tuple
include/type_traits
test/std/experimental/utilities/tuple/tuple.apply/constexpr_types.pass.cpp
test/std/experimental/utilities/tuple/tuple.apply/ref_qualifiers.pass.cpp
EMAIL PREFERENCES
http://reviews.llvm.org/settings/panel/emailpreferences/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D9730.25651.patch
Type: text/x-patch
Size: 13026 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20150513/023eb1e0/attachment.bin>
More information about the cfe-commits
mailing list