Boost logo

Boost :

Subject: Re: [boost] [fusion] undocumented sequence requirement: convert
From: Mathias Gaunard (mathias.gaunard_at_[hidden])
Date: 2012-08-22 16:58:04


On 22/08/2012 22:38, Eric Niebler wrote:
>
> Say I have a valid fusion sequence. I want to use an mpl algorithm on
> it. I include boost/fusion/mpl.hpp and put a nested tag type in my
> sequence that is an alias for fusion::fusion_sequence_tag. So far, so
> good. Then I try to call mpl::pop_back on this sequence, and I find
> that, despite fulfilling all the documented requirements for Fusion
> ForwardSequence, the code fails to compile. That's because of this in
> boost/fusion/mpl/pop_back.hpp:
>
> template <>
> struct pop_back_impl<fusion::fusion_sequence_tag>
> {
> template <typename Sequence>
> struct apply
> {
> typedef typename
> fusion::result_of::pop_back<Sequence>::type
> result;
>
> typedef typename
> fusion::result_of::convert<
> typename fusion::detail::tag_of<Sequence>::type,
> result>::type
> type;
> };
> };
>
> My code doesn't compile because I haven't implemented the
> fusion::convert customization point. Where is that documented and what
> does it do?

As the name suggests, it converts a Fusion sequence type to a MPL
sequence type.

For example, it converts a fusion::vector to a mpl::vector, and a
fusion::list to a mpl::list.

Maybe pop_back shouldn't require that conversion though.


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