Take a look at this peice of code:
template <typename K,typename T>
Pointer<typename Collection<T>::Iterator> BinaryTree<K,T>::GetBeginning() const
{
return new BinaryTreeIterator(this,BinaryTreeIterator::Position::atBeginning);
}
When I try to compile it using VSTS 2008, I get:
error C2244: 'BinaryTree<K,T>::GetBeginning' : unable to match function definition to an existing declaration
see declaration of 'BinaryTree<K,T>::GetBeginning'
2> definition
2> 'Pointer<Collection<T>::Iterator> BinaryTree<K,T>::GetBeginning(void) const'
2> existing declarations
2> 'Pointer<Collection<T>::Iterator> BinaryTree<K,T>::GetBeginning(void) const'
The declaration:
Pointer<Iterator> GetBeginning() const;
is inside the class. BinaryTree indirectly inherits from Collection, and BinaryTreeIterator indirectly inherits from Iterator, both nested classes of their respective containers.
You can easily see that even in the error report, both definition and declaration are identical. Is there really something wrong here?
I found that microsoft released a hotfix: "Certain template code does not compile, and error C2244 occurs after you install Visual Studio 2005 Service Pack 1". However I couldn't find any reference to VSTS 2008.
So first I wanted to check if anybody could spot a real error in the code at a glance, and if it's VS's fault, does anyone know if the above hotfix is the solution and is relevant for 2008 as well.