Thread overview
D vs C++ metaprogramming: why are c++ templates inherently slow
Nov 04, 2012
evansl
Nov 04, 2012
Mehrdad
Nov 04, 2012
Timon Gehr
November 04, 2012
This post is in response to Nick's suggestion in this post:


http://forum.dlang.org/thread/k524ke$gvt$1@digitalmars.com#post-20121104000747.00001f10:40unknown

to repost the question here. (please note I have read the link Nick provided, but as noted in my last post to the c++ list, that link, although very convincing, did not answer my question about why ADL and partial specialization are one of the causes of slow compile times.)

So here's the original post to the c++ newsgroup:

In this post:

  http://article.gmane.org/gmane.comp.lib.boost.devel/189925

Eric indicates that Walter Bright believes, in c++:

  that instantiating a template is inherently expensive, and certain
  features of the C++ language (ADL, partial specialization, etc.)
  force that to be the case.

Walter, if Eric is remembering correctly, could you provide a little more explanation on why this is so or provide a link to some document supporting this conclusion?

TIA.

-regards,
Larry




November 04, 2012
On Sunday, 4 November 2012 at 16:44:30 UTC, evansl wrote:
>   that instantiating a template is inherently expensive

Just a guess, but perhaps pattern-matching templates is NP-complete?

November 04, 2012
On 11/04/2012 08:47 PM, Mehrdad wrote:
> On Sunday, 4 November 2012 at 16:44:30 UTC, evansl wrote:
>>   that instantiating a template is inherently expensive
>
> Just a guess, but perhaps pattern-matching templates is NP-complete?
>

That does not say anything about evaluation speed.