
20 Apr
2011
20 Apr
'11
7:10 a.m.
On 20.04.2011 0:40, Artyom wrote:
From: Mathias Gaunard<mathias.gaunard@ens-lyon.org>
Template meta-programming is not a mean to duplicate code. [...]
I mean binary code.
When you have
template<typename Type> class foo { void bar() { something type independent } }
And then use:
foo<char>
and
foo<wchar_t>
bar would be eventually duplicated in binary code as
void foo<char>::bar(); void foo<wchar_t>::bar();
Regardless the fact it does the same job. And finally you get huge executables that basically copy same things around.
There are techniques to prevent code bloat: in this case you can inherit from type independent base class (with type independent code) -- - Do you speak English? Мужик с глубоким вздохом: - Yes I do. А хули толку?