Boost C++ Libraries: Ticket #1469: [mpl] nested typedef of set has two different meanings https://svn.boost.org/trac10/ticket/1469 <p> This problem was diagnosed by Steve Watanabe after my posting on the developer list (see <a class="ext-link" href="http://thread.gmane.org/gmane.comp.lib.boost.devel/168339/focus=168366"><span class="icon">​</span>http://thread.gmane.org/gmane.comp.lib.boost.devel/168339/focus=168366</a>) </p> <p> Basically the following doesn't compile: </p> <pre class="wiki">#include &lt;boost/mpl/set.hpp&gt; #include &lt;boost/mpl/vector.hpp&gt; #include &lt;boost/mpl/copy.hpp&gt; #include &lt;boost/mpl/insert.hpp&gt; #include &lt;boost/mpl/inserter.hpp&gt; using namespace boost::mpl; template&lt; typename T &gt; &gt; struct as_set : copy&lt; T , inserter&lt; set&lt;&gt; , insert&lt; _1, _2 &gt; &gt; &gt; {}; typedef set&lt;int,char&gt; a_set; typedef vector&lt;int,int,char&gt; a_vector; typedef as_set&lt; a_set &gt;::type set_as_set; typedef as_set&lt; a_vector &gt;::type vector_as_set; typedef next&lt; begin&lt; a_set &gt;::type &gt;::type THIS_IS_OK; typedef next&lt; next&lt; begin&lt; a_set &gt;::type &gt;::type &gt;::type THIS_IS_OK_AS_WELL; typedef next&lt; begin&lt; a_vector &gt;::type &gt;::type THIS_IS_OK_TOO; typedef next&lt; begin&lt; set_as_set &gt;::type &gt;::type THIS_WORKS_TOO; typedef next&lt; next&lt; begin&lt; set_as_set &gt;::type &gt;::type &gt;::type THIS_FAILS; typedef next&lt; next&lt; begin&lt; vector_as_set &gt;::type &gt;::type &gt;::type THIS_FAILS_TOO; </pre><p> Steve Watanabe diagnosed this to be a problem of mpl::set using the nested typedef 'type' for two different purposes: one as an alias of the set&lt;&gt;, the other refering to the item type. The result is that upon iteration the termination condition isn't recognized and the iterator blows up </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/1469 Trac 1.4.3