Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống
1
/ 642 trang
THÔNG TIN TÀI LIỆU
Thông tin cơ bản
Định dạng
Số trang
642
Dung lượng
4,58 MB
Nội dung
[...]... dyne-book 12 The C++StandardLibrary Chapter 2 Introduction to C++ and the StandardLibrary 2.1 History The standardization of C++ was started in 1989 and finished at the end of 1997, although some formal motions delayed the final publication until September 1998 The result was a reference manual with approximately 750 pages, published by the International Standards Organization (ISO) The standard has... important new language features that are relevant for the C++standardlibrary 2.2.1 Templates Almost all parts of the library are written as templates Without template support, you can't use the standardlibrary Moreover, the library needed new special template features, which I introduce after a short overview of templates dyne-book 14 The C++StandardLibrary Templates are functions or classes that are... This chapter describes the concept of different memory models in the C++standardlibrary • An appendix with o Internet Resources o Bibliography o Index 1.4 How to Read this Book This book is a mix of introductory user's guide and structured reference manual regarding the C++ standard library The individual components of the C++standardlibrary are independent of each other, to some extent, so after reading... the C++standardlibrary was introduced during the standardization process This change is not backward compatible to old header files, in which identifiers of the C++standardlibrary are declared in the global scope In addition, some interfaces of classes changed during the standardization process (however, the goal was to stay backward compatible if possible) So, a new style for the names of standard. .. defines the exact contents and behavior of C++, it makes it easier to teach C++, to use C++ in applications, and to port C++ programs to different platforms It also gives users greater freedom of choice regarding different C++ implementations Its stability and portability help library providers and tool providers as well as implementers Thus, the standard helps C++ application developers build better... Note that some dyne-book 24 The C++ Standard Library compilers might print a warning message regarding this or even handle it as error Well, that's life before the standard 2.3 Complexity and the Big-O Notation For certain parts of the C++standardlibrary (especially for the STL), the performance of algorithms and member functions was considered carefully Thus, the standard requires a certain "complexity"... the standard in five years or so However for the next few years, C++ programmers have a standard and the chance to write powerful code that is portable to very different platforms 2.2 New Language Features The core language and the library of C++ were standardized in parallel In this way, the library could benefit from improvements in the language and the language could benefit from experiences of library. .. root of several standard exception classes that form a hierarchy, as shown in Figure 3.1 These standard exception classes can be divided into three groups: Figure 3.1 Hierarchy of Standard Exceptions dyne-book 29 The C++StandardLibrary 1 Exceptions for language support 2 Exceptions for the C++standardlibrary 3 Exceptions for errors outside the scope of a program Exception Classes for Language Support... Exception Classes for the StandardLibrary Exception classes for the C++standardlibrary are usually derived from class logic_error Logic errors are errors that, at least in theory, could be avoided by the program; for example, by performing additional tests of function arguments Examples of such errors are a violation of logical preconditions or a class invariant The C++standardlibrary provides the... avoidable The C++standardlibrary provides the following classes for runtime errors: • • • An exception of class range_error is used to report a range error in internal computations An exception of class overflow_error is used to report an arithmetic overflow An exception of class underflow_error is used to report an arithmetic underflow Exceptions Thrown by the StandardLibrary The C++ standardlibrary . +49 5309 5774 Many thanks. The C++ Standard Library dyne-book 13 Chapter 2. Introduction to C++ and the Standard Library 2.1 History The standardization of C++ was started in 1989 and finished. Chapter 2: Introduction to C++ and the Standard Library This chapter provides a brief overview of the history of the C++ standard library and the context of its standardization. It also contains. for the C++ standard library. 2.2.1 Templates Almost all parts of the library are written as templates. Without template support, you can't use the standard library. Moreover, the library