-1
void f(int, const int (&)[2] = {})    { }   // #1

void f(const int&, const int (&)[1])  { }   // #2

In those function overloads but what exactly are the second parameters.

My guess is,

#1 any empty array #2 Returns the reference of the first index of an array

user17732522
  • 53,019
  • 2
  • 56
  • 105
jomegaA
  • 131
  • 6

1 Answers1

2

Both are references to arrays of the written type and size.

For example const int (&)[2] is a const lvalue reference to an array of 2 int (or equivalently a lvalue reference to an array of 2 const int).

The first one has a default argument which would create a temporary array of the given type to which the reference binds if no argument is provided in a call. That temporary array would be initialized as if by a = {} initializer. (In the case of type int this means the elements are zero-initialized.)

user17732522
  • 53,019
  • 2
  • 56
  • 105