Boost logo

Boost Users :

Subject: [Boost-users] [fusion] Using fusion::at_c on a sequence or an unused type
From: teajay (teajay_at_[hidden])
Date: 2010-11-09 17:01:29


Hi,

I'm working on finalizing an extension to spirit/qi in which I need to
extract an attribute from a fusion sequence in a parser context.
The problem I'm facing is that this parser attribute can be an unused
type or a valid fusion sequence.

Just to illustrate my problem:

template <typename Elements,typename Attribute>
struct parser_dispachter
{
template <typename Index>
        void parse(Index &idx, Attribute &attr)
        {
         
fusion::at_c<Index::value>(Elements).parse(fusion::at_c<Index::value>(attr));
                
        }
};

I actually have two cases:
1. Attribute = unused_type -> at_c replacement should return unused
2. Attribute = fusion sequence -> at_c replacement should return the
corresponding attribute reference.

What would be the best solution to extract the give attribute ?

Regards,
Thomas Bernard


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