Boost logo

Boost Users :

Subject: Re: [Boost-users] Boost-users Digest, Vol 3359, Issue 1
From: John M. Dlugosz (mpbecey7gu_at_[hidden])
Date: 2013-02-14 13:59:50


On 2/14/2013 2:26 AM, boost-users-request-at-lists.boost.org |Boost/Allow to home| wrote:
> Message: 5
> Date: Wed, 13 Feb 2013 19:20:40 -0500
> From: Edward Diener<eldiener_at_[hidden]>
> To:boost-users_at_[hidden]
> Subject: Re: [Boost-users] [Preprocessor] Generate #include directive
> with preprocessor
> Message-ID:<kfhaku$ikt$1_at_[hidden]>
> Content-Type: text/plain; charset=ISO-8859-1; format=flowed
>
> On 2/13/2013 6:43 AM, Adam Badura wrote:
>> >Is it possible to use preprocessor to generate #include directives (or
>> >in any other way include the files)?
> No it is not possible. You cannot define a macro which expands to other
> another macro definition or any other basic preprocessor construct,
> including the #include.
>
>
It is possible to use a macro as the name of the file to include. So you can choose the
file via preprocessing logic, but not alter the fact that some file is to be included.
So... given an empty file and a file with
     #include M1
     #include M2
you can use recursion to include an arbitrary number of different files based on
preprocessor logic.

--John


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