For some classes we can define macros which does explicit template specialization as the folllowing example from Boost Serialization library:
#define BOOST_IS_BITWISE_SERIALIZABLE(T) \
namespace boost { \
namespace serialization { \
template<> \
struct is_bitwise_serializable< T > : mpl::true_ {}; \
}} \
/**/
This works for full specialization like BOOST_IS_BITWISE_SERIALIZABLE(MyClass<int>)
But I would like to create a convenience macro that works for partial specialization with different arguments as following:
template<class T, class Enable>
struct is_bitwise_serializable< MyClassA<T, Enable> > : mpl::true_ {};
template<class T>
struct is_bitwise_serializable< MyClassB<T> > : mpl::true_ {};
template<int N>
struct is_bitwise_serializable< MyClassC<N> > : mpl::true_ {};
.....
I was trying to go through Boost PreProcessor documentation for this problem, but could not proceed a lot. Is it there a Boost PreProcessor solution for this?
BOOST_PP_SEQ_FOR_EACH
orBOOST_PP_LIST_FOR_EACH
. – Xylina