Boost logo

Boost :

From: Douglas Gregor (dgregor_at_[hidden])
Date: 2007-10-27 11:39:22


On Sat, 2007-10-27 at 11:08 -0400, Arkadiy Vertleyb wrote:
> "Eric Niebler" <eric_at_[hidden]> wrote
>
> > In order for BOOST_TYPEOF to work with xpressive's static regexes
> > (something I'm actively trying to support), I need registrations for
> > reference_wrapper<> and mpl::int_<>. I'm happy to add them, but I'm not
> > sure where. Thoughts?
>
> Looks like the model where authors are responsible for registering their own
> classes dosn't work quite well... Maybe there should be a designated place
> with collective ownership, where interested users could add such
> registrations? This place could mimique the boost directory structure, to
> avoid conflicts, something like:
>
> typeof_registrations
> mpl
> bind
> xpressive
> spirit
> ...

There are several libraries that have this kind of problem. typeof needs
registrations, serialization needs serialize() functions, MPI needs
datatype traits, etc. I wonder if we can solve this problem for all of
Boost with some kind of automatic scheme that says: if you include
header A from one library and header B from another library, you
automatically get whatever glue makes A and B work well together.

It's relatively simple to implement this for two headers. In header A
you have:

#ifdef HEADER_B_INCLUDED
# include <glue_a_and_b.hpp>
#endif

In header B you have:

#ifdef HEADER_A_INCLUDED
# include <glue_a_and_b.hpp>
#endif

For the general case, we would probably want a "glue" subdirectory whose
directory mimics the Boost directory structure (like a generalized
version of your typeof_registrations suggestion). Each header in "glue"
would have a bunch of #ifdef's checking all of the various other
library/header names and including the appropriate glue code.

Overall, it's O(N^2) work in the number of data
structures/headers/libraries (depending on how we chop it up), but users
would get all of the important glue "for free".

        - Doug


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk