[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Q about g++-3 and template instantiation



On Thu, May 03, 2001 at 11:36:05AM -0300, Dan E. Kelley wrote:
> Ilya, thanks VERY MUCH.  This solved my problem in a flash.  My
> application (38 thousand lines, compared to the 6 lines of my
> test-file) now compiles and links properly in g++-3, and, with a
> preprocessor switch, in g++-2 as well.  In case other folks are
> interested, below is how I now do it (sorry that I test for __GNUC__;
> this code is meant to work for many other compilers as well) ...
> 
>   #if defined(__GNUC__)
> 
>   #if __GNUC__ == 3
> 
>   void
>   std::reverse(std::vector<double>::iterator, std::vector<double>::iterator);
> 
>   #else
> 
>   template void
>   std::reverse(std::vector<double>::iterator, std::vector<double>::iterator);
> 
>   #endif
> 
>   #endif

You could probably reduce this to:

#if defined __GNUC__ && __GNUC__ < 3
template
#endif
void std::reverse(std::vector<double>::iterator, std::vector<double>::iterator);

Just FYI :)

-- 
 -----------=======-=-======-=========-----------=====------------=-=------
/  Ben Collins  --  ...on that fantastic voyage...  --  Debian GNU/Linux   \
`  bcollins@debian.org  --  bcollins@openldap.org  --  bcollins@linux.com  '
 `---=========------=======-------------=-=-----=-===-======-------=--=---'



Reply to: