Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: Class templates and inlining (OT)

Author: Russell Reagan

Date: 13:43:20 12/23/02

Go up one level in this thread


On December 23, 2002 at 16:20:48, Sune Fischer wrote:

>I want to do Swap, Max, Sort and all that the smart way, no macros!

The STL has a swap() and a sort() that work on any type.

>Different question, even more serious.
>How tha' heck do I inline functions in C++?
>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???

You have to make the function you want inlined viewable by the place you are
inlining it. If it's in another source file, it's not viewable *from the file
that you are in* (unless you #include it, hince why writing it in an include
file works).

Russell



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.