[Boost-bugs] [Boost C++ Libraries] #3204: binary mpl::transform fails to compile with fusion::vector

Subject: [Boost-bugs] [Boost C++ Libraries] #3204: binary mpl::transform fails to compile with fusion::vector
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2009-06-22 17:18:20

#3204: binary mpl::transform fails to compile with fusion::vector
 Reporter: tegtmeye@… | Owner: djowel
     Type: Bugs | Status: new
Milestone: Boost 1.40.0 | Component: fusion
  Version: Boost 1.39.0 | Severity: Problem
 Keywords: |
 Comments from boost-users mailing list:

> 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 (http://tinyurl.com/l6kcb4).
> fusion::vector adheres fully to an MPL::Forward Sequence.

 No, the error is caused by the following code in MPL's pair_view
 (which is the underlying implementation mechanism for the binary

     typedef typename min<
           typename iterator_category<iter1_>::type
         , typename iterator_category<iter2_>::type
>::type category_;

 That is, as per iterator_category's requirements [1], 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.


 The following code fails to compile:

 #include <boost/mpl/transform.hpp>
 #include <boost/mpl/vector.hpp>

 #include <boost/fusion/include/mpl.hpp>
 #include <boost/fusion/container/vector.hpp>

 #include <utility>

 using namespace boost;

 struct my_make_pair {
   template<typename T1, typename T2>
   struct apply {
     typedef std::pair<T1,T2> type;

 int main(int argc, char *argv[])
 #if 0
   typedef mpl::vector<int,long> seq1;
   typedef mpl::vector<float,double> seq2;
   typedef mpl::vector<std::pair<int,float>,std::pair<long,double> > pairs;

   typedef mpl::transform<seq1,seq2,my_make_pair>::type result;

   BOOST_MPL_ASSERT(( equal<result,pairs> ));

   typedef fusion::vector<int,long> seq1;
   typedef fusion::vector<float,double> seq2;
   typedef fusion::vector<std::pair<int,float>,std::pair<long,double> >

   typedef mpl::transform<seq1,seq2,my_make_pair>::type result;

   BOOST_MPL_ASSERT(( equal<result,pairs> ));

   return 0;


Ticket URL: <https://svn.boost.org/trac/boost/ticket/3204>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.

This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:00 UTC