Files
boost_fusion/doc/html/fusion/support/pair.html
Joel de Guzman eb324cc029 Doc Tweaks
[SVN r35130]
2006-09-16 05:27:33 +00:00

213 lines
11 KiB
HTML
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>pair</title>
<link rel="stylesheet" href="../../boostbook.css" type="text/css">
<meta name="generator" content="DocBook XSL Stylesheets V1.66.1">
<link rel="start" href="../../index.html" title="Chapter 1. Fusion 2.0">
<link rel="up" href="../support.html" title="Support">
<link rel="prev" href="category_of.html" title="category_of">
<link rel="next" href="../iterators.html" title="Iterators">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table cellpadding="2" width="100%">
<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../boost.png"></td>
<td align="center"><a href="../../../../../../index.htm">Home</a></td>
<td align="center"><a href="../../../../../libraries.htm">Libraries</a></td>
<td align="center"><a href="../../../../../../people/people.htm">People</a></td>
<td align="center"><a href="../../../../../../more/faq.htm">FAQ</a></td>
<td align="center"><a href="../../../../../../more/index.htm">More</a></td>
</table>
<hr>
<div class="spirit-nav">
<a accesskey="p" href="category_of.html"><img src="../../images/prev.png" alt="Prev"></a><a accesskey="u" href="../support.html"><img src="../../images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../images/home.png" alt="Home"></a><a accesskey="n" href="../iterators.html"><img src="../../images/next.png" alt="Next"></a>
</div>
<div class="section" lang="en">
<div class="titlepage"><div><div><h3 class="title">
<a name="fusion.support.pair"></a><a href="pair.html" title="pair">pair</a></h3></div></div></div>
<a name="fusion.support.pair.description"></a><h4>
<a name="id454608"></a>
<a href="pair.html#fusion.support.pair.description">Description</a>
</h4>
<p>
Fusion <tt class="computeroutput"><span class="identifier">pair</span></tt> type is a half
runtime pair. A half runtime pair is similar to a <a href="../sequences/adapted/std__pair.html" title="std::pair"><tt class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">pair</span></tt></a>,
but, unlike <a href="../sequences/adapted/std__pair.html" title="std::pair"><tt class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">pair</span></tt></a>,
the first type does not have data. It is used as elements in <span class="underline">_map</span>_s,
for example.
</p>
<a name="fusion.support.pair.synopsis"></a><h4>
<a name="id454708"></a>
<a href="pair.html#fusion.support.pair.synopsis">Synopsis</a>
</h4>
<pre class="programlisting">
<span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">typename</span> <span class="identifier">First</span><span class="special">,</span> <span class="keyword">typename</span> <span class="identifier">Second</span><span class="special">&gt;</span>
<span class="keyword">struct</span> <span class="identifier">pair</span><span class="special">;</span>
</pre>
<a name="fusion.support.pair.template_parameters"></a><h4>
<a name="id454802"></a>
<a href="pair.html#fusion.support.pair.template_parameters">Template parameters</a>
</h4>
<div class="informaltable">
<h4>
<a name="id454823"></a>
</h4>
<table class="table">
<colgroup>
<col>
<col>
</colgroup>
<thead><tr>
<th>Parameter</th>
<th>Description</th>
</tr></thead>
<tbody>
<tr>
<td>First</td>
<td>The first type. This is purely a type. No
data is held.</td>
</tr>
<tr>
<td>Second</td>
<td>The second type. This contains data.</td>
</tr>
</tbody>
</table>
</div>
<div class="variablelist">
<p class="title"><b>Notation</b></p>
<dl>
<dt><span class="term"><tt class="computeroutput"><span class="identifier">P</span></tt></span></dt>
<dd>
Fusion pair type
</dd>
<dt><span class="term"><tt class="computeroutput"><span class="identifier">p</span></tt>,
<tt class="computeroutput"><span class="identifier">p2</span></tt></span></dt>
<dd>
Fusion pairs
</dd>
<dt><span class="term"><tt class="computeroutput"><span class="identifier">F</span></tt>,
<tt class="computeroutput"><span class="identifier">S</span></tt></span></dt>
<dd>
Arbitrary types
</dd>
<dt><span class="term"><tt class="computeroutput"><span class="identifier">s</span></tt></span></dt>
<dd>
Value of type <tt class="computeroutput"><span class="identifier">S</span></tt>
</dd>
<dt><span class="term"><tt class="computeroutput"><span class="identifier">o</span></tt></span></dt>
<dd>
Output stream
</dd>
<dt><span class="term"><tt class="computeroutput"><span class="identifier">i</span></tt></span></dt>
<dd>
Input stream
</dd>
</dl>
</div>
<a name="fusion.support.pair.expression_semantics"></a><h4>
<a name="id455028"></a>
<a href="pair.html#fusion.support.pair.expression_semantics">Expression Semantics</a>
</h4>
<div class="informaltable">
<h4>
<a name="id455049"></a>
</h4>
<table class="table">
<colgroup>
<col>
<col>
</colgroup>
<thead><tr>
<th>Expression</th>
<th>Semantics</th>
</tr></thead>
<tbody>
<tr>
<td><tt class="computeroutput"><span class="identifier">P</span><span class="special">::</span><span class="identifier">first_type</span></tt></td>
<td>The type
of the first template parameter, <tt class="computeroutput"><span class="identifier">F</span></tt>.</td>
</tr>
<tr>
<td><tt class="computeroutput"><span class="identifier">P</span><span class="special">::</span><span class="identifier">second_type</span></tt></td>
<td>The type
of the second template parameter, <tt class="computeroutput"><span class="identifier">S</span></tt>.</td>
</tr>
<tr>
<td><tt class="computeroutput"><span class="identifier">P</span><span class="special">()</span></tt></td>
<td>Default
construction.</td>
</tr>
<tr>
<td><tt class="computeroutput"><span class="identifier">P</span><span class="special">(</span><span class="identifier">s</span><span class="special">)</span></tt></td>
<td>Construct
a pair given value for the second type, <tt class="computeroutput"><span class="identifier">s</span></tt>.</td>
</tr>
<tr>
<td><tt class="computeroutput"><span class="identifier">P</span><span class="special">(</span><span class="identifier">p2</span><span class="special">)</span></tt></td>
<td>Copy
constructs a pair from another pair, <tt class="computeroutput"><span class="identifier">p2</span></tt>.</td>
</tr>
<tr>
<td><tt class="computeroutput"><span class="identifier">p</span> <span class="special">=</span> <span class="identifier">p2</span></tt></td>
<td>Assigns a pair,
p1, from another pair, <tt class="computeroutput"><span class="identifier">p2</span></tt>.</td>
</tr>
<tr>
<td>make_pair&lt;F&gt;(s)</td>
<td>Make a pair given the first
type, <tt class="computeroutput"><span class="identifier">F</span></tt>, and a value
for the second type, <tt class="computeroutput"><span class="identifier">s</span></tt>.
The second type assumes the type of <tt class="computeroutput"><span class="identifier">s</span></tt>
</td>
</tr>
<tr>
<td><tt class="computeroutput"><span class="identifier">o</span> <span class="special">&lt;&lt;</span> <span class="identifier">p</span></tt></td>
<td>Output <tt class="computeroutput"><span class="identifier">p</span></tt> to output stream, <tt class="computeroutput"><span class="identifier">o</span></tt>.</td>
</tr>
<tr>
<td><tt class="computeroutput"><span class="identifier">i</span> <span class="special">&gt;&gt;</span> <span class="identifier">p</span></tt></td>
<td>Input <tt class="computeroutput"><span class="identifier">p</span></tt> from input stream, <tt class="computeroutput"><span class="identifier">i</span></tt>.</td>
</tr>
<tr>
<td><tt class="computeroutput"><span class="identifier">p</span> <span class="special">==</span> <span class="identifier">p2</span></tt></td>
<td>Tests two pairs
for equality.</td>
</tr>
<tr>
<td><tt class="computeroutput"><span class="identifier">p</span> <span class="special">!=</span> <span class="identifier">p2</span></tt></td>
<td>Tests two pairs
for inequality.</td>
</tr>
</tbody>
</table>
</div>
<a name="fusion.support.pair.header"></a><h4>
<a name="id455514"></a>
<a href="pair.html#fusion.support.pair.header">Header</a>
</h4>
<pre class="programlisting">
<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">fusion</span><span class="special">/</span><span class="identifier">support</span><span class="special">/</span><span class="identifier">pair</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
</pre>
<a name="fusion.support.pair.example"></a><h4>
<a name="id455606"></a>
<a href="pair.html#fusion.support.pair.example">Example</a>
</h4>
<pre class="programlisting">
<span class="identifier">pair</span><span class="special">&lt;</span><span class="keyword">int</span><span class="special">,</span> <span class="keyword">char</span><span class="special">&gt;</span> <span class="identifier">p</span><span class="special">(</span><span class="char">'X'</span><span class="special">);</span>
<span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special">&lt;&lt;</span> <span class="identifier">p</span> <span class="special">&lt;&lt;</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span>
<span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special">&lt;&lt;</span> <span class="identifier">make_pair</span><span class="special">&lt;</span><span class="keyword">int</span><span class="special">&gt;(</span><span class="char">'X'</span><span class="special">)</span> <span class="special">&lt;&lt;</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span>
<span class="identifier">assert</span><span class="special">((</span><span class="identifier">p</span> <span class="special">==</span> <span class="identifier">make_pair</span><span class="special">&lt;</span><span class="keyword">int</span><span class="special">&gt;(</span><span class="char">'X'</span><span class="special">)));</span>
</pre>
</div>
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
<td align="left"></td>
<td align="right"><small>Copyright © 2001-2005 Joel de Guzman, Dan Marsden</small></td>
</tr></table>
<hr>
<div class="spirit-nav">
<a accesskey="p" href="category_of.html"><img src="../../images/prev.png" alt="Prev"></a><a accesskey="u" href="../support.html"><img src="../../images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../images/home.png" alt="Home"></a><a accesskey="n" href="../iterators.html"><img src="../../images/next.png" alt="Next"></a>
</div>
</body>
</html>