Home c++ What Returns BOOST :: BIND?

What Returns BOOST :: BIND?




What type of data Return value Boost :: Bind ? I want to make a function that will take the result of the Boost :: Bind , but I do not know what type of value it returns.

void work (int num) {
  STD :: COUT & LT; & LT; Num & lt; & lt; STD :: ENDL;
  Auto Test = Boost :: Bind (Work, 5);

Answer 1, Authority 100%

Boost :: Bind The entity is template, and the type returned by it may (and it will) depend on the types of transmitted arguments. However, if you want to be attached to a specific option, it comes to the help comes DECLTYPE . Example :

# include & lt; iostream & gt;
#Include & lt; boost / bind / bind.hpp & gt;
Void Work (int num) {
  STD :: COUT & LT; & LT; Num & lt; & lt; STD :: ENDL;
Void F (DeclType (Boost :: Bind (Work, Int ())) Arg) {
  arg ();
  AUTO TEST = Boost :: Bind (Work, 10);
  F (test);

I specifically pointed out int () in f to show that the dependence is from the type, and not from the value.

At the same time, the idea of ​​what is needed to rely on the resulting type Boost :: Bind seems to me doubtful.

Programmers, Start Your Engines!

Why spend time searching for the correct question and then entering your answer when you can find it in a second? That's what CompuTicket is all about! Here you'll find thousands of questions and answers from hundreds of computer languages.

Recent questions