C++ boost::bind














































C++ boost::bind



DESCRIPTION-:

BOOST.BIND  is one of those boost library which makes it easier to understand the std::bind() function. 
                                                                     OR
BOOST.BIND is an alternative simplified  approch to use  std::bind().

*This boost library contain header file as #include<boost/bind.hpp> which mainly contain boost::bind(function_name,parameter_1,parameter_2......parameter_n)  
as its function template.

*Here below is a simple program that expalins the most basic use of boost.bind .
_________________________________________________________________________________________________
PROGRAM-:

#include<iostream.h>
#include<boost/bind.hpp>  /*contain boost library*/

using namespace std ;
 

void  multi(int a,int b)       /*declearing a normal function*/
{
 cout<<a*b<<"\n";
}

int main()
{
     int  a=boost::bind(multi,10,20);   /*using boost bind that takes parameter by value to function()*/
     int b=boost::bind(multi,20,30);
          a();                                                 /*calling "multi" function by using boost.bind */
          b();                                                              
     return(0);
}
_________________________________________________________________________________________________
OUTPUT:-
200
600
_________________________________________________________________________________________________

*THE ABOVE PROGRAM JUST GIVES THE BASIC APPROCH OF BOOST.BIND*

Comments