【发布时间】:2017-03-15 00:50:29
【问题描述】:
以下代码无法编译:
struct object
{
static constexpr auto f;
};
constexpr auto object::f = [](auto&& x){x += 1;};
没有这个:
struct object
{
static constexpr auto f = [](auto&& x){x += 1;};
};
但确实如此(当f 不是成员时):
static constexpr auto f = [](auto&& x){x += 1;};
有没有办法在 C++14 中声明和定义静态 constexpr 数据成员 lambda?
【问题讨论】:
标签: c++ lambda static c++14 data-members