は私がWandboxに以下のコードを試してみました:std :: applyおよびconstant expression?
#include <array>
#include <iostream>
#include <tuple>
#include <typeinfo>
#include <functional>
#include <utility>
int main()
{
constexpr std::array<const char, 10> str{"123456789"};
constexpr auto foo = std::apply([](auto... args) constexpr { std::integer_sequence<char, args...>{}; } , str);
std::cout << typeid(foo).name();
}
とコンパイラがargs...
は定数式ではないことを教えてくれました。 どうしたの?
、あなたがconstexprの関数のパラメータを持つことができません。つまり、すべての関数はランタイムパラメータで呼び出すことができると想定しなければならず、ラムダは意味をなさない。 – krzaq
@krzaqどういう残念... – Cu2S