1<html> 2<head> 3<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> 4<title>Class stack_traits</title> 5<link rel="stylesheet" href="../../../../../../doc/src/boostbook.css" type="text/css"> 6<meta name="generator" content="DocBook XSL Stylesheets V1.79.1"> 7<link rel="home" href="../../index.html" title="Chapter 1. Coroutine"> 8<link rel="up" href="../stack.html" title="Stack allocation"> 9<link rel="prev" href="segmented_stack_allocator.html" title="Class segmented_stack_allocator"> 10<link rel="next" href="stack_context.html" title="Class stack_context"> 11</head> 12<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"> 13<table cellpadding="2" width="100%"><tr> 14<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../boost.png"></td> 15<td align="center"><a href="../../../../../../index.html">Home</a></td> 16<td align="center"><a href="../../../../../../libs/libraries.htm">Libraries</a></td> 17<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td> 18<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td> 19<td align="center"><a href="../../../../../../more/index.htm">More</a></td> 20</tr></table> 21<hr> 22<div class="spirit-nav"> 23<a accesskey="p" href="segmented_stack_allocator.html"><img src="../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../stack.html"><img src="../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="stack_context.html"><img src="../../../../../../doc/src/images/next.png" alt="Next"></a> 24</div> 25<div class="section"> 26<div class="titlepage"><div><div><h3 class="title"> 27<a name="coroutine.stack.stack_traits"></a><a class="link" href="stack_traits.html" title="Class stack_traits">Class <span class="emphasis"><em>stack_traits</em></span></a> 28</h3></div></div></div> 29<p> 30 <span class="emphasis"><em>stack_traits</em></span> models a <span class="emphasis"><em>stack-traits</em></span> 31 providing a way to access certain properites defined by the enironment. Stack 32 allocators use <span class="emphasis"><em>stack-traits</em></span> to allocate stacks. 33 </p> 34<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">coroutine</span><span class="special">/</span><span class="identifier">stack_traits</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span> 35 36<span class="keyword">struct</span> <span class="identifier">stack_traits</span> 37<span class="special">{</span> 38 <span class="keyword">static</span> <span class="keyword">bool</span> <span class="identifier">is_unbounded</span><span class="special">()</span> <span class="keyword">noexcept</span><span class="special">;</span> 39 40 <span class="keyword">static</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">size_t</span> <span class="identifier">page_size</span><span class="special">()</span> <span class="keyword">noexcept</span><span class="special">;</span> 41 42 <span class="keyword">static</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">size_t</span> <span class="identifier">default_size</span><span class="special">()</span> <span class="keyword">noexcept</span><span class="special">;</span> 43 44 <span class="keyword">static</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">size_t</span> <span class="identifier">minimum_size</span><span class="special">()</span> <span class="keyword">noexcept</span><span class="special">;</span> 45 46 <span class="keyword">static</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">size_t</span> <span class="identifier">maximum_size</span><span class="special">()</span> <span class="keyword">noexcept</span><span class="special">;</span> 47<span class="special">}</span> 48</pre> 49<h5> 50<a name="coroutine.stack.stack_traits.h0"></a> 51 <span class="phrase"><a name="coroutine.stack.stack_traits._code__phrase_role__keyword__static__phrase___phrase_role__keyword__bool__phrase___phrase_role__identifier__is_unbounded__phrase__phrase_role__special______phrase___code_"></a></span><a class="link" href="stack_traits.html#coroutine.stack.stack_traits._code__phrase_role__keyword__static__phrase___phrase_role__keyword__bool__phrase___phrase_role__identifier__is_unbounded__phrase__phrase_role__special______phrase___code_"><code class="computeroutput"><span class="keyword">static</span> <span class="keyword">bool</span> <span class="identifier">is_unbounded</span><span class="special">()</span></code></a> 52 </h5> 53<div class="variablelist"> 54<p class="title"><b></b></p> 55<dl class="variablelist"> 56<dt><span class="term">Returns:</span></dt> 57<dd><p> 58 Returns <code class="computeroutput"><span class="keyword">true</span></code> if the environment 59 defines no limit for the size of a stack. 60 </p></dd> 61<dt><span class="term">Throws:</span></dt> 62<dd><p> 63 Nothing. 64 </p></dd> 65</dl> 66</div> 67<h5> 68<a name="coroutine.stack.stack_traits.h1"></a> 69 <span class="phrase"><a name="coroutine.stack.stack_traits._code__phrase_role__keyword__static__phrase___phrase_role__identifier__std__phrase__phrase_role__special______phrase__phrase_role__identifier__size_t__phrase___phrase_role__identifier__page_size__phrase__phrase_role__special______phrase___code_"></a></span><a class="link" href="stack_traits.html#coroutine.stack.stack_traits._code__phrase_role__keyword__static__phrase___phrase_role__identifier__std__phrase__phrase_role__special______phrase__phrase_role__identifier__size_t__phrase___phrase_role__identifier__page_size__phrase__phrase_role__special______phrase___code_"><code class="computeroutput"><span class="keyword">static</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">size_t</span> <span class="identifier">page_size</span><span class="special">()</span></code></a> 70 </h5> 71<div class="variablelist"> 72<p class="title"><b></b></p> 73<dl class="variablelist"> 74<dt><span class="term">Returns:</span></dt> 75<dd><p> 76 Returns the page size in bytes. 77 </p></dd> 78<dt><span class="term">Throws:</span></dt> 79<dd><p> 80 Nothing. 81 </p></dd> 82</dl> 83</div> 84<h5> 85<a name="coroutine.stack.stack_traits.h2"></a> 86 <span class="phrase"><a name="coroutine.stack.stack_traits._code__phrase_role__keyword__static__phrase___phrase_role__identifier__std__phrase__phrase_role__special______phrase__phrase_role__identifier__size_t__phrase___phrase_role__identifier__default_size__phrase__phrase_role__special______phrase___code_"></a></span><a class="link" href="stack_traits.html#coroutine.stack.stack_traits._code__phrase_role__keyword__static__phrase___phrase_role__identifier__std__phrase__phrase_role__special______phrase__phrase_role__identifier__size_t__phrase___phrase_role__identifier__default_size__phrase__phrase_role__special______phrase___code_"><code class="computeroutput"><span class="keyword">static</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">size_t</span> <span class="identifier">default_size</span><span class="special">()</span></code></a> 87 </h5> 88<div class="variablelist"> 89<p class="title"><b></b></p> 90<dl class="variablelist"> 91<dt><span class="term">Returns:</span></dt> 92<dd><p> 93 Returns a default stack size, which may be platform specific. If the 94 stack is unbounded then the present implementation returns the maximum 95 of <code class="computeroutput"><span class="number">64</span> <span class="identifier">kB</span></code> 96 and <code class="computeroutput"><span class="identifier">minimum_size</span><span class="special">()</span></code>. 97 </p></dd> 98<dt><span class="term">Throws:</span></dt> 99<dd><p> 100 Nothing. 101 </p></dd> 102</dl> 103</div> 104<h5> 105<a name="coroutine.stack.stack_traits.h3"></a> 106 <span class="phrase"><a name="coroutine.stack.stack_traits._code__phrase_role__keyword__static__phrase___phrase_role__identifier__std__phrase__phrase_role__special______phrase__phrase_role__identifier__size_t__phrase___phrase_role__identifier__minimum_size__phrase__phrase_role__special______phrase___code_"></a></span><a class="link" href="stack_traits.html#coroutine.stack.stack_traits._code__phrase_role__keyword__static__phrase___phrase_role__identifier__std__phrase__phrase_role__special______phrase__phrase_role__identifier__size_t__phrase___phrase_role__identifier__minimum_size__phrase__phrase_role__special______phrase___code_"><code class="computeroutput"><span class="keyword">static</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">size_t</span> <span class="identifier">minimum_size</span><span class="special">()</span></code></a> 107 </h5> 108<div class="variablelist"> 109<p class="title"><b></b></p> 110<dl class="variablelist"> 111<dt><span class="term">Returns:</span></dt> 112<dd><p> 113 Returns the minimum size in bytes of stack defined by the environment 114 (Win32 4kB/Win64 8kB, defined by rlimit on POSIX). 115 </p></dd> 116<dt><span class="term">Throws:</span></dt> 117<dd><p> 118 Nothing. 119 </p></dd> 120</dl> 121</div> 122<h5> 123<a name="coroutine.stack.stack_traits.h4"></a> 124 <span class="phrase"><a name="coroutine.stack.stack_traits._code__phrase_role__keyword__static__phrase___phrase_role__identifier__std__phrase__phrase_role__special______phrase__phrase_role__identifier__size_t__phrase___phrase_role__identifier__maximum_size__phrase__phrase_role__special______phrase___code_"></a></span><a class="link" href="stack_traits.html#coroutine.stack.stack_traits._code__phrase_role__keyword__static__phrase___phrase_role__identifier__std__phrase__phrase_role__special______phrase__phrase_role__identifier__size_t__phrase___phrase_role__identifier__maximum_size__phrase__phrase_role__special______phrase___code_"><code class="computeroutput"><span class="keyword">static</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">size_t</span> <span class="identifier">maximum_size</span><span class="special">()</span></code></a> 125 </h5> 126<div class="variablelist"> 127<p class="title"><b></b></p> 128<dl class="variablelist"> 129<dt><span class="term">Preconditions:</span></dt> 130<dd><p> 131 <code class="computeroutput"><span class="identifier">is_unbounded</span><span class="special">()</span></code> 132 returns <code class="computeroutput"><span class="keyword">false</span></code>. 133 </p></dd> 134<dt><span class="term">Returns:</span></dt> 135<dd><p> 136 Returns the maximum size in bytes of stack defined by the environment. 137 </p></dd> 138<dt><span class="term">Throws:</span></dt> 139<dd><p> 140 Nothing. 141 </p></dd> 142</dl> 143</div> 144</div> 145<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr> 146<td align="left"></td> 147<td align="right"><div class="copyright-footer">Copyright © 2009 Oliver Kowalke<p> 148 Distributed under the Boost Software License, Version 1.0. (See accompanying 149 file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>) 150 </p> 151</div></td> 152</tr></table> 153<hr> 154<div class="spirit-nav"> 155<a accesskey="p" href="segmented_stack_allocator.html"><img src="../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../stack.html"><img src="../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="stack_context.html"><img src="../../../../../../doc/src/images/next.png" alt="Next"></a> 156</div> 157</body> 158</html> 159