
On Sat, 2007-09-01 at 17:17 -0400, David Abrahams wrote:
on Sat Sep 01 2007, Douglas Gregor <doug.gregor-AT-gmail.com> wrote:
while an AST-producing C++ parser won't have much less code than a full C++ compiler, it will execute far less of that code. You need template instantiation and overload resolution, but only in very limited cases.
Seems to me that parsing almost any non-templated code that uses a class template for anything will need template instantiation. What am I missing?
Yes, class templates used in non-templated code will often have to be instantiated. But the member functions of those class templates don't need to be instantiated, nor do the bodies of other function templates used from non-template code. Since most templates that get instantiated are instantiated from other templates, not having to instantiate function bodies can save a lot of time. - Doug