Well, itโs actually misleading that the compiled example code. In truth, the kits are unusable . Each attempt to insert data into them creates an expected error.
What works the "dark side" of the C ++ template. They do not exist until you use them (and therefore will not create compiler errors until you do this).
Check it:
#include <set> class X {}; int main() { typedef void(X::*FuncPtr)(); std::set< FuncPtr > set; std::less< FuncPtr > less; FuncPtr f1; FuncPtr f2; //set.insert(f1); // both of these lines //less(f1,f2); // produce an error };
Removing comments on either of the last two lines results in an error:
invalid operands of types void (X :: * const) () and 'void (X :: * const) () in the binary' operator <
Compile it right here .
source share