Opened 10 years ago

Closed 10 years ago

#7977 closed Bugs (fixed)

functor_input example for multi_pass iterator has various issues

Reported by: Jeff Trull <edaskel@…> Owned by: Hartmut Kaiser
Milestone: To Be Determined Component: spirit
Version: Boost Development Trunk Severity: Problem
Keywords: Cc:

Description

As given, the functor_input example in the multi_pass documentation (see "How to write a functor for use with the functor_input InputPolicy") will not compile, and once the compile issues are fixed, will not run successfully. The issues are more than simply typos - among them are:

1) operator() cannot be const, as it modifies the private member c_ 2) policies are given to multi_pass directly instead of through default_policy 3) the policies are in the wrong order (functor_input must be third, not first) 4) '\0' cannot be used as the EOF marker, because the multi_pass is_eof() member will return true in this case due to a comparison against the initialized curtok value of 0 - this may be a bug.

I have attached a modified version of the example which works as described in the documentation.

Attachments (1)

test_fi.cpp (1.3 KB ) - added by Jeff Trull <edaskel@…> 10 years ago.
Suggested replacement code

Download all attachments as: .zip

Change History (3)

by Jeff Trull <edaskel@…>, 10 years ago

Attachment: test_fi.cpp added

Suggested replacement code

comment:1 by Joel de Guzman, 10 years ago

Owner: changed from Joel de Guzman to Hartmut Kaiser

comment:2 by Hartmut Kaiser, 10 years ago

Resolution: fixed
Status: newclosed

(In [82759]) Spirit: fix #7977: functor_input example for multi_pass iterator has various issues

Note: See TracTickets for help on using tickets.