Error Handling STL设计的目标是性能最优化,而不是最安全. 错误检查是极其浪费时间的,因此,STL对于错误处理几乎没有做处理,因此,这对STL的使用者的要求就非常高. 为什么不采取错误处理呢,下面是两个主要原因: Error checking reduces performance, and speed is still a general goal of programs. As mentioned, good performance was one of the design…
一.set 在了解关联容器set之前,让我们先来看看下面这个例子,并猜测该例子输出什么: // stl/set1.cpp #include <iostream> #include <set> int main() { //type of the collection typedef std::set<int> IntSet; IntSet coll; //set container for int values /* insert elements from 1 to…