Re: [Boost-bugs] [Boost C++ Libraries] #6067: <boost/fusion/algorithm/transformation/push_back.hpp> is broken

Subject: Re: [Boost-bugs] [Boost C++ Libraries] #6067: <boost/fusion/algorithm/transformation/push_back.hpp> is broken
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2011-10-29 05:48:18

#6067: <boost/fusion/algorithm/transformation/push_back.hpp> is broken
  Reporter: sefi@… | Owner: djowel
      Type: Bugs | Status: new
 Milestone: Boost 1.48.0 | Component: fusion
   Version: Boost 1.48.0 | Severity: Regression
Resolution: | Keywords:
Changes (by eric_niebler):

  * owner: eric_niebler => djowel


 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.

 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
 '''before it includes anything else'''. 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.

 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.


Ticket URL: <>
Boost C++ Libraries <>
Boost provides free peer-reviewed portable C++ source libraries.

This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:07 UTC