
I have a function in STL which add the 'area' attribute of a list of Rect. float getTotalAreaPerCent(BlockDataList& bdl) { return accumulate (bdl.begin(), bdl.end(), 0.0, add_area_per_cent<BlockData*, float>()); } template< class T1, class T2> class add_area_per_cent : public binary_function<T2, T1, T2> { public: add_area_per_cent() { } T2 operator() (T2 initial, T1 element) { if (element != NULL) { return initial + element->getAreaPerCent(); } else { return initial; } } }; Can you please tell me how can I reduce the amount of code and use Boost bind library to achieve the same thing? Thank you. __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com