Boost logo

Boost :

From: Paul Mensonides (pmenso57_at_[hidden])
Date: 2002-08-01 18:12:58

> >>If Boost.Tuple was PP'ified, nobody would need to do that.
> >
> > <snickers as he considers the EDG preprocessor expanding 10,000 template
> > parameters>
> yeah, yeah :)
> That's a problem with the MPL also: if anyone really wants to make a MPL
> list (or vector) of 10,000 elements, EDG-based compilers are not going
> to be a lot of help.

This is no longer so relevant with the advent of file-iteration that the PP
library now possesses. While, of course, the library cannot expand 10,000
template parameters directly, it can expand 100--and do it fast.

Also, it depends heavily on how something is implemented. For example:

#define ABC(x) ABC_D(x)
#define ABC_D(x) XYZ(x)

#define XYZ(x) XYZ_D(x)
#define XYZ_D(x) x *much* more efficient in most contexts than this:

#define ABC(x) XYZ(x)
#define XYZ(x) x

I don't know why or see any logical reason for it, but that is the way it is.
If *every* macro had a delay like the above, before using its arguments, things
would get even faster yet. :|

BTW, I have an implementation that I'm 'perfecting' of high-precision arithmetic
sitting on my computer. It implements full ten-digit arithmetic. Addition,
subtraction, and multiplication are all constant-time operations and fast--even
on EDG. Division (and modulus) is not constant-time and not as fast, but it
should still be usable on EDG if necessary. With those primitives, the
preprocessor library *could* generate 10,000 template parameters--but I don't
recommend it. :)

Paul Mensonides

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