Subject: Re: [boost] [offtopic] C++11 useful trick
From: Roland Bock (rbock_at_[hidden])
Date: 2012-07-04 02:12:51
On 2012-07-03 20:52, Roland Bock wrote:
> On 2012-07-03 19:50, Roland Bock wrote:
>> On 2012-07-03 19:36, Eric Niebler wrote:
>>> And clang crashes when I add another row of parameters in Eric's
>>> version. No problems with my version...
>>> I hope you filed a bug. :-)
>> Will do :-)
This is going way over my current abilities, but the ticket has caught
--- Comment #5 from Richard Smith <richard-llvm_at_[hidden]> 2012-07-03 16:31:55 CDT ---
To be clear, we have three problems on the original code:
1) We don't appear to apply the instantiation depth limit in this case (we
still hit a stack overflow with -ftemplate-depth=1).
2) The stack usage per instantiation is sometimes high enough to blow out the
stack before we would have hit the limit anyway (depending on ulimits).
3) The compile-time (and, potentially, runtime) performance is quadratic in the
number of arguments (but this is fundamental to the way the code has been
Your second attachment avoids the first problem by using class templates (for
which the limit is enforced), and mitigates the second problem (because the
stack usage per instantiation is lower for that case).
- original code: Eric's version
- second attachment: my "boring" version
Richard also offers an alternative (see ticket link above) which he
claims to be much more effective, but I haven't comprehended it yet...
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk