Defining your C++ template in a .cpp file

Normally all your C++ template classes are implemented in their header files, and when we  tried to move the definition of a template class out to a .cpp file, the compiler complained.  I thought I remembered reading in Stroustrup’s The C++ Programming Language of  a keyword  that could help with this very issue, last time I was doing C++ programming.  A little digging turned up the name of the keyword: export (TC++PL §9.2.3).  However, it’s currently not a good option (also see the beginning of the discussion).

So, back into the header it goes.  :)

Advertisements

,

  1. #2 by danielmeyer on December 23, 2009 - 11:27 am

    Thanks for the pointer, Febil!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s