#ifndef ALGOSTUFF_HPP
#define ALGOSTUFF_HPP
#include <iostream>
#include <vector>
#include <deque>
#include <list>
#include <set>
#include <map>
#include <string>
#include <algorithm>
#include <functional>
#include <numeric>
using namespace std;
template <class T>
inline void PRINT_ELEMENTS(const T& coll, const char* optcstr = "")
{
typename T::const_iterator pos;
std::cout << optcstr;
for (pos = coll.begin(); pos != coll.end(); ++pos)
{
cout << *pos << " ";
}
cout << endl;
}
template<class T>
inline void INSERT_ELEMENTS(T& coll, int first, int last)
{
for (int i = first; i <= last; ++i)
{
coll.insert(coll.end(), i);
}
}
#endif
algostuff.h
最新推荐文章于 2025-12-28 15:42:52 发布
该头文件定义了常用于算法和数据结构的模板函数,包括打印容器元素的函数`PRINT_ELEMENTS`和向容器插入元素的函数`INSERT_ELEMENTS`。它包含了iostream,vector,deque,list,set,map,string等标准库的引用。
162

被折叠的 条评论
为什么被折叠?



