From 554fd8c5195424bdbcabf5de30fdc183aba391bd Mon Sep 17 00:00:00 2001 From: upstream source tree Date: Sun, 15 Mar 2015 20:14:05 -0400 Subject: obtained gcc-4.6.4.tar.bz2 from upstream website; verified gcc-4.6.4.tar.bz2.sig; imported gcc-4.6.4 source tree from verified upstream tarball. downloading a git-generated archive based on the 'upstream' tag should provide you with a source tree that is binary identical to the one extracted from the above tarball. if you have obtained the source via the command 'git clone', however, do note that line-endings of files in your working directory might differ from line-endings of the respective files in the upstream repository. --- libstdc++-v3/doc/html/manual/pairs.html | 45 +++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 libstdc++-v3/doc/html/manual/pairs.html (limited to 'libstdc++-v3/doc/html/manual/pairs.html') diff --git a/libstdc++-v3/doc/html/manual/pairs.html b/libstdc++-v3/doc/html/manual/pairs.html new file mode 100644 index 000000000..8c4dbb763 --- /dev/null +++ b/libstdc++-v3/doc/html/manual/pairs.html @@ -0,0 +1,45 @@ + + +Pairs

The pair<T1,T2> is a simple and handy way to + carry around a pair of objects. One is of type T1, and another of + type T2; they may be the same type, but you don't get anything + extra if they are. The two members can be accessed directly, as + .first and .second. +

Construction is simple. The default ctor initializes each member + with its respective default ctor. The other simple ctor, +

+    pair (const T1& x, const T2& y);
+   

does what you think it does, first getting x + and second getting y. +

There is a copy constructor, but it requires that your compiler + handle member function templates: +

+    template <class U, class V> pair (const pair<U,V>& p);
+   

The compiler will convert as necessary from U to T1 and from + V to T2 in order to perform the respective initializations. +

The comparison operators are done for you. Equality + of two pair<T1,T2>s is defined as both first + members comparing equal and both second members comparing + equal; this simply delegates responsibility to the respective + operator== functions (for types like MyClass) or builtin + comparisons (for types like int, char, etc). +

+ The less-than operator is a bit odd the first time you see it. It + is defined as evaluating to: +

+    x.first  <  y.first  ||
+	( !(y.first  <  x.first)  &&  x.second  <  y.second )
+   

The other operators are not defined using the rel_ops + functions above, but their semantics are the same. +

Finally, there is a template function called make_pair + that takes two references-to-const objects and returns an + instance of a pair instantiated on their respective types: +

+    pair<int,MyClass> p = make_pair(4,myobject);
+   
-- cgit v1.2.3