Boost logo

Boost :

Subject: [boost] [parameter] referring to argument types in BOOST_PARAMETER_FUNCTION return values
From: Erik Erlandson (eje_at_[hidden])
Date: 2013-11-05 09:54:32


There is documentation that demonstrates using boost::parameter::value_type<> to extract the type of an argument in the boost::parameter library. However, the example does *not* use the BOOST_PARAMETER_FUNCTION() macro, and so the resulting function doesn't benefit from all the features you can get from that macro:

Section 3.2.2:
http://www.boost.org/doc/libs/1_54_0/libs/parameter/doc/html/index.html#more-argumentpacks

I was able to fairly easily obtain the same kind of arg type information inside of a BOOST_PARAMETER_FUNCTION() declaration, which I show in this example:
https://gist.github.com/erikerlandson/7319975

To come up with that, I had to throw '-E' and examine the macro expansions to determine that 'Args' is the appropriate argument-pack template name to use. In other words, what I did doesn't appear to be officially supported:

// not officially documented or supported?
(typename boost::parameter::value_type<Args, tag::c, int>::type)

However, I don't see any barrier to officially supporting the above. All it requires is a promise that 'Args' is the template name that will be generated by the macros. Alternatively, provide a new utility macro, such as:

#define BOOST_PARAMETER_ARG_TYPE(arg_name) typename boost::parameter::value_type<[template arg name], [namespace]::arg_name, int>::type


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