On Sat, 28 Apr 2007 18:10:59 +0100 John D Lamb <J.D.Lamb@btinternet.com> wrote:
On Sat, 2007-04-28 at 11:00 -0400, Jerry Feldman wrote:
No. this->i_key is equivalent to i_key in a member function. The issue is with the dual template arguments. i_key is defined in the base class as: ThisType const & i_key;
But the inheriting class does not include the ThisType template parameter. The correct solution, as I found out yesterday afternoon is to refer to i_key as fully qualified: FuBar<ItemType, type_t>::i_key;
That should also work because it makes i_key nondependent and I'm not surprised you spotted that one so quickly.
Was there something about the context of i_key that made this->i_key not work? I don't think I've encountered a context in which it would fail, but it wouldn't surprise me if there are some.
My instinct says we've found alternative solutions to the same problem. Mine avoids some problems with virtual function calls, but I suspect there is going to be some occasion when it won't work. In this case, i_key is a member of the base class: FuBar<ItemType, type_t> I think the problem is the compiler is unable to resolve i_key because of the second template parameter. I'll double check using 'this->.
-- Jerry Feldman <gaf@blu.org> Boston Linux and Unix user group http://www.blu.org PGP key id:C5061EA9 PGP Key fingerprint:053C 73EC 3AC1 5C44 3E14 9245 FB00 3ED5 C506 1EA9