From: Michael Marcin (mmarcin_at_[hidden])
Date: 2007-12-05 16:45:50
Peter Dimov wrote:
> Michael Marcin:
>> I'm trying to make local modifications to bind to improve the code
>> generated the compiler I have to use.
>> tester::value_type test_bind( tester& t, tester::const_reference x )
>> return boost::bind( &tester::test, &t, _1 )( x );
> I'd start with a code example that is closer to your actual use, as there is
> no reason to use bind at all in the above. Typically boost::bind, which is
> the inefficient part, is called once, and the (x) call is done multiple
> times inside a for_each or similar. You might find the performance adequate
> for some uses. There will certainly be cases where boost::bind won't cut it,
> but you'd be able to selectively replace just those uses with handwritten
> function objects, or even with handwritten loops.
> It's not easy to optimize the general boost::bind case while still allowing
> the tests to pass; it might be better to write a separate leaner version
> that is more limited but still serves the majority of your specific needs.
That code started as my use case but I removed a lot of complexity to
make it fit for consumption on the list.
Essentially it is a function object for a std::transfrom that moves 3d
vertices from model space to view space for all vertices in a model.
The unrolled and bind version were close to identical for VC8 so I
figured I might be able to make RVCT act right if I dropped in a few
magic __forceinline keywords here or there. It's probably too much
effort for me anyways so I'll just use a hand coded functor for now and
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk