帮忙翻译下啊~~

来源:百度知道 编辑:UC知道 时间:2024/05/21 10:13:14
The next thing to notice is that we create an iterator for our vector type. An iterator is somewhat like a POSITION in CList, except iterators work with all STL containers, in fact this is how the process of stepping through a container is made generic, which allows algorithms to be written to work with (nearly) all containers. Part 2 will explain the nearly bit.... We can get an iterator which equates to the start of a container using the begin() function, and one which equates to the position one past the end with the end() function. Why one past ? So that we can create a loop to go through the container, it's in line with the idea of zero indexing generally. This is not the best way of doubling the values in the vector, I've done it this way purely to show you one way of stepping through a container. As you can see, dereferencing the iterator gives us a reference to the underlying value ( so if we change it, the value in the vector is changed ). This can lead to trouble if y

下件事对通知是我们创造一iterator为我们的传染媒介类型。 iterator是有些象一个位置在CList,除了iterators与所有STL容器一起使用,实际上这是怎么跨步的过程通过容器使成为普通,允许算法给被写与(几乎)所有容器一起使用。 第2部分将解释几乎咬住了….我们可以得到视同到容器开始使用开始的视同到位置一过去末端以结尾的iterator ()作用和一个()作用。 为什么一过去? 因此我们可以创造圈审阅容器,它一般是根据零的分度法想法。这不是加倍价值最佳的方式在传染媒介,我做了它这个方式纯粹显示您单程跨步通过容器。 您能看,间接引用iterator给我们在部下的价值的参考(如此,如果我们改变它,在传染媒介改变价值)。这可能导致麻烦,如果您有一个容器尖,我也将盖那问题详细以后。[