#include <iostream>
using namespace std;
template<class T>
inline void PRINT_ELEMENTS(const T& coll,const char* optcstr=" ")
{
 typename T::const_iterator pos;
 cout<<optcstr;
 for(pos=coll.begin();pos!=coll.end();++pos)
 {
  cout<<*pos<< " ";
 }
 cout<<endl;
}

注:PRINT_ELEMENTS第二个参数可有可无,在打印时它放在所有元素之前(起一个指示作用)

posted on 2010-04-10 09:56  蓝牙  阅读(196)  评论(0编辑  收藏  举报