[Preprocessor] Can we generate token for #include programmatically ?

Here is what I had in mind #define BASE foo.hpp #include BOOST_PP_STRINGIZE(BOOST_PP_CAT(nt2/support/numeric/functions/scalar/,BASE)) It fails because it seems we can't paste stuff ending with / ... Using fiel iteration, how can I circumvent hsi problem and generate a list of #include whose filename are computed from a sequence of name in a BOOST_PP_SEQ and a given, changing, prefix path ?

Joel Falcou wrote:
#define SLASH() / #define BASE nt2/support/numeric/functions #include BOOST_PP_STRINGIZE(BASE SLASH()abs.hpp) this actually works for whatever reason ... Can anyone see if this ugly hack works on VC or other compilers. If yes and if ti's actually something standard accepts, maybe it can be nice to have a generalized version of this in Boost.Preprocessor

Joel Falcou wrote: On Friday, May 15, 2009 10:07 AM
It works on GCC 3.3.3 and 4.1.2. It fails on VC8: fatal error C1083: Cannot open include file: 'nt2/support/numeric/functions /abs.hpp': No such file or directory Notice the space in the pathname. _____ Rob Stewart robert.stewart@sig.com Software Engineer, Core Software using std::disclaimer; Susquehanna International Group, LLP http://www.sig.com IMPORTANT: The information contained in this email and/or its attachments is confidential. If you are not the intended recipient, please notify the sender immediately by reply and immediately delete this message and all its attachments. Any review, use, reproduction, disclosure or dissemination of this message or any attachment by an unintended recipient is strictly prohibited. Neither this message nor any attachment is intended as or should be construed as an offer, solicitation or recommendation to buy or sell any security or other financial instrument. Neither the sender, his or her employer nor any of their respective affiliates makes any warranties as to the completeness or accuracy of any of the information contained herein or that this message or any of its attachments is free of viruses.

OK, i got some VC++ 2008 working overthere. This seems to work on VC and GCC #define BASE() nt2/support/numeric/functions/ #define INCLUDE(Base,File) BOOST_PP_STRINGIZE(Base()File) #include INCLUDE(BASE,abs.hpp)

Joel Falcou wrote: On Friday, May 15, 2009 10:41 AM
This also works: #define BASE() nt2/support/numeric/functions/ #include BOOST_PP_STRINGIZE(BASE()abs.hpp) _____ Rob Stewart robert.stewart@sig.com Software Engineer, Core Software using std::disclaimer; Susquehanna International Group, LLP http://www.sig.com IMPORTANT: The information contained in this email and/or its attachments is confidential. If you are not the intended recipient, please notify the sender immediately by reply and immediately delete this message and all its attachments. Any review, use, reproduction, disclosure or dissemination of this message or any attachment by an unintended recipient is strictly prohibited. Neither this message nor any attachment is intended as or should be construed as an offer, solicitation or recommendation to buy or sell any security or other financial instrument. Neither the sender, his or her employer nor any of their respective affiliates makes any warranties as to the completeness or accuracy of any of the information contained herein or that this message or any of its attachments is free of viruses.

Joel Falcou wrote: On Friday, May 15, 2009 10:37 AM
I don't know the preprocessor well enough to say that. I tried the following, but it didn't help: #define SLASH()/ I also tried this without success: #include BOOST_PP_STRINGIZE(BOOST_PP_CAT(BASE, SLASH()abs.hpp)) error: pasting "functions" and "/" does not give a valid preprocessing token _____ Rob Stewart robert.stewart@sig.com Software Engineer, Core Software using std::disclaimer; Susquehanna International Group, LLP http://www.sig.com IMPORTANT: The information contained in this email and/or its attachments is confidential. If you are not the intended recipient, please notify the sender immediately by reply and immediately delete this message and all its attachments. Any review, use, reproduction, disclosure or dissemination of this message or any attachment by an unintended recipient is strictly prohibited. Neither this message nor any attachment is intended as or should be construed as an offer, solicitation or recommendation to buy or sell any security or other financial instrument. Neither the sender, his or her employer nor any of their respective affiliates makes any warranties as to the completeness or accuracy of any of the information contained herein or that this message or any of its attachments is free of viruses.
participants (2)
-
Joel Falcou
-
Stewart, Robert