Actually, this is not entirely accurate. Limitations:
8.3.6 Default Arguments [dcl.fct.default]
7) Local variables should not be used in the default argument. [Example:
void f() { int i; extern void g(int x = i);
-end example]
8) The this should not be used in the default argument for a member function. [Example:
class A { void f(A* p = this) { }
So, this and local variables cannot be used as default values.
For example, the following is valid:
int a = 1; int f(int); int g(int x = f(a));
g will be called with a value of f(2) , which is not a compile-time constant. This is an example directly from the standard.
Reasons like him are common: either there was no offer for him, or it was rejected, it was considered not necessary or too difficult to implement.
source share