C++ Primer英文版(第5版)

C++ Primer英文版(第5版) pdf epub mobi txt 電子書 下載 2025

[美] 李普曼(Stanley B. Lippman),[美] 拉喬伊(Josée Lajoie),[美] 默(Barbara E. Moo) 著
想要找書就要到 靜流書站
立刻按 ctrl+D收藏本頁
你會得到大驚喜!!
齣版社: 電子工業齣版社
ISBN:9787121200380
版次:5
商品編碼:11220904
品牌:Broadview
包裝:平裝
開本:16開
齣版時間:2013-05-01
用紙:膠版紙
頁數:964
正文語種:中文,英文

具體描述

編輯推薦

  

  新標準C++11發布,距上一版本已10年;《C++Primer英文版(第5版)》是持續更新的全球C++讀本。
  經過前四個版本積纍,第5版的體例堪稱完美。
  這一版本作者曆時3年完成,極力避免在原版上升級,而是將C++11的新特性真正融入各章節;更將所有代碼示例用C++11的簡化寫法完成,而不是僅單獨增加內容。
 

內容簡介

  《C++ Primer英文版(第5版)》久負盛名的C++經典教程,時隔八年之久,終迎來的重大升級。除令全球無數程序員從中受益,甚至為之迷醉的--C++大師Stanley B. Lippman的豐富實踐經驗,C++標準委員會原負責人Josée Lajoie對C++標準的深入理解,以及C++先驅Barbara E. Moo在C++教學方麵的真知灼見外,更是基於全新的C++11標準進行瞭全麵而徹底的內容更新。非常難能可貴的是,書中所有示例均全部采用C++11標準改寫,這在經典升級版中極其罕見--充分體現瞭C++語言的重大進展極其全麵實踐。書中豐富的教學輔助內容、醒目的知識點提示,以及精心組織的編程示範,讓《C++ Primer英文版(第5版)》這本書在C++領域的專業地位更加不可動搖。無論是初學者入門,或是中、高級程序員提升,《C++ Primer英文版(第5版)》均為不容置疑的優選。

作者簡介

  Stanley B. Lippman,目前是微軟公司 Visual C++ 團隊的架構師。他從1984年開始在貝爾實驗室與C++的設計者Bjarne Stroustrup一起從事C++的設計與開發。他在迪士尼和夢工廠從事動畫製作,還擔任過JPL的高級顧問。

  Josée Lajoie,曾經是IBM加拿大研究中心C/C++編譯器開發團隊的成員,在ISO C++標準委員會工作瞭7年,擔任過ISO核心語言工作組的主席和C++ Report雜誌的專欄作傢。

  Barbara E. Moo,擁有25年軟件經驗的獨立谘詢顧問。在AT&T;,她與Stroustrup、Lippman一起管理過復雜的C++開發項目。

目錄

Preface xxiii

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.3 AWordaboutComments
1.4 FlowofControl
1.4.1 The whileStatement
1.4.2 The forStatement
1.4.3 ReadinganUnknownNumberof Inputs
1.4.4 The ifStatement
1.5 IntroducingClasses
1.5.1 The Sales_itemClass
1.5.2 AFirstLookatMemberFunctions
1.6 TheBookstoreProgram

ChapterSummary
DefinedTerms
Part I The Basics

Chapter 2 Variables and Basic Types
2.1 PrimitiveBuilt-inTypes
2.1.1 ArithmeticTypes
2.1.2 TypeConversions
2.1.3 Literals
2.2 Variables
2.2.1 VariableDefinitions
2.2.2 VariableDeclarations andDefinitions
2.2.3 Identifiers
2.2.4 Scopeof aName
2.3 CompoundTypes
2.3.1 References
2.3.2 Pointers
vii
viii Contents
2.3.3 UnderstandingCompoundTypeDeclarations
2.4 constQualifier
2.4.1 References to const
2.4.2 Pointers and const
2.4.3 Top-Level const
2.4.4 constexprandConstantExpressions
2.5 DealingwithTypes
2.5.1 TypeAliases
2.5.2 The autoTypeSpecifier
2.5.3 The decltypeTypeSpecifier
2.6 DefiningOurOwnDataStructures
2.6.1 Defining the Sales_dataType
2.6.2 Using the Sales_dataClass
2.6.3 Writing Our Own Header Files

ChapterSummary
DefinedTerms

Chapter 3 Strings, Vectors, and Arrays
3.1 Namespace usingDeclarations
3.2 Library stringType
3.2.1 Defining and Initializing strings
3.2.2 Operations on strings
3.2.3 Dealing with the Characters in a string
3.3 Library vectorType
3.3.1 Defining and Initializing vectors
3.3.2 Adding Elements to a vector
3.3.3 Other vectorOperations
3.4 IntroducingIterators
3.4.1 UsingIterators
3.4.2 IteratorArithmetic
3.5 Arrays
3.5.1 DefiningandInitializingBuilt-inArrays
3.5.2 AccessingtheElementsof anArray
3.5.3 Pointers andArrays
3.5.4 C-StyleCharacterStrings
3.5.5 InterfacingtoOlderCode
3.6 MultidimensionalArrays

ChapterSummary
DefinedTerms

Chapter 4 Expressions
4.1 Fundamentals
4.1.1 BasicConcepts
4.1.2 PrecedenceandAssociativity
4.1.3 OrderofEvaluation
4.2 ArithmeticOperators
4.3 Logical andRelationalOperators
Contents ix
4.4 AssignmentOperators
4.5 Increment andDecrementOperators
4.6 TheMemberAccessOperators
4.7 TheConditionalOperator
4.8 TheBitwiseOperators
4.9 The sizeofOperator
4.10 CommaOperator
4.11 TypeConversions
4.11.1 TheArithmeticConversions
4.11.2 Other ImplicitConversions
4.11.3 ExplicitConversions
4.12 OperatorPrecedenceTable

ChapterSummary
DefinedTerms

Chapter 5 Statements
5.1 Simple Statements
5.2 StatementScope
5.3 Conditional Statements
5.3.1 The ifStatement
5.3.2 The switchStatement
5.4 IterativeStatements
5.4.1 The whileStatement
5.4.2 Traditional forStatement
5.4.3 Range forStatement
5.4.4 The do whileStatement
5.5 JumpStatements
5.5.1 The breakStatement
5.5.2 The continueStatement
5.5.3 The gotoStatement
5.6 tryBlocks andExceptionHandling
5.6.1 A throwExpression
5.6.2 The tryBlock
5.6.3 StandardExceptions

ChapterSummary
DefinedTerms

Chapter 6 Functions
6.1 FunctionBasics
6.1.1 LocalObjects
6.1.2 FunctionDeclarations
6.1.3 SeparateCompilation
6.2 ArgumentPassing
6.2.1 PassingArgumentsbyValue
6.2.2 PassingArgumentsbyReference
6.2.3 constParametersandArguments
6.2.4 ArrayParameters
x Contents
6.2.5 main:HandlingCommand-LineOptions
6.2.6 FunctionswithVaryingParameters
6.3 Return Types and the returnStatement
6.3.1 FunctionswithNoReturnValue
6.3.2 FunctionsThatReturnaValue
6.3.3 ReturningaPointer toanArray
6.4 OverloadedFunctions
6.4.1 OverloadingandScope
6.5 Features forSpecializedUses
6.5.1 DefaultArguments
6.5.2 Inline and constexprFunctions
6.5.3 Aids for Debugging
6.6 FunctionMatching
6.6.1 ArgumentTypeConversions
6.7 Pointers toFunctions

ChapterSummary
DefinedTerms

Chapter 7 Classes
7.1 DefiningAbstractDataTypes
7.1.1 Designing the Sales_dataClass
7.1.2 Defining the Revised Sales_dataClass
7.1.3 DefiningNonmemberClass-RelatedFunctions
7.1.4 Constructors
7.1.5 Copy,Assignment, andDestruction
7.2 AccessControl andEncapsulation
7.2.1 Friends
7.3 AdditionalClassFeatures
7.3.1 ClassMembersRevisited
7.3.2 Functions That Return *this
7.3.3 ClassTypes
7.3.4 FriendshipRevisited
7.4 ClassScope
7.4.1 NameLookupandClassScope
7.5 ConstructorsRevisited
7.5.1 Constructor InitializerList
7.5.2 DelegatingConstructors
7.5.3 TheRoleof theDefaultConstructor
7.5.4 ImplicitClass-TypeConversions
7.5.5 AggregateClasses
7.5.6 LiteralClasses
7.6 staticClassMembers

ChapterSummary
DefinedTerms
Contents xi
Part II The C++ Library

Chapter 8 The IO Library
8.1 The IOClasses
8.1.1 NoCopyorAssignfor IOObjects
8.1.2 ConditionStates
8.1.3 ManagingtheOutputBuffer
8.2 File Input and Output
8.2.1 Using File Stream Objects
8.2.2 File Modes
8.3 stringStreams
8.3.1 Using an istringstream
8.3.2 Using ostringstreams

ChapterSummary
DefinedTerms

Chapter 9 Sequential Containers
9.1 Overviewof the SequentialContainers
9.2 ContainerLibraryOverview
9.2.1 Iterators
9.2.2 ContainerTypeMembers
9.2.3 begin and endMembers
9.2.4 DefiningandInitializingaContainer
9.2.5 Assignment and swap
9.2.6 ContainerSizeOperations
9.2.7 RelationalOperators
9.3 SequentialContainerOperations
9.3.1 AddingElements toaSequentialContainer
9.3.2 AccessingElements
9.3.3 ErasingElements
9.3.4 Specialized forward_listOperations
9.3.5 ResizingaContainer
9.3.6 ContainerOperationsMayInvalidateIterators
9.4 How a vectorGrows
9.5 Additional stringOperations
9.5.1 Other Ways to Construct strings
9.5.2 Other Ways to Change a string
9.5.3 stringSearchOperations
9.5.4 The compareFunctions
9.5.5 NumericConversions
9.6 ContainerAdaptors

ChapterSummary
DefinedTerms
xii Contents

Chapter 10 Generic Algorithms
10.1 Overview
10.2 AFirstLookat theAlgorithms
10.2.1 Read-OnlyAlgorithms
10.2.2 AlgorithmsThatWriteContainerElements
10.2.3 AlgorithmsThatReorderContainerElements
10.3 CustomizingOperations
10.3.1 PassingaFunctiontoanAlgorithm
10.3.2 LambdaExpressions
10.3.3 LambdaCapturesandReturns
10.3.4 BindingArguments
10.4 Revisiting Iterators
10.4.1 Insert Iterators
10.4.2 iostream Iterators
10.4.3 Reverse Iterators
10.5 StructureofGenericAlgorithms
10.5.1 TheFive IteratorCategories
10.5.2 AlgorithmParameterPatterns
10.5.3 AlgorithmNamingConventions
10.6 Container-SpecificAlgorithms

ChapterSummary
DefinedTerms

Chapter 11 Associative Containers
11.1 UsinganAssociativeContainer
11.2 Overviewof theAssociativeContainers
11.2.1 DefininganAssociativeContainer
11.2.2 Requirements onKeyType
11.2.3 The pairType
11.3 Operations onAssociativeContainers
11.3.1 AssociativeContainer Iterators
11.3.2 AddingElements
11.3.3 ErasingElements
11.3.4 Subscripting a map
11.3.5 AccessingElements
11.3.6 AWordTransformationMap
11.4 TheUnorderedContainers

ChapterSummary
DefinedTerms

Chapter 12 DynamicMemory
12.1 DynamicMemoryandSmartPointers
12.1.1 The shared_ptrClass
12.1.2 ManagingMemoryDirectly
12.1.3 Using shared_ptrs with new
12.1.4 SmartPointers andExceptions
12.1.5 unique_ptr
Contents xiii
12.1.6 weak_ptr
12.2 DynamicArrays
12.2.1 newandArrays
12.2.2 The allocatorClass
12.3 UsingtheLibrary:AText-QueryProgram
12.3.1 Designof theQueryProgram
12.3.2 DefiningtheQueryProgramClasses

ChapterSummary
DefinedTerms
Part III Tools for Class Authors

Chapter 13 Copy Control
13.1 Copy,Assign, andDestroy
13.1.1 TheCopyConstructor
13.1.2 TheCopy-AssignmentOperator
13.1.3 TheDestructor
13.1.4 TheRuleofThree/Five
13.1.5 Using = default
13.1.6 PreventingCopies
13.2 CopyControl andResourceManagement
13.2.1 ClassesThatActLikeValues
13.2.2 DefiningClassesThatActLikePointers
13.3 Swap
13.4 ACopy-ControlExample
13.5 ClassesThatManageDynamicMemory
13.6 MovingObjects
13.6.1 RvalueReferences
13.6.2 MoveConstructor andMoveAssignment
13.6.3 RvalueReferencesandMemberFunctions

ChapterSummary
DefinedTerms

Chapter 14 Overloaded Operations and Conversions
14.1 BasicConcepts
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 Increment andDecrementOperators
14.7 MemberAccessOperators
14.8 Function-CallOperator
xiv Contents
14.8.1 LambdasAreFunctionObjects
14.8.2 Library-DefinedFunctionObjects
14.8.3 Callable Objects and function
14.9 Overloading,Conversions, andOperators
14.9.1 ConversionOperators
14.9.2 AvoidingAmbiguousConversions
14.9.3 FunctionMatchingandOverloadedOperators

ChapterSummary
DefinedTerms

Chapter 15 Object-Oriented Programming
15.1 OOP:AnOverview
15.2 DefiningBaseandDerivedClasses
15.2.1 DefiningaBaseClass
15.2.2 DefiningaDerivedClass
15.2.3 Conversions andInheritance
15.3 VirtualFunctions
15.4 AbstractBaseClasses
15.5 AccessControl andInheritance
15.6 ClassScopeunder Inheritance
15.7 Constructors andCopyControl
15.7.1 VirtualDestructors
15.7.2 SynthesizedCopyControl andInheritance
15.7.3 Derived-ClassCopy-ControlMembers
15.7.4 InheritedConstructors
15.8 Containers andInheritance
15.8.1 Writing a BasketClass
15.9 TextQueriesRevisited
15.9.1 AnObject-OrientedSolution
15.9.2 The Query_base and QueryClasses
15.9.3 TheDerivedClasses
15.9.4 The evalFunctions

ChapterSummary
DefinedTerms

Chapter 16 Templates and Generic Programming
16.1 DefiningaTemplate
16.1.1 FunctionTemplates
16.1.2 ClassTemplates
16.1.3 TemplateParameters
16.1.4 MemberTemplates
16.1.5 Controlling Instantiations
16.1.6 Efficiency and Flexibility
16.2 TemplateArgumentDeduction
16.2.1 Conversions andTemplateTypeParameters
16.2.2 Function-TemplateExplicitArguments
16.2.3 Trailing Return Types and Type Transformation
Contents xv
16.2.4 FunctionPointers andArgumentDeduction
16.2.5 TemplateArgumentDeductionandReferences
16.2.6 Understanding std::move
16.2.7 Forwarding
16.3 OverloadingandTemplates
16.4 VariadicTemplates
16.4.1 WritingaVariadicFunctionTemplate
16.4.2 PackExpansion
16.4.3 ForwardingParameterPacks
16.5 Template Specializations

ChapterSummary
DefinedTerms
Part IV Advanced Topics

Chapter 17 Specialized Library Facilities
17.1 The tupleType
17.1.1 Defining and Initializing tuples
17.1.2 Using a tuple toReturnMultipleValues
17.2 The bitsetType
17.2.1 Defining and Initializing bitsets
17.2.2 Operations on bitsets
17.3 RegularExpressions
17.3.1 UsingtheRegularExpressionLibrary
17.3.2 TheMatchandRegex IteratorTypes
17.3.3 UsingSubexpressions
17.3.4 Using regex_replace
17.4 RandomNumbers
17.4.1 Random-NumberEngines andDistribution
17.4.2 OtherKinds ofDistributions
17.5 The IOLibraryRevisited
17.5.1 FormattedInput andOutput
17.5.2 UnformattedInput/OutputOperations
17.5.3 RandomAccess toaStream

ChapterSummary
DefinedTerms

Chapter 18 Tools for Large Programs
18.1 ExceptionHandling
18.1.1 ThrowinganException
18.1.2 CatchinganException
18.1.3 Function tryBlocks andConstructors
18.1.4 The noexceptExceptionSpecification
18.1.5 ExceptionClassHierarchies
18.2 Namespaces
18.2.1 NamespaceDefinitions
xvi Contents
18.2.2 UsingNamespaceMembers
18.2.3 Classes,Namespaces,andScope
18.2.4 OverloadingandNamespaces
18.3 Multiple andVirtual Inheritance
18.3.1 Multiple Inheritance
18.3.2 Conversions andMultipleBaseClasses
18.3.3 ClassScopeunderMultiple Inheritance
18.3.4 Virtual Inheritance
18.3.5 Constructors andVirtual Inheritance

ChapterSummary
DefinedTerms

Chapter 19 Specialized Tools and Techniques
19.1 Controlling Memory Allocation
19.1.1 Overloading new and delete
19.1.2 Placement newExpressions
19.2 Run-TimeTypeIdentification
19.2.1 The dynamic_castOperator
19.2.2 The typeidOperator
19.2.3 UsingRTTI
19.2.4 The type_infoClass
19.3 Enumerations
19.4 Pointer toClassMember
19.4.1 Pointers toDataMembers
19.4.2 Pointers toMemberFunctions
19.4.3 UsingMemberFunctions asCallableObjects
19.5 NestedClasses
19.6 union:ASpace-SavingClass
19.7 LocalClasses
19.8 InherentlyNonportableFeatures
19.8.1 Bit-fields
19.8.2 volatileQualifier
19.8.3 Linkage Directives: extern "C"

ChapterSummary
DefinedTerms
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 BinarySearchAlgorithms
A.2.4 AlgorithmsThatWriteContainerElements
A.2.5 PartitioningandSortingAlgorithms
A.2.6 GeneralReorderingOperations
A.2.7 PermutationAlgorithms
A.2.8 SetAlgorithms forSortedSequences
Contents xvii
A.2.9 MinimumandMaximumValues
A.2.10 NumericAlgorithms
A.3 RandomNumbers
A.3.1 RandomNumberDistributions
A.3.2 RandomNumberEngines
Index



New Features in C++
2.1.1 long longType
2.2.1 List Initialization
2.3.2 nullptrLiteral
2.4.4 constexprVariables
2.5.1 TypeAliasDeclarations
2.5.2 The autoTypeSpecifier
2.5.3 The decltypeTypeSpecifier
2.6.1 In-Class Initializers
3.2.2 Using auto or decltype forTypeAbbreviation
3.2.3 Range forStatement
3.3 Defining a vector of vectors
3.3.1 List Initialization for vectors
3.4.1 Container cbegin and cendFunctions
3.5.3 Library begin and endFunctions
3.6 Using auto or decltype to SimplifyDeclarations
4.2 RoundingRules forDivision
4.4 Assignment fromaBracedListofValues
4.9 sizeofAppliedtoaClassMember
5.4.3 Range forStatement
6.2.6 Library initializer_listClass
6.3.2 List InitializingaReturnValue
6.3.3 Declaring a Trailing Return Type
6.3.3 Using decltype to Simplify Return Type Declarations
6.5.2 constexprFunctions
7.1.4 Using = default toGenerateaDefaultConstructor
7.3.1 In-class Initializers forMembersofClassType
7.5.2 DelegatingConstructors
7.5.6 constexprConstructors
8.2.1 Using strings for File Names
9.1 The array and forward_listContainers
9.2.3 Container cbegin and cendFunctions
9.2.4 List InitializationforContainers
9.2.5 Container Nonmember swapFunctions
9.3.1 Return Type for Container insertMembers
9.3.1 Container emplaceMembers
xix
xx New Features in C++
9.4 shrink_to_fit
9.5.5 Numeric Conversion Functions for strings
10.3.2 LambdaExpressions
10.3.3 Trailing Return Type in Lambda Expressions
10.3.4 The Library bindFunction
11.2.1 List Initializationof anAssociativeContainer
11.2.3 List Initializing pairReturnType
11.3.2 List Initialization of a pair
11.4 TheUnorderedContainers
12.1 SmartPointers
12.1.1 The shared_ptrClass
12.1.2 List InitializationofDynamicallyAllocatedObjects
12.1.2 autoandDynamicAllocation
12.1.5 The unique_ptrClass
12.1.6 The weak_ptrClass
12.2.1 Range for Doesn't Apply to Dynamically Allocated Arrays
12.2.1 List InitializationofDynamicallyAllocatedArrays
12.2.1 autoCan'tBeUsedtoAllocateanArray
12.2.2 allocator::constructCanUseanyConstructor
13.1.5 Using = default forCopy-ControlMembers
13.1.6 Using = delete toPreventCopyingClassObjects
13.5 MovingInsteadofCopyingClassObjects
13.6.1 RvalueReferences
13.6.1 The Library moveFunction
13.6.2 MoveConstructor andMoveAssignment
13.6.2 Move Constructors Usually Should Be noexcept
13.6.2 MoveIterators
13.6.3 ReferenceQualifiedMemberFunctions
14.8.3 The functionClassTemplate
14.9.1 explicitConversionOperators
15.2.2 overrideSpecifier forVirtualFunctions
15.2.2 Preventing Inheritance by Defining a Class as final
15.3 override and final Specifiers for Virtual Functions
15.7.2 DeletedCopyControl andInheritance
15.7.4 InheritedConstructors
16.1.2 DeclaringaTemplateTypeParameteras aFriend
16.1.2 TemplateTypeAliases
16.1.3 DefaultTemplateArguments forTemplateFunctions
16.1.5 ExplicitControlof Instantiation
16.2.3 Template Functions and Trailing Return Types
16.2.5 ReferenceCollapsingRules
16.2.6 static_cast fromanLvaluetoanRvalue
16.2.7 The Library forwardFunction
16.4 VariadicTemplates
16.4 The sizeof...Operator
16.4.3 VariadicTemplates andForwarding
New Features in C++11 xxi
17.1 The Library TupleClassTemplate
17.2.2 New bitsetOperations
17.3 TheRegularExpressionLibrary
17.4 TheRandomNumberLibrary
17.5.1 Floating-Point FormatControl
18.1.4 The noexceptExceptionSpecifier
18.1.4 The noexceptOperator
18.2.1 InlineNamespaces
18.3.1 InheritedConstructors andMultiple Inheritance
19.3 Scoped enums
19.3 Specifying the Type Used to Hold an enum
19.3 Forward Declarations for enums
19.4.3 The Library mem_fnClassTemplate
19.6 UnionMembersofClassTypes

精彩書摘

  " We start by initializing it to denote the first element intext.The loop continues until either we process every element intext or we find an element that is empty.So long as there areelements and we haven't seen an empty element,we print the currentelement.It is worth noting that beeause the loop reads but does notwrite to the elements in text,we use cbegin and cend to control theiteration.Some vector Operations Invalidate Iterators
  In 3.3.2 (p.101) we noted that there are implications of thefact that vectors can grow dynamically.We also noted that one suchimplication is that we cannot add elements to a vector inside arange for loop.Another implication is that any operation,such aspush_back,that changes the size of a vector potentially invalidatesall iterators into that vector.We'll explore how iterators becomeinvalid in more detail in 9.3.6 (p.353).
  WARNING
  For now,it is important to realize that loops that use iteratorsshould not add elements to the container to which the iteratorsrefer.
  EXERCISES SECTION 3.4.1
  Exercise 3.21: Redo the first exercise from 3.3.3 (p.105) usingiterators.
  Exercise 3.22: Revise the loop that printed the first paragraphin text to instead change the elements in text that correspond tothe first paragraph to all uppercase.After you've updatedtext,print its contents.
  Exercise 3.23: Write a program to create a vector with ten intelements.Using an iterator,assign each element a value that istwice its current value.Test your program by printing thevector."
  ……

前言/序言

  難以計數的程序員已經通過舊版的C++ Primer 學會瞭C++語言。而在這段時間中,C++本身又已成熟瞭許多:語言本身的關注點和程序設計社區的關注點都已大大開闊,已經從主要關注機器效率轉變為更多地關注編程效率。
  2011 年,C++標準委員會發布瞭ISO C++標準的一個重要修訂版。此修訂版是C++進化過程中的最新一步,延續瞭前幾個版本對編程效率的強調。新標準的主要目標是:
  使語言更為統一,更易於教學
  使標準庫更簡單、安全、使用更高效
  使編寫高效率的抽象和庫變得更簡單
  因此,在這個版本的C++ Primer 中,我們進行瞭徹底的修改,使用瞭最新的C++標準。為瞭瞭解新標準是如何全麵影響C++語言的,你可以看一下xxiii 頁至xxv 頁的新特性列錶,其中列齣瞭哪些章節涉及瞭C++的新特性。
  新標準增加的一些特性是具有普適性的,例如用於類型推斷的auto。這些新特性使本書中的代碼更易於閱讀和理解。程序(以及程序員!)可以忽略類型的細節,從而更容易集中精力於程序邏輯上來。其他一些新特性,例如智能指針和允許移動的容器,允許我們編寫更為復雜的類,而又不必與錯綜復雜的資源管理做鬥爭。因此,在本書中開始講授如何編寫自己的類,會比第4 版簡單得多。舊標準中阻擋在我們前進路上的很多細節,你我都不必再擔心瞭。
  對於本書中涉及新標準定義的新特性的那些部分,我們都已用一個特殊的圖標標記齣來瞭。我們希望這些提示標記對那些已經熟悉C++語言核心內容的讀者是有幫助的,可以幫助他們決定將注意力投嚮哪裏。對於那些可能尚不支持所有新特性的編譯器,我們還希望這些圖標能有助於解釋這類編譯器所給齣的編譯錯誤信息。這是因為雖然本書中幾乎所有例子都已經用最新版本的GNU 編譯器編譯通過,但我們知道一些讀者可能尚未將編譯器更新到最新版本。雖然新標準增加瞭大量新功能,但核心C++語言並未變化,這構成瞭本書的大部分內容。讀者可以藉助這些圖標來判斷哪些功能可能還沒有被自己的編譯器所支持。
  為什麼選擇這本書?
  現代C++語言可以看作是三部分組成的:
  低級語言,大部分繼承自 C 語言。
  現代高級語言特性,允許我們定義自己的類型以及組織大規模程序和係統。
  標準庫,它利用高級特性來提供有用的數據結構和算法。
  大多數 C++教材按照語言進化的順序來組織其內容。首先講授C++的C 子集,然後將C++的更為抽象的一些特性作為高級話題在書的最後進行介紹。這種方式存在兩個問題:讀者會陷入那些繼承自低級程序設計的細節,從而由於挫摺感而放棄;讀者被強加學習一些壞習慣,隨後又需要忘記這些內容。
  我們采用一種相反的方法:從一開始就介紹一些語言特性,能讓程序員忽略那些繼承自低級程序設計的細節。例如,在介紹和使用內置的算術和數組類型時,我們還連同介紹和使用標準庫中的類型string 和vector。使用這些類型的程序更易寫、易理解且更少齣錯。
  太多時候,標準庫被當作一種“高級”話題來講授。很多教材不使用標準庫,而是使用基於字符數組指針和動態內存管理的低級程序設計技術。讓使用這種低級技術的程序正確運行,要比編寫相應的使用標準庫的C++代碼睏難得多。
  貫穿 C++ Primer 全書,我們都在強調好的風格:我們想幫助讀者直接養成好的習慣,而不是在獲得很多很復雜的知識後再去忘掉那些壞習慣。我們特彆強調那些棘手的問題,並對常見的錯誤想法和陷阱提齣警告。
  我們還注意解釋規則背後的基本原理--使讀者不僅知其然,還能知其所以然。我們相信,通過體會程序的工作原理,讀者會更快地鞏固對語言的理解。
  雖然你不必為瞭學習本書而掌握 C 語言,但我們還是假定你瞭解足夠多的程序設計知識,瞭解至少一門現代分程序結構語言,知道如何用這門語言編寫、編譯以及運行程序。特彆是,我們假定你已經使用過變量,編寫、調用過函數,也使用過編譯器。
  第 5 版變化的內容
  這一版C++ Primer 的新特點是用邊欄圖標來幫助引導讀者。C++是一種龐大的編程語言,它提供瞭一些為特定程序設計問題定製的功能。其中一些功能對大型項目團隊有很重要的意義,但對於小型項目開發可能並無必要。因此,並非每個程序員都需要瞭解每個語言特性的所有細節。我們加入這些邊欄圖標來幫助讀者弄清哪些內容可以隨後再學習,而哪些主題是更為重要的。
  對於包含C++語言基礎內容的章節,我們用一個小人正在讀書的圖標加以標記。用這個圖標標記的那些章節,涵蓋瞭構成語言核心部分的主題。每個人都應該閱讀並理解這些章節的內容。
  對於那些涉及高級主題或特殊目的主題的章節,我們也進行瞭標記。在首次閱讀時,這些章節可以跳過或快速瀏覽。我們用一疊書的圖標標記這些章節,指齣在這些地方,你可以放心地放下書本。快速瀏覽這些章節可能是一個好主意,這樣你就可以知道有這些特性存在。但在真正需要在自己的程序中使用這些特性之前,沒有必要花費時間仔細學習這些主題。
  為瞭進一步引導讀者的注意力,我們還用放大鏡圖標標記瞭特彆復雜的概念。我們希望讀者對有這種標記的章節能多花費一些時間徹底理解其中的內容。在這些章節中,至少有一些,其主題的重要性可能不是那麼明顯;但我們認為,你會發現這些章節涉及的主題對理解C++語言原來至關重要。
  交叉引用的廣泛使用,是本書采用的另外一種閱讀幫助。我們希望這些引用能幫助讀者容易地翻閱書中的內容,同時還能在後麵的例子涉及到前麵的內容時容易地跳迴到前麵。
  沒有改變的是,C++ Primer 仍是一本清晰、正確、全麵的C++入門教材。我們通過給齣一係列復雜度逐步增加的例子來講授這門語言,這些例子說明瞭語言特性,展示瞭如何充分用好C++語言。
  本書的結構
  我們首先在第I 部分和第II 部分中介紹瞭C++語言和標準庫的基礎內容。這兩部分包含的內容足夠你編寫齣有意義的程序,而不是隻能寫一些玩具程序。大部分程序員基本上都需要掌握本書這兩部分所包含的所有內容。
  除瞭講授 C++的基礎內容,第I 部分和第II 部分還有另外一個重要目的:通過使用標準庫中定義的抽象設施,使你更加適應高級程序設計技術。標準庫設施本身是一組抽象數據類型,通常用C++編寫。用來設計標準庫的,就是任何C++程序員都可以使用的用來構造類的那些語言特性。我們講授C++語言的一個經驗是,在先學習瞭使用設計良好的抽象類型後,讀者會發現理解如何構造自己的類型更容易瞭。
  隻有在經過全麵的標準庫使用訓練,並編寫瞭各種標準庫所支持的抽象程序後,我們纔真正進入到那些允許你編寫自己的抽象類型的C++特性中去。本書的第III 部分和第IV 部分介紹瞭如何編寫類的形式的抽象類型。第III 部分包含基礎內容,第IV 部分介紹更專門的語言特性。
  在第III 部分中,我們將介紹拷貝控製問題,以及其他一些使類能像內置類型一樣容易使用的技術。類是麵嚮對象編程和泛型編程的基礎,第III 部分也會介紹這些內容。第IV 部分是C++ Primer 的結束部分,它介紹瞭一些在組織大型復雜係統時非常有用的語言特性。此外,我們將在附錄A 中總結標準庫算法。
  讀者幫助
  本書的每一章均以一個總結和一個術語錶結束,兩者一起扼要迴顧瞭這一章的大部分學習重點。讀者應該將這些部分作為個人備忘錄:如果你不理解某個術語,可以重新學習這一章的相應部分。
  在本書中我們還使用瞭其他一些學習輔助:
  重要的術語用加粗字體顯示;我們假定讀者已經熟悉的重要術語用粗斜體顯示。每個術語都會列在章末尾的術語錶中。
  貫穿全書,我們用高亮顯示來提醒讀者注意語言的重要部分,對常見的陷阱提齣警告,建議好的程序設計習慣,以及提供一般性的使用提示。
  為瞭更好地理解語言特性間和概念間的聯係,我們提供大量嚮前的和嚮後的交叉引用。
  對重要的概念和 C++新程序員常常覺得最睏難的主題,我們提供邊欄討論。
  學習任何程序設計語言都需要編寫程序。為此,貫穿全書我們提供大量程序示例。擴展示例的源碼可從下麵的網址獲得http://www.informit.com/title/0321714113
  關於編譯器的注意事項
  在撰寫本書時(2012 年7 月),編譯器提供商正在努力工作,升級編譯器以匹配最新的ISO 標準。我們使用最多的編譯器是GNU 編譯器4.7.0。本書中隻有一小部分特性在此編譯器中尚未實現:繼承構造函數、成員函數的引用限定符以及正則錶達式庫。
  緻謝
  我們要特彆感謝標準委員會幾位現任和前任委員:Dave Abrahams、Andy Koenig、Stephan T. Lavavej、Jason Merrill、John Spicer 和Herb Sutter 在準備本書的過程中提供的幫助。在理解新標準的一些更微妙之處,他們為我們提供瞭寶貴的幫助。我們還要感謝很多緻力於升級GNU 編譯器以實現新標準的人們。
  與舊版C++ Primer 中一樣,我們要感謝Bjarne Stroustrup 不知疲倦地為C++工作以及他和作者長時間的友誼。我們還要感謝Alex Stepanov 的非凡洞察力,催生瞭標準庫核心的容器和算法。最後,我們要感謝C++標準委員會的所有委員,感謝他們這麼多年來在淨化、精煉和改進C++語言方麵的辛苦工作。
  我們衷心感謝審稿人:Marshall Clow、Jon Kalb、Nevin Liber、Dr. C. L. Tondo、Daveed Vandevoorde 和Steve Vinoski,他們建設性的意見幫助我們對全書做齣瞭大大小小的改進。
  本書是用 Latex 及其發行版本中的很多包來進行排版的,我們應該感謝Latex社區成員創造齣如此強大的排版工具。
  最後,我們要感謝Addison-Wesley 公司的優秀員工,他們指導瞭本書的整個齣版過程:Peter Gordon,我們的編輯,他給瞭我們動力再次修改C++ Primer;Kim Boedigheimer,保證瞭一切按計劃進行;Barbara Wood,她在編輯過程中找到瞭大量編輯錯誤;還有Elizabeth Ryan,很高興再次和她共同工作,她指導我們完成瞭整個設計和生産流程。


用戶評價

評分

經典中的經典,經典中的聖經,戰鬥機

評分

快遞包裝未能很好地保護的書本,作為商傢應該要保證運送的途中包裝對商品的基本保護,這樣薄薄地一層塑料保護作用為0,導緻打開快遞時書本已經有多處磨損和褶皺,看圖,有圖有真相。希望以後商傢能有所改進!

評分

已經看瞭一半瞭,收獲很大,後一半準備先看麵嚮對象,再迴頭看標準庫。

評分

之前的四被人偷瞭,隻好買瞭五版收藏。

評分

好厚啊,英文版的,逼著自己學英語。不錯不錯!

評分

印刷精美,內容豐富,值得購買

評分

之前的四被人偷瞭,隻好買瞭五版收藏。

評分

618活動動給力,買的幾本書很劃算,買的四本書有本感覺跟舊的是的,跟客服溝通後,很快解決瞭,換貨瞭,挺好。另外三本有塑封還沒拆,應該沒啥問題。

評分

紙張不錯,速度很快,昨天下單今天就收到瞭

相關圖書

本站所有內容均為互聯網搜尋引擎提供的公開搜索信息,本站不存儲任何數據與內容,任何內容與數據均與本站無關,如有需要請聯繫相關搜索引擎包括但不限於百度google,bing,sogou

© 2025 windowsfront.com All Rights Reserved. 靜流書站 版權所有