Is it a function?
Yes.
Arrays have a bit wonky syntax in the C syntax that C++ inherited. The square brackets go to the very end of the declaration. Here is a variable example:
element_type variable_name [array_size];
Pointers and references also have wonky syntax especially when combined with arrays. The following is simple:
// array of pointers
element_type * variable_name [array_size];
// array of references - this is not allowed
element_type & variable_name [array_size];
But what if we want a reference (or pointer) to an array? We add parentheses around the name and the punctuator to signify that the it applies to the variable rather than the array element:
// pointer to array
element_type (* variable_name) [array_size];
// reference to array
element_type (& variable_name) [array_size];
Now on to functions. Arrays cannot be returned, but you can return pointer or reference to an array. Just like in the case of variables, the square brackets go to the end of the declaration - all the way after the parameter list. And parentheses surround not only the punctuator and name but also the parameter list:
// function that returns pointer to array
element_type (* function_name (parameter_list)) [array_size];
// function that returns reference to array
element_type (& function_name (parameter_list)) [array_size];
I would recommend not writing functions like this, but instead to take advantage of type aliases to make it easier to read:
using Color3 = Color[3];
inline const Color3 & EnumValuesColor();
Or use the std::array
template:
inline const std::array<Color, 3> & EnumValuesColor();
Or std::span
:
inline std::span<const Color, 3> EnumValuesColor();
To actually understand how any C-like declaration works, you could teach yourself the Clockwise/Spiral Rule. Frankly, I wouldn't bother unless you intend to write a C or C++ parser. Not understanding unnecessarily complex declarations makes it easier to prevent yourself from writing unreadable declarations yourself.
If you encounter something that you don't understand, let a program parse it for your: https://github.com/ridiculousfish/cdecl-blocks