Advertisement
VisualPaul

C++ binary operations test

Dec 2nd, 2014
427
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.41 KB | None | 0 0
  1. #include <stdio.h>
  2. template <class T>
  3. struct test_obj {};
  4. template <>
  5. struct test_obj<signed int> {
  6.     const char *get() const {
  7.         return "int";
  8.     }
  9. };
  10.  
  11. template <>
  12. struct test_obj<unsigned int> {
  13.     const char *get() const {
  14.         return "unsigned int";
  15.     }
  16. };
  17.  
  18. template <typename T>
  19. test_obj<T> tst(T) {
  20.     return test_obj<T>();
  21. }
  22.  
  23. int main() {
  24.     puts(tst(1 << 31u).get());
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement