1. Trang chủ
  2. » Khoa Học Tự Nhiên

Addison wesley the c++ standard library a tutorial and reference

749 128 0

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

THÔNG TIN TÀI LIỆU

Thông tin cơ bản

Định dạng
Số trang 749
Dung lượng 3,37 MB

Nội dung

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 implementation In fact, during the standardization process the library often used special language features that were not yet available C++ is not the same language it was five years ago If you didn't follow its evolution, you may be surprised with the new language features used by the library This section gives you a brief overview of those new features For details, refer to books on the language in question While I was writing this book (in 1998), not all compilers were able to provide all of the new language features I hope (and expect) that this will change very soon (most compiler vendors were part of the standardization process) Thus, you may be restricted in your use of the library Portable implementations of the library typically consider whether features are present in the environment they use (they usually have some test programs to check which language features are present, and then set preprocessor directives according to the result of the check) I'll mention any restrictions that are typical and important throughout the book by using footnotes The following subsections describe the most important new language features that are relevant 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 needed new special template features, which I introduce after a short overview of templates Templates are functions or classes that are written for one or more types not yet specified When you use a template, you pass the types as arguments, explicitly or implicitly The following is a typical example a function that returns the maximum of two values: template inline const T& max (const T& a, const T& b) { // if a

Ngày đăng: 25/03/2019, 17:12

TỪ KHÓA LIÊN QUAN