R
The problem is next. C++ scales are functional, much closer to macroes than to functions/classes. It's a clean compilation time. It is not possible to " mop " the template in such a way that it can then simply be tied to the programme (unlike functions and classes). That's why you're gonna have to keep a text in an objective file anyway, and there's no winning.Why isn't it possible to collate into an objective code in advance? Look at this simple code:template <typename T1, typename T2>
void f(T1 t1)
{
T2 t2 = t1;
}
That's it. http://en.cppreference.com/w/cpp/language/copy_initialization ♪ Depending on types T1 and T2as well as the visibility of other types at the point of use, it may be combined to challenge the best available http://en.cppreference.com/w/cpp/language/converting_constructor (and type conversion T2 to the type of argument of the designer, if they do not match, http://en.cppreference.com/w/cpp/language/cast_operator standard conversions, numerical conversions, including loss of precision and change of view between the floating point and whole numbers.Do you think it's possible to encrypt this in an objective code (i.e., basically on the assembler) Not knowing at the time of compilation T1 and T2?There's a whole article from EDG analyzing why the export of the templates won't take off or cost the candle: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2003/n1426.pdf ♪ And another one: http://blogs.msmvps.com/vandooren/2008/09/24/c-keyword-of-the-day-export/ ♪In more detail, the following problems (from article EDG):EDG had 1.5 years for design and 3 years for implementation (compared to Java for only two years). However, EDG is not a company, it has good developers, with years of experience in developing C+++ compilers.The typical structure of the C+++ compiler is not suitable for the implementation of this thing. The design of the compiler had to be redesigned, and it was likely that all other developers would have to do so if exports became a mandatory part of the standard.Many mistakes that were not necessarily detectable without the export of the templates (e.g. ODR-rule violation, which is only UB standard), with exports, are in fact mandatory.The formats of the intermediate files will have to change completely.This thing doesn't do so much good:
It is believed that the original library code will no longer be required to export the templates. That's not true. As the templates work at a level close to the syntax, together with the libraries, it will be necessary to supply either the text of the templates or its direct equivalent (e.g. syntax tree), as all the information is needed during the installation of the templates.It is believed that the export of the templates will accelerate the compilation and reduce the number of relationships. That's not true, because (in consequence of the syntax nature of the templates) the exported template is impossible in advance. Compilation♪ The combination of the template (at least the syntax tree level) will still have to be repeated this time at the design stage. So the compiler will have to fulfil. at least Same job as no exports.The only real work plus the exports of the templates is that the macs are not leaving the boundaries of the broadcast unit. (In the case of non-export, the macroes defined in the file with the template are " visible " to all who use the template.) This positive effect, however, can be achieved through a stricter code organization; there are other, lighter and more effective methods of addressing this problem at the language standard level.