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 func = bind( hello, count );
    func();
}

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

Advertisements

2 Responses to “boost::function”


  1. 1 Bheeshmar July 26, 2005 at 11:58 am

    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 July 26, 2005 at 8:20 pm

    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> > >


Comments are currently closed.




%d bloggers like this: