The information in this article applies to:
SYMPTOMSWhen you pass a reference to a pointer of the templated type, the compiler incorrectly generates an error at the point where the function is called. The error is: where <type> represents the data type to which the templated data type is being instantiated for the function call. WORKAROUND
You may be able to accomplish the same thing by remembering that pointers
are similar to references, so you may be able to pass a pointer to a
pointer instead of a reference to a pointer. The problem with this is that
it requires code modification at the point where the function is called
because you must pass the address of the pointer. Also, you need to modify
the code at any point within the function where the pointer is referenced,
which means that one more level of de-referencing is required.
STATUSMicrosoft has confirmed this to be a bug in the Microsoft products listed at the beginning of this article. This problem was corrected in Microsoft Visual C++, 32 bit edition, version 4.0. Sample Code to Demonstrate Problem
Example WorkaroundIn this case, the address the pointer points to does not need to be permanently changed, so you could simply remove the ampersane (&) from this line:
This is sufficient to make the program compile and run correctly. If it was
necessary to change the address that ptr points to permanently within the
fn function, you could change it to void fn(T** ptr), and add an additional
level of indirection to every reference of ptr within fn. It would also be
necessary to add the ampersand (&) operator to every call of fn in order to
pass the address of its argument. In the previous code sample, fn(ip) would
have to be changed to fn(&ip).
Additional query words: 2.00 2.10 2.20 9.0 9.00
Keywords : |
Last Reviewed: January 31, 2000 © 2000 Microsoft Corporation. All rights reserved. Terms of Use. |