<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html xmlns:v="urn:schemas-microsoft-com:vml"
xmlns:o="urn:schemas-microsoft-com:office:office"
xmlns:w="urn:schemas-microsoft-com:office:word"
xmlns:st1="urn:schemas-microsoft-com:office:smarttags"
xmlns="http://www.w3.org/TR/REC-html40">

<head>
<title>Type Traits Issue List</title>
<meta http-equiv=Content-Type content="text/html; charset=windows-1252">
<meta name=ProgId content=Word.Document>
<meta name=Generator content="Microsoft Word 10">
<meta name=Originator content="Microsoft Word 10">
<link rel=File-List href="n1519_files/filelist.xml">
<o:SmartTagType namespaceuri="urn:schemas-microsoft-com:office:smarttags"
 name="date"/>
<!--[if gte mso 9]><xml>
 <o:DocumentProperties>
  <o:Author>FSC</o:Author>
  <o:LastAuthor>FSC</o:LastAuthor>
  <o:Revision>37</o:Revision>
  <o:TotalTime>288</o:TotalTime>
  <o:Created>2003-09-14T11:28:00Z</o:Created>
  <o:LastSaved>2003-09-20T11:03:00Z</o:LastSaved>
  <o:Pages>1</o:Pages>
  <o:Words>2759</o:Words>
  <o:Characters>15732</o:Characters>
  <o:Company>FSC</o:Company>
  <o:Lines>131</o:Lines>
  <o:Paragraphs>36</o:Paragraphs>
  <o:CharactersWithSpaces>18455</o:CharactersWithSpaces>
  <o:Version>10.3501</o:Version>
 </o:DocumentProperties>
</xml><![endif]--><!--[if gte mso 9]><xml>
 <w:WordDocument>
  <w:SpellingState>Clean</w:SpellingState>
  <w:GrammarState>Clean</w:GrammarState>
  <w:BrowserLevel>MicrosoftInternetExplorer4</w:BrowserLevel>
 </w:WordDocument>
</xml><![endif]--><!--[if !mso]><object
 classid="clsid:38481807-CA0E-42D2-BF39-B33AF135CC4D" id=ieooui></object>
<style>
st1\:*{behavior:url(#ieooui) }
</style>
<![endif]-->
<style>
<!--
 /* Font Definitions */
 @font-face
	{font-family:Wingdings;
	panose-1:5 0 0 0 0 0 0 0 0 0;
	mso-font-charset:2;
	mso-generic-font-family:auto;
	mso-font-pitch:variable;
	mso-font-signature:0 268435456 0 0 -2147483648 0;}
 /* Style Definitions */
 p.MsoNormal, li.MsoNormal, div.MsoNormal
	{mso-style-parent:"";
	margin:0cm;
	margin-bottom:.0001pt;
	mso-pagination:widow-orphan;
	font-size:12.0pt;
	font-family:"Times New Roman";
	mso-fareast-font-family:"Times New Roman";}
h1
	{mso-margin-top-alt:auto;
	margin-right:0cm;
	mso-margin-bottom-alt:auto;
	margin-left:0cm;
	mso-pagination:widow-orphan;
	mso-outline-level:1;
	font-size:24.0pt;
	font-family:"Times New Roman";
	font-weight:bold;}
h2
	{mso-margin-top-alt:auto;
	margin-right:0cm;
	mso-margin-bottom-alt:auto;
	margin-left:0cm;
	mso-pagination:widow-orphan;
	mso-outline-level:2;
	font-size:18.0pt;
	font-family:"Times New Roman";
	font-weight:bold;}
h3
	{mso-style-next:Normal;
	margin-top:12.0pt;
	margin-right:0cm;
	margin-bottom:3.0pt;
	margin-left:0cm;
	mso-pagination:widow-orphan;
	page-break-after:avoid;
	mso-outline-level:3;
	font-size:13.0pt;
	font-family:Arial;
	font-weight:bold;}
h6
	{mso-style-next:Normal;
	margin-top:12.0pt;
	margin-right:0cm;
	margin-bottom:3.0pt;
	margin-left:0cm;
	mso-pagination:widow-orphan;
	mso-outline-level:6;
	font-size:11.0pt;
	font-family:"Times New Roman";
	font-weight:bold;}
p.MsoListBullet, li.MsoListBullet, div.MsoListBullet
	{mso-style-update:auto;
	mso-style-link:"List Bullet Char";
	margin-top:0cm;
	margin-right:0cm;
	margin-bottom:0cm;
	margin-left:18.0pt;
	margin-bottom:.0001pt;
	text-indent:-18.0pt;
	mso-pagination:widow-orphan;
	mso-list:l0 level1 lfo3;
	tab-stops:list 18.0pt;
	font-size:12.0pt;
	font-family:"Times New Roman";
	mso-fareast-font-family:"Times New Roman";}
a:link, span.MsoHyperlink
	{color:blue;
	text-decoration:underline;
	text-underline:single;}
a:visited, span.MsoHyperlinkFollowed
	{color:purple;
	text-decoration:underline;
	text-underline:single;}
p
	{mso-margin-top-alt:auto;
	margin-right:0cm;
	mso-margin-bottom-alt:auto;
	margin-left:0cm;
	mso-pagination:widow-orphan;
	font-size:12.0pt;
	font-family:"Times New Roman";
	mso-fareast-font-family:"Times New Roman";}
code
	{font-family:"Courier New";
	mso-ascii-font-family:"Courier New";
	mso-fareast-font-family:"Times New Roman";
	mso-hansi-font-family:"Courier New";
	mso-bidi-font-family:"Courier New";}
pre
	{margin:0cm;
	margin-bottom:.0001pt;
	mso-pagination:widow-orphan;
	tab-stops:45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;
	font-size:10.0pt;
	font-family:"Courier New";
	mso-fareast-font-family:"Times New Roman";}
span.ListBulletChar
	{mso-style-name:"List Bullet Char";
	mso-style-link:"List Bullet";
	mso-ansi-font-size:12.0pt;
	mso-bidi-font-size:12.0pt;
	mso-ansi-language:EN-US;
	mso-fareast-language:EN-US;
	mso-bidi-language:AR-SA;}
span.SpellE
	{mso-style-name:"";
	mso-spl-e:yes;}
span.GramE
	{mso-style-name:"";
	mso-gram-e:yes;}
@page Section1
	{size:612.0pt 792.0pt;
	margin:72.0pt 90.0pt 72.0pt 90.0pt;
	mso-header-margin:35.4pt;
	mso-footer-margin:35.4pt;
	mso-paper-source:0;}
div.Section1
	{page:Section1;}
 /* List Definitions */
 @list l0
	{mso-list-id:-119;
	mso-list-type:simple;
	mso-list-template-ids:1425471582;}
@list l0:level1
	{mso-level-number-format:bullet;
	mso-level-style-link:"List Bullet";
	mso-level-text:\F0B7;
	mso-level-tab-stop:18.0pt;
	mso-level-number-position:left;
	margin-left:18.0pt;
	text-indent:-18.0pt;
	font-family:Symbol;}
@list l1
	{mso-list-id:1219437320;
	mso-list-type:hybrid;
	mso-list-template-ids:1351929094 67698689 67698691 67698693 67698689 67698691 67698693 67698689 67698691 67698693;}
@list l1:level1
	{mso-level-number-format:bullet;
	mso-level-text:\F0B7;
	mso-level-tab-stop:36.0pt;
	mso-level-number-position:left;
	text-indent:-18.0pt;
	font-family:Symbol;}
@list l2
	{mso-list-id:1462773597;
	mso-list-type:hybrid;
	mso-list-template-ids:-1893857994 67698689 67698691 67698693 67698689 67698691 67698693 67698689 67698691 67698693;}
@list l2:level1
	{mso-level-number-format:bullet;
	mso-level-text:\F0B7;
	mso-level-tab-stop:36.0pt;
	mso-level-number-position:left;
	text-indent:-18.0pt;
	font-family:Symbol;}
@list l2:level2
	{mso-level-tab-stop:72.0pt;
	mso-level-number-position:left;
	text-indent:-18.0pt;}
@list l2:level3
	{mso-level-tab-stop:108.0pt;
	mso-level-number-position:left;
	text-indent:-18.0pt;}
@list l2:level4
	{mso-level-tab-stop:144.0pt;
	mso-level-number-position:left;
	text-indent:-18.0pt;}
@list l2:level5
	{mso-level-tab-stop:180.0pt;
	mso-level-number-position:left;
	text-indent:-18.0pt;}
@list l2:level6
	{mso-level-tab-stop:216.0pt;
	mso-level-number-position:left;
	text-indent:-18.0pt;}
@list l2:level7
	{mso-level-tab-stop:252.0pt;
	mso-level-number-position:left;
	text-indent:-18.0pt;}
@list l2:level8
	{mso-level-tab-stop:288.0pt;
	mso-level-number-position:left;
	text-indent:-18.0pt;}
@list l2:level9
	{mso-level-tab-stop:324.0pt;
	mso-level-number-position:left;
	text-indent:-18.0pt;}
@list l3
	{mso-list-id:1606376135;
	mso-list-type:hybrid;
	mso-list-template-ids:40262988 -319550856 67698691 67698693 67698689 67698691 67698693 67698689 67698691 67698693;}
@list l3:level1
	{mso-level-start-at:3;
	mso-level-number-format:bullet;
	mso-level-text:\F06E;
	mso-level-tab-stop:36.0pt;
	mso-level-number-position:left;
	text-indent:-18.0pt;
	font-family:Wingdings;
	mso-fareast-font-family:"Times New Roman";
	mso-bidi-font-family:"Times New Roman";}
@list l3:level2
	{mso-level-tab-stop:72.0pt;
	mso-level-number-position:left;
	text-indent:-18.0pt;}
@list l3:level3
	{mso-level-tab-stop:108.0pt;
	mso-level-number-position:left;
	text-indent:-18.0pt;}
@list l3:level4
	{mso-level-tab-stop:144.0pt;
	mso-level-number-position:left;
	text-indent:-18.0pt;}
@list l3:level5
	{mso-level-tab-stop:180.0pt;
	mso-level-number-position:left;
	text-indent:-18.0pt;}
@list l3:level6
	{mso-level-tab-stop:216.0pt;
	mso-level-number-position:left;
	text-indent:-18.0pt;}
@list l3:level7
	{mso-level-tab-stop:252.0pt;
	mso-level-number-position:left;
	text-indent:-18.0pt;}
@list l3:level8
	{mso-level-tab-stop:288.0pt;
	mso-level-number-position:left;
	text-indent:-18.0pt;}
@list l3:level9
	{mso-level-tab-stop:324.0pt;
	mso-level-number-position:left;
	text-indent:-18.0pt;}
ol
	{margin-bottom:0cm;}
ul
	{margin-bottom:0cm;}
-->
</style>
<!--[if gte mso 10]>
<style>
 /* Style Definitions */
 table.MsoNormalTable
	{mso-style-name:"Table Normal";
	mso-tstyle-rowband-size:0;
	mso-tstyle-colband-size:0;
	mso-style-noshow:yes;
	mso-style-parent:"";
	mso-padding-alt:0cm 5.4pt 0cm 5.4pt;
	mso-para-margin:0cm;
	mso-para-margin-bottom:.0001pt;
	mso-pagination:widow-orphan;
	font-size:10.0pt;
	font-family:"Times New Roman";}
</style>
<![endif]-->
<meta name="vs_targetSchema"
content="http://schemas.microsoft.com/intellisense/ie5">
<!--[if gte mso 9]><xml>
 <o:shapedefaults v:ext="edit" spidmax="9218"/>
</xml><![endif]--><!--[if gte mso 9]><xml>
 <o:shapelayout v:ext="edit">
  <o:idmap v:ext="edit" data="1"/>
 </o:shapelayout></xml><![endif]-->
</head>

<body lang=EN-US link=blue vlink=purple style='tab-interval:36.0pt'>

<div class=Section1>

<div>

<h1>Type Traits Issue List</h1>

<p>Doc.no.:J16/ 03-0102=WG21/N1519<br>
Date: <st1:date Year="2003" Day="18" Month="9">18 Sept 2003</st1:date><br>
Project: Programming Language C++ <br>
Subgroup: Library<br>
<span class=SpellE>Wiki</span>: <a
href="http://www.research.att.com/~ark/cgi-bin/lwg-wiki/wiki?RegularExpressions">http://www.research.att.com/~ark/cgi-bin/lwg-wiki/wiki?RegularExpressions</a><br>
Reply to: John Maddock &lt;john@johnmaddock.co.uk&gt;</p>

<p>This document describes open issues in the type-traits proposal (<span
class=ListBulletChar><a
href="http://anubis.dkuug.dk/jtc1/sc22/wg21/docs/papers/2002/n1424.htm">N1424</a></span>).
</p>

<h2 style='tab-stops:45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt'>Use
of Language in type transformations </h2>

<p style='tab-stops:45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt'><em>Pete
Becker writes:</em> I've come across two places in the type traits proposal
where the words don't seem to properly express the intent. They're both in
TT.4, Transformations between Types: </p>

<p style='tab-stops:45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt'>For
&quot;Array Modifications,&quot; the text says: type: defined to be a type that
is the same as T, except any top level array bounds have been removed.
Technically, an array bound (see 8.3.4) is the constant-expression that
specifies the number of elements in the array, so for '<span class=SpellE>typedef</span>
<span class=SpellE>int</span> <span class=SpellE><span class=GramE>arr</span></span><span
class=GramE>[</span>10]', the type of <span class=SpellE>arr</span> without the
array bound is '<span class=SpellE>int</span> []'. From the code preceding this
text, it looks like that's not what's intended: the result should be '<span
class=SpellE>int</span>'. The way to say this is: for a type 'array of T', the
resulting type is T; for any other type U, the resulting type is U. This also
suggests that the name isn't right. <span class=GramE>Perhaps <span
class=SpellE>element_type</span>?</span> For an array, that's what the standard
calls it. </p>

<p style='tab-stops:45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt'>The
other one comes immediately after that. It's the description of the effect of <span
class=SpellE>add_pointer</span>: type: defined to be a type that is the result
of the expression &amp;t, where t is an imaginary <span class=SpellE>lvalue</span>
of type T. What about a type T that defines an operator&amp;? According to this
text, the effect of <span class=SpellE>add_pointer</span> is to get the return
type of operator&amp;. The code, on the other hand (and again I think the code
expresses the actual intent) is <span class=SpellE>remove_bounds</span>&lt;<span
class=SpellE>remove_reference</span>&lt;T&gt;:<span class=GramE>:type</span>&gt;::type*,
that is, produce a pointer to the underlying type. I don't have suggested <span
class=SpellE>standardese</span> here. It might be worthwhile to define a few
terms that can be used to talk about these things. Something on the line of
&quot;underlying type&quot; would be useful for this description, as well as
for things like <span class=SpellE>add_cv</span>. (That would also eliminate
the undefined term &quot;imaginary <span class=SpellE>lvalue</span>&quot; from
this definition). </p>

<p style='tab-stops:45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt'><em>John
Maddock notes:</em> </p>

<p style='margin-left:36.0pt;text-indent:-18.0pt;mso-list:l1 level1 lfo8;
tab-stops:list 36.0pt left 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt'><![if !supportLists]><span
style='font-family:Symbol;mso-fareast-font-family:Symbol;mso-bidi-font-family:
Symbol'><span style='mso-list:Ignore'><span style='font:7.0pt "Times New Roman"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</span></span></span><![endif]>There was some discussion on the list as to what
<span class=SpellE>remove_bounds</span> should be called, there seemed to be no
better alternative than <span class=SpellE>remove_dimension</span>.</p>

<p style='margin-left:36.0pt;text-indent:-18.0pt;mso-list:l1 level1 lfo8;
tab-stops:list 36.0pt left 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt'><![if !supportLists]><span
style='font-family:Symbol;mso-fareast-font-family:Symbol;mso-bidi-font-family:
Symbol'><span style='mso-list:Ignore'><span style='font:7.0pt "Times New Roman"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</span></span></span><![endif]>There is an additional issue with <span
class=SpellE>remove_bounds</span>  the code shown does not function correctly
for types array of unknown bound of T, this is easily fixed though.</p>

<p style='tab-stops:45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt'><em>Proposed
changes:</em> </p>

<p style='tab-stops:45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt'>Replace
all occurrences of <span class=SpellE>remove_bounds</span> with <span
class=SpellE>remove_dimension</span>. </p>

<p style='tab-stops:45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt'>Replace:
</p>

<p class=MsoNormal style='margin-left:36.0pt;tab-stops:45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt'><span
class=GramE><span style='font-size:10.0pt;font-family:"Courier New";color:black'>template</span></span><span
style='font-size:10.0pt;font-family:"Courier New";color:black'> &lt;class T&gt;
<span class=SpellE>struct</span> <span class=SpellE>remove_bounds</span>{<o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:36.0pt;tab-stops:45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt'><span
style='font-size:10.0pt;font-family:"Courier New";color:black'><span
style='mso-spacerun:yes'> </span><span class=SpellE><span class=GramE>typedef</span></span>
T type;<o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:36.0pt;tab-stops:45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt'><span
style='font-size:10.0pt;font-family:"Courier New";color:black'>};<o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:36.0pt;tab-stops:45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt'><span
class=GramE><span style='font-size:10.0pt;font-family:"Courier New";color:black'>template</span></span><span
style='font-size:10.0pt;font-family:"Courier New";color:black'> &lt;class T, <span
class=SpellE>std::size_t</span> N&gt; <span class=SpellE>struct</span> <span
class=SpellE>remove_bounds</span>&lt;T[N]&gt;{<o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:36.0pt;tab-stops:45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt'><span
style='font-size:10.0pt;font-family:"Courier New";color:black'><span
style='mso-spacerun:yes'> </span><span class=SpellE><span class=GramE>typedef</span></span>
T type;<o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:36.0pt;tab-stops:45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt'><span
style='font-size:10.0pt;font-family:"Courier New";color:black'>};<o:p></o:p></span></p>

<p style='margin-left:36.0pt;tab-stops:45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt'><span
class=GramE><code><span style='font-size:10.0pt'>type</span></code></span>:
defined to be a type that is the same as T, except any top level array bounds
have been removed. </p>

<p style='tab-stops:45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt'>With:
</p>

<p class=MsoNormal style='margin-left:36.0pt;tab-stops:45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt'><span
class=GramE><span style='font-size:10.0pt;font-family:"Courier New";color:black'>template</span></span><span
style='font-size:10.0pt;font-family:"Courier New";color:black'> &lt;class T&gt;
<span class=SpellE>struct</span> <span class=SpellE>remove_dimension</span>{<o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:36.0pt;tab-stops:45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt'><span
style='font-size:10.0pt;font-family:"Courier New";color:black'><span
style='mso-spacerun:yes'> </span><span class=SpellE><span class=GramE>typedef</span></span>
T type;<o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:36.0pt;tab-stops:45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt'><span
style='font-size:10.0pt;font-family:"Courier New";color:black'>};<o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:36.0pt;tab-stops:45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt'><span
style='font-size:10.0pt;font-family:"Courier New";color:black'>template
&lt;class T, <span class=SpellE>std::size_t</span> N&gt; <span class=SpellE>struct</span>
<span class=SpellE>remove_dimension</span>&lt;T[N]&gt;{<o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:36.0pt;tab-stops:45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt'><span
style='font-size:10.0pt;font-family:"Courier New";color:black'><span
style='mso-spacerun:yes'> </span><span class=SpellE><span class=GramE>typedef</span></span>
T type;<o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:36.0pt;tab-stops:45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt'><span
style='font-size:10.0pt;font-family:"Courier New";color:black'>}<span
class=GramE>;</span><br>
template &lt;class T&gt; <span class=SpellE>struct</span> <span class=SpellE>remove_dimension</span>&lt;T[]&gt;{<br>
<span style='mso-spacerun:yes'> </span>typedefs T type;<br>
};<o:p></o:p></span></p>

<p style='margin-left:36.0pt;tab-stops:45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt'><span
class=GramE><code><span style='font-size:10.0pt'>type</span></code></span>: for
a type 'array of U', the resulting type is U; for any other type V, the
resulting type is V. </p>

<p style='margin-left:36.0pt;tab-stops:45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt'>[<i
style='mso-bidi-font-style:normal'>Note  </i>for multidimensional arrays, only
the first array dimension is removed <i style='mso-bidi-font-style:normal'>
end note</i>]</p>

<p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
margin-left:36.0pt'>[<span class=GramE><i style='mso-bidi-font-style:normal'>example</i></span><i
style='mso-bidi-font-style:normal'> </i></p>

<pre style='margin-left:36.0pt'>// the following assertions should all hold:</pre><pre><span style='mso-spacerun:yes'> </span><span
class=GramE>assert(</span>(<span class=SpellE>is_same</span>&lt;<span
class=SpellE>remove_dimension</span>&lt;<span class=SpellE>int</span>&gt;::type, <span
class=SpellE>int</span>&gt;::value));</pre><pre><span style='mso-spacerun:yes'> </span><span
class=GramE>assert(</span>(<span class=SpellE>is_same</span>&lt;<span
class=SpellE>remove_dimension</span>&lt;<span class=SpellE>int</span>[2]&gt;::type, <span
class=SpellE>int</span>&gt;::value));</pre><pre><span style='mso-spacerun:yes'> </span><span
class=GramE>assert(</span>(<span class=SpellE>is_same</span>&lt;<span
class=SpellE>remove_dimension</span>&lt;<span class=SpellE>int</span>[2][3]&gt;::type, <span
class=SpellE>int</span>[3]&gt;::value));</pre><pre><span style='mso-spacerun:yes'> </span><span
class=GramE>assert(</span>(<span class=SpellE>is_same</span>&lt;<span
class=SpellE>remove_dimension</span>&lt;<span class=SpellE>int</span>[][3]&gt;::type, <span
class=SpellE>int</span>[3]&gt;::value));</pre>

<p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
margin-left:36.0pt;tab-stops:45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt'><i
style='mso-bidi-font-style:normal'>- end example</i>]<span style='color:black'><o:p></o:p></span></p>

<p style='tab-stops:45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt'>Replace:
</p>

<p style='margin-left:36.0pt;tab-stops:45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt'><span
class=GramE><code><span style='font-size:10.0pt'>type</span></code></span>:
defined to be a type that is the result of the expression <code><span
style='font-size:10.0pt'>&amp;t</span></code>, where t is an imaginary <span
class=SpellE>lvalue</span> of type T. </p>

<p style='tab-stops:45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt'>With:
</p>

<p style='margin-left:36.0pt;tab-stops:45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt'><span
class=GramE><code><span style='font-size:10.0pt'>type</span></code></span>:
defined to be a type that is the same as <span class=SpellE><code><span
style='font-size:10.0pt'>remove_reference</span></code></span><code><span
style='font-size:10.0pt'>&lt;T&gt;::type*</span></code> if T is a reference
type, otherwise <code><span style='font-size:10.0pt'>T*</span></code>. </p>

<h2 style='tab-stops:45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt'>Why
three headers? </h2>

<p style='tab-stops:45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt'><em>Pete
Becker writes:</em> Three headers <span class=GramE>seems</span> excessive. Why
not put them all into &lt;<span class=SpellE>type_traits</span>&gt;? That would
simplify things for users, who wouldn't have to remember which of the three
headers defines the template they're interested in. Currently, &lt;<span
class=SpellE>type_traits</span>&gt; has 33 templates (not counting helpers),
&lt;<span class=SpellE>type_compare</span>&gt; has 3, and &lt;<span
class=SpellE>type_transform</span>&gt; has 11. The classification is reasonable
in itself, but I don't think it's particularly helpful. </p>

<p style='tab-stops:45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt'>A
number of people expressed support for one header on the LWG reflector  the
changes needed are mostly administrative and/or organizational</p>

<p style='tab-stops:45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt'><em>Proposed
resolution:</em> Combine the three type traits headers into a single header
named &lt;<span class=SpellE>type_traits</span>&gt;. </p>

<h2 style='tab-stops:45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt'>Is
<span class=SpellE>integral_constant</span> an implementation detail? </h2>

<p style='tab-stops:45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt'><em>Pete
Becker writes:</em> The <span class=SpellE>type_traits</span> templates need
two types to distinguish between true and false. These are named <span
class=SpellE>true_type</span> and <span class=SpellE>false_type</span>. The
paper says that these two types are required to be instances of the template <span
class=SpellE>integral_constant</span>, specifically <span class=SpellE>integral_constant</span>&lt;<span
class=SpellE>bool</span>, true&gt; and <span class=SpellE>integral_constant</span>&lt;<span
class=SpellE>bool</span>, false&gt;, respectively. Is this a legitimate
requirement, or is it an implementation detail? Do we lose anything by making
the details of these types up to the implementation, leaving it open to the
implementation to use, for example, a pair of ordinary classes instead of
further burdening template instantiation? </p>

<p style='tab-stops:45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt'><em>John
Maddock replies: </em>It was intended to be a requirement: there <span
class=GramE>are</span> some function overload situations where you do actually
need to refer to <span class=SpellE>integral_constant</span> rather than just
the typedefs, in fact there is one in the rationale: </p>

<pre><span class=GramE>template&lt;</span><span class=SpellE>typename</span> T&gt; </pre><pre>T* <span
class=SpellE>do_<span class=GramE>copy</span></span><span class=GramE>(</span>const T* first, const T* last, T* out, const <span
class=SpellE>true_type</span>&amp;)</pre><pre><span class=GramE>{ /</span>* <span
class=SpellE>optimised</span> copy here */ }</pre><pre><o:p>&nbsp;</o:p></pre><pre><span
class=GramE>template&lt;</span><span class=SpellE>typename</span> I1, <span
class=SpellE>typename</span> I2, <span class=SpellE>bool</span> b&gt;</pre><pre>I2 <span
class=SpellE>do_<span class=GramE>copy</span></span><span class=GramE>(</span>I1 first, I1 last, I2 out, const <span
class=SpellE>integral_constant</span>&lt;<span class=SpellE>bool</span>, b&gt;&amp;)</pre><pre><span
class=GramE>{ /</span>* non-<span class=SpellE>optimised</span> copy here */ }</pre><pre><o:p>&nbsp;</o:p></pre><pre><span
class=GramE>template&lt;</span><span class=SpellE>typename</span> I1 <span
class=SpellE>typename</span> I2&gt;</pre><pre><span class=GramE>inline</span> I2 copy(I1 first, I1 last, I2 out)</pre><pre>{</pre><pre><span style='mso-spacerun:yes'> </span><span
class=GramE>typedef</span> <span class=SpellE>typename</span> <span
class=SpellE>std::iterator_traits</span>&lt;I1&gt;::<span class=SpellE>value_type</span> <span
class=SpellE>value_type</span>;</pre><pre><span style='mso-spacerun:yes'> </span><span
class=GramE>return</span> <span class=SpellE>do_copy</span>(first, last, out, <span
class=SpellE>has_trivial_assign</span>&lt;<span class=SpellE>value_type</span>&gt;()); </pre><pre>} </pre>

<p style='tab-stops:45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt'>Note
that in the second overload for <span class=SpellE>do_copy</span> using <span
class=SpellE>false_type</span> in place of <span class=SpellE>integral_constant</span>&lt;<span
class=SpellE>bool</span>, something&gt; wouldn't actually work, if one had to
rely on the typedefs alone one would have to add a third overload. </p>

<p style='tab-stops:45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt'>Perhaps
a better example is for implementing user defined traits classes: </p>

<pre><span class=GramE>template</span> &lt;class T&gt; </pre><pre><span
class=GramE>struct</span> <span class=SpellE>my_trait</span> : public <span
class=SpellE>integral_constant</span>&lt;</pre><pre><span style='mso-spacerun:yes'> </span><span
class=GramE>bool</span>,</pre><pre><span style='mso-spacerun:yes'> </span><span
class=GramE>some-complex-logical-expression</span>&gt; </pre><pre><span style='mso-spacerun:yes'></span>{}; </pre>

<p style='tab-stops:45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt'>Or
where dispatch to a function overload requires a logical combination of traits:
</p>

<pre><span class=GramE>template</span> &lt;class T&gt; </pre><pre><span
class=GramE>void</span> <span class=SpellE>do_fill</span>(T* <span
class=SpellE>i</span>, T* j, const T&amp; <span class=SpellE>val</span>, const <span
class=SpellE>true_type</span>&amp;) </pre><pre><span class=GramE>{ <span
class=SpellE>memset</span></span>(<span class=SpellE>i</span>, <span
class=SpellE>val</span>, j-<span class=SpellE>i</span>); } </pre><pre><o:p>&nbsp;</o:p></pre><pre><span
class=GramE>template</span> &lt;class I, class T, class U&gt; </pre><pre><span
class=GramE>void</span> <span class=SpellE>do_fill</span>(I <span class=SpellE>i</span>, I j, const T&amp; <span
class=SpellE>val</span>, const U&amp;) </pre><pre>{</pre><pre><span style='mso-spacerun:yes'> </span><span
class=GramE>while(</span><span class=SpellE>i</span> != j)</pre><pre><span style='mso-spacerun:yes'> </span><span
class=GramE>{ *</span><span class=SpellE>i</span> = <span class=SpellE>val</span>; ++<span
class=SpellE>i</span>; } </pre><pre>} </pre><pre><o:p>&nbsp;</o:p></pre><pre><span
class=GramE>template</span> &lt;class I, class T,&gt; </pre><pre><span
class=GramE>void</span> fill(I <span class=SpellE>i</span>, I j, const T&amp; <span
class=SpellE>val</span>) </pre><pre>{</pre><pre><span style='mso-spacerun:yes'> </span><span
class=SpellE><span class=GramE>typedef</span></span> <span class=SpellE>typename</span> <span
class=SpellE>iterator_traits</span>&lt;I&gt;::<span class=SpellE>value_type</span> <span
class=SpellE>out_type</span>;</pre><pre><span style='mso-spacerun:yes'> </span><span style='mso-spacerun:yes'></span><span
class=SpellE>do_<span class=GramE>fill</span></span><span class=GramE>(</span><span
class=SpellE>i</span>, j, <span class=SpellE>integral_constant</span>&lt;</pre><pre><span style='mso-spacerun:yes'> </span><span
class=GramE>bool</span>,</pre><pre><span style='mso-spacerun:yes'> </span><span
class=GramE>sizeof(</span><span class=SpellE>out_type</span> == 1)</pre><pre><span style='mso-spacerun:yes'> </span>&amp;&amp; <span
class=SpellE>has_trivial_assign</span>&lt;<span class=SpellE>out_type</span>&gt;:<span
class=GramE>:value</span></pre><pre><span style='mso-spacerun:yes'> </span>&amp;&amp; <span
class=SpellE>has_trivial_assign</span>&lt;T&gt;:<span class=GramE>:value</span></pre><pre><span style='mso-spacerun:yes'> </span>&gt;()</pre><pre><span style='mso-spacerun:yes'> </span><span style='mso-spacerun:yes'></span>);</pre><pre>}</pre>

<p style='tab-stops:45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt'>Basically
it comes in the category of &quot;useful helper class&quot;, yes you can do
without it, but eventually you end up reinventing it if it's not there. </p>

<p style='tab-stops:45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt'>Aleksey
<span class=SpellE>Gurtovoy</span> provided other examples, and showed how <span
class=SpellE>integral_constant</span> facilitates interaction with Boosts MPL
library (and other libraries that use similar meta-programming techniques). </p>

<p style='tab-stops:45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt'>There
followed a fairly long discussion which centered around the following issue: <span
class=SpellE>integral_constant</span> is not strictly required to implement the
proposal as it stands, however it is useful in extending the proposal, and
several people suggested extensions which would in fact require it (<span
class=SpellE>alignment_of</span> and variations thereof included in some of the
issues below, plus the following change to the Unary Type Traits Requirements).
</p>

<h2 style='tab-stops:45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt'>Revising
the Unary Type Traits Requirements</h2>

<p style='tab-stops:45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt'>Some
of the new traits that have been proposed require that their value member is
of integral type rather than <span class=SpellE>bool</span>.<span
style='mso-spacerun:yes'> </span>The library was always intended to be capable
of extension in this way, but the <span class=SpellE>UnaryTypeTrait</span>
requirements talk about Boolean properties.</p>

<p style='tab-stops:45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt'><i
style='mso-bidi-font-style:normal'>Proposed changes:</i> </p>

<p style='tab-stops:45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt'>Replace
table TT2 with:</p>

<h6 align=center style='text-align:center;tab-stops:45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt'>Table
TT2 - <span class=SpellE>UnaryTypeTrait</span> requirements</h6>

<div align=center>

<table class=MsoNormalTable border=1 cellspacing=1 cellpadding=0 width=617
 style='width:462.75pt;mso-cellspacing:.7pt;mso-padding-alt:5.25pt 5.25pt 5.25pt 5.25pt'>
 <tr style='mso-yfti-irow:0'>
  <td width="33%" valign=top style='width:33.12%;padding:5.25pt 5.25pt 5.25pt 5.25pt'>
  <p>Expression</p>
  </td>
  <td width="33%" valign=top style='width:33.12%;padding:5.25pt 5.25pt 5.25pt 5.25pt'>
  <p>Return type</p>
  </td>
  <td width="33%" valign=top style='width:33.14%;padding:5.25pt 5.25pt 5.25pt 5.25pt'>
  <p>Requirement</p>
  </td>
 </tr>
 <tr style='mso-yfti-irow:1'>
  <td width="33%" valign=top style='width:33.12%;padding:5.25pt 5.25pt 5.25pt 5.25pt'>
  <p>X&lt;T&gt;::<span class=SpellE>value_type</span></p>
  </td>
  <td width="33%" valign=top style='width:33.12%;padding:5.25pt 5.25pt 5.25pt 5.25pt'>
  <p>An integral type</p>
  </td>
  <td width="33%" valign=top style='width:33.14%;padding:5.25pt 5.25pt 5.25pt 5.25pt'>
  <p>The type of X&lt;T&gt;:<span class=GramE>:value</span>.</p>
  </td>
 </tr>
 <tr style='mso-yfti-irow:2'>
  <td width="33%" valign=top style='width:33.12%;padding:5.25pt 5.25pt 5.25pt 5.25pt'>
  <p>X&lt;T&gt;::value</p>
  </td>
  <td width="33%" valign=top style='width:33.12%;padding:5.25pt 5.25pt 5.25pt 5.25pt'>
  <p><span class=SpellE>value_type</span></p>
  </td>
  <td width="33%" valign=top style='width:33.14%;padding:5.25pt 5.25pt 5.25pt 5.25pt'>
  <p>An integral constant expression that takes the value of the specified
  trait.</p>
  </td>
 </tr>
 <tr style='mso-yfti-irow:3'>
  <td width="33%" valign=top style='width:33.12%;padding:5.25pt 5.25pt 5.25pt 5.25pt'>
  <p>X&lt;T&gt;::type</p>
  </td>
  <td width="33%" valign=top style='width:33.12%;padding:5.25pt 5.25pt 5.25pt 5.25pt'>
  <p><span class=SpellE>integral_constant</span>&lt;<span class=SpellE>value_type,value</span>&gt;</p>
  </td>
  <td width="33%" valign=top style='width:33.14%;padding:5.25pt 5.25pt 5.25pt 5.25pt'>
  <p>A type for use in situations where a <span class=SpellE>typename</span> is
  more appropriate than a value. The class template <span class=SpellE>integral_constant</span>
  is declared in &lt;<span class=SpellE>type_traits</span>&gt;.</p>
  </td>
 </tr>
 <tr style='mso-yfti-irow:4;mso-yfti-lastrow:yes'>
  <td width="33%" valign=top style='width:33.12%;padding:5.25pt 5.25pt 5.25pt 5.25pt'>
  <p>X&lt;T&gt;::type t = X&lt;T&gt;()</p>
  </td>
  <td width="33%" valign=top style='width:33.12%;padding:5.25pt 5.25pt 5.25pt 5.25pt'>
  <p>&nbsp;</p>
  </td>
  <td width="33%" valign=top style='width:33.14%;padding:5.25pt 5.25pt 5.25pt 5.25pt'>
  <p>Both <span class=SpellE>lvalues</span> of <code><span style='font-size:
  10.0pt'>type X&lt;T&gt; const&amp;</span></code> and <span class=SpellE>rvalues</span>
  of type <code><span style='font-size:10.0pt'>X&lt;T&gt;</span></code> are
  implicitly convertible to <code><span style='font-size:10.0pt'>X&lt;T&gt;:</span></code><span
  class=GramE><span style='font-size:10.0pt;font-family:"Courier New"'>:type</span></span>.</p>
  </td>
 </tr>
</table>

</div>

<h2 style='tab-stops:45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt'>New
Unary Type Traits </h2>

<p style='tab-stops:45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt'>Several
new type traits have been proposed on the lib reflector list: </p>

<h3 style='tab-stops:45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt'><span
class=SpellE>alignment_of</span></h3>

<p class=MsoNormal style='margin-left:36.0pt;tab-stops:45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt'><span
class=GramE><span style='font-size:10.0pt;font-family:"Courier New";color:black'>template</span></span><span
style='font-size:10.0pt;font-family:"Courier New";color:black'> &lt;class T&gt;
<span class=SpellE>struct</span> <span class=SpellE>alignment_of</span> {<o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:36.0pt;tab-stops:45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt'><span
style='font-size:10.0pt;font-family:"Courier New";color:black'>&nbsp;&nbsp; <span
class=GramE>static</span><span style='mso-spacerun:yes'> </span>const <span
class=SpellE>std::size_t</span> value<span
style='mso-spacerun:yes'> </span>= <span class=SpellE>implementation_defined</span>;
<o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:36.0pt;tab-stops:45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt'><span
style='font-size:10.0pt;font-family:"Courier New";color:black'><span
style='mso-spacerun:yes'> </span><span class=SpellE><span class=GramE>typedef</span></span><span
class=GramE><span style='mso-spacerun:yes'> </span><span class=SpellE>std</span></span><span
class=SpellE>::size_t</span><span
style='mso-spacerun:yes'> </span><span
style='mso-spacerun:yes'></span><span class=SpellE>value_type</span>;<o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:36.0pt;tab-stops:45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt'><span
style='font-size:10.0pt;font-family:"Courier New";color:black'><span
style='mso-spacerun:yes'> </span><span class=SpellE><span class=GramE>typedef</span></span><span
class=GramE><span style='mso-spacerun:yes'> </span><span class=SpellE>integral</span></span><span
class=SpellE>_constant</span>&lt;<span class=SpellE>value_type,value</span>&gt;<span
style='mso-spacerun:yes'> </span>type;<o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:36.0pt;tab-stops:45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt'><span
style='font-size:10.0pt;font-family:"Courier New";color:black'><span
style='mso-spacerun:yes'> </span><span class=GramE>operator</span>
type()const;<o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:36.0pt;tab-stops:45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt'><span
style='font-size:10.0pt;font-family:"Courier New";color:black'>};<o:p></o:p></span></p>

<p style='margin-left:36.0pt;tab-stops:45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt'><span
class=GramE><span style='font-size:10.0pt;font-family:"Courier New";color:black'>value</span></span><span
style='color:black'>: An</span> implementation-defined integer value
representing a number of bytes of the alignment of objects of type T; an object
of type T may be allocated at an address that is a multiple of its alignment
(3.9).</p>

<p style='tab-stops:45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt'><i
style='mso-bidi-font-style:normal'>Notes:</i> This template has been present in
the Boost library for some time and is of proven utility, several users have
expressed disappointment that it was not included in the original type traits
proposal.<span style='mso-spacerun:yes'> </span>Gabriel Dos Reis has pointed
out that some ABI specifications have two kinds of alignment: the alignment of
an object within a <span class=SpellE>struct</span> (field alignment), and the
ideal alignment that an object would like to take (for example for the starting
address of an array of T).<span style='mso-spacerun:yes'> </span>The
specification above deals only with the former alignment type, and is based on
the wording in 3.9 paragraph 5; there being no other alignment concept in the
current standard.<span style='mso-spacerun:yes'> </span>It is unclear whether
this is the best name, Gabriel Dos Reis writes: the template-argument list
&lt;T&gt; is already read as `of tee, the suffix `_of is overkill, IMO, on
the other hand, the existing name hasnt generated comment from Boost users.</p>

<h3 style='tab-stops:45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt'><span
class=SpellE>has_virtual_destructor</span></h3>

<p class=MsoNormal style='margin-left:36.0pt;tab-stops:45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt'><span
class=GramE><span style='font-size:10.0pt;font-family:"Courier New";color:black'>template</span></span><span
style='font-size:10.0pt;font-family:"Courier New";color:black'> &lt;class T&gt;
<span class=SpellE>struct</span> </span><span class=SpellE>has_virtual_destructor</span><span
style='font-size:10.0pt;font-family:"Courier New";color:black'> {<o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:36.0pt;tab-stops:45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt'><span
style='font-size:10.0pt;font-family:"Courier New";color:black'>&nbsp;&nbsp; <span
class=GramE>static</span><span style='mso-spacerun:yes'> </span>const <span
class=SpellE>bool</span> value<span
style='mso-spacerun:yes'> </span>= <span class=SpellE>implementation_defined</span>;
<o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:36.0pt;tab-stops:45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt'><span
style='font-size:10.0pt;font-family:"Courier New";color:black'><span
style='mso-spacerun:yes'> </span><span class=SpellE><span class=GramE>typedef</span></span><span
class=GramE><span style='mso-spacerun:yes'> </span><span class=SpellE>bool</span></span><span
style='mso-spacerun:yes'> </span><span
class=SpellE>value_type</span>;<o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:36.0pt;tab-stops:45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt'><span
style='font-size:10.0pt;font-family:"Courier New";color:black'><span
style='mso-spacerun:yes'> </span><span class=SpellE><span class=GramE>typedef</span></span><span
class=GramE><span style='mso-spacerun:yes'> </span><span class=SpellE>integral</span></span><span
class=SpellE>_constant</span>&lt;<span class=SpellE>bool,value</span>&gt;<span
style='mso-spacerun:yes'> </span>type;<o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:36.0pt;tab-stops:45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt'><span
style='font-size:10.0pt;font-family:"Courier New";color:black'><span
style='mso-spacerun:yes'> </span><span class=GramE>operator</span>
type()const;<o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:36.0pt;tab-stops:45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt'><span
style='font-size:10.0pt;font-family:"Courier New";color:black'>};<o:p></o:p></span></p>

<p style='margin-left:36.0pt;tab-stops:45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt'><span
class=GramE><span style='font-size:10.0pt;font-family:"Courier New";color:black'>value</span></span><span
style='color:black'>: true if type T has a virtual destructor (12.4) otherwise
false</span>.</p>

<p style='tab-stops:45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt'><i
style='mso-bidi-font-style:normal'>Notes:</i> <code><span style='font-size:
10.0pt'>is_polymorphic</span></code> is sufficient to determine whether a type
can be <code><span style='font-size:10.0pt'>dynamic_cast</span></code> to
another, but doesnt tell you whether it can be safely cast to a base type and
still be safely deleted (since a type can be polymorphic but still not have a
virtual destructor); this trait fills that gap.<span style='mso-spacerun:yes'>
</span>Note however that the memory management provided by <code><span
style='font-size:10.0pt'>shared_ptr</span></code> is capable of correctly
deleting a <code><span style='font-size:10.0pt'>shared_ptr&lt;Base&gt;</span></code>
even after a cast from <code><span style='font-size:10.0pt'>shared_ptr&lt;Derived&gt;
</span></code>irrespective whether Base has a virtual destructor.<span
style='mso-spacerun:yes'> </span>Whether this negates the need for this trait
is an open issue.<span style='mso-spacerun:yes'> </span><span class=SpellE>Bronek</span>
<span class=SpellE>Kozicki</span> has also asked for <code><span
style='font-size:10.0pt'>is_safely_destructable</span></code>: this evaluates
as true unless a type has a public base class that does not have a virtual
destructor; this trait would be used in template factory functions to assert
that the type is actually safe to be factory-created and then destroyed via a
pointer to base.</p>

<p style='tab-stops:45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt'>A
fuller rationale and proposal for <span class=SpellE><code><span
style='font-size:10.0pt'>has_vitual_destructor</span></code></span> and <span
class=SpellE><code><span style='font-size:10.0pt'>is_safely_destructable</span></code></span>
can be found in document <a
href="http://anubis.dkuug.dk/jtc1/sc22/wg21/docs/papers/2002/n1508.htm">J16/03-0091
= WG21/N1508</a>.</p>

<h3 style='tab-stops:45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt'><span
class=GramE>rank</span></h3>

<p class=MsoNormal style='margin-left:36.0pt;tab-stops:45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt'><span
class=GramE><span style='font-size:10.0pt;font-family:"Courier New";color:black'>template</span></span><span
style='font-size:10.0pt;font-family:"Courier New";color:black'> &lt;class T&gt;
<span class=SpellE>struct</span> rank {<o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:36.0pt;tab-stops:45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt'><span
style='font-size:10.0pt;font-family:"Courier New";color:black'>&nbsp;&nbsp; <span
class=GramE>static</span><span style='mso-spacerun:yes'> </span>const <span
class=SpellE>std::size_t</span> value<span
style='mso-spacerun:yes'> </span>= <span class=SpellE>implementation_defined</span>;
<o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:36.0pt;tab-stops:45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt'><span
style='font-size:10.0pt;font-family:"Courier New";color:black'><span
style='mso-spacerun:yes'> </span><span class=SpellE><span class=GramE>typedef</span></span><span
class=GramE><span style='mso-spacerun:yes'> </span><span class=SpellE>std</span></span><span
class=SpellE>::size_t</span><span
style='mso-spacerun:yes'> </span><span
class=SpellE>value_type</span>;<o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:36.0pt;tab-stops:45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt'><span
style='font-size:10.0pt;font-family:"Courier New";color:black'><span
style='mso-spacerun:yes'> </span><span class=SpellE><span class=GramE>typedef</span></span><span
class=GramE><span style='mso-spacerun:yes'> </span><span class=SpellE>integral</span></span><span
class=SpellE>_constant</span>&lt;<span class=SpellE>value_type,value</span>&gt;<span
style='mso-spacerun:yes'> </span>type;<o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:36.0pt;tab-stops:45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt'><span
style='font-size:10.0pt;font-family:"Courier New";color:black'><span
style='mso-spacerun:yes'> </span><span class=GramE>operator</span>
type()const;<o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:36.0pt;tab-stops:45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt'><span
style='font-size:10.0pt;font-family:"Courier New";color:black'>};<o:p></o:p></span></p>

<p style='margin-left:36.0pt;tab-stops:45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt'><span
class=GramE><span style='font-size:10.0pt;font-family:"Courier New";color:black'>value</span></span><span
style='color:black'>: An</span> implementation-defined integer value
representing the rank of objects of type T (8.3.4). [<i style='mso-bidi-font-style:
normal'>Note  the term rank here is used to describe the number of
dimensions of an array type  end note</i>]</p>

<p style='margin-left:36.0pt;tab-stops:45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt'>[<span
class=GramE><i style='mso-bidi-font-style:normal'>example</i></span><i
style='mso-bidi-font-style:normal'>  </i></p>

<p style='margin-left:36.0pt;tab-stops:45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt'><code><span
style='font-size:10.0pt'>// the following assertions should hold:</span></code><span
style='font-size:10.0pt;font-family:"Courier New"'><br>
<code>assert(rank&lt;<span class=SpellE>int</span>&gt;::value == 0);</code><br>
<code>assert(rank&lt;<span class=SpellE>int</span>[2]&gt;::value == 1);</code><br>
<code>assert(rank&lt;<span class=SpellE>int</span>[][4]&gt;::value == 2);<o:p></o:p></code></span></p>

<p style='margin-left:36.0pt;tab-stops:45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt'><i
style='mso-bidi-font-style:normal'>- end example</i>]</p>

<p style='tab-stops:45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt'><i
style='mso-bidi-font-style:normal'>Notes:</i> There was some discussion about
the choice of the term rank here  the term is correctly used in this case,
but the standard uses rank to refer to the shape of an array in 8.3.4.<span
style='mso-spacerun:yes'> </span>There is no precedent for this template in
the Boost library, although at least one list member had previously
independently invented it prior to its discussion.</p>

<h3 style='tab-stops:45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt'><span
class=GramE>dimension</span></h3>

<p class=MsoNormal style='margin-left:36.0pt;tab-stops:45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt'><span
class=GramE><span style='font-size:10.0pt;font-family:"Courier New";color:black'>template</span></span><span
style='font-size:10.0pt;font-family:"Courier New";color:black'> &lt;class T,
unsigned I = 0&gt; <span class=SpellE>struct</span> dimension {<o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:36.0pt;tab-stops:45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt'><span
style='font-size:10.0pt;font-family:"Courier New";color:black'>&nbsp;&nbsp; <span
class=GramE>static</span><span style='mso-spacerun:yes'> </span>const <span
class=SpellE>std::size_t</span> value<span
style='mso-spacerun:yes'> </span>= <span class=SpellE>implementation_defined</span>;
<o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:36.0pt;tab-stops:45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt'><span
style='font-size:10.0pt;font-family:"Courier New";color:black'><span
style='mso-spacerun:yes'> </span><span class=SpellE><span class=GramE>typedef</span></span><span
class=GramE><span style='mso-spacerun:yes'> </span><span class=SpellE>std</span></span><span
class=SpellE>::size_t</span><span
style='mso-spacerun:yes'> </span><span
class=SpellE>value_type</span>;<o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:36.0pt;tab-stops:45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt'><span
style='font-size:10.0pt;font-family:"Courier New";color:black'><span
style='mso-spacerun:yes'> </span><span class=SpellE><span class=GramE>typedef</span></span><span
class=GramE><span style='mso-spacerun:yes'> </span><span class=SpellE>integral</span></span><span
class=SpellE>_constant</span>&lt;<span class=SpellE>value_type,value</span>&gt;<span
style='mso-spacerun:yes'> </span>type;<o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:36.0pt;tab-stops:45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt'><span
style='font-size:10.0pt;font-family:"Courier New";color:black'><span
style='mso-spacerun:yes'> </span><span class=GramE>operator</span>
type()const;<o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:36.0pt;tab-stops:45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt'><span
style='font-size:10.0pt;font-family:"Courier New";color:black'>};<o:p></o:p></span></p>

<p style='margin-left:36.0pt;tab-stops:45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt'><span
class=GramE><span style='font-size:10.0pt;font-family:"Courier New";color:black'>value</span></span><span
style='color:black'>: An</span> implementation-defined integer value
representing the dimension of the <span class=SpellE><i style='mso-bidi-font-style:
normal'>Ith</i></span> bound of objects of type T (8.3.4).<span
style='mso-spacerun:yes'> </span>If the type T is not an array type, has rank
of less than <i style='mso-bidi-font-style:normal'>I</i>, or if <code><span
style='font-size:10.0pt'>I == 0</span></code> and is of type array of unknown
bound of T, then <code><span style='font-size:10.0pt'>value</span></code>
shall evaluate to zero; otherwise value shall evaluate to the number of elements
in the <span class=SpellE><i style='mso-bidi-font-style:normal'>Ith</i></span>
array bound of T.<span style='mso-spacerun:yes'> </span>[<i style='mso-bidi-font-style:
normal'>Note  the term dimension here is used to describe the number of
elements in an array type  end note</i>]<span style='font-size:10.0pt'><o:p></o:p></span></p>

<p style='margin-left:36.0pt;tab-stops:45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt'>[<span
class=GramE><i style='mso-bidi-font-style:normal'>example</i></span><i
style='mso-bidi-font-style:normal'>  </i></p>

<p style='margin-left:36.0pt;tab-stops:45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt'><code><span
style='font-size:10.0pt'>// the following assertions should hold:</span></code><span
style='font-size:10.0pt;font-family:"Courier New"'><br>
<code>assert(dimension&lt;<span class=SpellE>int</span>&gt;::value == 0);</code><br>
<code>assert(dimension&lt;<span class=SpellE>int</span>[2]&gt;::value == 2);</code><br>
<code>assert(dimension&lt;<span class=SpellE>int</span>[2][4]&gt;::value == 2);</code><br>
<code>assert(dimension&lt;<span class=SpellE>int</span>[][4]&gt;::value == 0);</code><br>
<code>assert((dimension&lt;<span class=SpellE>int</span>, 1&gt;::value) == 0);</code><br>
<code>assert((dimension&lt;<span class=SpellE>int</span>[2], 1&gt;::value) ==
0);</code><br>
<code>assert((dimension&lt;<span class=SpellE>int</span>[2][4], 1&gt;::value)
== 4);</code><br>
<code>assert((dimension&lt;<span class=SpellE>int</span>[][4], 1&gt;::value) ==
0);<o:p></o:p></code></span></p>

<p style='margin-left:36.0pt;tab-stops:45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt'><i
style='mso-bidi-font-style:normal'>- end example</i>]</p>

<p style='tab-stops:45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt'><i
style='mso-bidi-font-style:normal'>Notes:</i> There was some discussion about
the choice of the term dimension here  the term is often abused within the
programming community and extent was one alternative suggested.<span
style='mso-spacerun:yes'> </span>There is no precedent for this template in
the Boost library.<span style='mso-spacerun:yes'> </span>The wording for
boundary cases need checking for sensibility: what should happen when T is an
unbounded array or is not an array at all?</p>

<h2 style='tab-stops:45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt'>New
transformation traits</h2>

<p style='tab-stops:45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt'>The
following type transformation traits have been suggested on the lib reflector:</p>

<h3 style='tab-stops:45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt'><span
class=SpellE>aligned_storage</span></h3>

<p class=MsoNormal style='margin-left:36.0pt;tab-stops:45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt'><span
class=GramE><span style='font-size:10.0pt;font-family:"Courier New";color:black'>template</span></span><span
style='font-size:10.0pt;font-family:"Courier New";color:black'> &lt;<span
class=SpellE>std::size_t</span> Len, <span class=SpellE>std::size_t</span>
Align&gt; <span class=SpellE>struct</span> <span class=SpellE>aligned_storage</span>{<o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:36.0pt;tab-stops:45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt'><span
style='font-size:10.0pt;font-family:"Courier New";color:black'><span
style='mso-spacerun:yes'> </span><span class=SpellE><span class=GramE>typedef</span></span>
<span class=SpellE>implementation_defined</span> type;<o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:36.0pt;tab-stops:45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt'><span
style='font-size:10.0pt;font-family:"Courier New";color:black'>};<o:p></o:p></span></p>

<p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
margin-left:36.0pt;tab-stops:45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt'><span
class=GramE><span style='font-size:10.0pt;font-family:"Courier New";color:black'>type</span></span><span
style='color:black'>: an implementation defined POD type with size <i
style='mso-bidi-font-style:normal'>Len</i> and alignment <i style='mso-bidi-font-style:
normal'>Align</i>, and suitable for use as <span class=SpellE>uninitialized</span>
storage for any object of type T whose size is <i style='mso-bidi-font-style:
normal'>Len</i>, and alignment <i style='mso-bidi-font-style:normal'>Align</i>.<o:p></o:p></span></p>

<p style='tab-stops:45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt'><i
style='mso-bidi-font-style:normal'>Notes</i>: This template is present in the
Boost library as <span class=SpellE>type_with_alignment</span>, but that
doesnt accurately describe what it does.<span style='mso-spacerun:yes'>
</span></p>

<p style='tab-stops:45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt'>There
is a suggestion that type must be an array of bytes in order to fit within the
current language structure, what impact does this have on compiler writers?</p>

<p style='tab-stops:45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt'>Gabriel
Dos Reis writes: </p>

<p style='margin-left:36.0pt;tab-stops:45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt'>When
designing <span class=GramE>a type traits</span> for properly aligned storage,
one has to keep in mind the restrictions on object aliasing and interaction
with the rest of the language/library.&nbsp; In particular, the language
defines &quot;byte&quot; (i.e. char or unsigned char) as the type of storage.
Furthermore, we have the following restrictions:&nbsp; </p>

<p style='margin-left:36.0pt;tab-stops:45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt'>3.10/15:</p>

<p style='margin-left:54.0pt;tab-stops:45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt'>If
a program attempts to access the stored value of an object through an <span
class=SpellE>lvalue</span> of other than one of the following types the
behavior is undefined: </p>

<p style='margin-left:90.0pt;text-indent:-18.0pt;mso-list:l3 level1 lfo5;
tab-stops:45.8pt list 90.0pt left 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt'><![if !supportLists]><span
style='font-family:Wingdings;mso-fareast-font-family:Wingdings;mso-bidi-font-family:
Wingdings'><span style='mso-list:Ignore'>n<span style='font:7.0pt "Times New Roman"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</span></span></span><![endif]>the dynamic type of the object,</p>

<p style='margin-left:90.0pt;text-indent:-18.0pt;mso-list:l3 level1 lfo5;
tab-stops:45.8pt list 90.0pt left 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt'><![if !supportLists]><span
style='font-family:Wingdings;mso-fareast-font-family:Wingdings;mso-bidi-font-family:
Wingdings'><span style='mso-list:Ignore'>n<span style='font:7.0pt "Times New Roman"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</span></span></span><![endif]>a <span class=SpellE>cv</span>-qualified version
of the dynamic type of the object,</p>

<p style='margin-left:90.0pt;text-indent:-18.0pt;mso-list:l3 level1 lfo5;
tab-stops:45.8pt list 90.0pt left 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt'><![if !supportLists]><span
style='font-family:Wingdings;mso-fareast-font-family:Wingdings;mso-bidi-font-family:
Wingdings'><span style='mso-list:Ignore'>n<span style='font:7.0pt "Times New Roman"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</span></span></span><![endif]>a type that is the signed or unsigned type
corresponding to the dynamic type of the object, </p>

<p style='margin-left:90.0pt;text-indent:-18.0pt;mso-list:l3 level1 lfo5;
tab-stops:45.8pt list 90.0pt left 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt'><![if !supportLists]><span
style='font-family:Wingdings;mso-fareast-font-family:Wingdings;mso-bidi-font-family:
Wingdings'><span style='mso-list:Ignore'>n<span style='font:7.0pt "Times New Roman"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</span></span></span><![endif]>a type that is the signed or unsigned type
corresponding to a <span class=SpellE>cv</span>-qualified version of the
dynamic type of the object, </p>

<p style='margin-left:90.0pt;text-indent:-18.0pt;mso-list:l3 level1 lfo5;
tab-stops:45.8pt list 90.0pt left 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt'><![if !supportLists]><span
style='font-family:Wingdings;mso-fareast-font-family:Wingdings;mso-bidi-font-family:
Wingdings'><span style='mso-list:Ignore'>n<span style='font:7.0pt "Times New Roman"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</span></span></span><![endif]>an aggregate or union type that includes one of
the aforementioned types among its members (including, recursively, a member of
a sub-aggregate or contained union), </p>

<p style='margin-left:90.0pt;text-indent:-18.0pt;mso-list:l3 level1 lfo5;
tab-stops:45.8pt list 90.0pt left 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt'><![if !supportLists]><span
style='font-family:Wingdings;mso-fareast-font-family:Wingdings;mso-bidi-font-family:
Wingdings'><span style='mso-list:Ignore'>n<span style='font:7.0pt "Times New Roman"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</span></span></span><![endif]>a type that is a (possibly <span class=SpellE>cv</span>-qualified)
base class type of the dynamic type of the object, </p>

<p style='margin-left:90.0pt;text-indent:-18.0pt;mso-list:l3 level1 lfo5;
tab-stops:45.8pt list 90.0pt left 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt'><![if !supportLists]><span
style='font-family:Wingdings;mso-fareast-font-family:Wingdings;mso-bidi-font-family:
Wingdings'><span style='mso-list:Ignore'>n<span style='font:7.0pt "Times New Roman"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</span></span></span><![endif]><span class=GramE>a</span> char or unsigned char
type.</p>

<p style='tab-stops:45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt'><i
style='mso-bidi-font-style:normal'>Rationale:</i> It is tempting to reformulate
this template as:</p>

<pre><span class=GramE>template&lt;</span>class T&gt; <span class=SpellE>struct</span> <span
class=SpellE>aligned_storage</span>; // provides storage for type T</pre>

<p style='tab-stops:45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt'>However
this fails several important use cases:</p>

<p style='margin-left:36.0pt;text-indent:-18.0pt;mso-list:l2 level1 lfo7;
tab-stops:list 36.0pt left 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt'><![if !supportLists]><span
style='font-family:Symbol;mso-fareast-font-family:Symbol;mso-bidi-font-family:
Symbol'><span style='mso-list:Ignore'><span style='font:7.0pt "Times New Roman"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</span></span></span><![endif]>The first case is a discriminated union (see <span
class=SpellE>boost::variant</span> - which has <span class=SpellE><code><span
style='font-size:10.0pt'>aligned_storage</span></code></span><code><span
style='font-size:10.0pt'>&lt;Size, Align&gt;</span></code> as an implementation
detail) where one of a list of types may be constructed in the same raw
storage. </p>

<p style='margin-left:36.0pt;text-indent:-18.0pt;mso-list:l2 level1 lfo7;
tab-stops:list 36.0pt left 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt'><![if !supportLists]><span
style='font-family:Symbol;mso-fareast-font-family:Symbol;mso-bidi-font-family:
Symbol'><span style='mso-list:Ignore'><span style='font:7.0pt "Times New Roman"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</span></span></span><![endif]>The second case is the pool allocator in <code><span
style='font-size:10.0pt'>boost/<span class=SpellE>detal/quick_allocator.hpp</span></span></code>,
where something similar to <span class=SpellE><code><span style='font-size:
10.0pt'>aligned_storage</span></code></span><code><span style='font-size:10.0pt'>&lt;Size,
Align&gt;</span></code> is used in order to reuse the pools for types that have
equal sizes and alignments but are not the same type, for example <span
class=SpellE>int</span>, unsigned <span class=SpellE>int</span>, long, unsigned
long.</p>

<p style='margin-left:36.0pt;text-indent:-18.0pt;mso-list:l2 level1 lfo7;
tab-stops:list 36.0pt left 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt'><![if !supportLists]><span
style='font-family:Symbol;mso-fareast-font-family:Symbol;mso-bidi-font-family:
Symbol'><span style='mso-list:Ignore'><span style='font:7.0pt "Times New Roman"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</span></span></span><![endif]>Another example: think of a <span class=SpellE>std::function</span>&lt;&gt;
that wants to avoid allocating memory for small objects. It needs to reserve a
small buffer - <span class=SpellE><code><span style='font-size:10.0pt'>aligned_storage</span></code></span><code><span
style='font-size:10.0pt'>&lt;12, <span class=SpellE>some_suitable_align</span>&gt;</span></code>
- and then check in the <br>
<br>
<code><span style='font-size:10.0pt'>template&lt;class F&gt; <span class=GramE>function(</span>F
<span class=SpellE>f</span>);</span></code><br>
<br>
constructor whether F can fit in 12 bytes and whether it is compatible with <span
class=SpellE><i style='mso-bidi-font-style:normal'>some_suitable_align</i></span>.
F isn't known at the time the function&lt;&gt; is declared, so it can't be used
as an argument to <span class=SpellE><code><span style='font-size:10.0pt'>aligned_storage</span></code></span>.</p>

<h3 style='tab-stops:45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt'><span
class=SpellE>remove_all_dimensions</span></h3>

<p class=MsoNormal style='margin-left:36.0pt;tab-stops:45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt'><span
class=GramE><span style='font-size:10.0pt;font-family:"Courier New";color:black'>template</span></span><span
style='font-size:10.0pt;font-family:"Courier New";color:black'> &lt;class T&gt;
<span class=SpellE>struct</span> <span class=SpellE>remove_all_dimensions</span>{<o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:36.0pt;tab-stops:45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt'><span
style='font-size:10.0pt;font-family:"Courier New";color:black'><span
style='mso-spacerun:yes'> </span><span class=SpellE><span class=GramE>typedef</span></span>
T type;<o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:36.0pt;tab-stops:45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt'><span
style='font-size:10.0pt;font-family:"Courier New";color:black'>};<o:p></o:p></span></p>

<pre style='margin-left:36.0pt'>template &lt;class T, std::size_t N&gt; struct remove_all_dimensions&lt;T[N]&gt;{
   typedef typename remove_all_dimensions&lt;T&gt;::type type;
};
template &lt;class T&gt; struct remove_all_dimensions&lt;T[]&gt;{
   typedef typename remove_all_dimensions&lt;T&gt;::type type;
};</pre>

<p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
margin-left:36.0pt;tab-stops:45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt'><span
class=GramE><span style='font-size:10.0pt;font-family:"Courier New";color:black'>type</span></span><span
style='color:black'>: </span>for a type 'multi-dimensional array of U', the
resulting type is U; for any other type V, the resulting type is V.</p>

<p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
margin-left:36.0pt;tab-stops:45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt'>[<span
class=GramE><i style='mso-bidi-font-style:normal'>example</i></span><i
style='mso-bidi-font-style:normal'> </i></p>

<pre style='margin-left:36.0pt'>// the following assertions should all hold:
assert((is_same&lt;remove_all_dimensions&lt;int&gt;::type, int&gt;::value));
assert((is_same&lt;remove_all_dimensions&lt;int[2]&gt;::type, int&gt;::value));
assert((is_same&lt;remove_all_dimensions&lt;int[2][3]&gt;::type, int&gt;::value));
assert((is_same&lt;remove_all_dimensions&lt;int[][3]&gt;::type, int&gt;::value));</pre>

<p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
margin-left:36.0pt;tab-stops:45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt'><i
style='mso-bidi-font-style:normal'>- end example</i>]<span style='color:black'><o:p></o:p></span></p>

<p style='tab-stops:45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt'>Howard
<span class=SpellE>Hinnant</span> reports that this trait has been useful in
implementing <span class=SpellE><code><span style='font-size:10.0pt'>is_pod</span></code></span>,
and that the trait is present in the Metrowerks library, there was some
discussion on the list as to whether the trait has uses beyond implementing <span
class=SpellE><code><span style='font-size:10.0pt'>is_pod</span></code></span>
though.</p>

</div>

</div>

</body>

</html>


