I have the following (minimized) code, which worked in VC2005, but no longer works in 2010.
template <typename TDataType>
class TSpecWrapper
{
public:
typedef typename TDataType::parent_type index_type;
public:
template <bool THasTriangles>
void Spec(index_type& io_index)
{ std::cout << "False version" << std::endl; }
template <>
void Spec<true>(index_type& io_index)
{ std::cout << "True version" << std::endl; }
};
It seems that when "index_type" is a dependent type, I always get a C2770: invalid explicit template argument(s) error on the specialization. Note that this code is actually enough to generate the error - an empty main is sufficient to compile it, the template need not even be instantiated.
It works fine if index_type is not a dependent type. Any ideas why this is so in VC2010, if this is actually standard behaviour or a bug, and if I can work around it?