Re: C++ templates: no support for 'export' ?
Re: C++ templates: no support for 'export' ?
- Subject: Re: C++ templates: no support for 'export' ?
- From: Paul Walmsley <email@hidden>
- Date: Mon, 31 Mar 2008 09:26:50 +0100
Dan Caugherty wrote:
What other source code organization strategies can I try, other than
(gag)
sticking all of my class methods in the header?
If you have large template methods in your header then it may be worth
seeing if there are large chunks of it that aren't dependent on the
templated class, that you could move into a separate concrete class or
function. I've also come across cases where there has been a lot of
duplicated templated code because one function defines an operation for
vectors, one does it for lists, etc. In this case, rewriting the
interfaces to use either iterators or creating a 'container' template
would remove lots of duplication.
There are many other strategies such as trying to convert the templated
code to use class hierarchies and function overloading, or using type
traits to control type-specific behaviour.
The key question to ask is: how does the behaviour of my templated code
depend on the templated type? Then try to extract all the stuff that
doesn't vary at all.
Paul
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden