Boost C++ Libraries: Ticket #5965: indirect_iterator conflicts with forward declaration https://svn.boost.org/trac10/ticket/5965 <p> indirect_iterator, or more precisely its base class indirect_base, checks whether it can dereference its argument twice. This ends in an error, if the target type is incomplete (from a forward declaration). The error occurs even if the dereferencing is not used in the affected code unit. (It is concept checking.) </p> <p> /usr/include/boost/detail/is_incrementable.hpp:84: error: cannot increment a pointer to incomplete type ‘Derived’ </p> <p> indirect_iterator handles pointers. Pointers and forward declaration should complete each other well. So indirect_iterator should never try to dereference if it is not forced by using code. Concept checking does not work here satisfactorily. </p> <p> I appended exemplary code which I compiled with GCC 4.4.3. </p> <p> Best regards, </p> <p> Simon </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/5965 Trac 1.4.3 Simon <simon.siemens@…> Fri, 30 Sep 2011 10:13:28 GMT attachment set https://svn.boost.org/trac10/ticket/5965 https://svn.boost.org/trac10/ticket/5965 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">Base.hpp</span> </li> </ul> <p> The base class with a forward declaration and a range for a certain sub-class. </p> Ticket Simon <simon.siemens@…> Fri, 30 Sep 2011 10:14:11 GMT attachment set https://svn.boost.org/trac10/ticket/5965 https://svn.boost.org/trac10/ticket/5965 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">Derived.hpp</span> </li> </ul> <p> The sub-class. A list of pointers to this class is saved in the base class. </p> Ticket Simon <simon.siemens@…> Fri, 30 Sep 2011 10:14:44 GMT attachment set https://svn.boost.org/trac10/ticket/5965 https://svn.boost.org/trac10/ticket/5965 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">main.cpp</span> </li> </ul> <p> the main that puts everything together. </p> Ticket jeffrey.hellrung Sat, 13 Oct 2012 20:17:00 GMT <link>https://svn.boost.org/trac10/ticket/5965#comment:1 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/5965#comment:1</guid> <description> <p> The immediate problem actually appears to lie in boost::pointee, so one can partially specialize boost::pointee for pointer types to avoid instantiating is_incrementable. However, after doing this, a new problem arises with instantiating boost::is_POD on the value_type of the indirect_iterator (which, in this case, is Derived) during determination of the return type of operator[]. So, a possible resolution for your specific example would be to disable operator[] when the traversal of the underlying iterator is not random access. I'll see what I can do to effect this. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>jeffrey.hellrung</dc:creator> <pubDate>Sun, 14 Oct 2012 03:30:54 GMT</pubDate> <title>cc set https://svn.boost.org/trac10/ticket/5965#comment:2 https://svn.boost.org/trac10/ticket/5965#comment:2 <ul> <li><strong>cc</strong> <span class="trac-author">jeffrey.hellrung</span> added </li> </ul> Ticket Dave Abrahams Wed, 21 Nov 2012 20:30:44 GMT owner changed https://svn.boost.org/trac10/ticket/5965#comment:3 https://svn.boost.org/trac10/ticket/5965#comment:3 <ul> <li><strong>owner</strong> changed from <span class="trac-author">Dave Abrahams</span> to <span class="trac-author">jeffrey.hellrung</span> </li> </ul> Ticket