Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: Class templates and inlining (OT)

Author: Sune Fischer

Date: 14:37:07 12/23/02

Go up one level in this thread


On December 23, 2002 at 17:16:27, Russell Reagan wrote:

>On December 23, 2002 at 16:20:48, Sune Fischer wrote:
>
>>The only way to inline is to write the whole function inside the header
>>file in the class, why is that? Isn't there a way to just have the prototype in
>>the class, and have the inlined function written in the cpp file?
>>What good is cpp files then, seems I only ever need headers???
>
>Another way to think of it is to think of inlined functions working just like a
>macro. If you wrote a macro in a source file, then tried to use that macro in a
>seperate source file, the compiler is going to say, "I don't see no macro." But
>that same macro will work fine in the file that you wrote it in.

Yes you are right.
I put them into their own file "inlines.cpp" (lack of imagination or what:), and
included that source file into the other files. No more unresolved externals,
although I fail to understand why the preprocessor can make one more pass over
the code and find the functions? After all it _can_ find them they aren't
inlined. Perhaps the linker does the connection in that case.

Any word on my template class and that weird error?
I think maybe it's because static functions need external definitions (or
something like that)?

-S.



This page took 0 seconds to execute

Last modified: Thu, 15 Apr 21 08:11:13 -0700

Current Computer Chess Club Forums at Talkchess. This site by Sean Mintz.