文档下载 文档下载导航
设为首页 | 加入收藏
搜索 请输入内容:  
 导航当前位置: 文档下载 > 所有分类 > IT/计算机 > 侯捷stl源码剖析注释之20 sgi-stl-algobase
侵权投诉

侯捷stl源码剖析注释之20 sgi-stl-algobase

sgi-stl-algobase

<stl_algobase.h> 完整列表 3

#undef min

#undef max

template <class T>

inline const T& min(const T& a, const T& b) {

return b < a ? b : a;

}

template <class T>

inline const T& max(const T& a, const T& b) {

return a < b ? b : a;

}

#endif /* __BORLANDC__ */

template <class T, class Compare>

inline const T& min(const T& a, const T& b, Compare comp) {

return comp(b, a) ? b : a; // 由 comp 決定「大小比較」標準

}

template <class T, class Compare>

inline const T& max(const T& a, const T& b, Compare comp) {

return comp(a, b) ? b : a; // 由 comp 決定「大小比較」標準

}

template <class InputIterator, class OutputIterator>

inline OutputIterator __copy(InputIterator first, InputIterator last, OutputIterator result, input_iterator_tag)

{

for ( ; first != last; ++result, ++first)

*result = *first;

return result;

}

template <class RandomAccessIterator, class OutputIterator, class Distance> inline OutputIterator

__copy_d(RandomAccessIterator first, RandomAccessIterator last,

OutputIterator result, Distance*)

{

for (Distance n = last - first; n > 0; --n, ++result, ++first)

*result = *first;

return result;

}

template <class RandomAccessIterator, class OutputIterator>

inline OutputIterator

__copy(RandomAccessIterator first, RandomAccessIterator last,

OutputIterator result, random_access_iterator_tag)

{

The Annotated STL Sources

上一页第3页

你可能喜欢

热门文档

相关文档

站点地图 | 文档上传 | 侵权投诉 | 手机版
本站所有资源均来自互联网,本站只负责收集和整理,均不承担任何法律责任,如有侵权等其它行为请联系我们.
文档下载 Copyright 2013 doc.guandang.net All Rights Reserved.  -  email