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/xml/manual/utilities.xml | 124 ++++++++++++++++++++++++++++++ 1 file changed, 124 insertions(+) create mode 100644 libstdc++-v3/doc/xml/manual/utilities.xml (limited to 'libstdc++-v3/doc/xml/manual/utilities.xml') diff --git a/libstdc++-v3/doc/xml/manual/utilities.xml b/libstdc++-v3/doc/xml/manual/utilities.xml new file mode 100644 index 000000000..5c3a8fd48 --- /dev/null +++ b/libstdc++-v3/doc/xml/manual/utilities.xml @@ -0,0 +1,124 @@ + + + + + Utilities + <indexterm><primary>Utilities</primary></indexterm> + + + + ISO C++ + + + library + + + + + + + +
Functors + + + If you don't know what functors are, you're not alone. Many people + get slightly the wrong idea. In the interest of not reinventing + the wheel, we will refer you to the introduction to the functor + concept written by SGI as chapter of their STL, in + their + http://www.sgi.com/tech/stl/functors.html. + +
+ + +
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); + + +
+ + +
Memory + + + + Memory contains three general areas. First, function and operator + calls via new and delete + operator or member function calls. Second, allocation via + allocator. And finally, smart pointer and + intelligent pointer abstractions. + + + + + + + + + + + + + + +
+ + +
Traits + + + + +
+ +
-- cgit v1.2.3