|
Boost : |
From: Paul Mensonides (pmenso57_at_[hidden])
Date: 2002-06-19 20:57:51
> Paul Mensonides wrote:
> > Ralf, I tweaked my own local copy of the 'factory.hpp' file to use
> > file-iteration just for this part:
> >
> > BOOST_PP_REPEAT_2ND(
> > BOOST_PP_DEC(BOOST_MPL_LIST_PARAMETERS_NUMBER)
> > , BOOST_MPL_AUX_LIST_FACTORY_SPEC
> > , unused
> > )
> >
> > Preprocessing <boost/mpl/type_list.hpp> (which includes 'factory.hpp')
> took me
> > 7-8 minutes before. It now takes 6 seconds--I'd say that is an
> improvement.
>
> Definitely! Can you post your version of the header so we can take a look at
> it and compare with the "traditional" (current) approach?
>
> Aleksey
Aleksey, I'm waiting on Dave's response about the naming scheme. After that,
I'll change a few names and then upload the files. Please consider that these
files are just initial versions, and they may change. But it should give you
something to fool around with.
As for your question, there are two ways to do it supported by the
file-iteration mechanism.
1) the easy way that requires minimal changes to your current code
/* old version
BOOST_PP_REPEAT_2ND(
BOOST_PP_DEC(BOOST_MPL_LIST_PARAMETERS_NUMBER)
, BOOST_MPL_AUX_LIST_FACTORY_SPEC
, unused
) */
// new version, assuming that "iterate.hpp" is included
#define BOOST_PP_LOCAL_MACRO(n) BOOST_MPL_AUX_LIST_FACTORY_SPECIALIZATION(n)
#define BOOST_PP_LOCAL_LBOUND 1
#define BOOST_PP_LOCAL_UBOUND \
BOOST_PP_DEC(BOOST_MPL_LIST_PARAMETERS_NUMBER)
#include BOOST_PP_LOCAL_ITERATE()
This will, ultimately, expand BOOST_MPL_AUX_LIST_FACTORY_SPECIALIZATION with
arguments ranging from 1 to BOOST_MPL_LIST_PARAMETERS_NUMBER - 1, which is the
way it is now, each expansion will be on a separate line.
2) the more complicated, but significantly more debuggable and slightly faster
version, I will upload after I upload the iterations files themselves. It
requires more than a small local change like the above, but more an alteration
of the file as a whole. I sent an example to the Dave (c/o this list) that
should help clarify the more complex mechanism.
Paul Mensonides
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk