I have a class
template <typename T> struct Dispatch;
which is used to call a type-specific function. For example, suppose I have dispatchers like
template <> struct Dispatch <MyClass> {
static void Apply (void* a, MyClass& m)
{
::memcpy (a, &m, sizeof (m));
}
};
Now I have a bunch of classes, for whom I have a type-character ArrayTypes. I would like to do something like:
template <> struct Dispatch <enable_if<IsArrayType>>
{
template <typename ArrayType>
static void Apply (void* a, ArrayType& m)
{
::memcpy (a, &m, ArrayTypeTraits<ArrayType>::GetSize (m));
}
};
Is it possible?
source
share