<分区>
我想知道如何明确返回数组引用的函数的返回类型。
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
,但我想知道它的语法。