Boost C++ Libraries: Ticket #6067: <boost/fusion/algorithm/transformation/push_back.hpp> is broken https://svn.boost.org/trac10/ticket/6067 <p> I get an error when only including the push_back header with using boost-1.48.0_beta1. It used to work with boost-1.47.0. </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/6067 Trac 1.4.3 anonymous Thu, 27 Oct 2011 14:41:46 GMT attachment set https://svn.boost.org/trac10/ticket/6067 https://svn.boost.org/trac10/ticket/6067 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">raw.cpp</span> </li> </ul> Ticket Joel de Guzman Fri, 28 Oct 2011 23:41:39 GMT owner changed https://svn.boost.org/trac10/ticket/6067#comment:1 https://svn.boost.org/trac10/ticket/6067#comment:1 <ul> <li><strong>owner</strong> changed from <span class="trac-author">Joel de Guzman</span> to <span class="trac-author">Eric Niebler</span> </li> </ul> <p> Eric, could you please have a quick check? </p> <p> The error points me to: </p> <p> C:\dev\boost\boost/fusion/view/iterator_range/detail/segmented_iterator_range.hpp(261) : error C2146: syntax error : missing ',' before identifier 'push_back' </p> <p> I'm not familiar enough with segmented_iterator. </p> <p> Thanks! </p> Ticket Eric Niebler Sat, 29 Oct 2011 05:48:17 GMT owner changed https://svn.boost.org/trac10/ticket/6067#comment:2 https://svn.boost.org/trac10/ticket/6067#comment:2 <ul> <li><strong>owner</strong> changed from <span class="trac-author">Eric Niebler</span> to <span class="trac-author">Joel de Guzman</span> </li> </ul> <p> The problem is simple, and the fix is also simple but tedious and requires discipline. The problem is circular includes. It's nearly impossible to avoid. Consider that fusion::begin should automatically return a segmented_iterator for segmented sequences. But the implementation of segmented_iterator itself need to use fusion::begin() to find the start iterator of the sequence's internal segments. Hence, you end up with a circular dependency: begin.hpp needs segmented_iterator, but segmented_iterator.hpp needs begin. In this case, it's the fact that segmented_iterator's implementation uses push_back, which uses joint_view, which uses begin, which uses segmented_iterator, closing the circle. </p> <p> The solution is consistent use of _fwd.hpp headers. Every .hpp gets an associated _fwd.hpp that forward-declares the things it publishes. The _fwd.hpp must do nothing but forward-declare stuff and include other _fwd.hpp headers. Then, for instance, foo.hpp includes foo_fwd.hpp <strong>before it includes anything else</strong>. When you do that consistently, circular includes happen, but they never lead to this strange situation where a file appears to be included but its symbols are not visible -- as is happening here. </p> <p> In Proto, I solve this problem by having one big proto_fwd.hpp file that forward-declares everything in Proto. That gets included from every other file in Proto. Once that's done, headers are free to include each other willy-nilly and the circular include problem is vanquished. You may choose to do something similar, or individual _fwd.hpp headers, or maybe granular ones like algorithm_fwd.hpp and intrinsic_fwd.hpp. You get the idea. </p> <p> HTH, Eric </p> Ticket Eric Niebler Sat, 29 Oct 2011 05:55:25 GMT attachment set https://svn.boost.org/trac10/ticket/6067 https://svn.boost.org/trac10/ticket/6067 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">segmented_iterator_range.hpp.patch</span> </li> </ul> <p> Hack to solve the immediate problem </p> Ticket Eric Niebler Sat, 29 Oct 2011 05:59:22 GMT <link>https://svn.boost.org/trac10/ticket/6067#comment:3 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/6067#comment:3</guid> <description> <p> Sorry, forgot to mention: the above is a description of how to address the larger issue. For the immediate problem, we can hack some forward declarations directly into segmented_iterator_range.hpp, as in the patch I just attached. </p> <p> Also, my apologies for not catching this issue sooner. I already added a bunch of _fwd.hpp headers to solve many of these problems and thought I had caught them all. Clearly I was wrong. A consistent policy is needed, but I'll leave that for you to decide. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Joel de Guzman</dc:creator> <pubDate>Fri, 04 Nov 2011 20:39:22 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/6067#comment:4 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/6067#comment:4</guid> <description> <p> Thanks Eric. This will do for now. Hmm, I guess it's too late to merge to release huh? </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Eric Niebler</dc:creator> <pubDate>Fri, 04 Nov 2011 21:01:50 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/6067#comment:5 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/6067#comment:5</guid> <description> <p> I don't think it's too late, and this is a very low risk fix with a potentially large positive impact. As a release manager, you have my permission. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Joel de Guzman</dc:creator> <pubDate>Sat, 05 Nov 2011 02:03:31 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/6067#comment:6 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/6067#comment:6</guid> <description> <p> Thanks, Eric! Done. </p> </description> <category>Ticket</category> </item> <item> <author>Kohei Takahashi <flast@…></author> <pubDate>Wed, 05 Nov 2014 13:35:07 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/6067#comment:7 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/6067#comment:7</guid> <description> <p> This is already fixed. djowel, please close. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Joel de Guzman</dc:creator> <pubDate>Wed, 05 Nov 2014 15:06:29 GMT</pubDate> <title>status changed; resolution set https://svn.boost.org/trac10/ticket/6067#comment:8 https://svn.boost.org/trac10/ticket/6067#comment:8 <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> Ticket