Boost logo

Boost :

From: Markus Schöpflin (markus.schoepflin_at_[hidden])
Date: 2002-03-19 04:03:26

Hi there,

I'm trying to use the BPL for the following and I'm kind of stuck.

#include <boost/preprocessor.hpp>

// This creates a name for a function type, given the name of a function.
#define MAKE_FUNCTION_TYPE_NAME(f_name) BOOST_PP_CAT(f_name,_type)

// This creates a typedef for a function with n parameters.
#define MAKE_TYPEDEF_N(ret_type,f_name,n_params) \
typedef ret_type f_name(MAKE_FUNCTION_TYPE_NAME(f_name)) (BOOST_PP_ENUM_PARAMS(n_params,param))

#define TYPEDEF_0(ret_type,f_name) MAKE_TYPEDEF_N(ret_type,f_name,0)
#define TYPEDEF_1(ret_type,f_name,param0) MAKE_TYPEDEF_N(ret_type,f_name,1)

I would like to use it like this:

TYPEDEF_0(void, foo) -> typedef void foo(foo_type) ()

This works ok. But the one argument version gives me

TYPEDEF_1(void, bar, int) -> typedef void bar(bar_type) ( param0) instead of typedef void bar(bar_type) ( int).

Is it somehow possible to expand the generated parameter list to get the desired result?

TIA, Markus

Boost list run by bdawes at, gregod at, cpdaniel at, john at