Boost logo

Boost :

From: David Abrahams (dave_at_[hidden])
Date: 2005-03-19 17:15:37

"Thorsten Ottosen" <nesotto_at_[hidden]> writes:

> |There was however (as far as I could tell at least) some concern about
> |this approach in the other thread. (Mostly related to code size and
> hm...the function is only going to be used by 3 different classes, right?
> If so at most 3 times the size of a virtual function solution;
> v-tables fill up too; and virtual functions in a class template
> can have *large* code size impact if not all virtual functions
> are used. (So are they?)

They're costly even if they are used. Calling virtual functions
generates a *lot* more code than a trivial inline function does.
Putting type erasure in the lowest-level string design is wrong,
especially if it means calling through virtual functions once per
character (but even if it doesn't). If you want to erase the encoding
information from the type, that should be done in a separate layer, as
with boost::function.

Dave Abrahams
Boost Consulting

Boost list run by bdawes at, gregod at, cpdaniel at, john at