From: David Abrahams (dave_at_[hidden])
Date: 2005-03-01 10:40:43
Aleksey Gurtovoy <agurtovoy_at_[hidden]> writes:
> I haven't had a chance to look at it in detail yet, but I'm pretty
> sure that the penatly comes from simply _instantiating_ the vector
> type with a huge number of elements. 'begin' just happened to be the
> first metafunction that causes that in Arkadiy's code. Of course that
> doesn't mean that it's not an issue, especially since we guarantee
> that "predefined" content specification has amortized constant
> time complexity. At the very least, if we find out that there is
> nothing we can do, the docs would need to be fixed.
According to the tests we did for "C++ Template Metaprogramming,"
there is no cost associated with argument arity except on GCC and
Comeau, where the cost rises linearly with N
So, on those compilers, expect that first instantiation of a long
vector template will be expensive. That said, I see no reason why we
need to be causing any instantiation. Everything *could* be done by
partial specialization matching, though it might be verbose to account
for the numbered and unnumbered forms.
-- Dave Abrahams Boost Consulting www.boost-consulting.com
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk