3 <meta http-equiv=
"Content-Type" content=
"text/html; charset=US-ASCII">
4 <title>Class fixedsize_stack
</title>
5 <link rel=
"stylesheet" href=
"../../../../../../doc/src/boostbook.css" type=
"text/css">
6 <meta name=
"generator" content=
"DocBook XSL Stylesheets V1.75.2">
7 <link rel=
"home" href=
"../../index.html" title=
"Chapter 1. Fiber">
8 <link rel=
"up" href=
"../stack.html" title=
"Stack allocation">
9 <link rel=
"prev" href=
"pooled_fixedsize.html" title=
"Class pooled_fixedsize_stack">
10 <link rel=
"next" href=
"segmented_stack.html" title=
"Class segmented_stack">
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>
22 <div class=
"spirit-nav">
23 <a accesskey=
"p" href=
"pooled_fixedsize.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=
"segmented_stack.html"><img src=
"../../../../../../doc/src/images/next.png" alt=
"Next"></a>
26 <div class=
"titlepage"><div><div><h3 class=
"title">
27 <a name=
"fiber.stack.fixedsize"></a><a name=
"class_fixedsize_stack"></a><a class=
"link" href=
"fixedsize.html" title=
"Class fixedsize_stack">Class
28 <span class=
"emphasis"><em>fixedsize_stack
</em></span></a>
29 </h3></div></div></div>
31 <span class=
"bold"><strong>Boost.Fiber
</strong></span> provides the class __fixedsize__
32 which models the
<a class=
"link" href=
"../stack.html#stack_allocator_concept"><span class=
"emphasis"><em>stack-allocator
33 concept
</em></span></a>. In contrast to __protected_fixedsize__ it does
34 not append a guard page at the end of each stack. The memory is simply managed
35 by
<code class=
"computeroutput"><span class=
"identifier">std
</span><span class=
"special">::
</span><span class=
"identifier">malloc
</span><span class=
"special">()
</span></code>
36 and
<code class=
"computeroutput"><span class=
"identifier">std
</span><span class=
"special">::
</span><span class=
"identifier">free
</span><span class=
"special">()
</span></code>.
38 <pre class=
"programlisting"><span class=
"preprocessor">#include
</span> <span class=
"special"><</span><span class=
"identifier">boost
</span><span class=
"special">/
</span><span class=
"identifier">context
</span><span class=
"special">/
</span><span class=
"identifier">fixedsize_stack
</span><span class=
"special">.
</span><span class=
"identifier">hpp
</span><span class=
"special">></span>
40 <span class=
"keyword">struct
</span> <span class=
"identifier">fixedsize_stack
</span> <span class=
"special">{
</span>
41 <span class=
"identifier">fixedsize_stack
</span><span class=
"special">(
</span><span class=
"identifier">std
</span><span class=
"special">::
</span><span class=
"identifier">size_t
</span> <span class=
"identifier">size
</span> <span class=
"special">=
</span> <span class=
"identifier">traits_type
</span><span class=
"special">::
</span><span class=
"identifier">default_size
</span><span class=
"special">());
</span>
43 <span class=
"identifier">stack_context
</span> <span class=
"identifier">allocate
</span><span class=
"special">();
</span>
45 <span class=
"keyword">void
</span> <span class=
"identifier">deallocate
</span><span class=
"special">(
</span> <span class=
"identifier">stack_context
</span> <span class=
"special">&);
</span>
46 <span class=
"special">}
</span>
49 <a name=
"fiber.stack.fixedsize.h0"></a>
50 <span><a name=
"fiber.stack.fixedsize._code__phrase_role__identifier__stack_context__phrase___phrase_role__identifier__allocate__phrase__phrase_role__special______phrase___code_"></a></span><a class=
"link" href=
"fixedsize.html#fiber.stack.fixedsize._code__phrase_role__identifier__stack_context__phrase___phrase_role__identifier__allocate__phrase__phrase_role__special______phrase___code_"><code class=
"computeroutput"><span class=
"identifier">stack_context
</span> <span class=
"identifier">allocate
</span><span class=
"special">()
</span></code></a>
52 <div class=
"variablelist">
53 <p class=
"title"><b></b></p>
55 <dt><span class=
"term">Preconditions:
</span></dt>
57 <code class=
"computeroutput"><span class=
"identifier">traits_type
</span><span class=
"special">::
</span><span class=
"identifier">minimum_size
</span><span class=
"special">()
</span>
58 <span class=
"special"><=
</span> <span class=
"identifier">size
</span></code>
59 and
<code class=
"computeroutput"><span class=
"identifier">traits_type
</span><span class=
"special">::
</span><span class=
"identifier">is_unbounded
</span><span class=
"special">()
</span>
60 <span class=
"special">||
</span> <span class=
"special">(
</span>
61 <span class=
"identifier">traits_type
</span><span class=
"special">::
</span><span class=
"identifier">maximum_size
</span><span class=
"special">()
</span>
62 <span class=
"special">>=
</span> <span class=
"identifier">size
</span><span class=
"special">)
</span></code>.
64 <dt><span class=
"term">Effects:
</span></dt>
66 Allocates memory of at least
<code class=
"computeroutput"><span class=
"identifier">size
</span></code>
67 bytes and stores a pointer to the stack and its actual size in
<code class=
"computeroutput"><span class=
"identifier">sctx
</span></code>. Depending on the architecture
68 (the stack grows downwards/upwards) the stored address is the highest/lowest
74 <a name=
"fiber.stack.fixedsize.h1"></a>
75 <span><a name=
"fiber.stack.fixedsize._code__phrase_role__keyword__void__phrase___phrase_role__identifier__deallocate__phrase__phrase_role__special_____phrase___phrase_role__identifier__stack_context__phrase___phrase_role__special___amp___phrase___phrase_role__identifier__sctx__phrase__phrase_role__special_____phrase___code_"></a></span><a class=
"link" href=
"fixedsize.html#fiber.stack.fixedsize._code__phrase_role__keyword__void__phrase___phrase_role__identifier__deallocate__phrase__phrase_role__special_____phrase___phrase_role__identifier__stack_context__phrase___phrase_role__special___amp___phrase___phrase_role__identifier__sctx__phrase__phrase_role__special_____phrase___code_"><code class=
"computeroutput"><span class=
"keyword">void
</span> <span class=
"identifier">deallocate
</span><span class=
"special">(
</span> <span class=
"identifier">stack_context
</span>
76 <span class=
"special">&</span> <span class=
"identifier">sctx
</span><span class=
"special">)
</span></code></a>
78 <div class=
"variablelist">
79 <p class=
"title"><b></b></p>
81 <dt><span class=
"term">Preconditions:
</span></dt>
83 <code class=
"computeroutput"><span class=
"identifier">sctx
</span><span class=
"special">.
</span><span class=
"identifier">sp
</span></code> is valid,
<code class=
"computeroutput"><span class=
"identifier">traits_type
</span><span class=
"special">::
</span><span class=
"identifier">minimum_size
</span><span class=
"special">()
</span> <span class=
"special"><=
</span> <span class=
"identifier">sctx
</span><span class=
"special">.
</span><span class=
"identifier">size
</span></code> and
<code class=
"computeroutput"><span class=
"identifier">traits_type
</span><span class=
"special">::
</span><span class=
"identifier">is_unbounded
</span><span class=
"special">()
</span> <span class=
"special">||
</span> <span class=
"special">(
</span> <span class=
"identifier">traits_type
</span><span class=
"special">::
</span><span class=
"identifier">maximum_size
</span><span class=
"special">()
</span> <span class=
"special">>=
</span> <span class=
"identifier">sctx
</span><span class=
"special">.
</span><span class=
"identifier">size
</span><span class=
"special">)
</span></code>.
85 <dt><span class=
"term">Effects:
</span></dt>
87 Deallocates the stack space.
92 <table xmlns:
rev=
"http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width=
"100%"><tr>
93 <td align=
"left"></td>
94 <td align=
"right"><div class=
"copyright-footer">Copyright
© 2013 Oliver Kowalke
<p>
95 Distributed under the Boost Software License, Version
1.0. (See accompanying
96 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>)
101 <div class=
"spirit-nav">
102 <a accesskey=
"p" href=
"pooled_fixedsize.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=
"segmented_stack.html"><img src=
"../../../../../../doc/src/images/next.png" alt=
"Next"></a>