vec.erase ( remove ( vec.begin() , vec.end() , 10 ),vec.end() ) ;
请问这里remove() 的原型是什么?
vec.erase ( remove ( vec.begin() , vec.end() , 10 ),vec.end() ) ;
请问这里remove() 的原型是什么?
。。没啥可说的。反正我看不懂。
// TEMPLATE FUNCTION remove
template<class _FI, class _Ty> inline
_FI
remove(_FI _F, _FI _L, const _Ty& _V)
{_F
= find(_F, _L, _V);
if
(_F == _L)
return
(_F);
else
{_FI
_Fb = _F;
return
(remove_copy(++_F, _L, _Fb, _V)); }}
//
TEMPLATE FUNCTION remove_if
template<class _FI, class _Pr> inline
_FI
remove_if(_FI _F, _FI _L, _Pr _P)
{_F
= find_if(_F, _L, _P);
if
(_F == _L)
return
(_F);
else
{_FI
_Fb = _F;
return
(remove_copy_if(++_F, _L, _Fb, _P)); }}
template<class _II, class _OI, class
_Ty> inline
_OI
remove_copy(_II _F, _II _L, _OI _X, const _Ty& _V)
{for
(; _F != _L; ++_F)
if
(!(*_F == _V))
*_X++
= *_F;
return
(_X); }
//
TEMPLATE FUNCTION remove_copy_if
template<class _II, class _OI, class
_Pr> inline
_OI
remove_copy_if(_II _F, _II _L, _OI _X, _Pr _P)
{for
(; _F != _L; ++_F)
if
(!_P(*_F))
*_X++
= *_F;
return
(_X); }