|
Boost : |
From: Tom Brinkman (reportbase_at_[hidden])
Date: 2008-05-30 18:22:37
I use these extensions to "for_each" alot. You can add them to your
list if you want.
template<typename _InIt, typename _InIt2, typename _Fn1> inline
_Fn1 for_each(_InIt _First, _InIt _Last, _InIt2 _First2, _Fn1 _Func)
{
for (; _First != _Last; ++_First,++_First2)
_Func(*_First,*_First2);
return (_Func);
}
template<typename _InIt, typename _InIt2, typename _InIt3, typename _Fn1> inline
_Fn1 for_each(_InIt _First, _InIt _Last, _InIt2 _First2, _InIt3
_First3, _Fn1 _Func)
{
for (; _First != _Last; ++_First,++_First2,++_First3)
_Func(*_First, *_First2, *_First3);
return (_Func);
}
template<typename _InIt, typename _InIt2, typename _InIt3, typename
_InIt4, typename _Fn1> inline
_Fn1 for_each(_InIt _First, _InIt _Last, _InIt2 _First2, _InIt3
_First3, _InIt4 _First4, _Fn1 _Func)
{
for (; _First != _Last; ++_First,++_First2,++_First3,++_First4)
_Func(*_First, *_First2, *_First3, *_First4);
return (_Func);
}
template<typename _InIt, typename _InIt2, typename _InIt3, typename
_InIt4, typename _InIt5, typename _Fn1> inline
_Fn1 for_each(_InIt _First, _InIt _Last, _InIt2 _First2, _InIt3
_First3, _InIt4 _First4, _InIt5 _First5, _Fn1 _Func)
{
for (; _First != _Last; ++_First,++_First2,++_First3,++_First4,++_First5)
_Func(*_First, *_First2, *_First3, *_First4, *_First5);
return (_Func);
}
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk