Boost C++ Libraries: Ticket #2864: Compilation error if container definition is inside of linked class https://svn.boost.org/trac10/ticket/2864 <p> Following code will fail to compile (at least under MSVC2005 SP1) </p> <pre class="wiki">#include &lt;boost/intrusive/list.hpp&gt; using namespace boost::intrusive; struct Linked { list_member_hook&lt;&gt; _myhook; // list is defined inside of linked class list&lt;Linked, member_hook&lt;Linked, list_member_hook&lt;&gt;, &amp;Linked::_myhook&gt; &gt; mylist; }; </pre><p> If it's impossible to resolve this problem, I think that nuance have to be highlighted in documentation. </p> <p> Thanks in advance, Yuriy </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/2864 Trac 1.4.3 Andrey Semashev Wed, 18 Mar 2009 07:47:32 GMT <link>https://svn.boost.org/trac10/ticket/2864#comment:1 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/2864#comment:1</guid> <description> <p> You can try using list_base_hook instead of list_member_hook. </p> </description> <category>Ticket</category> </item> <item> <author>d_rider@…</author> <pubDate>Fri, 20 Mar 2009 21:40:44 GMT</pubDate> <title>cc set https://svn.boost.org/trac10/ticket/2864#comment:2 https://svn.boost.org/trac10/ticket/2864#comment:2 <ul> <li><strong>cc</strong> <span class="trac-author">d_rider@…</span> added </li> </ul> <p> Replying to <a class="ticket" href="https://svn.boost.org/trac10/ticket/2864#comment:1" title="Comment 1">andysem</a>: </p> <blockquote class="citation"> <p> You can try using list_base_hook instead of list_member_hook. </p> </blockquote> <p> Ok, thank you. It helped partly. Now I can use following </p> <pre class="wiki">struct Linked : public list_base_hook&lt;&gt; { list&lt;Linked&gt; m_children; }; </pre><p> with one limitation - it's impossible to use tags. Also I've reproduced this issue on mingw ((GCC) 3.4.5 (mingw-vista special <a class="changeset" href="https://svn.boost.org/trac10/changeset/3" title="Tweak disclaimer text">r3</a>)) </p> <p> Regards, Yuriy </p> Ticket Ion Gaztañaga Fri, 12 Jun 2009 12:35:23 GMT <link>https://svn.boost.org/trac10/ticket/2864#comment:3 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/2864#comment:3</guid> <description> <p> Your report is not a bug, it's standard C++, since you can't define a pointer to member "&amp;Linked::_myhook" to the class inside the class (the compiler can't deduce the offset of the element). That's an inherent limitation of member hooks. </p> <p> Why do you say is impossible to use tags when using base hooks? </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Ion Gaztañaga</dc:creator> <pubDate>Thu, 25 Jun 2009 16:13:20 GMT</pubDate> <title>status changed; resolution set https://svn.boost.org/trac10/ticket/2864#comment:4 https://svn.boost.org/trac10/ticket/2864#comment:4 <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">worksforme</span> </li> </ul> Ticket