Boost logo

Boost :

From: Christopher Kohlhoff (chris_at_[hidden])
Date: 2006-02-26 07:51:33


Hi Jeff,

--- Jeff Flinn <TriumphSprint2000_at_[hidden]> wrote:

> What is the rationale for boost::asio::placeholders::error and
> boost::asio::placeholders::bytes_transfered?

The named placeholders date from when some of the callback
handlers had arguments like "last_bytes_transferred" as well as
"total_bytes_transferred". Even though I wrote the functions, I
would forget the order of these parameters.

> I find this a foreign and confusing usage a boost::bind.
> Granted I jumped over the Tutorial explicitly introducing
> these, instead starting with the Tutorial DayTime.3 that
> addressed my interests. I see the familiar boost::bind, with
> the lack of _1, _2, so I'm thinking bind is generating a
> function of type void ()(). ... but handle_accept is expecting
> a boost::asio::error&???

That's why it's in a namespace called "placeholders" :) You
don't have to use the named placeholders if you don't want to,
but I find them a convenient aid in remembering and documenting
which arguments I'm expecting to go where.

Cheers,
Chris


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk