Note that there are some explanatory texts on larger screens.

plurals
  1. POStrange VC++ compile error, C2244
    primarykey
    data
    text
    <p>Take a look at this peice of code:</p> <pre><code>template &lt;typename K,typename T&gt; Pointer&lt;typename Collection&lt;T&gt;::Iterator&gt; BinaryTree&lt;K,T&gt;::GetBeginning() const { return new BinaryTreeIterator(this,BinaryTreeIterator::Position::atBeginning); } </code></pre> <p>When I try to compile it using VSTS 2008, I get:</p> <pre><code>error C2244: 'BinaryTree&lt;K,T&gt;::GetBeginning' : unable to match function definition to an existing declaration see declaration of 'BinaryTree&lt;K,T&gt;::GetBeginning' 2&gt; definition 2&gt; 'Pointer&lt;Collection&lt;T&gt;::Iterator&gt; BinaryTree&lt;K,T&gt;::GetBeginning(void) const' 2&gt; existing declarations 2&gt; 'Pointer&lt;Collection&lt;T&gt;::Iterator&gt; BinaryTree&lt;K,T&gt;::GetBeginning(void) const' </code></pre> <p>The declaration:</p> <pre><code>Pointer&lt;Iterator&gt; GetBeginning() const; </code></pre> <p>is inside the class. BinaryTree indirectly inherits from Collection, and BinaryTreeIterator indirectly inherits from Iterator, both nested classes of their respective containers.</p> <p>You can easily see that even in the error report, both definition and declaration are identical. Is there really something wrong here?</p> <p>I found that microsoft released a <a href="http://support.microsoft.com/kb/930198" rel="nofollow noreferrer">hotfix</a>: "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.</p> <p>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.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload