Date: Thu, 16 Mar 1995 11:08:12 -0800 (PST) From: Gordon Hogenson To: Erik Laumb Jensen Cc: djgpp AT sun DOT soe DOT clarkson DOT edu Subject: inline template functions On Thu, 16 Mar 1995, Erik Laumb Jensen wrote: > > test.cc: In function `int main()': > test.cc:1: warning: can't inline call to `void tSwap(int &,int &)' > Am I missing something here? I know that the 'inline' keyword is a request > only, but if template functions can't be inlined (where the equivalent > non-template function can), I'd just as well write macros. As I Current version of g++ can't inline template functions on their *first* use. This is a limitation, and is caused by the fact that the template function is instantiated at that point. To get around this, just add an explicit instantiation directive to your file, template void tSwap(int&, int&); or something like that. This will cause the template to be instantiated at that point, so that it can be expanded inline when it is actually used. -- Gordon J. Hogenson Tel. (206) 685-2951