Always #include the proper headers

来源:互联网 发布:淘宝优惠券qq群号 编辑:程序博客网 时间:2024/04/29 22:47

STL编程的次要麻烦之一是虽然可以很容易地建立可以在一个平台上编译的软件,但在其它平台上则需要附加的#include指示。这个烦恼来自一个事实:C++标准(不像C标准)未能指定哪一个标准头文件必须或者可能被其他标准头文件#include。由于有了这样的灵活性,不同的实现就会选择去做不同的东西。

Among the minor frustrations of STL programming is that it is easy to create software that compiles on one platform, yet requires additional #include directives on others. This annoyance stems from the fact that the Standard for C++ (unlike the Standard for C) fails to dictate which standard headers must or may be #included by other standard headers. Given such flexibility, different implementers have chosen to do different things.

One of STL programming's most troublesome problem is that we can easily create a software which can be compiled in a platform but can't be compiled in another platform without some extra "#include" directions. This trouble comes from a fact that C++ standard(not like C standard) doesn't specify which standard header file nust be or may be included by other standard header files. Owing to tese flexibility,different implementations can choose different things.