Boost logo

Boost Users :

Subject: [Boost-users] [parameter][mpl] How to do a union of ArgumentPacks?
From: Jesse Perla (jesseperla_at_[hidden])
Date: 2010-02-17 17:25:22


Sorry... looks like I was getting more complicated than necessary with talks
of unions, mpl, etc. and suddenly realized what the "," actually does. To
answer my own question:

template<typename ArgPack1, typename ArgPack2>
double g(const ArgPack1& args1, const ArgPack2& args2)
{
return f( (args1, args2) ); //comma does the union!
}

//or you can get at the underlying type with decltype as usual.
template<typename ArgPack1, typename ArgPack2>
double g(const ArgPack1& args1, const ArgPack2& args2)
{
typedef typename decltype(args1, args2) union_type;
 union_type args = (args1, args2);
return f(args);
}



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