-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathpair.cpp.html
105 lines (69 loc) · 4.55 KB
/
pair.cpp.html
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
101
102
103
104
105
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<title>/Volumes/Unix/unix-files.noindex/ntl-new/ntl-9.6.0/doc/pair.cpp.html</title>
<meta name="Generator" content="Vim/7.3">
<meta name="plugin-version" content="vim7.3_v6">
<meta name="syntax" content="cpp">
<meta name="settings" content="use_css">
<style type="text/css">
<!--
pre { font-family: monospace; color: #000000; background-color: #ffffff; }
body { font-family: monospace; color: #000000; background-color: #ffffff; }
.Statement { color: #b03060; font-weight: bold; }
.Type { color: #008b00; font-weight: bold; }
.String { color: #4a708b; }
.PreProc { color: #1874cd; }
.Comment { color: #0000ee; font-style: italic; }
-->
</style>
</head>
<body>
<pre>
<span class="Comment">/*</span><span class="Comment">*************************************************************************\</span>
<span class="Comment">MODULE: pair</span>
<span class="Comment">SUMMARY:</span>
<span class="Comment">Pair templates.</span>
<span class="Comment">The decalaration </span>
<span class="Comment"> Pair<S,T> p;</span>
<span class="Comment">creates a pair object using the default constructors for S and T. The</span>
<span class="Comment">member p.a is the first component (of type S) and the member p.b is</span>
<span class="Comment">the second component (of type T).</span>
<span class="Comment">\*************************************************************************</span><span class="Comment">*/</span>
<span class="PreProc">#include </span><span class="String"><NTL/tools.h></span>
<span class="Type">template</span><<span class="Type">class</span> S, <span class="Type">class</span> T>
<span class="Type">class</span> Pair {
<span class="Statement">public</span>:
S a;
T b;
Pair();
<span class="Comment">// default constructor...invokes default constructors for S and T</span>
Pair(<span class="Type">const</span> Pair<S,T>& x); <span class="Comment">// copy</span>
Pair& <span class="Statement">operator</span>=(<span class="Type">const</span> Pair<S,T>& x); <span class="Comment">// assignment</span>
Pair(<span class="Type">const</span> S& x, <span class="Type">const</span> T& y); <span class="Comment">// initialize with (x, y)</span>
~Pair();
<span class="Comment">// destructor...invokes destructors for S and T</span>
};
<span class="Type">template</span><<span class="Type">class</span> S, <span class="Type">class</span> T>
Pair<S,T> cons(<span class="Type">const</span> S& x, <span class="Type">const</span> T& y);
<span class="Comment">// returns Pair<S,T>(x, y)</span>
<span class="Comment">/*</span><span class="Comment">*************************************************************************\</span>
<span class="Comment"> Input/Output</span>
<span class="Comment">The I/O format for a Pair is</span>
<span class="Comment"> [a b]</span>
<span class="Comment">\*************************************************************************</span><span class="Comment">*/</span>
<span class="Type">template</span><<span class="Type">class</span> S, <span class="Type">class</span> T>
istream& <span class="Statement">operator</span>>>(istream&, Pair<S,T>&);
<span class="Type">template</span><<span class="Type">class</span> S, <span class="Type">class</span> T>
ostream& <span class="Statement">operator</span><<(ostream&, <span class="Type">const</span> Pair<S,T>&);
<span class="Comment">/*</span><span class="Comment">*************************************************************************\</span>
<span class="Comment"> Equality Testing</span>
<span class="Comment">\*************************************************************************</span><span class="Comment">*/</span>
<span class="Type">template</span><<span class="Type">class</span> S, <span class="Type">class</span> T>
<span class="Type">long</span> <span class="Statement">operator</span>==(<span class="Type">const</span> Pair<S,T>& x, <span class="Type">const</span> Pair<S,T>& y);
<span class="Type">template</span><<span class="Type">class</span> S, <span class="Type">class</span> T>
<span class="Type">long</span> <span class="Statement">operator</span>!=(<span class="Type">const</span> Pair<S,T>& x, <span class="Type">const</span> Pair<S,T>& y);
</pre>
</body>
</html>