fork download
  1. #include <iostream>
  2.  
  3. template<typename To, typename From>
  4. union Reinterpret_Cast
  5. {
  6. Reinterpret_Cast(From f) : f(f)
  7. {
  8. }
  9. operator To()
  10. {
  11. return t;
  12. }
  13. private:
  14. From f;
  15. To t;
  16. };
  17.  
  18. int main()
  19. {
  20. double d = 0.1;
  21. unsigned long long n = Reinterpret_Cast<unsigned long long, double>(d);
  22. std::cout << n << std::endl;
  23. }
Success #stdin #stdout 0s 2896KB
stdin
Standard input is empty
stdout
4591870180066957722