Boost logo

Boost :

From: vesa_karvonen (vesa_karvonen_at_[hidden])
Date: 2002-03-08 08:24:29


--- In boost_at_y..., "Peter Dimov" <pdimov_at_m...> wrote:
[...]
> I haven't found the 'perfect' solution to this problem yet. The
> preprocessor library has the advantage that the preprocessor is
> always present; but it adds a significant amount of obfuscation.

Macro definitions can be a bit difficult to read when they are mixed
with ordinary C++ code. Macro uses, on the other hand, are not very
difficult to read. Most of the macros offered by the preprocessor
library are rather fundamental and should not, IMHO, take a lot of
time to understand. Take BOOST_PP_REPEAT() for example.

  <--->
  #define BOOST_PP_REPEAT(N,M,P)

  Repeats the macro M(I,P) for I = [0,N[.

  In other words, expands to the sequence:

    M(0,P) M(1,P) ... M(BOOST_PP_DEC(N),P)
  <--->

I don't know how to make this any simpler. BOOST_PP_REPEAT() takes a
repetition count, a macro to repeat, and an extra parameter. It then
repeats the macro giving it the index and the extra parameter.

I'll try to find time for PP library during the weekend. There are
many libraries in Boost that could (not should) use the preprocessor
library and it is a problem that people find it too difficult to even
try.


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