Boost logo

Boost Users :

Subject: Re: [Boost-users] how are the iterative/looping mechanism implemented in boost preprocessor?
From: Marc Poulin (marc.a.poulin_at_[hidden])
Date: 2011-05-24 17:54:57


The C++ preprocessor expands macros ***recursively***.

Recursion is the secret. This is also how functional languages (eg. Haskell)
implement iteration without having looping control structures like "for" or
"while".

On Tue, May 24, 2011 at 3:20 PM, R A <ren_zokuken01_at_[hidden]> wrote:

> at first i thought that the boost library came with it's own
> implementation of a c preprocessor, as i thought that was the only way it
> could be doing all that iteration (multiple "patterned" declarations, etc,
> etc) and the c standard hasn't introduced a notion of counters... i've
> considered concatenation, but that incurs a "final" string to be compared
> which cannot be generated automatically a priori (correct me if i'm
> mistaken). but when i looked at boost thoroughly, it seems to be doing
> everything in standard. so can anybody tell me how that is done?
>



Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net