|
Boost : |
From: Jens Maurer (Jens.Maurer_at_[hidden])
Date: 2002-01-01 12:12:40
I'm only now reading the recent integer library additions from Daryle
Walker, which are already integrated in the CVS.
I've got these comments (I'm only reading the docs, so these
issues may very well be problems with the documentation only):
- static_log2 takes an "unsigned long" as its parameter,
but its "value" is only an "int". This is, strictly speaking,
non-portable code, since there might be machines where an
unsigned long is so large that its logarithm doesn't fit into
an int. I agree that this is *very* unlikely, but I'd like
to see a note in the documentation.
- I don't like the extrema templates. I'd like to see
the integral type as a template parameter, and not as a
fixed "long/unsigned long" choice. Reasons:
* There are compilers where "long long" is actually an
integral type. Currently, I am not able to use boost's
compile-time min/max with values of that type.
* The "long / unsigned long" distinction would be merged
into a single template (one for min, one for max) only,
static_max<> and static_min<>. This seems more orthogonal.
* Since these min/max "functions" are used for compile-time
evaluations anyway, I don't buy the argument that "each
additional template parameter halves the remaining number of
users" in this case: The target audience is not someone having
only a minor understanding of templates and trying to use a
smart pointer, but someone actually doing template (meta-)
programming.
Daryle, what do you think?
Jens Maurer
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk