How to fwd decl boost::variant (with type sequences)?
In a large project (winxp, boost 1.38.0, 10K sources) we are using the
boost::variant at some places. The variant types are visible to a large
amount of cpp’s. Many of these source-file are not ‘using’ the variant
at all, a small amount only ‘passes’ a variant type, and an even smaller
amount actually uses it (copy, static-visitor, etc). We have noticed
however that the compile-time increases for all sources-files, even when
the variant is not used. On a single source-file its maybe split of a
second extra but with 10K sources it quickly becomes problem.
First attempt to solve this is to fwd declare the variant using provided
header variant_fwd.hpp.
Example:
[v.h]
#include
MplV; typedef boost::make_variant_over<MplV>::type v;
Now each cpp file must not only include the variant definitions again but also (part of) mpl. How could we solve this issue? One idea we had is to wrap the variant in a class and fwd decl that. Although it works I’m not sure if that is the way to go? Thanks for any advise, Paul
participants (1)
-
Paul