From: vesa_karvonen (vesa_karvonen_at_[hidden])
Date: 2002-03-08 09:09:00
--- In boost_at_y..., "David Abrahams" <david.abrahams_at_r...> wrote:
> From: "vesa_karvonen" <vesa_karvonen_at_h...>
> > --- In boost_at_y..., "David Abrahams" <david.abrahams_at_r...> wrote:
> > > From: "vesa_karvonen" <vesa_karvonen_at_h...>
> And PLEASE make it clear that I can just pass "ignore" for R in most
> simple cases.
hmm... I've tried to use the same one character names for every macro
parameter used for the same purpose in the library, but there are
still many exceptions to the rules. I'll try to fix those exceptions
and add a separate page that explicitly explains the naming of
The R and D parameters are actually "generated" by BOOST_PP_FOR() and
BOOST_PP_WHILE(), respectively, and passed to the user written macro.
Both R and D serve as recursion depth and are an unfortunate
implementation detail necessitated by the C++ preprocessor. The R and
D parameters can often be ignored by the user.
The P parameter is a parameter specified by the user and is passed to
the user written macro. The P parameter serves as a way to provide
context for the user written macro. Many user written macros do not
need the context and the user can pass almost anything (e.g. 'ignore'
or 'dummy') as the P parameter. I personally recommend '_' (a single
underscore), because it is often used for the same or similar purpose
in functional programming languages.
> You could look at
> boost/python/converter/from_python_data.hpp for what I ended up
That looks quite nice.
As this case requires iteration over types (which can be done using
template metaprogramming), and is not a specialization of a template
(which can not be done using template metaprogramming), I think that
it should be possible to achieve the same effect using only MPL,
which might be preferable.
The basic idea would be to make a metafunction that generates nested
unions. Consider the following union:
template<class T0, class T1>
The idea is to generate nested union like this:
union_pair<T1, union_pair<T2, ... union_pair<TN, char> ... > >
The above kind of nested union can certainly be generated using MPL.
It should provide an alignment that is at least as high as the
alignment of the highest aligned type TI.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk