Chinaunix首页 | 论坛 | 博客
  • 博客访问: 27615
  • 博文数量: 9
  • 博客积分: 535
  • 博客等级: 中士
  • 技术积分: 115
  • 用 户 组: 普通用户
  • 注册时间: 2007-12-20 14:28
文章分类

全部博文(9)

文章存档

2010年(6)

2009年(3)

我的朋友

分类: C/C++

2009-04-21 14:38:58

1.std::sort

sort的声明:



使用的时候没有注意 _Last,直接以array[4]代替了。。。找了半天错误。。。
 

template<class RandomAccessIterator>
  void sort(
      RandomAccessIterator _First,
      RandomAccessIterator _Last
   );
template<class RandomAccessIterator, class Pr>
   void sort(
      RandomAccessIterator _First,
      RandomAccessIterator _Last,
      BinaryPredicate _Comp
   );
//int array[4]

Parameters
_First

A random-access iterator addressing the position of the first element in the range to be sorted.

//起始位置 &array[0]

_Last

A random-access iterator addressing the position one past the final element in the range to be sorted.

//数组最后结束位置 &array[0] + sizeof(array)/sizeof(int)

_Comp

User-defined predicate function object that defines the comparison criterion to be satisfied by successive elements in the ordering. A binary predicate takes two arguments and returns true when satisfied and false when not satisfied.

阅读(702) | 评论(0) | 转发(0) |
0

上一篇:没有了

下一篇:PHP使用远程文件

给主人留下些什么吧!~~