For some reason, the following code gives an error Symbol 'TemplateBase' could not be resolved.:
template <typename T>
class TemplateBase
{
TemplateBase(std::map<std::string, T>::const_iterator anIterator)
{ }
};
class SubClass : public TemplateBase<int>
{
SubClass(std::map<std::string, int>::const_iterator anIterator) :
TemplateBase<int>(anIterator)
{ }
};
Strange, when deleting ::const_iterator, an error does not appear, and only remains std::map<std::string, int>:
template <typename T>
class TemplateBase
{
TemplateBase(std::map<std::string, T> aMap)
{ }
};
class SubClass : public TemplateBase<int>
{
SubClass(std::map<std::string, int> aMap) :
TemplateBase<int>(aMap)
{ }
};
In addition, the following function also gives no errors, so it really seems to be related to the combination of calling the base class of the template using const_iterator:
void function()
{
std::map<std::string, int>::const_iterator anIterator;
TemplateBase<int> aTemplateBase(anIterator);
}
Is there any rule against using const_iterator as an argument for base class template constructors that I don't know about? Or is this a compiler error?
I am compiling with MinGW 64bit 4.9.0 on Windows 7 using C ++ 11.