|
กก |
In ANSI-C++ the way to include header files from the standard library has changed. The standard specifies the following modification from the C way of including standard header files:
Here you have a list of the standard C++ header files: <algorithm> <bitset> <deque> <exception> <fstream> <functional> <iomanip> <ios> <iosfwd> <iostream> <istream> <iterator> <limits> <list> <locale> <map> <memory> <new> <numeric> <ostream> <queue> <set> <sstream> <stack> <stdexcept> <streambuf> <string> <typeinfo> <utility> <valarray> <vector>And here is a list of the C header files included in ANSI-C++ with their new name and their equivalents in ANSI-C:
Since now classes and functions of the standard libraries are located within the std namespace we must use the C++ using directive for that these become usable in the same way they were in pre-standard code. For example, to be able to use all the standard classes of iostream we would have to include something similar to this: #include <iostream>that would be equivalent to the old expression #include <iostream.h>previous to the standard. Nevertheless for compatibility with ANSI-C, the use of name.h way to include C header files is allowed. Therefore, both following examples are valid and equivalent in a compiler which fulfills ANSI-C++ specifications:
In all the examples of the current version of The C++ tutorial it has been chosen to include the old way because to date is the most compatible format (and also shorter), although if you have a compiler that supports ANSI-C++ standard I recommended you the use of the new format in your programs.
| |||||||||||||||||||||||||||||||||||||||||||||||||