Explain why invoke is implemented with a macro (#368)

This commit is contained in:
Charlie Barto 2019-12-11 18:06:17 -08:00 коммит произвёл Stephan T. Lavavej
Родитель 07e032b3d3
Коммит 70e49a0156
1 изменённых файлов: 5 добавлений и 0 удалений

Просмотреть файл

@ -1476,6 +1476,11 @@ _NODISCARD constexpr conditional_t<!is_nothrow_move_constructible_v<_Ty> && is_c
template <class _Ty>
class reference_wrapper;
// std::invoke isn't constexpr in C++17, and implementers are forbidden from "strengthening" constexpr (WG21-N4842
// [constexpr.functions]/1), yet both std::apply and std::visit are required to be constexpr and have invoke-like
// behavior. We solve this by using a macro to stamp out both public non-constexpr and internal constexpr
// implementations. TRANSITION, P1065R2
#define _CONCATX(x, y) x##y
#define _CONCAT(x, y) _CONCATX(x, y)