Category : name-lookup

The draft C++20 standard N4861 sect. 6.5.1(7) reads: A name used in the definition of a class X outside of a complete-class context of X shall be declared … before its use in class X or be a member of a base class of X…. So why does the following compile? #include <iostream> struct X ..

Read more

Actually this code works fine in "DEV C++", but when I put it into my "Hacker-Rank" panel it gives this error "reference to function is ambiguous", although all the online compilers are giving errors… I don’t think here function overloading is somewhere interrupting, because this error mostly comes in function overloading. #include <bits/stdc++.h> #include <cstdio> ..

Read more

All standard references below refer to N4659: March 2017 post-Kona working draft/C++17 DIS. A function declared as a friend can also be defined at the friend declaration as follows: #include <iostream> namespace a { struct A { // Definition of ‘a::foo()’ friend void foo() { std::cout << __PRETTY_FUNCTION__; } }; } // namespace a Such ..

Read more