|
Boost : |
Subject: Re: [boost] [fusion] joint_view bug?
From: Joel de Guzman (joel_at_[hidden])
Date: 2011-08-06 19:52:56
On 8/7/2011 5:09 AM, Eric Niebler wrote:
> 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?
Indeed, it looks bogus. Feel free to remove, Eric.
Regards,
-- Joel de Guzman http://www.boostpro.com http://boost-spirit.com
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk