[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-devel
Subject: questions about c++ templates
From: Benoît_Jacob <jacob () math ! jussieu ! fr>
Date: 2006-08-18 16:11:12
Message-ID: 200608181811.12267.jacob () math ! jussieu ! fr
[Download RAW message or body]
Hi!
I've got a few questions, so if you can help me that'll result in a better
kdesupport/eigen library ;)
1. when you instantiate a template class, does the compiler generate code only
for those methods that are getting called for this particular template
instantiation, or does it generate code for all methods?
Concretely:
-------------------------------------------------------------------
template<class T> class M
{
// 500 methods that DON'T call one another
void method1();
...
void method500();
};
...
M<int> m;
m.method1();
-------------------------------------------------------------------
does that generate code for the 499 unused methods of M<int> ?
2. when you instantiate the same template class for various pointer types,
does the compiler generate code only once ?
Concretely:
M<int *> mi;
M<SomeClass *> mc; // does that generate code for M<SomeClass *> or does
// that share code with M<int *> ?
3. In my code, I have a class A (it's an assignable data type) and it would be
natural for me at some point to do
QList<A> l;
and then to use only a few elementary methods of QList<A> (like append
elements and do a foreach). How much binary size would be replaced by doing
QList<A *> l;
That would be less convenient for me, so I'd like to know if it's worth it.
Benoit
>> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe <<
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic