Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Export is only support by the EDG frontend, comercially only available in the Comeau compiler as far as I know.</p> <p>Export doesn't eliminate the need for source disclosure, nor does it reduce compile dependencies, while it requires a massive effort from compiler builders. </p> <p>So Herb Sutter himself asked compiler builders to 'forget about' export. As the time investment needed would be better spend elsewhere... so I don't think export will ever be implemented by other compilers after they saw how long it took, and how little was gained.</p> <p>The paper is called "Why we can't afford export", it's listed on <a href="http://gotw.ca/publications" rel="nofollow noreferrer">Sutters blog</a> but no pdf there (a quick google should turn it up though), it's six years old now, I suppose they all listened and never bothered :)</p> <p>Many people use two header files (e.g. <code>.hpp</code> and <code>.ipp</code>), one with only the declaration, and one with the definitions, then it's simply a matter of including one in the other.</p> <p>foo.hpp</p> <pre><code>#ifndef MY_TEMPLATES_HPP #define MY_TEMPLATES_HPP template&lt; class T &gt; void foo(T &amp; t); #include "foo.ipp" #endif </code></pre> <p>foo.ipp</p> <pre><code>#ifdef MY_TEMPLATES_IPP nonsense here, that will generate compiler error #else #define MY_TEMPLATES_IPP template&lt; class T &gt; void foo(T &amp; t) { ... // long function } #endif </code></pre> <p>This only gains some clarity of course, nothing really changes compared to simply inlining everything in one header file.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload