|
Boost : |
From: Marcus Lindblom (macke_at_[hidden])
Date: 2007-05-16 10:25:25
Jody Hagins wrote:
> One of the things I did in this particular library, is version itself
> with a macro like so in say, foo/common.hpp
>
> #define FOO_NAMESPACE PP_build_namespace(foo, FOO_MAJOR_VERSION)
> namespace FOO_NAMESPACE { }
> namespace foo = FOO_NAMESPACE;
>
> This means that all code can use the alias "foo" as the namespace name.
>
> The only problem is that the namespace can not be reopened with "foo"
> but must be reopened with the macro name...
>
FWIW, The Xerces C++ API uses the same techinique to version their
libraries. It also has issues with forward declaration, as that, also,
needs to be done in the correct namespace.
/Marcus
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk