Boost logo

Boost Users :

Subject: Re: [Boost-users] Passing * to member function as parameter
From: Igor R (boost.lists_at_[hidden])
Date: 2010-04-20 08:29:55


> How would I pass a pointer to a member function from the read request to the write handler to call when it performs the write.
> void handle_read_banner(
>   const boost::system::error_code& error,
>       std::size_t bytes_transferred
> ) {
>   if(!error) {
>           response_.consume(bytes_transferred);
>               boost::asio::async_write(socket_, request_,
>                   boost::bind(&asterisk::handle_write_request, this,
>                       boost::asio::placeholders::error
>       //, * to next read handler...
>       ));
>       }else{
>           throw(boost::system::system_error(error));
>       }
> }
>
> void handle_write_request(
>   const boost::system::error_code& error
>   //, memfunction func
> ) {
>   if (!error) {
>       boost::asio::async_read_until(socket_, response_, "\r\n",
>                   boost::bind(
>           //&asterisk::handle_read_login_attempt,
>           func
>           this,
>                       boost::asio::placeholders::error,
>                       boost::asio::placeholders::bytes_transferred));
>       }else{
>       throw(boost::system::system_error(error));
>       }
> }

Could you mention what line doesn't compile and error you get?


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net