Advertisement
spacechase0

Untitled

Jul 11th, 2013
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.40 KB | None | 0 0
  1. class Compare
  2. {
  3.     public:
  4.         Compare( bool theVert, bool theDesc )
  5.            : vert( theVert ),
  6.              desc( theDesc )
  7.         {
  8.         }
  9.        
  10.         bool operator () ( Object* a, Object* b )
  11.         {
  12.             float n1 = a->x;
  13.             float n2 = b->x;
  14.            
  15.             if ( theVert )
  16.             {
  17.                 n1 = a->y;
  18.                 n2 = b->y;
  19.             }
  20.            
  21.             return ( desc ) ? ( n1 < n2 ) : ( n2 >= n1 );
  22.         }
  23.    
  24.     private:
  25.         const bool vert;
  26.         const bool desc;
  27. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement