Boost C++ Libraries: Ticket #2893: Function Input Iterator https://svn.boost.org/trac10/ticket/2893 <p> 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: </p> <pre class="wiki">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; copy( make_function_input_iterator(f, infinite()), make_function_input_iterator(f, infinite()), ostream_iterator&lt;int&gt;(cout, " ") ); return 0; } </pre><p> And if you don't want an infinite range, you can simply bound it: </p> <pre class="wiki">copy( make_function_input_iterator(f, 0), make_function_input_iterator(f, 10), ostream_iterator&lt;int&gt;(cout, " ") ); </pre> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/2893 Trac 1.4.3 anonymous Fri, 27 Mar 2009 11:17:42 GMT attachment set https://svn.boost.org/trac10/ticket/2893 https://svn.boost.org/trac10/ticket/2893 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">function_input_iterator.hpp</span> </li> </ul> <p> Implementation header. </p> Ticket Dean Michael Berris Fri, 27 Mar 2009 11:21:54 GMT attachment set https://svn.boost.org/trac10/ticket/2893 https://svn.boost.org/trac10/ticket/2893 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">function_input_iterator.html</span> </li> </ul> <p> Function iterator documentation (HTML) </p> Ticket Dean Michael Berris Fri, 27 Mar 2009 11:23:11 GMT attachment set https://svn.boost.org/trac10/ticket/2893 https://svn.boost.org/trac10/ticket/2893 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">function_input_iterator.2.rst</span> </li> </ul> <p> Documentation source (RST) </p> Ticket Dean Michael Berris Fri, 27 Mar 2009 11:25:18 GMT cc set https://svn.boost.org/trac10/ticket/2893#comment:1 https://svn.boost.org/trac10/ticket/2893#comment:1 <ul> <li><strong>cc</strong> <span class="trac-author">mikhailberis@…</span> added </li> </ul> <p> Was submitting the ticket anonymously earlier (unintentionally). Adding a comment as me (Dean Michael Berris) for proper documentation. </p> Ticket Jeremiah Willcock Wed, 09 Jun 2010 00:09:58 GMT status changed; resolution set https://svn.boost.org/trac10/ticket/2893#comment:2 https://svn.boost.org/trac10/ticket/2893#comment:2 <ul> <li><strong>status</strong> <span class="trac-field-old">new</span> → <span class="trac-field-new">closed</span> </li> <li><strong>resolution</strong> → <span class="trac-field-new">fixed</span> </li> </ul> <p> (In <a class="changeset" href="https://svn.boost.org/trac10/changeset/62615" title="Added function_input_iterator from Dean Michael Berris; fixes #2893">[62615]</a>) Added function_input_iterator from Dean Michael Berris; fixes <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/2893" title="#2893: Library Submissions: Function Input Iterator (closed: fixed)">#2893</a> </p> Ticket Marshall Clow Sat, 08 Jan 2011 18:38:47 GMT <link>https://svn.boost.org/trac10/ticket/2893#comment:3 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/2893#comment:3</guid> <description> <p> (In <a class="changeset" href="https://svn.boost.org/trac10/changeset/67792" title="Merging fixes to release; fixes #2294 fixes #4918 fixes #3645 refs ...">[67792]</a>) Merging fixes to release; fixes <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/2294" title="#2294: Bugs: Please improve test annotation (closed: fixed)">#2294</a> fixes <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/4918" title="#4918: Patches: concept_check.hpp triggers self-assignment warnings (closed: fixed)">#4918</a> fixes <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/3645" title="#3645: Bugs: iterator_facade does not work in presence of ::implicit_cast (closed: fixed)">#3645</a> refs <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/2823" title="#2823: Bugs: [fusion] vector copy constructor copies sequence members in different ... (closed: fixed)">#2823</a> refs <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/1427" title="#1427: Feature Requests: [iterator] transform_iterator should use boost::result_of to determine ... (closed: fixed)">#1427</a> refs <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/2893" title="#2893: Library Submissions: Function Input Iterator (closed: fixed)">#2893</a> </p> </description> <category>Ticket</category> </item> <item> <author>mimomorin@…</author> <pubDate>Mon, 17 Jan 2011 12:49:41 GMT</pubDate> <title>status changed; resolution deleted https://svn.boost.org/trac10/ticket/2893#comment:4 https://svn.boost.org/trac10/ticket/2893#comment:4 <ul> <li><strong>status</strong> <span class="trac-field-old">closed</span> → <span class="trac-field-new">reopened</span> </li> <li><strong>resolution</strong> <span class="trac-field-deleted">fixed</span> </li> </ul> <p> Reopened until merged into release. (<a class="changeset" href="https://svn.boost.org/trac10/changeset/67792" title="Merging fixes to release; fixes #2294 fixes #4918 fixes #3645 refs ...">[67792]</a> didn't add <code>function_input_iterator</code> to release.) </p> Ticket Daniel James Tue, 29 Mar 2011 21:17:14 GMT status changed; resolution set https://svn.boost.org/trac10/ticket/2893#comment:5 https://svn.boost.org/trac10/ticket/2893#comment:5 <ul> <li><strong>status</strong> <span class="trac-field-old">reopened</span> → <span class="trac-field-new">closed</span> </li> <li><strong>resolution</strong> → <span class="trac-field-new">fixed</span> </li> </ul> <p> (In <a class="changeset" href="https://svn.boost.org/trac10/changeset/70709" title="Iterator: merge several changes from trunk. - Update iterator_facade ...">[70709]</a>) Iterator: merge several changes from trunk. </p> <ul><li>Update iterator_facade test for <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/1019" title="#1019: Bugs: iterator_facade::pointer should be the return type of operator-&gt; (DR 445) (closed: fixed)">#1019</a> (header change already merged). </li><li>Category of each iterator is reduced to a known category before we try to find a minimum. Fixes <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/1517" title="#1517: Feature Requests: zip_iterator can't zip Bidirectional Input iterators (closed: fixed)">#1517</a>. </li><li><code>function_input_iterator</code> from Dean Michael Berris. Fixes <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/2893" title="#2893: Library Submissions: Function Input Iterator (closed: fixed)">#2893</a> </li><li>Fix typo in <code>boost/iterator.hpp</code>. Fixes <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/3434" title="#3434: Bugs: boost/iterator.hpp typo in comment (closed: fixed)">#3434</a>. </li><li>Always include <code>add_reference</code> header in iterator adaptor header. </li></ul><p> Did not merge changes for <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/1427" title="#1427: Feature Requests: [iterator] transform_iterator should use boost::result_of to determine ... (closed: fixed)">#1427</a>. </p> Ticket