Boost logo

Boost :

From: Terje Slettebø (tslettebo_at_[hidden])
Date: 2002-10-24 01:04:37

>From: "Edward Diener" <eddielee_at_[hidden]>

> "Andrei Alexandrescu" <andrewalex_at_[hidden]> wrote in message
> news:ap7ji0$gv7$
> > "Edward Diener" <eddielee_at_[hidden]> wrote in message
> > news:ap7i2b$d9v$
> > > Regex++ is a library. It is a single DLL or LIB file and not just a
> of
> > > template header files.
> >
> > Why?
> Why what ? That it is partly a library or that it is a single library ?
> Surely you know why people create re-usable libraries.
> I would suggest that you ask Dr. John Maddock who wrote it further about
> design. I am not the designer although I have used it successfully in my
> Regular Expression Component Library (
> .
> At least a library allows one to fold common code together.

You're using a little unusual terms, here, I think. You may have header-only
libraries (like much of Boost), or a combination of headers and object code.
When you say "library", here, I assume you mean the latter. Surely, the
header-only libraries are just as much libraries, too?

> Much of the
> underlying Regex++ functionality exists in a library because instantiating
> such code via templates each and every time would really lead to code

That templates in itself would lead to code bloat is a myth. As Andrei and
others points out, if you have a header-only library, you only instantiate
what you need. For example, if you only use char, then it will only
instantiate for that, while a LIB or DLL might contain a lot of
instantiations you _might_ need, and take up unnecessary space, otherwise.
Thus, it's typically the other way around from what you say here, with
header-only libraries leading to less code than precompiled ones.

To quote from above, again:

> At least a library allows one to fold common code together.

(Again, with "library", I assume you mean object code library.) This is
possible with header-only libraries with templates, as well. You may use the
hoisting idiom to move type-independent code outside the template, for
example as a non-templated (or less parameterised) base class or function.
There's no difference between object code-, and header-only libraries in
this respect.



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