struct Test
{
static const int value = []() -> int { return 0; }();
};
使用gcc-4.6,我得到類似error: function needs to be constexpr的東西。我嘗試了多種組合,在各個地方放constexpr,但沒有運氣。 是否支持lambda函數constexpr(不管return類型
我知道sizeof...(Args...)產生的C++ 0x被壓縮的模板參數列表中的類型數量,但我想實現它用於演示目的的其他功能,但它不會編譯。 // This is not a solution -- overload ambiguity.
// template <typename... Args> size_t num_args(); // Line 7
// template <>