Boost logo

Boost Users :

Subject: Re: [Boost-users] [fusion] making an inner struct boost fusion compatible?
From: Oswin Krause (Oswin.Krause_at_[hidden])
Date: 2012-09-21 02:35:18


HI,

thanks for the reply.
Is it possible to just copy and rename the macro, or does it depend on
newer features of fusion? I need to be compatible with boost 1.45 so i
can't use it directly (also i need to add a few more functions to the
structure later on)

Greetings,
Oswin

On 2012-09-20 21:53, Nathan Ridge wrote:
>> Hi list,
>>
>> I have the following problem:
>>
>> template<class T, class U, class V>
>> struct MyType{
>> struct nested{
>> typename MetaFunc<T>::type a;
>> typename MetaFunc<U>::type b;
>> typename MetaFunc<V>::type c;
>> };
>> };
>>
>> now this inner struct must be a boost fusion compatible random
>> access
>> sequence. The examples cover only structs on namespace lvel, how can
>> i
>> handle this way? Later these classes will be generated by a macro
>> automatically so even dirty hacks are allowed :). But i don't want
>> to
>> clatter the namespace by pulling nested outside of the class.
>>
>> Is there an easy way or do i have to write the necessary
>> mtafunctions
>> to make this possible?
>
> You should be able to use BOOST_FUSION_DEFINE_STRUCT_INLINE [1]
> as follows:
>
> template<class T, class U, class V>
> struct MyType{
>     BOOST_FUSION_DEFINE_STRUCT_INLINE(
>         nested,
>         (typename MetaFunc<T>::type, a)
>         (typename MetaFunc<U>::type, b)
>         (typename MetaFunc<V>::type, c)
>     )
> };
>
> Note however that BOOST_FUSION_DEFINE_STRUCT_INLINE is new in Boost
> 1.51.
>
> Regards,
> Nate
>
> [1]
>
> http://www.boost.org/doc/libs/1_51_0/libs/fusion/doc/html/fusion/adapted/define_struct_inline.html
>
> _______________________________________________
> Boost-users mailing list
> Boost-users_at_[hidden]
> http://lists.boost.org/mailman/listinfo.cgi/boost-users


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