boost::function

I’ve had a minor revelation since my last two posts about C++. I don’t actually need the new auto keyword. Check it out:


#include 
#include 
#include 

using namespace std;
using namespace boost;

void hello( int a )
{
    while( a– ) cout << "Hi Mom: " << a << endl;
}
int main()
{
    const int count = 5;
    function< void (void) > func = bind( hello, count );
    func();
}

I’m still not exactly sure how this works, but I’m positve that boost::function rocks.

2 Responses to “boost::function”


  1. 1 Bheeshmar

    Crap!!!!!! I’m glad you found that, but I *swear* I was going to suggest trying it out. Check out my browser history!

  2. 2 Mark

    I believe you Bheesh :)

    I’m still trying to figure out how a boost::function can be initialized by a class boost::_bi::bind_t<void,void (__cdecl*)(int),class boost::_bi::list1<class boost::_bi::value<int> > >

Leave a Reply




Creative Commons Attribution-NonCommercial 3.0 United States
Creative Commons Attribution-NonCommercial 3.0 United States