【发布时间】:2014-09-29 21:33:35
【问题描述】:
我想知道如何明确返回数组引用的函数的返回类型。
typedef int const (Three_Const_Ints)[3];
Three_Const_Ints const & foo ()
{
static int const values[] = { 0, 1, 2 };
return values;
}
int const (&)[3] bar () // Does not compile. What is the proper syntax?
{
static int const values[] = { 0, 1, 2 };
return values;
}
是的,我可以使用std::array,但我很想知道这个语法。
【问题讨论】: