Boost C++ Libraries: Ticket #3204: binary mpl::transform fails to compile with fusion::vector https://svn.boost.org/trac10/ticket/3204 <p> Comments from boost-users mailing list: </p> <p> &lt;quote&gt; </p> <blockquote class="citation"> <p> Trying the code, it seems mpl::(binary)transform is looking for Seq::tag which is not a requirement for MPL::Forward Sequence which mpl::transform requires (<a class="ext-link" href="http://tinyurl.com/l6kcb4"><span class="icon">​</span>http://tinyurl.com/l6kcb4</a>). fusion::vector adheres fully to an MPL::Forward Sequence. </p> </blockquote> <p> No, the error is caused by the following code in MPL's pair_view (which is the underlying implementation mechanism for the binary transform): </p> <blockquote> <p> typedef typename min&lt; </p> <blockquote> <p> typename iterator_category&lt;iter1_&gt;::type </p> </blockquote> <p> , typename iterator_category&lt;iter2_&gt;::type </p> <blockquote class="citation"> <p> ::type category_; </p> </blockquote> </blockquote> <p> That is, as per iterator_category's requirements <a class="changeset" href="https://svn.boost.org/trac10/changeset/1" title="Import core sources for SVNmanger 0.38 ">[1]</a>, pair_view assumes that the iterator_category's result would be model of MPL's Integral Constant, which does not seem to be the case with Fusion categories. </p> <p> <a class="changeset" href="https://svn.boost.org/trac10/changeset/1" title="Import core sources for SVNmanger 0.38 ">[1]</a> <a href="http://www.boost.org/doc/libs/1_39_0/libs/mpl/doc/refmanual/iterator-categor">http://www.boost.org/doc/libs/1_39_0/libs/mpl/doc/refmanual/iterator-categor</a> y.html &lt;/quote&gt; </p> <p> The following code fails to compile: </p> <pre class="wiki">#include &lt;boost/mpl/transform.hpp&gt; #include &lt;boost/mpl/vector.hpp&gt; #include &lt;boost/fusion/include/mpl.hpp&gt; #include &lt;boost/fusion/container/vector.hpp&gt; #include &lt;utility&gt; using namespace boost; struct my_make_pair { template&lt;typename T1, typename T2&gt; struct apply { typedef std::pair&lt;T1,T2&gt; type; }; }; int main(int argc, char *argv[]) { #if 0 typedef mpl::vector&lt;int,long&gt; seq1; typedef mpl::vector&lt;float,double&gt; seq2; typedef mpl::vector&lt;std::pair&lt;int,float&gt;,std::pair&lt;long,double&gt; &gt; pairs; typedef mpl::transform&lt;seq1,seq2,my_make_pair&gt;::type result; BOOST_MPL_ASSERT(( equal&lt;result,pairs&gt; )); #endif typedef fusion::vector&lt;int,long&gt; seq1; typedef fusion::vector&lt;float,double&gt; seq2; typedef fusion::vector&lt;std::pair&lt;int,float&gt;,std::pair&lt;long,double&gt; &gt; pairs; typedef mpl::transform&lt;seq1,seq2,my_make_pair&gt;::type result; BOOST_MPL_ASSERT(( equal&lt;result,pairs&gt; )); return 0; } </pre> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/3204 Trac 1.4.3 tegtmeye@… Thu, 06 May 2010 18:26:47 GMT milestone changed https://svn.boost.org/trac10/ticket/3204#comment:1 https://svn.boost.org/trac10/ticket/3204#comment:1 <ul> <li><strong>milestone</strong> <span class="trac-field-old">Boost 1.40.0</span> → <span class="trac-field-new">Boost 1.44.0</span> </li> </ul> <p> Still present in 1.43 </p> Ticket anonymous Thu, 06 May 2010 18:27:44 GMT <link>https://svn.boost.org/trac10/ticket/3204#comment:2 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/3204#comment:2</guid> <description> <p> Link should be <a href="http://www.boost.org/doc/libs/1_39_0/libs/mpl/doc/refmanual/iterator-category.html">http://www.boost.org/doc/libs/1_39_0/libs/mpl/doc/refmanual/iterator-category.html</a> </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Steven Watanabe</dc:creator> <pubDate>Sun, 13 Jun 2010 01:22:45 GMT</pubDate> <title>status changed; resolution set https://svn.boost.org/trac10/ticket/3204#comment:3 https://svn.boost.org/trac10/ticket/3204#comment:3 <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">fixed</span> </li> </ul> <p> (In <a class="changeset" href="https://svn.boost.org/trac10/changeset/62889" title="Translate fusion iterator categories to MPL iteraotr categories for ...">[62889]</a>) Translate fusion iterator categories to MPL iteraotr categories for fusion_iterator. Fixes <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/3204" title="#3204: Bugs: binary mpl::transform fails to compile with fusion::vector (closed: fixed)">#3204</a>. </p> Ticket