《Essential C++》笔记三(3)、使用iostream iterators

本文是《Essential C++》笔记的第三部分,聚焦于iostream iterators的使用。通过书中提供的例程,深入探讨如何在C++中进行单步调试,并理解iostream迭代器在输入输出操作中的工作原理。
摘要由CSDN通过智能技术生成

Essential C++书中,给了一段关于iosteram iterators的例程,如下所示:

#include <iostream> 
#include <iterator> 
#include <algorithm> 
#include <vector> 
#include <string> 
using namespace std; 

int main() 
{ 
   istream_iterator< string > is( cin ); 
   istream_iterator< string > eof; 

   vector< string > text; 
   copy( is, eof, back_inserter( text )); 

   sort( text.begin(), text.end() ); 

   ostream_iterator<string> os( cout, " " ); 
   copy( text.begin(), text.end(), os ); 
} 

在输入的过程中,出现了一个问题,就是控制台不断要求输入,好像进入死循环,对于这个问题, http://wenku.baidu.com/view/91f2f2eff8c75fbfc77db2f5.html,给出了一些解释。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值