I am trying to build a specialization for a template class with a compile time constant.
The template class looks like this:
template<class TNativeItem, class TComItem = void,
VARTYPE _vartype = _ATL_AutomationType<TComItem>::type>
class InOutComArray
{
private:
CComSafeArray<TComItem, _vartype> _safeArray;
// ...
public:
InOutComArray(
TNativeItem* items, size_t length,
std::function<TComItem(const TNativeItem&)> convertToCom,
std::function<TNativeItem(const TComItem&)> convertFromCom)
: _safeArray(length)
{
// ...
}
// ...
};
Usage would be for example:
InOutComArray<BOOL, VARIANT_BOOL, VT_BOOL>(
items, length, BOOLToVARIANT_BOOL, VARIANT_BOOLToBOOL));
However, there also exist types that don't require conversion and I wanted to provide a short hand version for this:
InOutComArray<LONG>(items, length);
I tried to implement it like this:
template<class TItem, VARTYPE _vartype = _ATL_AutomationType<TItem>::type>
class InOutComArray<TItem, void, _vartype>
: public InOutComArray<TItem, TItem, _vartype>
{
public:
InOutComArray(TItem* items, size_t length)
: InOutComArray<TItem, TItem, _vartype>(
items, length, NoConverter<TItem>, NoConverter<TItem>)
{
}
};
However, I get the following error:
'_vartype' : default template arguments not allowed on a partial specialization
Is there any way around that?