boost::none - simpler and works with MSVC

This commit is contained in:
Andrzej Krzemienski
2015-10-01 15:26:15 +02:00
parent 593710e961
commit 9f8dd57386
8 changed files with 66 additions and 18 deletions

View File

@ -15,14 +15,16 @@
```
namespace boost {
class none_t {};
class none_t {/* see below */};
extern const none_t none; // see below
const none_t none (/* see below */);
} // namespace boost
```
Variable `none` has external linkage, however it is not required to link with any library to obtain its definition. Only by including this header file, the definition becomes available, by means of using template instantiation.
Class `none_t` is meant to serve as a tag for selecting appropriate overloads of from `optional`'s interface. It is an empty, trivially copyable class with disabled default constructor.
Constant `none` is used to indicate an optional object that does not contain a value in initialization, assignment and relational operations of `optional`.
[endsect]

View File

@ -146,7 +146,7 @@
</div>
</div>
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
<td align="left"><p><small>Last revised: July 08, 2015 at 21:39:55 GMT</small></p></td>
<td align="left"><p><small>Last revised: October 01, 2015 at 13:19:55 GMT</small></p></td>
<td align="right"><div class="copyright-footer"></div></td>
</tr></table>
<hr>

View File

@ -52,19 +52,23 @@
</p>
<pre class="programlisting"><span class="keyword">namespace</span> <span class="identifier">boost</span> <span class="special">{</span>
<span class="keyword">class</span> <span class="identifier">none_t</span> <span class="special">{};</span>
<span class="keyword">class</span> <span class="identifier">none_t</span> <span class="special">{/*</span> <span class="identifier">see</span> <span class="identifier">below</span> <span class="special">*/};</span>
<span class="keyword">extern</span> <span class="keyword">const</span> <span class="identifier">none_t</span> <span class="identifier">none</span><span class="special">;</span> <span class="comment">// see below</span>
<span class="keyword">const</span> <span class="identifier">none_t</span> <span class="identifier">none</span> <span class="special">(/*</span> <span class="identifier">see</span> <span class="identifier">below</span> <span class="special">*/);</span>
<span class="special">}</span> <span class="comment">// namespace boost</span>
</pre>
<p>
</p>
<p>
Variable <code class="computeroutput"><span class="identifier">none</span></code> has external
linkage, however it is not required to link with any library to obtain
its definition. Only by including this header file, the definition becomes
available, by means of using template instantiation.
Class <code class="computeroutput"><span class="identifier">none_t</span></code> is meant to
serve as a tag for selecting appropriate overloads of from <code class="computeroutput"><span class="identifier">optional</span></code>'s interface. It is an empty,
trivially copyable class with disabled default constructor.
</p>
<p>
Constant <code class="computeroutput"><span class="identifier">none</span></code> is used to
indicate an optional object that does not contain a value in initialization,
assignment and relational operations of <code class="computeroutput"><span class="identifier">optional</span></code>.
</p>
</div>
</div>