POV-Ray : Newsgroups : povray.off-topic : A question about Java generics (not a flame) : Re: A question about Java generics (not a flame) Server Time
7 Sep 2024 19:13:06 EDT (-0400)
  Re: A question about Java generics (not a flame)  
From: Fredrik Eriksson
Date: 15 May 2008 13:11:45
Message: <op.ua7gptbl7bxctx@e6600>
On Thu, 15 May 2008 18:12:17 +0200, Warp <war### [at] tagpovrayorg> wrote:
>> foo.cc:
>> export template<typename T>
>> void foo(T t) { bar(t); }
>
>>   I see how that could make some difference.
>
>   OTOH, thinking about it: There's no function named 'bar' defined  
> anywhere in the scope of foo.cc, so why should that even compile?

'bar' is a dependent name, and must therefore be looked up in both the  
definition context and the instantiation context.



>   I have to admit I don't know if the C++ standard requires the  
> environment of the instantation of the template when compiling the
> template function or not.

When parsing the template definition, only non-dependent names are looked  
up. Dependent names are looked up at the instantiation point; at that  
point both contexts are needed.



-- 
FE


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.