Boost logo

Boost :

From: Markus Schöpflin (markus.schoepflin_at_[hidden])
Date: 2002-03-20 10:21:08


Vesa Karvonen wrote:
>
> Ok. Here is what I'd do. I'd make a macro looking something like this:
>
> #define DECLARE_FUNCTION(cc,ret_type,name,param_cnt,param_type_tuple)\
> public: \
> ret_type name(FORMAL_PARAM_LIST(param_cnt,param_type_tuple,p)) \
> {return name##_ptr(BOOST_PP_ENUM_PARAMS(param_cnt,p));} \
> private: \
> int (cc *name##_ptr)(FORMAL_PARAM_LIST(param_cnt,param_type_tuple,p))
>
> The macro would then be used like this:
>
> DECLARE_FUNCTION(__stdcall, int, foo, 2, (int, float))
> DECLARE_FUNCTION(__cdecl, int, bar, 1, (double))
>
> (Alternatively you might use a list to pass the parameter types, but this
> would require more typing from the user.)
>

[snip]

Thank you very much for your patience. This is exactly the solution I was looking for. Now the only thing left for me is to actually understand it. :-)

Markus


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