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"><!--
|
---|
8 | fn { margin-left: 1cm; text-indent: -1cm; }
|
---|
9 | a:link { color: #004faf; text-decoration: none }
|
---|
10 | a:visited { color: #672967; text-decoration: none }
|
---|
11 | body { 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 Classes</font></a>
|
---|
23 | | <a href="mainclasses.html">
|
---|
24 | <font color="#004faf">Main 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 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 <<a href="qpair-h.html">qpair.h</a>></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 <a href="#first_type"><b>first_type</b></a></li>
|
---|
41 | <li class=fn>typedef T2 <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 T1 & t1, const T2 & t2 )</li>
|
---|
44 | <li class=fn>QPair<T1, T2> & <b>operator=</b> ( const QPair<T1, T2> & other )</li>
|
---|
45 | </ul>
|
---|
46 | <h2>Related Functions</h2>
|
---|
47 | <ul>
|
---|
48 | <li class=fn>QPair <a href="#qMakePair"><b>qMakePair</b></a> ( T1 t1, T2 t2 )</li>
|
---|
49 | </ul>
|
---|
50 | <hr><a name="details"></a><h2>Detailed Description</h2>
|
---|
51 |
|
---|
52 |
|
---|
53 | The 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
|
---|
58 | in your application if the standard pair<> is not available on
|
---|
59 | your target platforms.
|
---|
60 | <p> QPair<T1, T2> defines a template instance to create a pair of
|
---|
61 | values that contains two values of type T1 and T2. Please note
|
---|
62 | that QPair does not store pointers to the two elements; it holds a
|
---|
63 | copy of every member. This is why these kinds of classes are
|
---|
64 | called <em>value based</em>. If you're interested in <em>pointer based</em>
|
---|
65 | classes 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
|
---|
67 | not provide iterators to access these elements. Instead, the two
|
---|
68 | elements (<tt>first</tt> and <tt>second</tt>) are public member variables of
|
---|
69 | the pair. QPair owns the contained elements. For more relaxed
|
---|
70 | ownership semantics, see <a href="qptrcollection.html">QPtrCollection</a> and friends which are
|
---|
71 | pointer-based containers.
|
---|
72 | <p> Some classes cannot be used within a QPair: for example, all
|
---|
73 | classes derived from <a href="qobject.html">QObject</a> and thus all classes that implement
|
---|
74 | widgets. Only "values" can be used in a QPair. To qualify as a
|
---|
75 | value 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
|
---|
82 | copy constructors if no explicit version is supplied. In many
|
---|
83 | cases this is sufficient.
|
---|
84 | <p> QPair uses an STL-like syntax to manipulate and address the
|
---|
85 | objects 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>
|
---|
92 | The type of the first element in the pair.
|
---|
93 | <h3 class=fn><a name="second_type"></a>QPair::second_type</h3>
|
---|
94 | The 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
|
---|
100 | default constructed.
|
---|
101 |
|
---|
102 | <h3 class=fn><a name="QPair-2"></a>QPair::QPair ( const T1 & t1, const T2 & t2 )
|
---|
103 | </h3>
|
---|
104 |
|
---|
105 | <p> Constructs a pair and initializes the <tt>first</tt> element with <em>t1</em>
|
---|
106 | and 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 t1, T2 t2 )
|
---|
110 | </h3>
|
---|
111 |
|
---|
112 | <p>
|
---|
113 | <p> This is a template convenience function. It is used to create a
|
---|
114 | QPair<> object that contains <em>t1</em> and <em>t2</em>.
|
---|
115 |
|
---|
116 | <!-- eof -->
|
---|
117 | <hr><p>
|
---|
118 | This file is part of the <a href="index.html">Qt toolkit</a>.
|
---|
119 | Copyright © 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 © 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>
|
---|