title: Declaring function objects for comparison?
body: <p>I have seen other people questions but found none that applied to what I'm trying to achieve here.</p>
  <p>I'm trying to sort Entities via my EntityManager class using std::sort and a <code>std::vector&lt;Entity *&gt;</code></p>
  <pre><code>/*Entity.h*/
  class Entity
  {
  public:
   float x,y;
  };
  
  struct compareByX{
   bool operator()(const GameEntity &amp;a, const GameEntity &amp;b)
   {
    return (a.x &lt; b.x);
   }
  };   
     
  /*Class EntityManager that uses  Entitiy*/
  
  typedef std::vector&lt;Entity *&gt; ENTITY_VECTOR; //Entity reference vector
     
  class EntityManager: public Entity
  {
  private:
   ENTITY_VECTOR managedEntities;
  
  public:
   void sortEntitiesX();
  };
  
  void EntityManager::sortEntitiesX()
  {
   
   /*perform sorting of the entitiesList by their X value*/
   compareByX comparer;
   
   std::sort(entityList.begin(), entityList.end(), comparer);
  }
  </code></pre>
  <p>I'm getting a dozen of errors like</p>
  <pre><code>: error: no match for call to '(compareByX) (GameEntity* const&amp;, GameEntity* const&amp;)'
  : note: candidates are: bool compareByX::operator()(const GameEntity&amp;, const GameEntity&amp;)
  </code></pre>
  <p>I'm not sure but ENTITY_VECTOR is <code>std::vector&lt;Entity *&gt;</code> , and I don't know if that could be the problem when using the compareByX function object ?</p>
  <p>I'm pretty new to C++, so any kind of help is welcome.</p>