Boost logo

Boost :

Subject: [boost] [fusion] joint_view bug?
From: Eric Niebler (eric_at_[hidden])
Date: 2011-08-06 17:09:34


The following code asserts at compile time for me. Am I doing something
wrong?

    typedef fusion::vector2<int,int> pair;
    pair p(1,2);
    fusion::joint_view<pair, pair> x(p, p);
    auto begin = fusion::begin(x);
    auto end = fusion::end(x);
    int i = fusion::distance(begin, end);

The assert is on line 39 of fusion/iterator/distance.hpp:

    template <typename Tag>
    struct distance_impl
    {
        // default implementation
        template <typename First, typename Last>
        struct apply : distance_detail::linear_distance<First, Last>
        {
            BOOST_MPL_ASSERT_NOT((traits::is_random_access<First>));
            BOOST_MPL_ASSERT_NOT((traits::is_random_access<Last>));
        };
    };

In this case, First is a joint_view iterator and Last is a vector
iterator, which is indeed random-access. If I simply comment out the
compile-time asserts, the code compiles and works as expected. I think
these asserts are bogus. OK to remove them?

-- 
Eric Niebler
BoostPro Computing
http://www.boostpro.com

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk