Use of input iterators
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2

Thread: Use of input iterators

Hybrid View

  1. #1
    Join Date
    Sep 2010
    Posts
    2

    Use of input iterators

    Hi all,

    I recently came across input iterators in STL, but couldn't find out any scenario in which they might be used? (E.g. output iterators can be used along with copy() function to print the container items to console or a file).

    Can anyone help me with this one?

  2. #2
    Join Date
    Jan 2006
    Location
    Singapore
    Posts
    6,316

    Re: Use of input iterators

    Since forward iterators are input iterators, if you have an algorithm that works as efficiently with input iterators as with forward iterators, then you might as well write it with input iterators in mind so that it would work with forward iterators too, even if it never actually gets used with input iterators that are not forward iterators.

    For example, you could use input iterators to initialise a container, just as you could use the iterators from another container to initialise that container.
    C + C++ Compiler: MinGW port of GCC
    Build + Version Control System: SCons + Bazaar

    Look up a C/C++ Reference and learn How To Ask Questions The Smart Way
    Kindly rate my posts if you found them useful

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center