Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Apr 28th, 2012  |  syntax: C++  |  size: 0.40 KB  |  hits: 23  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1.   bool matches(char ca) {
  2.     switch(T) {
  3.     case Lit: return c == ca;
  4.     case Opt: return (set & (1 << (ca - 'a'))) != 0;
  5.     }
  6.   }
  7.  
  8.  
  9.  
  10. replacing THIS
  11.   //  if(!M[i].matches(word[i])) return false;
  12.  
  13. manual inlining HERE
  14.  
  15.     Match &ma = M[i];
  16.     switch(ma.T) {
  17.     case Lit: if(ma.c != word[i]) return false;
  18.     case Opt: if(!((ma.set & (1 << (word[i] - 'a'))) != 0)) return false;
  19.     }