c++ boost::bind::binding_template_function














































c++ boost::bind::binding_template_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<typename t > /*using a template*/
void   greater( t a,t b)       
{
if(a>b)
 cout<<a<<" IS GREATER"<<"\n";
else
cout<<b<<" IS GREATER"<<"\n";
}

int main()
{
     auto  a=boost::bind(namespace::greater<int>,10,20);   /*binding a template function*/
     auto b=boost::bind(namespace::greater<float>,20.3,30.5);
          a();                                               
          b();                                                              
     return(0);
}

_____________________________________________________________________________________________________
OUTPUT-
20 IS GREATER
30.5 IS GREATER


________________________________________________________________________________________________

Comments