c++ boost::bind::binding_template_member_function














































c++ boost::bind::binding_template_member_function



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.
_______________________________________________________________________________________________________
PROGRAM-:

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

using namespace std ;
 
template<class t > /*using a template*/

class example
{
public :
void  minimum( t a,t b)       
{
if(a<b)
  cout<<a<<" IS SMALLER"<<"\n";
else
cout<<b<<" IS SMALLER"<<"\n";
}
};
int main()
{
example e1,e2;
     auto  a=boost::bind(&example::minimum<int>,&e1,10,20);   /*binding a template member function*/
     auto  a=boost::bind(&example::minimum<float>,&e2,10.4,20.5);
          a();                                                 
          b();                                                              
     return(0);
}

_____________________________________________________________________________________________________
OUTPUT-
10 IS SMALLER
10.4 IS SMALLER


________________________________________________________________________________________________

Comments