This declaration:
static std::vector<int> race(int v1, int v2, int v3);
declares race
to be a static
member function that takes 3 int
parameters and returns a std::vector<int>
.
When you write race[0]
the function race
decays to a function pointer, and then you're indexing into that. The compiler is warning you that this never makes sense, which is true.
Note that you're only getting a warning instead of an error because you're presumably compiling the code with GCC, which accepts this code as an extension. As far as the language is concerned, this is not allowed, and is an error.
Also, the compiler is not referring to v1
, v2
, and v3
as functions, it's only referring to race
as a function, which is also true.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…