
Suggestions on possible schemes:
( 'a_lib' in the examples denotes a placholder for the name of the
'a_component.hpp' denotes the name of a public header of the library. )
1. Create a 'typeof_support' directory reflecting the public headers of
"Tobias Schwinger" <tschwinger@neoscientists.org> wrote library, the
library. The user enables Typeof support by including additional headers.
Example:
#include <boost/a_lib/a_component.hpp> // ^^^ usual library header #include <boost/a_lib/typeof_support/a_component.hpp> // ^^^ contains the registration for the header above
This scheme looks similar to what we've done with std headers. It may make sense for typeof_support/a_component.hpp to include a_component.hpp.
2. The Typeof registration is done in one separate header per library (module) that checks the include guards to register the components,
Thus avoiding the nead to forward-declare everything?
where the registration is guarded by "registration guards" (as suggested by Arkadiy Vertleyb in the "Typeof and MPL" thread).
The user enables Typeof support for the whole library by including a single header.
Example:
#include <boost/a_lib/a_component.hpp> #include <boost/a_lib/typeof_support.hpp> // The typeof_support header would do the following: // - Check the include guard macros to see which files have been // included // +-- For each of these files: register the components defined within // (guarded by a "registration guard macro") // - Define a macro to notify library headers #includeD later that
It was first suggested by David Abrahams, and was meant to synchronize registrations of the same library done by different library users. What you are suggesting sounds like a new idea to me, and I am not sure I completely understand this. Can you ellaborate? the
// Typeof support header has to be re-#includeD // (for large libraries this approach can be applied on a per-module
basis)
3. The Typeof registration is put into the library's headers protected by
some
conditional. The user enables (or disables) Typeof support by defining a macro.
Example:
#define BOOST_A_LIB_TYPEOF_SUPPORT // ^^^ (or even do it in the Jamfile) #include <boost/a_lib/a_component.hpp>
Regards, Arkadiy