Boost logo

Boost Users :

Subject: Re: [Boost-users] binary mpl::transform fails to compile with fusion::vector
From: Aleksey Gurtovoy (agurtovoy_at_[hidden])
Date: 2009-06-22 00:29:08


On Wed, 17 Jun 2009 12:07:33 -0500, Joel de Guzman <djowel_at_[hidden]>
wrote:

> Mike Tegtmeyer wrote:
>> I am hoping someone can point me the in right direction regarding this
>> code snippit failing to compile. My suspicion is that it is a header
>> problem but any help would be appreciated.
>> In short, I seem to be missing why the binary form of mpl::transform
>> won't work with fusion::vector. (unary form works just fine).
>> The code below just attempts to make a std::pair<> from the contents
>> of two sequences (this is just an example to illustrate the transform
>> problem). If the two sequences are mpl::vectors, everything is fine. If
>> they are fusion::vectors then 'lots of errors'.
>> I'm fairly new to both mpl and fusion so I am not ruling out the fact
>> that I have done something stupid.
>>
>
> 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
transform):

     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.

[1]
http://www.boost.org/doc/libs/1_39_0/libs/mpl/doc/refmanual/iterator-category.html

HTH,

-- 
Aleksey Gurtovoy
MetaCommunications Engineering

Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net