c++11 - What does this "return ~Result(0)" mean in C++? -
i have never seen before... curious know "return ~result(0)" does.
simple::result screen::pickpoint(const point& point) const { if(scnr.haspoint()) return scnr.getindex(); else return ~result(0); }
assuming simple::result has overloaded bitwise not operator (~). call overloaded operator in simple::result class , return result.
if ~ operator performs bitwise not operation, function should return simple::result 1s (in binary) when scnr.haspoint returns false.
you can read more bitwise not operator here.
Comments
Post a Comment