unique.h
来自「这个是symbian下的一个蛮庞大的3D游戏源代码!对于学习3D开发的人有很大的」· C头文件 代码 · 共 37 行
H
37 行
#ifndef _LANG_UNIQUE_H
#define _LANG_UNIQUE_H
namespace lang
{
/**
* Removes duplicates.
* Assumes that elements are sorted.
* @return Iterator to the first non-unique element.
*/
template <class T> T* unique( T* begin, T* end )
{
T* res = begin;
if ( begin != end )
{
T u = *begin;
while ( ++begin != end )
{
if ( !(u == *begin) )
{
u = *begin;
*++res = u;
}
}
}
return ++res;
}
} // lang
#endif // _LANG_UNIQUE_H
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?