fork download
  1. #include <iostream>
  2. #include <cmath>
  3. #include <type_traits>
  4. using namespace std;
  5.  
  6. class Dummy{
  7. private:
  8. double content;
  9. public:
  10. Dummy(double _content) :content{ _content } {};
  11. operator long int() { return (long int)content; };
  12. };
  13.  
  14. int main(){
  15. Dummy a = Dummy(1.1);
  16. double aa = fabs(static_cast<double>(a));
  17.  
  18. double (*fabs_ptr)(double) = fabs;
  19. fabs_ptr(a);
  20.  
  21. using fabs_ptr2 = double (*)(double);
  22. static_cast<fabs_ptr2>(fabs)(a);
  23.  
  24. return 0;
  25. }
Success #stdin #stdout 0.01s 5504KB
stdin
Standard input is empty
stdout
Standard output is empty