Boost logo

Boost Users :

From: Ovanes Markarian (om_boost_at_[hidden])
Date: 2008-04-04 09:19:50


Sebastian,

preprocessor can not do parsing of C++ tokens for you, so it can not strip
template paramters. You approach should be reversed:

SOME_MAGIC_DEF_MACRO(myVec, type_seq) should take a boost preprocessor
sequence and genrate a template class instantiation and your pod type.

Macro input would be:

SOME_MAGIC_DEF_MACRO(myVec, ((int)(char)(double)(size_t)(whatever_type)))

This macro expansion should result in:
fusion::vector<int,char,double,size_t,whatever_type> myVec;
and
struct myVec_pod
{
  int v1;
  double v2;
  ...
};

BOOST_PP_SEQ_FOR_EACH or BOOST_PP_SEQ_FOLD_LEFT are your friends.

With Kind Regards,
Ovanes

On Fri, Apr 4, 2008 at 1:34 PM, Sebastian Weber <
sebastian.weber_at_[hidden]> wrote:

> Hi there!
>
> The fusion library seems to be the choice for handling tuple-like data
> in C++. However, for some reasons I would like to be able to transform a
> fusion vector into a pod object. Something like:
>
> fusion::vector<int, double, float> myVec;
>
> SOME_MAGIC_ADAPTER_MACRO(myVec)
>
> The macro or whatever should then turn the vector into
>
> struct myVec_pod {
> int v1;
> double v2;
> float v3;
> };
>
> or similar. Is this possible?
>
> Greetings,
>
> Sebastian Weber
>
> _______________________________________________
> 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