Do not tell me wrong: boost is bound ()
great.
But I hate to write and read the code with it, and I have hoped that my colleagues never gave it a cough.
I end up with the code like this:
BT.N.Clock.Connect (Bind (and Betabar :: Place Beat, this, BT_ID)) ; Animator.echframe.connect (tie (and widget :: move, button [bet_id]);
Which is logical, far from the very best code.
To display ... In C ++ 1x, we will have:
btn.clicked.connect ([& amp;] (int bet_id) { PlaceBet (bet_id);}) animator.eachFrame.connect ([& amp;] (point newPos) {button [Bet_id] .move (newPos)})
and a good DSL It may look like:
at (btn.clicked) placeBet (bet_id); But (animator.echframe) button [bet_id] .move (eachFrame :: newPos);
How do you cope with bondage in C ++? Do you just live with what you promote?
It looks like you want the following:
- < Li> Built-in binding for
- An option for the bracket attached to the function call that stores the binding.
- Automatically identifying which parameters are bound in your lambda-expression.
The first is very difficult in C ++, because this
is contained in a few references, and you certainly do not pass the job mutually I.e. You can not get it with library function, but you can do it with a macro. Even then, it would be ugly.
The second part is quite simple:
button .clicked.handler = bind (BetBar :: placeBet, this, bet_id);
For this, just handler. Operator = (boost :: function & lt; void (*) () const & amp;)
The third is again difficult, because you are just two-step The second case to look at the name is made. It was quite difficult with templates to promote _1 moves to explain the move that the arguments should be bound later. However, according to the name of _1, magic is not basically returning a free function: ARGR & lt; 1> Therefore, with proper definition of animator. EEFFrame NEOPS can be done as:
animator.echframe.andler = tie (and widget :: move, button [bt_id], _1) Animator.eachFrame.handler = tie (and widget :: move, button [bet_id], animator.echframe.news)
Comments
Post a Comment