fixes on the lazy stuff

[SVN r1729]
This commit is contained in:
Jaakko Järvi
2003-11-03 20:43:50 +00:00
parent 13f886ce1d
commit a5c7239fa9

View File

@@ -7,7 +7,7 @@
<META name="GENERATOR" content="hevea 1.06"> <META name="GENERATOR" content="hevea 1.06">
</HEAD> </HEAD>
<BODY > <BODY >
<!--HEVEA command line is: hevea enable_if_docs_for_boost.tex --> <!--HEVEA command line is: hevea -nosymb -noiso -pedantic -v enable_if_docs_for_boost.tex -->
<!--HTMLHEAD--> <!--HTMLHEAD-->
<!--ENDHTML--> <!--ENDHTML-->
<!--PREFIX <ARG ></ARG>--> <!--PREFIX <ARG ></ARG>-->
@@ -20,7 +20,7 @@
<img border="0" src="c++boost.gif" align="center" width="277" height="86">enable_if</h1> <img border="0" src="c++boost.gif" align="center" width="277" height="86">enable_if</h1>
<BR> <BR>
<BR> <BR>
Copyright 2003 Jaakko J<EFBFBD>rvi, Jeremiah Willcock, Andrew Lumsdaine.<BR> Copyright 2003 Jaakko J&auml;rvi, Jeremiah Willcock, Andrew Lumsdaine.<BR>
<BR> <BR>
<!--TOC section Introduction--> <!--TOC section Introduction-->
@@ -261,8 +261,8 @@ partial specializations as well.<BR>
<H3><A NAME="htoc8">3.3</A>&nbsp;&nbsp;Lazy <TT>enable_if</TT></H3><!--SEC END --> <H3><A NAME="htoc8">3.3</A>&nbsp;&nbsp;Lazy <TT>enable_if</TT></H3><!--SEC END -->
<A NAME="sec:enable_if_lazy"></A> <A NAME="sec:enable_if_lazy"></A>
The standard is not entirely clear on how deep into nested template instantiations SFINAE applies, In some cases it is necessary to avoid instantiating part of a
and there is variation among compilers. For example: function signature unless an enabling condition is true. For example:
<PRE> <PRE>
template &lt;class T, class U&gt; class mult_traits; template &lt;class T, class U&gt; class mult_traits;
@@ -294,6 +294,18 @@ operator*(const T&amp; t, const U&amp; u) { ... }
that defines a nested type named <TT>type</TT> whenever the first that defines a nested type named <TT>type</TT> whenever the first
parameter (the condition) is true.<BR> parameter (the condition) is true.<BR>
<BR> <BR>
<!--TOC paragraph Note-->
<H5>Note</H5><!--SEC END -->
Referring to one member type or static constant in a traits class
causes all of the members (type and static constant) of that
specialization to be instantiated. Therefore, if your traits classes
can sometimes contain invalid types, you should use two distinct
templates for describing the conditions and the type mappings. In the
above example, <TT>is_multipliable&lt;T, U&gt;::value</TT> defines when
<TT>mult_traits&lt;T, U&gt;::type</TT> is valid.<BR>
<BR>
<!--TOC subsection Compiler workarounds--> <!--TOC subsection Compiler workarounds-->
<H3><A NAME="htoc9">3.4</A>&nbsp;&nbsp;Compiler workarounds</H3><!--SEC END --> <H3><A NAME="htoc9">3.4</A>&nbsp;&nbsp;Compiler workarounds</H3><!--SEC END -->
@@ -367,16 +379,16 @@ Smith whose findings have influenced the library.<BR>
<H2>References</H2><!--SEC END --> <H2>References</H2><!--SEC END -->
<DL COMPACT=compact><DT><A NAME="jarvi:03:cuj_arbitrary_overloading"><FONT COLOR=purple>[1]</FONT></A><DD> <DL COMPACT=compact><DT><A NAME="jarvi:03:cuj_arbitrary_overloading"><FONT COLOR=purple>[1]</FONT></A><DD>
Jaakko J<EFBFBD>rvi, Jeremiah Willcock, Howard Hinnant, and Andrew Lumsdaine. Jaakko J&auml;rvi, Jeremiah Willcock, Howard Hinnant, and Andrew Lumsdaine.
Function overloading based on arbitrary properties of types. Function overloading based on arbitrary properties of types.
<EM>C/C++ Users Journal</EM>, 21(6):25--32, June 2003.<BR> <EM>C/C++ Users Journal</EM>, 21(6):25--32, June 2003.<BR>
<BR> <BR>
<DT><A NAME="jarvi:03:c++typeclasses"><FONT COLOR=purple>[2]</FONT></A><DD> <DT><A NAME="jarvi:03:c++typeclasses"><FONT COLOR=purple>[2]</FONT></A><DD>
Jaakko J<EFBFBD>rvi, Jeremiah Willcock, and Andrew Lumsdaine. Jaakko J&auml;rvi, Jeremiah Willcock, and Andrew Lumsdaine.
Concept-controlled polymorphism. Concept-controlled polymorphism.
In <EM>Proceedings of Generative Programming and Component In Frank Pfennig and Yannis Smaragdakis, editors, <EM>Generative
Engineering (GPCE'03)</EM>, September 2003. Programming and Component Engineering</EM>, volume 2830 of <EM>LNCS</EM>, pages
To appear.<BR> 228--244. Springer Verlag, September 2003.<BR>
<BR> <BR>
<DT><A NAME="vandevoorde2002:templates"><FONT COLOR=purple>[3]</FONT></A><DD> <DT><A NAME="vandevoorde2002:templates"><FONT COLOR=purple>[3]</FONT></A><DD>
David Vandevoorde and Nicolai&nbsp;M. Josuttis. David Vandevoorde and Nicolai&nbsp;M. Josuttis.
@@ -390,7 +402,7 @@ Addison-Wesley, 2002.</DL>
<hr></hr> <hr></hr>
<B>Contributed by:</B> <BR> <B>Contributed by:</B> <BR>
Jaakko J<EFBFBD>rvi, Jeremiah Willcock and Andrew Lumsdaine<BR> Jaakko J&auml;rvi, Jeremiah Willcock and Andrew Lumsdaine<BR>
<EM>{jajarvi|jewillco|lums}@osl.iu.edu</EM><BR> <EM>{jajarvi|jewillco|lums}@osl.iu.edu</EM><BR>
Indiana University<BR> Indiana University<BR>
Open Systems Lab Open Systems Lab