[TriLUG] OT: A C++ Templated Class Problem
Tanner Lovelace
clubjuggler at gmail.com
Fri Apr 14 14:08:04 EDT 2006
On 4/14/06, Owen Berry <oberry at trilug.org> wrote:
> Templates are powerful, but IMHO they just aren't that easy to read and
> understand in the first place. If you really want clean, generate the
> code for each template type. I don't know of anything off-hand to do
> that for you.
I disagree that they aren't easy to read. I think they read just fine.
You just have to have a mindset that understands templates.
In a different message, Randy Barlow <randy at electronsweatshop.com> wrote:
> Hmm, that did seem to resolve the linker errors, thanks! Is there any
> way to do it without putting all the code in the header though? I only
> ask because I just wanted to keep things clean and easy to read and
> understand by separating the interface from the implementation.
You could just add this at the end of the header file:
#include <filename.cpp>
That would get you the separation you want. You could even
change the file suffice to be something like .ii (for c++ inlines)
so you don't confuse it with normal c++ source files that are
meant to be compiled as normal.
Cheers,
Tanner
--
Tanner Lovelace
clubjuggler at gmail dot com
http://wtl.wayfarer.org/
(fieldless) In fess two roundels in pale, a billet fesswise and an
increscent, all sable.
More information about the TriLUG
mailing list