Стандарт C++ 98 (1119566), страница 84
Текст из файла (страница 84)
Any pragma that is not recognized by the implementation is ignored.16.7 Null directive1A preprocessing directive of the form# new-linehas no effect.308[cpp.null]© ISO/IEC16 Preprocessing directives16.8 Predefined macro names1ISO/IEC 14882:1998(E)16.8 Predefined macro names[cpp.predefined]The following macro names shall be defined by the implementation:_ _LINE_ _ The line number of the current source line (a decimal constant)._ _FILE_ _ The presumed name of the source file (a character string literal)._ _DATE_ _ The date of translation of the source file (a character string literal of the form"Mmm dd yyyy", where the names of the months are the same as those generated by the asctimefunction, and the first character of dd is a space character if the value is less than 10).
If the date oftranslation is not available, an implementation-defined valid date is supplied._ _TIME_ _ The time of translation of the source file (a character string literal of the form "hh:mm:ss"as in the time generated by the asctime function). If the time of translation is not available, animplementation-defined valid time is supplied._ _STDC_ _ Whether _ _STDC_ _ is predefined and if so, what its value is, are implementation-defined._ _cplusplus The name _ _cplusplus is defined to the value 199711L when compiling a C++translation unit.143)2The values of the predefined macros (except for _ _LINE_ _ and _ _FILE_ _) remain constant throughoutthe translation unit.3If any of the pre-defined macro names in this subclause, or the identifier defined, is the subject of a#define or a #undef preprocessing directive, the behavior is undefined.__________________143) It is intended that future versions of this standard will replace the value of this macro with a greater value.
Non-conforming compilers should use a value with at most five decimal digits.309ISO/IEC 14882:1998(E)©(Blank page)310ISO/IEC© ISO/IEC17 Library introductionISO/IEC 14882:1998(E)17 Library introduction17 Library introduction[lib.library]1This clause describes the contents of the C++ Standard Library, how a well-formed C++ program makesuse of the library, and how a conforming implementation may provide the entities in the library.2The C++ Standard Library provides an extensible framework, and contains components for: language support, diagnostics, general utilities, strings, locales, containers, iterators, algorithms, numerics, andinput/output. The language support components are required by certain parts of the C++ language, such asmemory allocation (5.3.4, 5.3.5) and exception processing (clause 15).3The general utilities include components used by other library elements, such as a predefined storage allocator for dynamic storage management (3.7.3).
The diagnostics components provide a consistent framework for reporting errors in a C++ program, including predefined exception classes.4The strings components provide support for manipulating text represented as sequences of type char,sequences of type wchar_t, or sequences of any other ‘‘character-like’’ type. The localization components extend internationalization support for such text processing.5The containers, iterators, and algorithms provide a C++ program with access to a subset of the most widelyused algorithms and data structures.6Numeric algorithms and the complex number components extend support for numeric processing.
Thevalarray components provide support for n-at-a-time processing, potentially implemented as paralleloperations on platforms that support such processing.7The iostreams components are the primary mechanism for C++ program input/output. They can beused with other elements of the library, particularly strings, locales, and iterators.8This library also makes available the facilities of the Standard C library, suitably adjusted to ensure statictype safety.9The following subclauses describe the definitions (17.1), and method of description (17.3) for the library.Clause 17.4 and clauses 18 through 27 specify the contents of the library, and library requirements and constraints on both well-formed C++ programs and conforming implementations.17.1 Definitions[lib.definitions]17.1.1 arbitrary-positional stream[defns.arbitrary.stream]a stream (described in clause 27) that can seek to any integral position within the length of the stream.Every arbitrary-positional stream is also a repositional stream (17.1.16).17.1.2 character[defns.character]in clauses 21, 22, and 27, means any object which, when treated sequentially, can represent text.
The termdoes not only mean char and wchar_t objects, but any value that can be represented by a type that provides the definitions specified in these clauses.17.1.3 character container type[defns.character.container]a class or a type used to represent a character (17.1.2). It is used for one of the template parameters of thestring and iostream class templates. A character container class shall be a POD (3.9) type.17.1.4 comparison functionan operator function (13.5) for any of the equality (5.10) or relational (5.9) operators.[defns.comparison]311ISO/IEC 14882:1998(E)17.1.5 component© ISO/IEC17 Library introduction17.1.5 component[defns.component]a group of library entities directly related as members, parameters, or return types. For example, the classtemplate basic_string and the non-member template functions that operate on strings are referred to asthe string component.17.1.6 default behavior[defns.default.behavior]a description of replacement function and handler function semantics.
Any specific behavior provided bythe implementation, within the scope of the required behavior.17.1.7 handler function[defns.handler]a non-reserved function whose definition may be provided by a C++ program. A C++ program may designate a handler function at various points in its execution, by supplying a pointer to the function when calling any of the library functions that install handler functions (clause 18).17.1.8 iostream class templates[defns.iostream.templates]templates, defined in clause 27, that take two template arguments: charT and traits.
The argumentcharT is a character container class, and the argument traits is a structure which defines additionalcharacteristics and functions of the character type represented by charT necessary to implement the iostream class templates.17.1.9 modifier function[defns.modifier]a class member function (9.3), other than constructors, assignment, or destructor, that alters the state of anobject of the class.17.1.10 object state[defns.obj.state]the current value of all nonstatic class members of an object (9.2). The state of an object can be obtainedby using one or more observer functions.17.1.11 narrow-oriented iostream classesthe instantiations of the iostream class templates on the character container class char and the defaultvalue of the traits parameter.
The traditional iostream classes are regarded as the narrow-oriented iostream classes (27.3.1).17.1.12 NTCTS[defns.ntcts]a sequence of values that have character type, that precede the terminating null character type valuecharT().17.1.13 observer function[defns.observer]a class member function (9.3) that accesses the state of an object of the class, but does not alter that state.Observer functions are specified as const member functions (9.3.2).17.1.14 replacement function[defns.replacement]a non-reserved function whose definition is provided by a C++ program.
Only one definition for such afunction is in effect for the duration of the program’s execution, as the result of creating the program (2.1)and resolving the definitions of all translation units (3.5).17.1.15 required behavior[defns.required.behavior]a description of replacement function and handler function semantics, applicable to both the behavior provided by the implementation and the behavior that shall be provided by any function definition in the program. If a function defined in a C++ program fails to meet the required behavior when it executes, thebehavior is undefined.312© ISO/IECISO/IEC 14882:1998(E)17 Library introduction17.1.16 repositional stream17.1.16 repositional stream[defns.repositional.stream]a stream (described in clause 27) that can seek only to a position that was previously encountered.17.1.17 reserved function[defns.reserved.function]a function, specified as part of the C++ Standard Library, that must be defined by the implementation.
If aC++ program provides a definition for any reserved function, the results are undefined.17.1.18 traits class[defns.traits]a class that encapsulates a set of types and functions necessary for template classes and template functionsto manipulate objects of types for which they are instantiated. Traits classes defined in clauses 21, 22 and27 are chararacter traits, which provide the character handling support needed by the string and iostreamclasses.17.1.19 wide-oriented iostream classesthe instantiations of the iostream class templates on the character container class wchar_t and the defaultvalue of the traits parameter (27.3.2).17.2 Additional definitions1[defns.additional]1.3 defines additional terms used elsewhere in this International Standard.17.3 Method of description (Informative)117.3 describes the conventions used to describe the C++ Standard Library.
It describes the structures of thenormative clauses 18 through 27 (17.3.1), and other editorial conventions (17.3.2).17.3.1 Structure of each subclause1[lib.description][lib.structure]17.4.1 provides a summary of the C++ Standard library’s contents. Other Library clauses provide detailedspecifications for each of the components in the library, as shown in Table 10:Table 10—Library Categories____________________________________________________ClauseCategory__________________________Language support 18Diagnostics 19 20General utilities 21Strings 22LocalizationContainers 23Iterators 24 25Algorithms 26Numerics 27Input/output__________________________2Each Library clause contains the following elements, as applicable:144)— Summary— Requirements— Detailed specifications__________________144) To save space, items that do not apply to a clause are omitted.