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

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



DEK> Ilya, thanks VERY MUCH.  This solved my problem in a flash.  My
DEK> application (38 thousand lines, compared to the 6 lines of my
DEK> test-file) now compiles and links properly in g++-3, and, with a
DEK> preprocessor switch, in g++-2 as well.  In case other folks are
DEK> interested, below is how I now do it (sorry that I test for __GNUC__;
DEK> this code is meant to work for many other compilers as well) ...

DEK>   #if defined(__GNUC__)

DEK>   #if __GNUC__ == 3

DEK>   void
DEK>   std::reverse(std::vector<double>::iterator, std::vector<double>::iterator);

DEK>   #else

DEK>   template void
DEK>   std::reverse(std::vector<double>::iterator, std::vector<double>::iterator);

DEK>   #endif

DEK>   #endif

Why use 'preprocessor switch'? AFAIK g++-2 should hanlde correct
syntax too (without keyword 'template'). At least version 2.95.3 does
compiles your example code with 'template' removed. Did you tried to
compile your application with g++-2 with 'template' removed where it
should be removed? If it will not compile and link I will be
surprised.

-- 
 -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
| Ilya Martynov (http://martynov.org/)                                    |
| GnuPG 1024D/323BDEE6 D7F7 561E 4C1D 8A15 8E80  E4AE BE1A 53EB 323B DEE6 |
| AGAVA Software Company (http://www.agava.com/)                          |
 -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-



Reply to: