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/containers.html | 55 ++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 libstdc++-v3/doc/html/manual/containers.html (limited to 'libstdc++-v3/doc/html/manual/containers.html') diff --git a/libstdc++-v3/doc/html/manual/containers.html b/libstdc++-v3/doc/html/manual/containers.html new file mode 100644 index 000000000..1185af6a1 --- /dev/null +++ b/libstdc++-v3/doc/html/manual/containers.html @@ -0,0 +1,55 @@ + + +Chapter 9.  Containers

+ Yes it is, and that's okay. This is a decision that we preserved + when we imported SGI's STL implementation. The following is + quoted from their FAQ: +

+ The size() member function, for list and slist, takes time + proportional to the number of elements in the list. This was a + deliberate tradeoff. The only way to get a constant-time + size() for linked lists would be to maintain an extra member + variable containing the list's size. This would require taking + extra time to update that variable (it would make splice() a + linear time operation, for example), and it would also make the + list larger. Many list algorithms don't require that extra + word (algorithms that do require it might do better with + vectors than with lists), and, when it is necessary to maintain + an explicit size count, it's something that users can do + themselves. +

+ This choice is permitted by the C++ standard. The standard says + that size() should be constant time, and + should does not mean the same thing as + shall. This is the officially recommended ISO + wording for saying that an implementation is supposed to do + something unless there is a good reason not to. +

+ One implication of linear time size(): you should never write +

+	 if (L.size() == 0)
+	     ...
+	 

+ Instead, you should write +

+	 if (L.empty())
+	     ...
+	 

+

+ In this + message to the list, Daniel Kostecky announced work on an + alternate form of std::vector that would support + hints on the number of elements to be over-allocated. The design + was also described, along with possible implementation choices. +

+ The first two alpha releases were announced here + and here. +

-- cgit v1.2.3