1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232
|
<!DOCTYPE html
PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!-- saved from url=(0014)about:internet -->
<html xmlns:MSHelp="http://www.microsoft.com/MSHelp/" lang="en-us" xml:lang="en-us"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="DC.Type" content="reference">
<meta name="DC.Title" content="Allocator Concept">
<meta name="DC.subject" content="Allocator Concept">
<meta name="keywords" content="Allocator Concept">
<meta name="DC.Relation" scheme="URI" content="../../reference/memory_allocation.htm">
<meta name="DC.Relation" scheme="URI" content="tbb_allocator_cls.htm">
<meta name="DC.Relation" scheme="URI" content="scalable_allocator_cls.htm">
<meta name="DC.Relation" scheme="URI" content="cache_aligned_allocator_cls.htm">
<meta name="DC.Relation" scheme="URI" content="zero_allocator.htm">
<meta name="DC.Format" content="XHTML">
<meta name="DC.Identifier" content="allocator_concept">
<meta name="DC.Language" content="en-US">
<link rel="stylesheet" type="text/css" href="../../intel_css_styles.css">
<title>Allocator Concept</title>
</head>
<body id="allocator_concept">
<!-- ==============(Start:NavScript)================= -->
<script src="..\..\NavScript.js" language="JavaScript1.2" type="text/javascript"></script>
<script language="JavaScript1.2" type="text/javascript">WriteNavLink(2);</script>
<!-- ==============(End:NavScript)================= -->
<a name="allocator_concept"><!-- --></a>
<h1 class="topictitle1">Allocator Concept</h1>
<div>
<div class="section">
<p>The allocator concept for allocators in Intel® Threading Building Blocks is similar to the "Allocator requirements" in Table 32 of the ISO C++ Standard, but with further guarantees required by the ISO C++ Standard for use with ISO C++ containers. The table below summarizes the allocator concept. Here, A and B represent instances of the allocator class.</p>
<div class="tablenoborder"><a name="tbl22"><!-- --></a><table cellpadding="4" summary="" id="tbl22" width="100%" frame="hsides" border="1" rules="all"><caption><span class="tablecap">Allocator Concept </span></caption>
<thead align="left"><tr>
<th class="cellrowborder" valign="top" width="NaN%" id="d91657e35"><p>Pseudo-Signature</p>
</th>
<th class="row-nocellborder" valign="top" width="NaN%" id="d91657e39"><p>Semantics</p>
</th>
</tr>
</thead>
<tbody>
<tr>
<td class="cellrowborder" valign="top" width="NaN%" headers="d91657e35 "><samp class="codeph">typedef T* A::pointer</samp></td>
<td class="row-nocellborder" valign="top" width="NaN%" headers="d91657e39 "><p>Pointer to <em>T</em>.</p>
</td>
</tr>
<tr>
<td class="cellrowborder" valign="top" width="NaN%" headers="d91657e35 "><samp class="codeph">typedef const T* A::const_pointer</samp></td>
<td class="row-nocellborder" valign="top" width="NaN%" headers="d91657e39 "><p>Pointer to const <em>T</em>.</p>
</td>
</tr>
<tr>
<td class="cellrowborder" valign="top" width="NaN%" headers="d91657e35 "><samp class="codeph">typedef T& A::reference</samp></td>
<td class="row-nocellborder" valign="top" width="NaN%" headers="d91657e39 "><p>Reference to <em>T</em>.</p>
</td>
</tr>
<tr>
<td class="cellrowborder" valign="top" width="NaN%" headers="d91657e35 "><samp class="codeph">typedef const T& A::const_reference</samp></td>
<td class="row-nocellborder" valign="top" width="NaN%" headers="d91657e39 "><p>Reference to const <em>T</em>.</p>
</td>
</tr>
<tr>
<td class="cellrowborder" valign="top" width="NaN%" headers="d91657e35 "><samp class="codeph">typedef T A::value_type</samp></td>
<td class="row-nocellborder" valign="top" width="NaN%" headers="d91657e39 "><p>Type of value to be allocated.</p>
</td>
</tr>
<tr>
<td class="cellrowborder" valign="top" width="NaN%" headers="d91657e35 "><samp class="codeph">typedef size_t A::size_type</samp></td>
<td class="row-nocellborder" valign="top" width="NaN%" headers="d91657e39 "><p>Type for representing number of values.</p>
</td>
</tr>
<tr>
<td class="cellrowborder" valign="top" width="NaN%" headers="d91657e35 "><samp class="codeph">typedef ptrdiff_t A::difference_type</samp></td>
<td class="row-nocellborder" valign="top" width="NaN%" headers="d91657e39 "><p>Type for representing pointer difference.</p>
</td>
</tr>
<tr>
<td class="cellrowborder" valign="top" width="NaN%" headers="d91657e35 "><samp class="codeph">template<typename U> struct rebind { typedef A<U> A::other;};</samp></td>
<td class="row-nocellborder" valign="top" width="NaN%" headers="d91657e39 "><p>Rebind to a different type U</p>
</td>
</tr>
<tr>
<td class="cellrowborder" valign="top" width="NaN%" headers="d91657e35 "><samp class="codeph">A() throw()</samp></td>
<td class="row-nocellborder" valign="top" width="NaN%" headers="d91657e39 "><p>Default constructor.</p>
</td>
</tr>
<tr>
<td class="cellrowborder" valign="top" width="NaN%" headers="d91657e35 "><samp class="codeph">A( const A& ) throw()</samp></td>
<td class="row-nocellborder" valign="top" width="NaN%" headers="d91657e39 "><p>Copy constructor.</p>
</td>
</tr>
<tr>
<td class="cellrowborder" valign="top" width="NaN%" headers="d91657e35 "><samp class="codeph">template<typename U> A( const A& )</samp></td>
<td class="row-nocellborder" valign="top" width="NaN%" headers="d91657e39 "><p>Rebinding constructor.</p>
</td>
</tr>
<tr>
<td class="cellrowborder" valign="top" width="NaN%" headers="d91657e35 "><samp class="codeph">~A() throw()</samp></td>
<td class="row-nocellborder" valign="top" width="NaN%" headers="d91657e39 "><p>Destructor.</p>
</td>
</tr>
<tr>
<td class="cellrowborder" valign="top" width="NaN%" headers="d91657e35 "><samp class="codeph">T* A::address( T& x ) const</samp></td>
<td class="row-nocellborder" valign="top" width="NaN%" headers="d91657e39 "><p>Take address.</p>
</td>
</tr>
<tr>
<td class="cellrowborder" valign="top" width="NaN%" headers="d91657e35 "><samp class="codeph">const T* A::const_address( const T& x ) const</samp></td>
<td class="row-nocellborder" valign="top" width="NaN%" headers="d91657e39 "><p>Take const address.</p>
</td>
</tr>
<tr>
<td class="cellrowborder" valign="top" width="NaN%" headers="d91657e35 "><samp class="codeph">T* A::allocate( size_type n, const void* hint=0 )</samp></td>
<td class="row-nocellborder" valign="top" width="NaN%" headers="d91657e39 "><p>Allocate space for <samp class="codeph">n</samp> values.</p>
</td>
</tr>
<tr>
<td class="cellrowborder" valign="top" width="NaN%" headers="d91657e35 "><samp class="codeph">void A::deallocate( T* p, size_t n )</samp></td>
<td class="row-nocellborder" valign="top" width="NaN%" headers="d91657e39 "><p>Deallocate <samp class="codeph">n</samp> values.</p>
</td>
</tr>
<tr>
<td class="cellrowborder" valign="top" width="NaN%" headers="d91657e35 "><samp class="codeph">size_type A::max_size() const throw()</samp></td>
<td class="row-nocellborder" valign="top" width="NaN%" headers="d91657e39 "><p>Maximum plausible argument to method allocate.</p>
</td>
</tr>
<tr>
<td class="cellrowborder" valign="top" width="NaN%" headers="d91657e35 "><samp class="codeph">void A::construct( T* p, const T& value )</samp></td>
<td class="row-nocellborder" valign="top" width="NaN%" headers="d91657e39 "><p><samp class="codeph">new(p) T(value)</samp></p>
</td>
</tr>
<tr>
<td class="cellrowborder" valign="top" width="NaN%" headers="d91657e35 ">
<samp class="codeph">void A::destroy( T* p )</samp>
</td>
<td class="row-nocellborder" valign="top" width="NaN%" headers="d91657e39 ">
<samp class="codeph"> p->T::~T()
</samp> </td>
</tr>
<tr>
<td class="cellrowborder" valign="top" width="NaN%" headers="d91657e35 "><samp class="codeph">bool operator==( const A&, const B& )</samp></td>
<td class="row-nocellborder" valign="top" width="NaN%" headers="d91657e39 "><p>Return true.</p>
</td>
</tr>
<tr>
<td class="cellrowborder" valign="top" width="NaN%" headers="d91657e35 "><samp class="codeph">bool operator!=( const A&, const B& )</samp></td>
<td class="row-nocellborder" valign="top" width="NaN%" headers="d91657e39 "><p>Return false.</p>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="section"><p><strong>Model Types</strong></p>
<p>Template classes:<samp class="codeph"> tbb_allocator</samp>,<samp class="codeph">
scalable_allocator</samp>, and <samp class="codeph">cached_aligned_allocator</samp>, and
<samp class="codeph">zero_allocator</samp> model the Allocator concept.</p>
</div>
</div>
<div class="familylinks">
<div class="parentlink"><strong>Parent topic:</strong> <a href="../../reference/memory_allocation.htm">Memory Allocation</a></div>
</div>
<div class="See Also">
<h2>See Also</h2>
<div class="linklist">
<div><a href="tbb_allocator_cls.htm">tbb_allocator Template Class</a></div>
<div><a href="scalable_allocator_cls.htm">scalable_allocator Template Class</a></div>
<div><a href="cache_aligned_allocator_cls.htm">cache_aligned_allocator Template Class</a></div>
<div><a href="zero_allocator.htm">zero_allocator Template Class</a></div></div>
</div>
</body>
</html>
|