Yes, there is a way, it is indirect, though.
As you said, a macro is pretty dumb in its interpretation. However, it still recognizes the parentheses.
Example: BOOST_MPL_ASSERT((boost::is_same<int,int>))
It works using a different level of parentheses, thus forming a Tuple (from a macro point of view).
If you use the Boost.Preprocessor library, you can easily "deploy" Tuple to get its contents intact. Unfortunately, you must know the size of the tuple, so you need an additional parameter
#define MY_MACRO(Size, TemplatedType, Name)\ BOOST_PP_TUPLE_REM(Size)(TemplatedType) Name
And in action:
MY_MACRO(2, (std::map<int,std::string>), idToName);
So yes, it is possible, but the macro must be explicitly configured to handle it.
source share