c++ - How do you pass boost::bind objects to a function? -


I have at least one dimensional function right now I'm passing it function indicator though there are several criteria in many functions, Some of which are certain. I have used this kind of motif such as

  template & lt; Class T & gt; At least (T & amp; F) {} factor F (param 1, absolute 2); Minimize & lt; Functor & gt; (F); However, in the definition of the Factor many boards are Boost :: The dam looks cleaner so that I can:  
  Reduce (boost: bind) (F, _1, absolute 1, absolute 2))  

However, I am not clear whether my at least declaration boost :: Bind . What type of object is boost :: bind ? Is there an easy pattern for this that avoids the boilerpets of mosquitoes but many parameters are binding?

You just use the boost :: function I think that < Code> boost :: bind has its own type, but it is compatible with boost :: function specific use for typingfiff for the function:

  typedef boost :: function & lt; Bool (std :: string) & gt; MyTestFunction;  

And then you can pass any compatible function with boost :: bind :

  bool SomeFunction (int I, std:: string s) {return true; } MyTestFunction f = boost :: bind (SomeFunction, 42, _1); F ("And then call it.");  

I hope what you want.

This also works by passing this pointers to call this column as another parameter boost :: bind .


Comments

Popular posts from this blog

c++ - Linux and clipboard -

What is expire header and how to achive them in ASP.NET and PHP? -

sql server - How can I determine which of my SQL 2005 statistics are unused? -