summaryrefslogtreecommitdiffstats
path: root/doc/man/man3/tqpair.3qt
blob: 63bc7168797c8700759c9982224856ca22d555f3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
'\" t
.TH TQPair 3qt "2 February 2007" "Trolltech AS" \" -*- nroff -*-
.\" Copyright 1992-2007 Trolltech ASA.  All rights reserved.  See the
.\" license file included in the distribution for a complete license
.\" statement.
.\"
.ad l
.nh
.SH NAME
TQPair \- Value-based template class that provides a pair of elements
.SH SYNOPSIS
\fC#include <tqpair.h>\fR
.PP
.SS "Public Members"
.in +1c
.ti -1c
.BI "typedef T1 \fBfirst_type\fR"
.br
.ti -1c
.BI "typedef T2 \fBsecond_type\fR"
.br
.ti -1c
.BI "\fBTQPair\fR ()"
.br
.ti -1c
.BI "\fBTQPair\fR ( const T1 & t1, const T2 & t2 )"
.br
.ti -1c
.BI "TQPair<T1, T2> & \fBoperator=\fR ( const TQPair<T1, T2> & other )"
.br
.in -1c
.SH RELATED FUNCTION DOCUMENTATION
.in +1c
.ti -1c
.BI "TQPair \fBqMakePair\fR ( T1 t1, T2 t2 )"
.br
.in -1c
.SH DESCRIPTION
The TQPair class is a value-based template class that provides a pair of elements.
.PP
TQPair is a TQt implementation of an STL-like pair. It can be used in your application if the standard pair<> is not available on your target platforms.
.PP
TQPair<T1, T2> defines a template instance to create a pair of values that contains two values of type T1 and T2. Please note that TQPair does not store pointers to the two elements; it holds a copy of every member. This is why these kinds of classes are called \fIvalue based\fR. If you're interested in \fIpointer based\fR classes see, for example, TQPtrList and QDict.
.PP
TQPair holds one copy of type T1 and one copy of type T2, but does not provide iterators to access these elements. Instead, the two elements (\fCfirst\fR and \fCsecond\fR) are public member variables of the pair. TQPair owns the contained elements. For more relaxed ownership semantics, see TQPtrCollection and friends which are pointer-based containers.
.PP
Some classes cannot be used within a TQPair: for example, all classes derived from TQObject and thus all classes that implement widgets. Only "values" can be used in a TQPair. To qualify as a value the class must provide:
.TP
A copy constructor
.TP
An assignment operator
.TP
A constructor that takes no arguments
.PP
Note that C++ defaults to field-by-field assignment operators and copy constructors if no explicit version is supplied. In many cases this is sufficient.
.PP
TQPair uses an STL-like syntax to manipulate and address the objects it contains. See the QTL documentation for more information.
.PP
Functions that need to return two values can use a TQPair.
.PP
See also TQt Template Library Classes, Implicitly and Explicitly Shared Classes, and Non-GUI Classes.
.SS "Member Type Documentation"
.SH "TQPair::first_type"
The type of the first element in the pair.
.SH "TQPair::second_type"
The type of the second element in the pair.
.SH MEMBER FUNCTION DOCUMENTATION
.SH "TQPair::TQPair ()"
Constructs an empty pair. The \fCfirst\fR and \fCsecond\fR elements are default constructed.
.SH "TQPair::TQPair ( const T1 & t1, const T2 & t2 )"
Constructs a pair and initializes the \fCfirst\fR element with \fIt1\fR and the \fCsecond\fR element with \fIt2\fR.
.SH RELATED FUNCTION DOCUMENTATION
.SH "TQPair qMakePair ( T1 t1, T2 t2 )"
This is a template convenience function. It is used to create a
TQPair<> object that contains \fIt1\fR and \fIt2\fR.

.SH "SEE ALSO"
.BR http://doc.trolltech.com/tqpair.html
.BR http://www.trolltech.com/faq/tech.html
.SH COPYRIGHT
Copyright 1992-2007 Trolltech ASA, http://www.trolltech.com.  See the
license file included in the distribution for a complete license
statement.
.SH AUTHOR
Generated automatically from the source code.
.SH BUGS
If you find a bug in Qt, please report it as described in
.BR http://doc.trolltech.com/bughowto.html .
Good bug reports help us to help you. Thank you.
.P
The definitive TQt documentation is provided in HTML format; it is
located at $TQTDIR/doc/html and can be read using TQt Assistant or with
a web browser. This man page is provided as a convenience for those
users who prefer man pages, although this format is not officially
supported by Trolltech. 
.P
If you find errors in this manual page, please report them to
.BR qt-bugs@trolltech.com .
Please include the name of the manual page (tqpair.3qt) and the Qt
version (3.3.8).