source: trunk/doc/html/qpair.html@ 203

Last change on this file since 203 was 190, checked in by rudi, 14 years ago

reference documentation added

File size: 5.6 KB
Line 
1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
2<!-- /home/espenr/tmp/qt-3.3.8-espenr-2499/qt-x11-free-3.3.8/doc/qpair.doc:40 -->
3<html>
4<head>
5<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
6<title>QPair Class</title>
7<style type="text/css"><!--
8fn { margin-left: 1cm; text-indent: -1cm; }
9a:link { color: #004faf; text-decoration: none }
10a:visited { color: #672967; text-decoration: none }
11body { background: #ffffff; color: black; }
12--></style>
13</head>
14<body>
15
16<table border="0" cellpadding="0" cellspacing="0" width="100%">
17<tr bgcolor="#E5E5E5">
18<td valign=center>
19 <a href="index.html">
20<font color="#004faf">Home</font></a>
21 | <a href="classes.html">
22<font color="#004faf">All&nbsp;Classes</font></a>
23 | <a href="mainclasses.html">
24<font color="#004faf">Main&nbsp;Classes</font></a>
25 | <a href="annotated.html">
26<font color="#004faf">Annotated</font></a>
27 | <a href="groups.html">
28<font color="#004faf">Grouped&nbsp;Classes</font></a>
29 | <a href="functions.html">
30<font color="#004faf">Functions</font></a>
31</td>
32<td align="right" valign="center"><img src="logo32.png" align="right" width="64" height="32" border="0"></td></tr></table><h1 align=center>QPair Class Reference</h1>
33
34<p>The QPair class is a value-based template class that provides a pair of elements.
35<a href="#details">More...</a>
36<p><tt>#include &lt;<a href="qpair-h.html">qpair.h</a>&gt;</tt>
37<p><a href="qpair-members.html">List of all member functions.</a>
38<h2>Public Members</h2>
39<ul>
40<li class=fn>typedef T1&nbsp;<a href="#first_type"><b>first_type</b></a></li>
41<li class=fn>typedef T2&nbsp;<a href="#second_type"><b>second_type</b></a></li>
42<li class=fn><a href="#QPair"><b>QPair</b></a> ()</li>
43<li class=fn><a href="#QPair-2"><b>QPair</b></a> ( const&nbsp;T1&nbsp;&amp;&nbsp;t1, const&nbsp;T2&nbsp;&amp;&nbsp;t2 )</li>
44<li class=fn>QPair&lt;T1, T2&gt; &amp; <b>operator=</b> ( const&nbsp;QPair&lt;T1,&nbsp;T2&gt;&nbsp;&amp;&nbsp;other )</li>
45</ul>
46<h2>Related Functions</h2>
47<ul>
48<li class=fn>QPair <a href="#qMakePair"><b>qMakePair</b></a> ( T1&nbsp;t1, T2&nbsp;t2 )</li>
49</ul>
50<hr><a name="details"></a><h2>Detailed Description</h2>
51
52
53The QPair class is a value-based template class that provides a pair of elements.
54<p>
55
56
57<p> QPair is a Qt implementation of an STL-like pair. It can be used
58in your application if the standard pair&lt;&gt; is not available on
59your target platforms.
60<p> QPair&lt;T1, T2&gt; defines a template instance to create a pair of
61values that contains two values of type T1 and T2. Please note
62that QPair does not store pointers to the two elements; it holds a
63copy of every member. This is why these kinds of classes are
64called <em>value based</em>. If you're interested in <em>pointer based</em>
65classes see, for example, <a href="qptrlist.html">QPtrList</a> and <a href="qdict.html">QDict</a>.
66<p> QPair holds one copy of type T1 and one copy of type T2, but does
67not provide iterators to access these elements. Instead, the two
68elements (<tt>first</tt> and <tt>second</tt>) are public member variables of
69the pair. QPair owns the contained elements. For more relaxed
70ownership semantics, see <a href="qptrcollection.html">QPtrCollection</a> and friends which are
71pointer-based containers.
72<p> Some classes cannot be used within a QPair: for example, all
73classes derived from <a href="qobject.html">QObject</a> and thus all classes that implement
74widgets. Only "values" can be used in a QPair. To qualify as a
75value the class must provide:
76<p> <ul>
77<li> A copy constructor
78<li> An assignment operator
79<li> A constructor that takes no arguments
80</ul>
81<p> Note that C++ defaults to field-by-field assignment operators and
82copy constructors if no explicit version is supplied. In many
83cases this is sufficient.
84<p> QPair uses an STL-like syntax to manipulate and address the
85objects it contains. See the <a href="qtl.html">QTL
86 documentation</a> for more information.
87<p> Functions that need to return two values can use a QPair.
88<p>See also <a href="qtl.html">Qt Template Library Classes</a>, <a href="shared.html">Implicitly and Explicitly Shared Classes</a>, and <a href="tools.html">Non-GUI Classes</a>.
89
90<hr><h2>Member Type Documentation</h2>
91<h3 class=fn><a name="first_type"></a>QPair::first_type</h3>
92The type of the first element in the pair.
93<h3 class=fn><a name="second_type"></a>QPair::second_type</h3>
94The type of the second element in the pair.
95<hr><h2>Member Function Documentation</h2>
96<h3 class=fn><a name="QPair"></a>QPair::QPair ()
97</h3>
98
99<p> Constructs an empty pair. The <tt>first</tt> and <tt>second</tt> elements are
100default constructed.
101
102<h3 class=fn><a name="QPair-2"></a>QPair::QPair ( const&nbsp;T1&nbsp;&amp;&nbsp;t1, const&nbsp;T2&nbsp;&amp;&nbsp;t2 )
103</h3>
104
105<p> Constructs a pair and initializes the <tt>first</tt> element with <em>t1</em>
106and the <tt>second</tt> element with <em>t2</em>.
107
108<hr><h2>Related Functions</h2>
109<h3 class=fn><a href="qpair.html">QPair</a> <a name="qMakePair"></a>qMakePair ( T1&nbsp;t1, T2&nbsp;t2 )
110</h3>
111
112<p>
113<p> This is a template convenience function. It is used to create a
114QPair&lt;&gt; object that contains <em>t1</em> and <em>t2</em>.
115
116<!-- eof -->
117<hr><p>
118This file is part of the <a href="index.html">Qt toolkit</a>.
119Copyright &copy; 1995-2007
120<a href="http://www.trolltech.com/">Trolltech</a>. All Rights Reserved.<p><address><hr><div align=center>
121<table width=100% cellspacing=0 border=0><tr>
122<td>Copyright &copy; 2007
123<a href="troll.html">Trolltech</a><td align=center><a href="trademarks.html">Trademarks</a>
124<td align=right><div align=right>Qt 3.3.8</div>
125</table></div></address></body>
126</html>
Note: See TracBrowser for help on using the repository browser.