Boost logo

Boost :

From: Christoph Ludwig (cludwig_at_[hidden])
Date: 2004-08-13 14:23:53


Hi,

On Sun, Aug 08, 2004 at 11:38:15AM -0700, Robert Ramey wrote:
> Christoph Ludwig wrote:
>
> >> template<class> struct pack;
> >>
> >> template<class T> struct pack<void (T)> {
> >> typedef T type;
> >> };
> >>
> >> BOOST_CLASS_EXPORT( pack<void (DerivedStatus< Algo<int, double >
> >> >)>::type );
>
>
> >That did the trick! Great!
>
> >I am not sure which of Boost's libraries is the most adequate place for
> >such a tool (preprocessor? mpl?), but it is certainly valuable. And if /
> >once there is such a tool in Boost, then the documentation of macros that
> >are likely to take classes genareted from templates as arguments should
> >refer to it.
>
> Hmmm - maybe we should just roll this into export.hpp - Would this create
> any other problems?

I don't see how it could interfere with other libraries if it is
defined in namespace serialization. The only limitation of this
technique I am aware right now is that you almost always need to use
BOOST_CLASS_EXPORT_GUID; the implied guid of BOOST_CLASS_EXPORT is
even in the case of short class template names and short arguments
often longer than the limit of 127 characters. (But then I am testing
this technique only since today and I am still hunting bugs in my
program probably unrelated to the export issue. If there are problems
I may very well not have encountered them yet.)

However, this problem is by no means specific to the serialization
library. Whenever you have a macro that takes a classname you may face
this issue. One could consider it a (inherent) preprocessor
shortcoming solved by means of template programming. Therefore the
preprocessor library or one of the libraries from Boost's Generic
Programming and Template Metaprogramming sections seem a more natural
place to me for such a tool. Of course, I don't know if one of the
authors of these libraries agrees and plans to eventually include such
a template.

Since the next release is (hopefully) not long away I'd only mention
this workaround in the documentation of the export macros. Once the
release is out and everything has settled down there's time to discuss
where this template belongs.

This template requires so few keystrokes that for the time being the
users that need it can easily provide it themselves. But in order to
avoid unnecessary bloat of Boost I wouldn't like to see it duplicated
in several Boost libraries in the end.

Regards

Christoph

-- 
http://www.informatik.tu-darmstadt.de/TI/Mitarbeiter/cludwig.html
LiDIA: http://www.informatik.tu-darmstadt.de/TI/LiDIA/Welcome.html

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