Boost logo

Boost :

From: Vesa Karvonen (vesa.karvonen_at_[hidden])
Date: 2001-07-04 16:57:34

From: "Douglas Gregor" <gregod_at_[hidden]>
> Vesa,
> Does this mean that BOOST_PREPROCESSOR_EQUAL will also make an appearance?

It seems likely. I have implemented a full range of logical operators (all of
the operations below work on non negative integers (non negative decimal
integer literals to be more accurate)):

  BOOL(X) -- convert (non negative) integer to bool (0 or 1)
  NOR(X,Y) -- used for implement the other boolean operations



However, I'm currently not entirely satisfied with the technique I used. I
hope to be able to implement all of the above and arithmetic operations
(ADD,SUB,MUL,DIV,MOD,...) using a single WHILE primitive (i.e. I don't want to
have 2ND_WHILE, 3RD_WHILE, etc...).

> To full MACROize Boost.Function I need something like:
> #define ADAPTABLE_UNARY() typedef T0 argument_type;
> #define ADAPTABLE_BINARY() typedef T0 first_argument_type; \
> typedef T1 second_argument_type;
> #define
> // Later...
> Thanks for all your great work on this library.
> Doug

Thanks for having a problem that needs the EQUAL primitive! You have just
significantly increased my motivation for continuing work on the library.


The C preprocessor is basically a functional language which has some severe
limitations. It is possible to simulate many functional programming idioms
using the C preprocessor. For instance, it is possible to simulate recursion,
tuples, lists, and even higher order functions, but each of these have severe

You can do many fun things with the preprocessor. For example:


turns into:

  2 3 - 5 - 7 - - - 11 - 13 - - - 17 - 19 - - - 23 - - - - - 29 - 31

and the following snippet

  #define TEST_STR (H,(O,(T,(S,(T,(U,(F,(F,(__,__)))))))))


turns into:


Where TOKENIZE is implemented using the following code:


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