|
Boost Users : |
From: Graeme Lufkin (gwl_at_[hidden])
Date: 2004-02-10 18:31:00
I've recently become excited by the variant class and the apply_visitor
technique. I've got a list of about 20 types that I want to handle in
my variant (they're all related, so I won't need to supply 20 operator()
to my visitors!). So I create a mpl::vector of the types, and then use
make_variant_over to create my particular variant type. All this works
fine (modulo a few days struggling to learn mpl stuff).
When I compile code that declares a variable of this variant type, the
compilation takes unreasonably long (like, 1.5 hours on a 2Ghz
machine). For fewer types it goes much quicker, the transition to
unreasonably long happens around 14 types in the mpl::vector.
Side question: I finally found the macros
BOOST_MPL_USE_PREPROCESSED_HEADERS and BOOST_MPL_LIMIT_VECTOR_SIZE that
I had to suitably define to use such large mpl::vector-s. Are these
documented anywhere, or am I missing the "suggested" way to do this?
Something else I've noticed: the Intel compiler doesn't have the
compilation problem! I've attached sample case code that uses 16 types,
which takes less than 5 seconds to compile with Intel 8.0 and almost 200
with GCC 3.2.2 (both on linux).
When I try the full 20 types I need, GCC chugs for several hours, which
is unacceptable for my project. Is there anything I can do, or is this
a GCC shortcoming that I need to wait for?
-- - Graeme gwl_at_[hidden] "This sentence contains exactly threee erors."
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net