首页 > 其他 > 详细

STL容器之List:rbegin

时间:2014-02-13 20:32:03      阅读:438      评论:0      收藏:0      [点我收藏+]

出处:http://hi.baidu.com/ycdoit/item/bb5ed3f48bad1dd543c36a7f

 

// returns a reverse iterator to the beginning of the list
#include <iostream>
#include <list>
#include <algorithm>
#include <numeric>
#include <iterator>
using namespace std;

int main () 
{
    list<int> l(10);
    iota(l.begin(),l.end(),1);

    copy(l.begin(),l.end(),
            ostream_iterator<int>(cout," "));
    cout << endl;

    list<int>::reverse_iterator It = l.rbegin();
    while ( It != l.rend() )
    cout << *(It++) << " ";
    cout << endl;

    return 0;
}
//OUTPUT:
// 1 2 3 4 5 6 7 8 9 10 
// 10 9 8 7 6 5 4 3 2 1 

STL容器之List:rbegin

原文:http://www.cnblogs.com/zhangxiaosong/p/3547890.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!