C++ Primer 第4版 评注版txt,chm,pdf,epub,mobi下载 作者:Stanley B. Lippman/Josée LaJoie/Barbara Moo 出版社: 电子工业出版社 译者:陈硕 出版年: 2012-7-18 页数: 715 定价: 108.00元 装帧: 平装 丛书: 博文视点评注版 ISBN: 9787121174414 内容简介 · · · · · ·《C++ Primer》是一本系统而绝佳的C++ 教材,它全面而深入地讲解了C++ 语言及其标准库。本书作者Stanley B. Lippman 在20 世纪80 年代早期即在C++ 之父Bjarne Stroustrup 领导下开发C++ 编译器,另一作者Josée Lajoie 曾多年担任C++ 标准委员会核心语言组主席,他们对这门编程语言的理解与把握非常人可比。本书对C++ 语法和语 义的阐释兼具准确性与可读性,在坊间无出其右者。第4 版更吸收了先进的C++ 教学经验,在内容组织上对初学者更加友好,详略得当且重点突出,使读者能更快上手编写有用的程序,也更适合自学。全球已有45 万人通过该 书的各个版本学习了C++ 编程。 对于国外技术图书,选择翻译版还是影印版,常常让人陷入两难的境地。本评注版力邀国内资深专家执笔,在英文原著基础上增加中文点评与... 作者简介 · · · · · ·陈硕,北京师范大学硕士,擅长 C++ 多线程网络编程和实时分布式系统架构。现任职于香港某跨国金融公司 IT 部门,从事实时外汇交易系统开发。编写了开源 C++ 网络库muduo;参与翻译了《代码大全(第二版)》和《C++ 编程规范(繁体版)》;2009 年在上海 C++ 技术大会做技术演讲《当析构函数遇到多线程》,同时担任 Stanley Lippman 先生的口译员;2010 年在珠三角技术沙龙做技术演讲《分布式系统的工程化开发方法》;2012年在“我们的开源项目”深圳站做《Muduo网络库:现代非阻塞C++网络编程》演讲。 目录 · · · · · ·PrefaceChapter 1 Getting Started 1.1 Writing a Simple C++Program . 1.1.1 Compiling and Executing Our Program 1.2 AFirstLookat Input/Output . 1.2.1 StandardInput andOutputObjects . · · · · · ·() Preface Chapter 1 Getting Started 1.1 Writing a Simple C++Program . 1.1.1 Compiling and Executing Our Program 1.2 AFirstLookat Input/Output . 1.2.1 StandardInput andOutputObjects . 1.2.2 AProgramthatUses the IOLibrary 1.3 AWordAboutComments 1.4 Control Structures . 1.4.1 The whileStatement . 1.4.2 The forStatement 1.4.3 The ifStatement 1.4.4 ReadinganUnknownNumberof Inputs . 1.5 IntroducingClasses 1.5.1 The Sales_itemClass 1.5.2 AFirstLookatMemberFunctions 1.6 The C++Program Part I The Basics Chapter 2 Variables and Basic Types 2.1 PrimitiveBuilt-inTypes . 2.1.1 IntegralTypes 2.1.2 Floating-PointTypes . 2.2 LiteralConstants 2.3 Variables 2.3.1 What Is aVariable? . 2.3.2 TheNameof aVariable 2.3.3 DefiningObjects . 2.3.4 VariableInitializationRules . 2.3.5 Declarations andDefinitions 2.3.6 Scopeof aName 2.3.7 DefineVariablesWhereTheyAreUsed 2.4 constQualifier . 2.5 References . 2.6 TypedefNames 2.7 Enumerations 2.8 ClassTypes 2.9 Writing Our Own Header Files . 2.9.1 DesigningOurOwnHeaders 2.9.2 ABrief IntroductiontothePreprocessor . Chapter 3 Library Types 3.1 Namespace usingDeclarations 3.2 Library stringType 3.2.1 Defining and Initializing strings 3.2.2 Reading andWriting strings . 3.2.3 Operations on strings . 3.2.4 Dealing with the Characters of a string . 3.3 Library vectorType . 3.3.1 Defining and Initializing vectors . 3.3.2 Operations on vectors 3.4 IntroducingIterators 3.4.1 IteratorArithmetic 3.5 Library bitsetType . 3.5.1 Defining and Initializing bitsets 3.5.2 Operations on bitsets Chapter 4 Arrays and Pointers 4.1 Arrays 4.1.1 DefiningandInitializingArrays . 4.1.2 OperationsonArrays . 4.2 IntroducingPointers . 4.2.1 What Is aPointer? . 4.2.2 DefiningandInitializingPointers 4.2.3 OperationsonPointers . 4.2.4 UsingPointers toAccessArrayElements . 4.2.5 Pointers and the constQualifier 4.3 C-StyleCharacterStrings 4.3.1 DynamicallyAllocatingArrays . 4.3.2 InterfacingtoOlderCode . 4.4 MultidimensionedArrays 4.4.1 Pointers andMultidimensionedArrays . Chapter 5 Expressions 5.1 ArithmeticOperators . 5.2 Relational andLogicalOperators . 5.3 TheBitwiseOperators 5.3.1 Using bitsetObjectsor IntegralValues 5.3.2 Usingthe ShiftOperators for IO 5.4 AssignmentOperators 5.4.1 Assignment IsRightAssociative 5.4.2 AssignmentHasLowPrecedence 5.4.3 CompoundAssignmentOperators . 5.5 Increment andDecrementOperators 5.6 TheArrowOperator 5.7 TheConditionalOperator 5.8 The sizeofOperator . 5.9 CommaOperator . 5.10 EvaluatingCompoundExpressions 5.10.1 Precedence . 5.10.2 Associativity 5.10.3 OrderofEvaluation . 5.11 The new and deleteExpressions . 5.12 TypeConversions 5.12.1 WhenImplicitTypeConversionsOccur 5.12.2 TheArithmeticConversions 5.12.3 Other ImplicitConversions . 5.12.4 ExplicitConversions . 5.12.5 WhenCastsMightBeUseful 5.12.6 NamedCasts 5.12.7 Old-StyleCasts . Chapter 6 Statements 6.1 Simple Statements 6.2 DeclarationStatements 6.3 CompoundStatements (Blocks) . 6.4 StatementScope 6.5 The ifStatement 6.5.1 The if Statement elseBranch 6.6 The switchStatement . 6.6.1 Using a switch 6.6.2 Control Flow within a switch 6.6.3 The defaultLabel 6.6.4 switchExpressionandCaseLabels . 6.6.5 Variable Definitions inside a switch 6.7 The whileStatement 6.8 The forLoopStatement 6.8.1 Omitting Parts of the forHeader 6.8.2 Multiple Definitions in the forHeader . 6.9 The do whileStatement . 6.10 The breakStatement . 6.11 The continueStatement 6.12 The gotoStatement 6.13 tryBlocks andExceptionHandling . 6.13.1 A throwExpression . 6.13.2 The tryBlock 6.13.3 StandardExceptions . 6.14 Using the Preprocessor for Debugging . Chapter 7 Functions 7.1 DefiningaFunction 7.1.1 FunctionReturnType 7.1.2 FunctionParameterList 7.2 ArgumentPassing 7.2.1 NonreferenceParameters 7.2.2 ReferenceParameters . 7.2.3 vectorandOtherContainerParameters . 7.2.4 ArrayParameters 7.2.5 ManagingArraysPassedtoFunctions 7.2.6 main:HandlingCommand-LineOptions . 7.2.7 FunctionswithVaryingParameters 7.3 The returnStatement 7.3.1 FunctionswithNoReturnValue 7.3.2 Functions thatReturnaValue . 7.3.3 Recursion 7.4 FunctionDeclarations 7.4.1 DefaultArguments 7.5 LocalObjects . 7.5.1 AutomaticObjects 7.5.2 StaticLocalObjects . 7.6 Inline Functions 7.7 ClassMemberFunctions 7.7.1 DefiningtheBodyofaMemberFunction . 7.7.2 DefiningaMemberFunctionOutside theClass . 7.7.3 Writing the Sales_itemConstructor 7.7.4 Organizing Class Code Files 7.8 OverloadedFunctions 7.8.1 OverloadingandScope 7.8.2 FunctionMatchingandArgumentConversions 7.8.3 TheThreeSteps inOverloadResolution . 7.8.4 Argument-TypeConversions 7.9 Pointers toFunctions . Chapter 8 The IO Library 8.1 AnObject-OrientedLibrary 8.2 Condition States 8.3 ManagingtheOutputBuffer . 8.4 File Input and Output 8.4.1 Using File Stream Objects . 8.4.2 File Modes . 8.4.3 A Program to Open and Check Input Files . 8.5 StringStreams Part II Containers and Algorithms Chapter 9 Sequential Containers 9.1 Defininga SequentialContainer 9.1.1 InitializingContainerElements . 9.1.2 Constraints onTypes that aContainerCanHold . 9.2 Iterators andIteratorRanges . 9.2.1 IteratorRanges 9.2.2 SomeContainerOperations InvalidateIterators 9.3 SequenceContainerOperations 9.3.1 ContainerTypedefs . 9.3.2 begin and endMembers 9.3.3 AddingElements toaSequentialContainer . 9.3.4 RelationalOperators . 9.3.5 Container SizeOperations 9.3.6 AccessingElements 9.3.7 ErasingElements 9.3.8 Assignment and swap 9.4 How a vectorGrows 9.4.1 capacity and reserveMembers 9.5 DecidingWhichContainer toUse 9.6 stringsRevisited 9.6.1 Other Ways to Construct strings 9.6.2 Other Ways to Change a string 9.6.3 string-OnlyOperations 9.6.4 stringSearchOperations 9.6.5 Comparing strings 9.7 ContainerAdaptors 9.7.1 StackAdaptor 9.7.2 Queue andPriorityQueue . Chapter 10 Associative Containers 10.1 Preliminaries: the pairType 10.2 AssociativeContainers 10.3 The mapType 10.3.1 Defining a map 10.3.2 Types Defined by map . 10.3.3 Adding Elements to a map . 10.3.4 Subscripting a map 10.3.5 Using map::insert . 10.3.6 Finding and Retrieving a mapElement 10.3.7 Erasing Elements from a map 10.3.8 Iterating across a map 10.3.9 AWordTransformationMap 10.4 The setType . 10.4.1 Defining and Using sets . 10.4.2 BuildingaWord-ExclusionSet 10.5 The multimap and multisetTypes 5 10.5.1 AddingandRemovingElements 10.5.2 Finding Elements in a multimap or multiset 10.6 UsingContainers: Text-QueryProgram 10.6.1 Designof theQueryProgram . 10.6.2 TextQueryClass 10.6.3 Using the TextQueryClass . 10.6.4 WritingtheMemberFunctions . Chapter 11 Generic Algorithms 11.1 Overview 11.2 AFirstLookat theAlgorithms 11.2.1 Read-OnlyAlgorithms 11.2.2 Algorithms thatWriteContainerElements 11.2.3 Algorithms thatReorderContainerElements . 11.3 Revisiting Iterators . 11.3.1 Insert Iterators 11.3.2 iostream Iterators . 11.3.3 Reverse Iterators 11.3.4 const Iterators . 11.3.5 TheFive IteratorCategories 11.4 StructureofGenericAlgorithms . 11.4.1 AlgorithmParameterPatterns 11.4.2 AlgorithmNamingConventions 11.5 Container-SpecificAlgorithms Part III Classes and Data Abstraction Chapter 12 Classes 429 12.1 ClassDefinitions andDeclarations 12.1.1 ClassDefinitions: ARecap 12.1.2 DataAbstractionandEncapsulation . 12.1.3 MoreonClassDefinitions 12.1.4 ClassDeclarationsversusDefinitions 12.1.5 ClassObjects 12.2 The Implicit thisPointer 12.3 ClassScope 12.3.1 NameLookupinClassScope 12.4 Constructors 12.4.1 TheConstructor Initializer 12.4.2 DefaultArguments andConstructors 12.4.3 TheDefaultConstructor 12.4.4 ImplicitClass-TypeConversions . 12.4.5 Explicit InitializationofClassMembers 12.5 Friends 12.6 staticClassMembers 12.6.1 staticMemberFunctions 12.6.2 staticDataMembers Chapter 13 Copy Control 13.1 TheCopyConstructor . 13.1.1 The SynthesizedCopyConstructor . 13.1.2 DefiningOurOwnCopyConstructor 13.1.3 PreventingCopies . 13.2 TheAssignmentOperator . 13.3 TheDestructor 13.4 AMessage-HandlingExample . 13.5 ManagingPointerMembers 13.5.1 DefiningSmartPointerClasses 13.5.2 Defining Valuelike Classes Chapter 14 Overloaded Operations and Conversions 14.1 DefininganOverloadedOperator 14.1.1 OverloadedOperatorDesign . 14.2 Input andOutputOperators 14.2.1 Overloading the Output Operator << . 14.2.2 Overloading the Input Operator >> . 14.3 Arithmetic andRelationalOperators 14.3.1 EqualityOperators 14.3.2 RelationalOperators . 14.4 AssignmentOperators 14.5 SubscriptOperator . 14.6 MemberAccessOperators . 14.7 Increment andDecrementOperators 14.8 CallOperatorandFunctionObjects . 14.8.1 UsingFunctionObjectswithLibraryAlgorithms 14.8.2 Library-DefinedFunctionObjects . 14.8.3 FunctionAdaptors forFunctionObjects 14.9 Conversions andClassTypes . 14.9.1 WhyConversionsAreUseful . 14.9.2 ConversionOperators 14.9.3 ArgumentMatchingandConversions . 14.9.4 OverloadResolution andClassArguments . 14.9.5 Overloading,Conversions, andOperators . Part IV Object-Oriented and Generic Programming Chapter 15 Object-Oriented Programming 15.1 OOP:AnOverview . 15.2 DefiningBaseandDerivedClasses 15.2.1 DefiningaBaseClass . 15.2.2 protectedMembers . 15.2.3 DerivedClasses 15.2.4 virtualandOtherMemberFunctions . 15.2.5 Public,Private,andProtectedInheritance 15.2.6 FriendshipandInheritance 15.2.7 Inheritance andStaticMembers 15.3 Conversions andInheritance . 15.3.1 Derived-to-BaseConversions . 15.3.2 Conversions fromBasetoDerived . 15.4 Constructors andCopyControl 15.4.1 Base-ClassConstructors andCopyControl . 15.4.2 Derived-ClassConstructors 15.4.3 CopyControl andInheritance 15.4.4 VirtualDestructors 15.4.5 Virtuals inConstructors andDestructors 15.5 ClassScopeunder Inheritance . 15.5.1 NameLookupHappensatCompileTime 15.5.2 Name Collisions and Inheritance . 15.5.3 ScopeandMemberFunctions 15.5.4 VirtualFunctions andScope 15.6 PureVirtualFunctions 15.7 Containers andInheritance 15.8 HandleClassesandInheritance 15.8.1 A Pointerlike Handle 15.8.2 CloninganUnknownType . 15.8.3 UsingtheHandle . 15.9 TextQueriesRevisited 15.9.1 AnObject-OrientedSolution . 15.9.2 A Valuelike Handle 15.9.3 The Query_baseClass 15.9.4 The QueryHandleClass 15.9.5 TheDerivedClasses 15.9.6 The evalFunctions Chapter 16 Templates and Generic Programming 16.1 TemplateDefinitions . 16.1.1 DefiningaFunctionTemplate 16.1.2 DefiningaClassTemplate 16.1.3 TemplateParameters . 16.1.4 TemplateTypeParameters . 16.1.5 NontypeTemplateParameters . 16.1.6 WritingGenericPrograms . 16.2 Instantiation 16.2.1 TemplateArgumentDeduction 16.2.2 Function-TemplateExplicitArguments 16.3 TemplateCompilationModels 16.4 ClassTemplateMembers . 16.4.1 Class-TemplateMemberFunctions . 16.4.2 TemplateArguments forNontypeParameters . 16.4.3 FriendDeclarations inClassTemplates 16.4.4 Queue and QueueItemFriendDeclarations . 16.4.5 MemberTemplates . 16.4.6 The Complete QueueClass . 16.4.7 staticMembersofClassTemplates . 16.5 AGenericHandleClass . 16.5.1 DefiningtheHandleClass 16.5.2 UsingtheHandle . 16.6 Template Specializations 16.6.1 SpecializingaFunctionTemplate . 16.6.2 SpecializingaClassTemplate 16.6.3 SpecializingMembersbutNot theClass 16.6.4 Class-TemplatePartialSpecializations 16.7 OverloadingandFunctionTemplates . Part V Advanced Topics Chapter 17 Tools for Large Programs 17.1 ExceptionHandling 17.1.1 ThrowinganExceptionofClassType 17.1.2 StackUnwinding 17.1.3 CatchinganException 17.1.4 Rethrow 17.1.5 TheCatch-AllHandler 17.1.6 FunctionTryBlocks andConstructors . 17.1.7 ExceptionClassHierarchies 17.1.8 AutomaticResourceDeallocation . 17.1.9 The auto_ptrClass 17.1.10ExceptionSpecifications . 17.1.11FunctionPointerExceptionSpecifications . 17.2 Namespaces 17.2.1 NamespaceDefinitions . 17.2.2 NestedNamespaces 17.2.3 UnnamedNamespaces 17.2.4 UsingNamespaceMembers 17.2.5 Classes,Namespaces,andScope 17.2.6 OverloadingandNamespaces 17.2.7 NamespacesandTemplates . 17.3 Multiple andVirtual Inheritance 731 17.3.1 Multiple Inheritance . 17.3.2 Conversions andMultipleBaseClasses 17.3.3 CopyControl forMultiplyDerivedClasses . 17.3.4 ClassScopeunderMultiple Inheritance 17.3.5 Virtual Inheritance . 17.3.6 VirtualBaseClassDeclaration . 17.3.7 Special InitializationSemantics Chapter 18 Specialized Tools and Techniques 18.1 OptimizingMemoryAllocation 18.1.1 Memory Allocation in C++ 18.1.2 The allocatorClass 18.1.3 operator new and operator deleteFunctions . 18.1.4 Placement newExpressions 18.1.5 ExplicitDestructor Invocation 18.1.6 Class Specific new and delete 18.1.7 AMemory-AllocatorBaseClass 18.2 Run-TimeTypeIdentification . 18.2.1 The dynamic_castOperator 18.2.2 The typeidOperator 18.2.3 UsingRTTI . 18.2.4 The type_infoClass 18.3 Pointer toClassMember . 18.3.1 DeclaringaPointer toMember . 18.3.2 UsingaPointer toClassMember 18.4 NestedClasses 18.4.1 ANested-Class Implementation . 18.4.2 NameLookupinNestedClassScope . 18.5 Union: ASpace-SavingClass 18.6 LocalClasses . 18.7 InherentlyNonportableFeatures . 18.7.1 Bit-fields 18.7.2 volatileQualifier 18.7.3 Linkage Directives: extern "C" Appendix A The Library A.1 LibraryNames andHeaders A.2 ABriefTourof theAlgorithms A.2.1 Algorithms toFindanObject . A.2.2 OtherRead-OnlyAlgorithms A.2.3 Binary-SearchAlgorithms . A.2.4 Algorithms thatWriteContainerElements . A.2.5 PartitioningandSortingAlgorithms A.2.6 GeneralReorderingOperations A.2.7 PermutationAlgorithms . A.2.8 SetAlgorithms for SortedSequences . A.2.9 MinimumandMaximumValues A.2.10 NumericAlgorithms A.3 The IOLibraryRevisited A.3.1 FormatState . A.3.2 ManyManipulatorsChangetheFormatState. A.3.3 Controlling Output Formats A.3.4 Controlling Input Formatting A.3.5 UnformattedInput/OutputOperations A.3.6 Single-ByteOperations A.3.7 Multi-ByteOperations A.3.8 RandomAccess toaStream A.3.9 Reading andWriting to the Same File · · · · · · () |
超喜欢 包装好看
受益匪浅!
很好,家人喜欢,很好!
中了毒,根本停不下来