关于container template
template<typename containerType>
void reverse(containerType &container)
{
typedef typename containerType::value_type elementType;
typedef typename containerType::iterator iterator;
iterator itrBegin = container.begin();
iterator itrEnd = container.end();
for(; itrBegin!=itrEnd && itrEnd!=itrBegin+1;itrBegin++, itrEnd--)
{
elementType temp = *itrBegin;
*itrBegin = *itrEnd;
*itrEnd = temp;
}
}
以上程序编译时,红笔处有错,不知道要如何修改?请大家帮帮忙,谢谢!