|
Boost : |
Subject: Re: [boost] [fusion] inconsistency in size metafunction
From: dan marsden (danmarsden_at_[hidden])
Date: 2009-09-27 10:37:41
Jean-Louis Leroy wrote:
> BOOST_MPL_ASSERT((is_same<result_of::size<seq1>::type, result_of::size<seq2>::type>));
>}
>
>One would not expect this to fail, however it does :
>
>'boost::mpl::assertion_failed' : cannot convert parameter 1 from 'boost::mpl::failed ************boost::is_same<T,U>::* ***********' to 'boost::mpl::assert<false>::type'
>1> with
>1> [
>1> T=boost::mpl::int_<2>,
>1> U=boost::mpl::integral_c<int,2>
>1> ]
This failure is reasonable IMO, the documented return type of size is an MPL
integral constant.. Ensuring that the same MPL type is used everywhere
would require marginally more TMP overhead, and make things fiddlier for
implementers of sequences.
We could possibly provide consistent use of the same MPL type for all
the Fusion built in sequence types, but I think that would just hide
bugs in user code. The comparison should be with mpl::equal_to.
>J-L
Cheers
Dan
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk