title: Passing const class object to std::function and std::bind lead compilation error
body: <p>When <strong>const</strong> <strong>Serviceclass</strong> used in <strong>std::function</strong> leads to compilation error.
  If remove <strong>const</strong> the complication is successful.</p>
  
  <p><strong>Code Flow</strong> <strong>:</strong> Client::GetValue() is called which calls on <strong>Server::datalist()</strong></p>
  
  <p><strong>QUESTION :</strong> Why can't i use <strong>const</strong> on <strong>Serviceclass</strong> ?</p>
  
  <p><strong>SERVER SIDE</strong></p>
  
  <pre><code>     //                                      vvvvv (if const remove then compliation success.)
        typedef std::function&lt;void(int, Status, const Serviceclass&amp;)&gt;
          Callback;
          //SECOND INVOKED
          void Server::datalist(int Id, sessionId,Callback callback) {
          std::unique_ptr&lt;Serviceclass&gt; ServiceObj = Serviceclass::create();
          callback(request_id, RESULT,*ServiceObj.get());
          }
  
         typedef std::vector&lt;std::string&gt; dataList;
  
         typedef std::function&lt;void(int, Status, const dataList&amp;)&gt;callback_data;
         //FOURTH INVOKED
         void Server::getdata(int Id,callback_data){
          // callback called with datalist
         }
  </code></pre>
  
  <p><strong>CLIENT SIDE</strong></p>
  
  <pre><code>  //FIFTH INVOKE
   void Client::Foo(int Id,Status,const dataList&amp; data){
      //impl
     }
  
  
   //THIRD INVOKED
  void Client::Boo(int Id, 
                  Status,
                  const Serviceclass&amp; Serviceclass){
    //            ^^^^^ (if const remove then compliation success.)
               Serviceclass.getdata(123,
                  std::bind(&amp;Client::Foo, this, std::placeholders::_1,
                            std::placeholders::_2, std::placeholders::_3));
  }
  
  //FIRST INVOKED
  void Client::GetValue() {
          int Id = 123; 
          serverobj-&gt;datalist(
                          Id, sessionId,
                          std::bind(&amp;Client::Boo, this, std::placeholders::_1,
                                  std::placeholders::_2, std::placeholders::_3));
  }
  </code></pre>
  
  <p><strong>ERROR</strong> </p>
  
  <pre><code>In member function 'void Client::Boo(int, Status, const Serviceclass&amp;)':
  mycode.cc:68:76: error: passing 'const Serviceclass&amp;' as 'this' argument discards qualifiers [-fpermissive]
                                 std::placeholders::_2, std::placeholders::_3));
  </code></pre>