我在 Wandbox 上尝试了以下代码:
#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...
不是常量表达式,这是为什么?