神书-C++ STL源码解析-高清完整版

所需积分/C币:50 2017-12-28 17:14:22 13.81MB PDF
收藏 收藏
举报

神书-STL实现原理,对于强化数据结构-算法的程序员必备、必读书籍。The Best-Selling Programmer Resource–Now Updated for C++11 The C++ standard library provides a set of common classes and interfaces that greatly extend the core C++ language. The library, however, is not self-explanatory. To make full use of its components - and to
This page intentionally left blank The C++ Standard library a Tutorial and reference Second edition Nicolai m josuttis AAddison-Wesley Upper Saddle river,NJ● Boston· Indianapolis● San francisco New York● Toronto● Montreal● London● Munich● Paris· Madrid Capetown Sydney· Tokyo· Singapore· Mexico City Many of the designations used by manufacturers and sellers to distinguish their products are claimed as trademarks. Where those designations appear in this book, and the publisher was aware of a trademark claim, the designations have been printed with initial capital letters or in all capitals The author and publisher have taken care in the preparation of this book, but make no expressed or implied warranty of any kind and assume no responsibility for errors or omissions. No liability is assumed for incidental or consequential damages in connection with or arising out of the use of the information or programs contained herein The publisher offers excellent discounts on this book when ordered in quantity for bulk purchases or special sales, which may include electronic versions and/or custom covers and content particular to your business, training goals, marketing focus, and branding interests. For more information, please contact: U.S. Corporate and Government Sales (800)382-3419 corpsales@pearsontechgroup.com For sales outside the United States, please contact International sales internationalpearson.com Visit us on the web: informit. com/aw Library of Congress Cataloging-in-Publication Data Josuttis. Nicolai m The C++ standard library: a tutorial and reference/Nicolai m. Josuttis.--2nd ed Includes bibliographical references and index isBn 978-0-321-62321-8(hardcover: alk. paper) 1. C++( Computer program language)I Title QA76.73C153J692012 005.133-dc23 2011045071 Copyright@ 2012 Pearson Education, Inc This book was typeset by the author using the latex document processing system All rights reserved. Printed in the United States of America. This publication is protected by copy- right, and permission must be obtained from the publisher prior to any prohibited reproduction storage in a retrieval system, or transmission in any form or by any means, electronic, mechanical, photocopying, recording, or likewise. To obtain permission to use material from this work, please submit a written request to Pearson Education, Inc, Permissions Department, One Lake Street, Upper Saddle river, New Jersey 07458, or you may fax your request to(201)236-3290 ISBN-13:9780-321-62321-8 ISBN-10: 0-321-62321-5 Text printed in the United States on recycled paper at Edwards Brothers in Ann Arbor, Michigan First printing, March 2012 To those who care for people and mankind Contents Preface to the second edition XXIlL Acknowledgments for the Second Edition XXIV Preface to the first edition XXV Acknowledgments for the first edition 1 About This book 1.1 Why This book 1.2 Before Reading This book 1.3 Style and Structure of the book 1. 4 How to read This book 1.5 State of the art 1.6 Example Code and Additional Information 224555 1.7 Feedback 2 Introduction to C++ and the Standard library 2.1 History of the C++ Standards 7 2.1.1 Common Questions about the c++1l Standard 8 2.1.2 Compatibility between C++98 and c++11 9 2.2 Complexity and Big-O Notation 10 3 New Language Features 13 3. 1 New C++1 l Language Features 13 3.1.1 Important Minor Syntax Cleanups 13 3.1.2 Automatic Type Deduction with auto 14 3.1.3 Uniform Initialization and Initializer lists 15 3.1.4 Range-Based for Loops 17 3. 1.5 Move semantics and rvalue references 19 Contents 1.6 New String literals 23 3.1.7 Keyword noexcept 24 3.1.8 Keyword constexpr 26 3.1.9 New Template Features 26 3.1.10 Lambdas 28 3.1.11 Keyword decltype 3. 1. 12 New Function Declaration Syntax 3.1.13 Scoped enumerations 32 3. 1. 14 New Fundamental Data Types 33 3.2Old“New” Language features 33 3.2.1 Explicit Initialization for Fundamental Types 37 3.2.2 Definition of main o 37 4 General Concepts 39 4 Namespace std 39 4.2 Header files 40 4.3 Error and Exception Handling 41 4.3.1 Standard Exception Classes 41 4.3.2 Members of Exception Classes 44 4.3.3 Passing Exceptions with Class exception_ptr 52 4.3.4 Throwing Standard Exceptions 53 4.3.5 Deriving from Standard Exception Classes 54 4.4 Callable objects 4.5 Concurrency and Multithreading 55 4.6 Allocators 57 5 Utilities 5. 1 Pairs and tuples 5.1.1 Pairs 5.1.2 Tuples 8 5.1.3 1/O for Tuples 74 5.1.4 Conversions between tuples and pairs 75 5.2 Smart Pointers 76 5.2. 1 Class shared_ptr 76 5.2.2 Class weak_ptr 84 5.2.3 Misusing shared pointers 89 5.2.4 Shared and Weak pointers in Detail 92 5.2.5 Class unique_ptr 98 Contents 5.2.6 Class unique ptr in detail ..110 5.2.7 Class auto_ptr .113 5.2. 8 Final Words on smart Pointers .114 5.3 Numeric Limits 115 5. 4 Type traits and Type utilities 122 5.4.1 Purpose of Type Traits 122 5.4.2 Type Traits in Detail 125 5.4.3 Reference Wrappers .132 5.4.4 Function Type Wrappers 133 5.5 Auxiliary Functions .134 5.5. 1 Processing the minimum and maximum 134 5.5.2 Swapping Two values .136 5.5.3 Supplementary comparison operators 138 5.6 Compile-Time Fractional Arithmetic with Class ratio<> 140 5.7 Clocks and timers .143 5.7.1 Overview of the Chrono library 143 5.7.2 Durations 144 5.7.3 Clocks and Timepoints 149 5.7.4 Date and Time Functions by C and PosiX 157 5.7.5 Blocking with Timers 160 5.8 Header Files <cstddef>, <cstdlib>, and <cstring> .161 5.8.1 Definitions in <cstddef> 161 5.8.2 Definitions in <cstdlib> .162 5.8.3 Definitions in <cstring> 163 6 The Standard Template library 165 6.1 STL Components 165 6.2 Containers .167 6.2.1 Sequence Containers 169 6.2.2 Associative Containers ..177 6.2 Unordered Containers 180 6.2.4 Associative Arrays 185 6.2.5 Other Containers 187 6.2.6Cor Adapters 188 6.3 Iterate 188 6.3.1 Further Examples of Using Associative and Unordered Containers 193 6.3.2 Iterator Categories 198

...展开详情
试读 127P 神书-C++ STL源码解析-高清完整版
立即下载 低至0.43元/次 身份认证VIP会员低至7折
抢沙发
一个资源只可评论一次,评论内容不能少于5个字
上传资源赚积分or赚钱
最新推荐
神书-C++ STL源码解析-高清完整版 50积分/C币 立即下载
1/127
神书-C++ STL源码解析-高清完整版第1页
神书-C++ STL源码解析-高清完整版第2页
神书-C++ STL源码解析-高清完整版第3页
神书-C++ STL源码解析-高清完整版第4页
神书-C++ STL源码解析-高清完整版第5页
神书-C++ STL源码解析-高清完整版第6页
神书-C++ STL源码解析-高清完整版第7页
神书-C++ STL源码解析-高清完整版第8页
神书-C++ STL源码解析-高清完整版第9页
神书-C++ STL源码解析-高清完整版第10页
神书-C++ STL源码解析-高清完整版第11页
神书-C++ STL源码解析-高清完整版第12页
神书-C++ STL源码解析-高清完整版第13页
神书-C++ STL源码解析-高清完整版第14页
神书-C++ STL源码解析-高清完整版第15页
神书-C++ STL源码解析-高清完整版第16页
神书-C++ STL源码解析-高清完整版第17页
神书-C++ STL源码解析-高清完整版第18页
神书-C++ STL源码解析-高清完整版第19页
神书-C++ STL源码解析-高清完整版第20页

试读结束, 可继续阅读

50积分/C币 立即下载 >