Boost logo

Boost Users :

Subject: Re: [Boost-users] Bind questions
From: John Dlugosz (JDlugosz_at_[hidden])
Date: 2010-06-07 15:29:41


What does AMDG mean?

Ah, so the return from bind is not the same kind of thing as class function. Bind knows the signature of what it's remembering, and operator(), itself a template, passes the arguments through and the compiler knows the type of everything. The "work" is done by the specialization of operator().

Meanwhile, the std::function object is declared with a specific signature, has an operator() that's not a template but takes just that, and what it points to inside is known to be that same type.
So... the initialization of the function instance picks wants a matching operator() on the bind result object, so it specializes that one, same as it would if calling it with those actual argument types exactly. The "work" is still done by the specialization so chosen.


> function<void(int, int, int, int)> stores any function object that can
> be called with four ints. The function object returned by bind()
> is called with those arguments, and may ignore some of them.
> The signature is necessary for boost::function, because boost::function
> is monomorphic. The bind function objects are polymorphic and
> try to adapt to whatever is thrown at them.

So, f= bind(whatever);
will have f remember the bind result object (whatever that is) and its member operator()(int,int,int,int). And to clarify, f doesn't take extra arguments past those four, that is a property of the bind object.

I think I got it now.

--John







TradeStation Group, Inc. is a publicly-traded holding company (NASDAQ GS: TRAD) of three operating subsidiaries, TradeStation Securities, Inc. (Member NYSE, FINRA, SIPC and NFA), TradeStation Technologies, Inc., a trading software and subscription company, and TradeStation Europe Limited, a United Kingdom, FSA-authorized introducing brokerage firm. None of these companies provides trading or investment advice, recommendations or endorsements of any kind. The information transmitted is intended only for the person or entity to which it is addressed and may contain confidential and/or privileged material. Any review, retransmission, dissemination or other use of, or taking of any action in reliance upon, this information by persons or entities other than the intended recipient is prohibited. If you received this in error, please contact the sender and delete the material from any computer.


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