fork download
  1. #include <utility>
  2. #include <type_traits>
  3. #include <cstdint>
  4.  
  5. struct strict_uint64_t
  6. {
  7. public:
  8. template <typename ArgT, typename Check = typename std::enable_if<std::is_same<ArgT, uint64_t>::value>::type >
  9. strict_uint64_t(ArgT arg)
  10. : value(arg)
  11. { }
  12.  
  13. operator uint64_t() const
  14. {
  15. return value;
  16. }
  17.  
  18. private:
  19. uint64_t value;
  20. };
  21.  
  22. int main() {
  23. //strict_uint64_t a = 2LL; //error
  24. //strict_uint64_t b = 2; //error
  25. strict_uint64_t c = 2ULL;
  26. return 0;
  27. }
Success #stdin #stdout 0s 3292KB
stdin
Standard input is empty
stdout
Standard output is empty