接触到 std 的 unique 这个函数,看了一下实现,自己也写了一下。在读默认的实现的时候发现代码真是的比较坑爹的,缩进啊,花括号啊,之类的,都是不按规范来的。
自己照着写了一个如下
#include <iostream>
#include <vector>
template<class It>
It myUnique(It itBegin, It itEnd) {
f…… 阅读全文
std unique 的实现
Reply
接触到 std 的 unique 这个函数,看了一下实现,自己也写了一下。在读默认的实现的时候发现代码真是的比较坑爹的,缩进啊,花括号啊,之类的,都是不按规范来的。
自己照着写了一个如下
#include <iostream>
#include <vector>
template<class It>
It myUnique(It itBegin, It itEnd) {
f…… 阅读全文