SHARE
TWEET

Untitled

a guest Mar 15th, 2012 140 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. template <typename T>   //Special template for EE_PDUs, which are weird
  2.     auto getKey_imp(const T &struc, int &key, int) -> decltype(struc.interesting_member, void())   //If struc has an interesting_member member, this version is used
  3.     {
  4.         key = 0;
  5.     }
  6.     template <typename T>
  7.     void getKey_imp(const T &struc, int &key, long)   //struc didn't have an interesting_member member, do nothing
  8.     {
  9.     }
  10.  
  11. public:
  12.     template <typename T>
  13.     bool getKey(const T &struc, int &key)
  14.     {
  15.         getKey_imp(struc, key, 0);
  16.         return key == 0;        //Successful?
  17.     }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top