Boost logo

Boost :

From: Jeff Flinn (TriumphSprint2000_at_[hidden])
Date: 2006-02-27 09:16:59


Christopher Kohlhoff wrote:
> 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.

Yes, I see that all now. For me personally seeing the '_n' in a boost bind
call is automatic now in recognizing the resultant function's expected args.
We don't use leading/trailing underscores in names by convention, so they
really standout.

Thanks, Jeff


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