title: Lambda Expression for find_if
body: <p>I am currently trying to find an element in vector V. 
  but i get a lot of errors.   </p>
  
  <p>bool VNS::remove(const HostName&amp; name){
        ^
  In file included from /usr/lib/gcc/x86_64-pc-cygwin/4.8.2/include/c++/algorithm:62:0,
                   from vns.cc:2:.....</p>
  
  <pre><code> bool VNS::remove(const HostName&amp; name){
          auto it=find_if(v.begin(),v.end(),[](const HostName&amp; a, const HostName&amp; b){return a==b;});
          //code that will remove the elem.
          if(it!=v.end()){
              return true;
          }else{
              return false;
          }
      }
  HeaderFile:
  class VNS:public NameServerInterface{
      public:
          /*
           * Insert a name/address pair. Does not check if the name
           * or address already exists.
           */
          virtual void insert(const HostName&amp;, const IPAddress&amp;);
  
          /*
           * Remove the pair with the specified host name. Returns true
           * if the host name existed and the pair was removed, false
           * otherwise.
           */
          virtual bool remove(const HostName&amp;);
  
          /*
           * Find the IP address for the specified host name. Returns
           * NON_EXISTING_ADDRESS if the host name wasn't in the name
           * server.
           */
          virtual IPAddress lookup(const HostName&amp;) const;
  
      private:
          std::vector&lt;std::pair&lt;HostName,IPAddress&gt; &gt; v;
  };
  </code></pre>
  
  <p>Interface:</p>
  
  <pre><code>/*
   * Interface NameServerInterface -- all name server implementations must
   * implement this interface.
   */
  #ifndef NAME_SERVER_INTERFACE_H
  #define NAME_SERVER_INTERFACE_H
  
  #include &lt;string&gt;
  
  using HostName = std::string;
  using IPAddress = unsigned int;
  const IPAddress NON_EXISTING_ADDRESS = 0;
  
  class NameServerInterface {
  public:
      virtual ~NameServerInterface() = default;
  
      /*
       * Insert a name/address pair. Does not check if the name
       * or address already exists.
       */
      virtual void insert(const HostName&amp;, const IPAddress&amp;) = 0;
  
      /*
       * Remove the pair with the specified host name. Returns true
       * if the host name existed and the pair was removed, false
       * otherwise.
       */
      virtual bool remove(const HostName&amp;) = 0;
  
      /*
       * Find the IP address for the specified host name. Returns
       * NON_EXISTING_ADDRESS if the host name wasn't in the name
       * server.
       */
      virtual IPAddress lookup(const HostName&amp;) const = 0;
  };
  
  #endif
  </code></pre>
  
  <p>My lambda exp has two parameters. How will the compiler know how it should replace them with correct values.</p>