Boost logo

Boost :

Subject: Re: [boost] [locale] Review
From: Max Sobolev (macsmr_at_[hidden])
Date: 2011-04-20 03:10:05


On 20.04.2011 0:40, Artyom wrote:
> From: Mathias Gaunard<mathias.gaunard_at_[hidden]>
>> 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. А хули толку?

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk