Boost logo

Boost :

From: Aleksey Gurtovoy (agurtovoy_at_[hidden])
Date: 2004-04-29 05:15:12

Alexander Nasonov writes:
> For the purpose of forward declaration of class templates this read-only
> lightweight sequence might be useful. For example, one might declare
> class template Selector in fwd file:
> // empty_sequence.hpp is designed for inclusion into fwd files
> #include <boost/mpl/empty_sequence.hpp>
> template<class Variants = empty_sequence>
> class Selector;

Seems like a reasonable wish, somewhat correlating with 'single_view'
( Why don't you write up the docs for it, and
I'll put it in? A reference page template attached.
> Another way to archieve this could be inclusion of
> <boost/mpl/vector_fwd.hpp> (why there is no such file in mpl?)

There wasn't a use case for it, I guess. The existing "_fwd" headers
facilitale the proper physical layering of the library rather than
anything else. IOW, they are not "user-oriented". Well, I guess a few of
them, like "void_fwd.hpp" are; OTOH, the utility of that particular one
is quite questionable -- given the size of the primary header, it might
as well be a pessimization.

In any case, I guess 'vector' is heavy-wegiht enough to have a forward
declaration. If you are willing to make the refactoring, and submit the
patch (preferrably in/against "mplbook" brach,,
I'll be happy to incorporate it.

> and using
> mpl::vector<> instead. Although, it could extend a set of class templates
> with those modifying template parameter but a user would find it strange to
> include <boost/mpl/vector.hpp> if he only uses Selector<>.

You can go with 'vector0<>' and "boost/mpl/vector/vector0.hpp"
correspondingly, which is a little bit more lightweight. But I agree,
'empty_sequence' is just cleaner, not as much performace POV as conceptually.

[implementation snipped]

> This is not yet complete. I hope that support for some transformations will
> be added later (transformation doesn't change empty_sequence unless the
> size is changed)

I am afraid I don't understand this part.

Aleksey Gurtovoy
MetaCommunications Engineering

Boost list run by bdawes at, gregod at, cpdaniel at, john at