Advertisement
pushrbx

OperatorEqual Check

Feb 16th, 2013
123
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.41 KB | None | 0 0
  1. #pragma once
  2.  
  3. #ifndef _OPERATORCHECK_H_
  4. #define _OPERATORCHECK_H_
  5.  
  6. namespace OperatorCheck
  7. {
  8.     typedef char no[7];
  9.     template<typename T> no& operator == (const T&, const T&);
  10.  
  11.     template <typename T>
  12.     struct opEqualExists
  13.     {
  14.         enum { value = (sizeof(*new T[1] == *new T[1]) != sizeof(no)) };
  15.     };
  16. }
  17.  
  18. #define IsEqualOperatorExists(expr) (OperatorCheck::opEqualExists<expr>::value == 1 ? true : false)
  19.  
  20. #endif
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement