Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!usc!wuarchive!emory!att!att!cbnewsk!pegasus!hansen From: hansen@pegasus.att.com (Tony L. Hansen) Newsgroups: comp.std.c++ Subject: Re: Compiled templates? Summary: it will be very implementation dependent Keywords: templates, precompilation Message-ID: <1991Mar29.184915.9063@cbnewsk.att.com> Date: 29 Mar 91 18:49:15 GMT References: Sender: hansen@cbnewsk.att.com (tony.l.hansen) Distribution: comp Organization: AT&T Bell Laboratories Lines: 34 < From: Ari.Huttunen@hut.fi (Ari Juhani Huttunen) < Is it possible to distribute compiled templates in binary form, so that < the user can use them as templates, or do you have to supply the source < code for them? < (As I understand it, distribution of compiled libraries is something < that is required of c++ to be successful.) Since templates don't exist yet, the answer is certainly no right now. However, in the future, the answer will be a definite maybe! :-) Seriously, consider what a template consists of: a model (the template) for a class or function in which some type information is missing. The application program will supply a type at compile time which will be melded with the model to form a real class or function definition. The template will have to be presented to the compiler in some form, but it won't necessarily have to be in source form. If a vendor chooses, it may decide to permit some form of "pre-parsing" to occur on templates. This would allow a library creator to distribute a pre-parsed form of the template instead of raw source. Templates pre-instantiated with certain types might be included in a library, but that is a separate issue. For the application to create a version of the template function or class at compile time, it needs access to the definition of the template and not object. The object code for a class instantiated for one type will be considerably different from the object code for a class instantiated for another type, particularly if one is a built-in type and the other is a class type. Is a pre-parsed version of a template close enough to what you call a compiled template? I think the market place will have to decide. By the way, there are many people who argue the premise that compiled libraries are a must. It is certainly not a given. Tony Hansen hansen@pegasus.att.com, tony@attmail.com att!pegasus!hansen, attmail!tony