Boost C++ Libraries: Ticket #10769: iterator_adaptor does not properly inherit "pointer" typedef from the base iterator https://svn.boost.org/trac10/ticket/10769 <p> I'm trying to define a <code>Derived_Iterator</code> class using a <code>Base_Iterator</code> class and the glue class <code>iterator_adaptor&lt; Derived_Class, Base_Class, ...&gt;</code> (as base of <code>Derived_Iterator</code>). In my use case, neither pointers nor references are plain: </p> <pre class="wiki">Base_Iterator::pointer != Base_Iterator::value_type* Base_Iterator::reference != Base_Iterator::value_type&amp; </pre><p> I found 2 possibly related problems, which I think are bugs: </p> <ol><li>The typedef <code>iterator_adaptor&lt;&gt;::pointer</code> is incorrect. Specifically, it produces a plain pointer, when I expect it to produce <code>Base_Iterator::pointer</code>. </li></ol><ol start="2"><li>There is something wrong with <code>iterator_adaptor&lt;&gt;::operator-&gt;()</code>. I would expect <code>Derived_Iterator</code> to behave exactly like <code>Base_Iterator</code>. So, if I don't explicitly define <code>Derived_Iterator::operator-&gt;()</code>, I would expect the version inherited from <code>iterator_adaptor&lt;&gt;</code> to do something similar to: <pre class="wiki">Base_Iterator operator-&gt;() const { return this-&gt;base(); } </pre></li></ol><p> But this doesn't happen. If I put in this definition explicitly in <code>Derived_Iterator</code>, then the code works. </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/10769 Trac 1.4.3 Matei David <matei@…> Fri, 07 Nov 2014 20:10:42 GMT attachment set https://svn.boost.org/trac10/ticket/10769 https://svn.boost.org/trac10/ticket/10769 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">iterator-example.cpp</span> </li> </ul> <p> example file </p> Ticket Matei David <matei@…> Fri, 07 Nov 2014 20:15:54 GMT <link>https://svn.boost.org/trac10/ticket/10769#comment:1 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/10769#comment:1</guid> <description> <p> In the example, I'm using the <code>bounded_pointer</code> and <code>bounded_reference</code> classes that are part of the <code>boost::intrusive</code> test suite, available in the github repo. </p> <p> I compile with <code>gcc-4.9.1</code> or <code>clang-3.5</code>: </p> <pre class="wiki">[g++|clang++] -std=c++11 -Wall -Wextra -pedantic -I${BOOST_INCLUDE_1_57} iterator-example.cpp -o iterator-example </pre> </description> <category>Ticket</category> </item> <item> <author>Matei David <matei@…></author> <pubDate>Fri, 07 Nov 2014 20:22:09 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/10769#comment:2 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/10769#comment:2</guid> <description> <p> I also posted a message about this on the boost-users mailing list, but Trac doesn't allow me to put the link here. (It thinks it's spam, then asks me solve a captcha without displaying one...) </p> </description> <category>Ticket</category> </item> </channel> </rss>