Exercise 14.33: How many operands may an overloaded function-call operator take?
这是我正在阅读的 C++ Primer 5th Edition 中的一个问题。
也来自本书:
An overloaded operator function has the same number of parameters as the operator has operands.(Section 14.1)
来自 another thread on SO :
— Parameters in one function definition [256].
— Arguments in one function call [256].
只是确认一下,256 是这个问题的答案吗?
最佳答案
不是真的。两者都可以至少有 256 个。
已在 Maximum number of parameters in function declaration 上讨论过.
The limits may constrain quantities that include those described below or others. The bracketed number following each quantity is recommended as the minimum for that quantity. However, these quantities are only guidelines and do not determine compliance.
— Parameters in one function definition [256].
— Arguments in one function call [256].
关于c++ - 一个重载的函数调用运算符可以有多少个操作数?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21211889/