Opened 8 years ago

Closed 6 years ago

#2893 closed Library Submissions (fixed)

Function Input Iterator

Reported by: anonymous Owned by: dave
Milestone: To Be Determined Component: iterator
Version: Severity: Not Applicable
Keywords: iterator function input Cc: mikhailberis@…


Simply put a the function input iterator implementation wraps a nullary function object and allows for bounded iterators using an embedded state variable. The use case is for something like the following:

struct generator {
 typedef int result_type;
 generator() { srand(time(0)); }
 result_type operator() () const { return rand(); }

using namespace std;
using namespace boost;

int main(int argc, char * argv[]) {
 generator f;
   make_function_input_iterator(f, infinite()),
   make_function_input_iterator(f, infinite()),
   ostream_iterator<int>(cout, " ")
 return 0;

And if you don't want an infinite range, you can simply bound it:

  make_function_input_iterator(f, 0),
  make_function_input_iterator(f, 10),
  ostream_iterator<int>(cout, " ")

Attachments (3)

function_input_iterator.hpp (1.9 KB) - added by anonymous 8 years ago.
Implementation header.
function_input_iterator.html (11.9 KB) - added by mikhailberis 8 years ago.
Function iterator documentation (HTML)
function_input_iterator.2.rst (4.3 KB) - added by mikhailberis 8 years ago.
Documentation source (RST)

Download all attachments as: .zip

Change History (8)

Changed 8 years ago by anonymous

Implementation header.

Changed 8 years ago by mikhailberis

Function iterator documentation (HTML)

Changed 8 years ago by mikhailberis

Documentation source (RST)

comment:1 Changed 8 years ago by mikhailberis

  • Cc mikhailberis@… added

Was submitting the ticket anonymously earlier (unintentionally). Adding a comment as me (Dean Michael Berris) for proper documentation.

comment:2 Changed 7 years ago by jewillco

  • Resolution set to fixed
  • Status changed from new to closed

(In [62615]) Added function_input_iterator from Dean Michael Berris; fixes #2893

comment:3 Changed 6 years ago by marshall

(In [67792]) Merging fixes to release; fixes #2294 fixes #4918 fixes #3645 refs #2823 refs #1427 refs #2893

comment:4 Changed 6 years ago by mimomorin@…

  • Resolution fixed deleted
  • Status changed from closed to reopened

Reopened until merged into release. ([67792] didn't add function_input_iterator to release.)

comment:5 Changed 6 years ago by danieljames

  • Resolution set to fixed
  • Status changed from reopened to closed

(In [70709]) Iterator: merge several changes from trunk.

  • Update iterator_facade test for #1019 (header change already merged).
  • Category of each iterator is reduced to a known category before we try to find a minimum. Fixes #1517.
  • function_input_iterator from Dean Michael Berris. Fixes #2893
  • Fix typo in boost/iterator.hpp. Fixes #3434.
  • Always include add_reference header in iterator adaptor header.

Did not merge changes for #1427.

Add Comment

Modify Ticket

Change Properties
Set your email in Preferences
as closed The owner will remain dave.
The resolution will be deleted. Next status will be 'reopened'.

E-mail address and user name can be saved in the Preferences.

Note: See TracTickets for help on using tickets.