Although the way code is written makes it possible, the definition of the class foo() in a class can only be processed after the class has been fully defined. It is as if you wrote this:
struct Foo { static auto foo(int bar); typedef std::result_of<decltype(Foo::foo)> foo_t; }; auto Foo::foo(int bar) { return 0; }
The definition of foo() allows the use of types defined in class Foo , including foo_t , which will be circular. Therefore, the definition of class Foo does not allow the use of the definition of its member functions - only their declarations.
In other words, you assume that the code is completely ranked top to bottom. This is not true.
source share