i dunno the significance of the following code , look at the following...code
#include <ystdex/container.hpp> // the question is that i can't find the file in my Xcode (the version of IDE: 4.6.1) and i dunno the significance of the Header file ...
std::string _Str(" 123ddfg56"); //create the global variable
ystdex::erase_all_if(s, static_cast<int(&)(int)>(std::isdigit));// i dunno the significance of int(&) int and std::isdigit
Its cryptic and whoever made it probrably doesnt know what it does, just bad api design when the function name doesn't imply anything what the function does and there are unnecessary" _" prefixes. You should look up what std::remove_if does, it must be some condition. Sorry I don't know. std::isdigit is used wrong since it is a function"()" without being properly called. It evaluates if a character is numerical "0-9" digit.
noooooo!! the afore code was to erase the digital in object _Str ,but i dunno the significance of "ystdex/container.hpp" header file ,the key question that i can't find the .hpp
ystdex::erase_all_if(s, static_cast<int(&)(int)>(std::isdigit));// i dunno the significance of int(&) int and std::isdigit
It's a disambiguating cast. There are two kinds of std::isdigit in the C++ standard library, one that takes an int and returns an int, another one that takes any char type and a locale and returns a bool.
Normally, when you put a name of a function in an expression like that, the compiler would create a pointer to it and pass that pointer as the argument to erase_all_if, but since the name std::isdigit stands for more than one function, it doesn't know whose address you want. The cast is one of the possible ways to resolve this ambiguity.