{{sellerTotalView > 1 ? __("sellers", {number: sellerTotalView}) : __("seller", {number: sellerTotalView}) }}, {{numTotalView > 1 ? __("items", {number: numTotalView}) : __("item", {number: numTotalView}) }}
免运费
Yami

Nickname

请告诉我们怎么更好地称呼你

更新你的名字
账户 订单 收藏
{{ inviteNavTitle }}
退出登录

切换配送区域

不同区域的库存和配送时效可能存在差异.

历史邮编

{{email ? __('Got it!') : __('Restock Alert')}}

我们将在商品到货后第一时间通知你。

取消
Yami

京东图书

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

{{buttonTypePin == 3 ? __("Scan to view more PinGo") : __("Scan to start")}}

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

{{__(":people-members", {'people': item.limit_people_count})}} {{ itemCurrency }}{{ item.valid_price }} {{ itemCurrency }}{{ item.invalid_price }} {{ itemDiscount }}
后结束
{{ itemCurrency }}{{ item.valid_price }}
{{ itemCurrency }}{{ priceFormat(item.valid_price / item.bundle_specification) }}/{{ item.unit }}
{{ itemDiscount }}
{{ itemCurrency }}{{ item.valid_price }} {{ itemCurrency }}{{ priceFormat(item.valid_price / item.bundle_specification) }}/{{ item.unit }} {{ itemCurrency }}{{ item.invalid_price }} {{itemDiscount}}
{{ itemCurrency }}{{ item.valid_price }}
后结束促销
后开始秒杀 后结束秒杀
{{ getSeckillDesc(item.seckill_data) }}
{{ __( "Pay with Gift Card to get sale price: :itemCurrency:price", { 'itemCurrency' : itemCurrency, 'price' : (item.giftcard_price ? priceFormat(item.giftcard_price) : '0.00') } ) }} ({{ itemCurrency }}{{ priceFormat(item.giftcard_price / item.bundle_specification) }}/{{ item.unit }}) 详情
商品有效期

已下架

当前地址无法配送
已售完

商品描述

展开全部描述
编辑推荐

新标准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,很高兴再次和她共同工作,她指导我们完成了整个设计和生产流程。

规格参数

品牌 京东图书
品牌属地 中国
ISBN 9787121200380
著者 [美]李普曼(Stanley B. Lippman),[美]拉乔伊(Josée Lajoie),[美]默(Barbara E. Moo)
出版社 电子工业出版社
印刷时间 2013-05-01
用纸 胶版纸
包装 平装
出版时间 2013-05-01
页数 964
语言 中文,英文
版次 5

免责声明

产品价格、包装、规格等信息如有调整,恕不另行通知。我们尽量做到及时更新产品信息,但请以收到实物为准。使用产品前,请始终阅读产品随附的标签、警告及说明。

查看详情
加入收藏
{{ $isZh ? coupon.coupon_name_sub : coupon.coupon_ename_sub | formatCurrency }}
{{__("Buy Directly")}} {{ itemCurrency }}{{ item.directly_price }}
数量
{{ quantity }}
{{ instockMsg }}
{{ limitText }}
{{buttonTypePin == 3 ? __("Scan to view more PinGo") : __("Scan to start")}}
由 京东图书 销售
送至
{{ __("Ship to United States only") }}
满$69免运费
正品保证

已加入购物车

继续逛逛

为你推荐

{{ item.brand_name }}

{{ item.item_name }}

{{ item.currency }}{{ item.market_price }}

{{ item.currency }}{{ item.unit_price }}

{{ item.currency }}{{ item.unit_price }}

优惠券

{{ coupon.coupon_name_new | formatCurrency }}
领取 已领取 已领完
{{ getCouponDescStr(coupon) }}
{{ coupon.use_time_desc }}
即将过期: {{ formatTime(coupon.use_end_time) }}

分享给好友

取消

亚米礼卡专享价

使用礼卡支付即可获得礼卡专享价

规则说明

礼卡专享价是部分商品拥有的特殊优惠价格;

购买礼卡专享价商品时,若在结算时使用电子礼卡抵扣支付,且礼卡余额足够支付订单中所有礼卡专享价商品的专享价总和,则可以启用礼卡专享价;

不使用礼卡支付,或礼卡余额不满足上一条所述要求时,将无法启用礼卡专享价,按照普通售价计算,但您仍然可以购买这些商品;

在购买礼卡专享价商品时,若余额不足,可以在购物车或结算页中点击“充值”按钮对礼卡进行购买和充值;

商品若拥有礼卡专享价,会显示“专享”的特殊价格标记;

如有疑问,请随时联系客服;

礼卡专享价相关规则最终解释权归亚米所有。

由 亚米 销售

服务保障

Yami 满$49免运费
Yami 无忧退换
Yami 从美国发货

配送信息

  • 美国

    标准配送 $5.99(不包含阿拉斯加,夏威夷),最终价满$49免运费

    本地配送$5.99(加州,纽约州,新泽西,麻省和宾夕法尼亚,以上州部分地区);最终价满$49免运费

    两日达(包含阿拉斯加夏威夷)运费$19.99起

退换政策

亚米网希望为我们的客户提供最优秀的售后服务,让所有人都能放心在亚米购物。亚米自营商品在满足退换货条件的情况下,可在收到包裹的30天之内退换商品(食品因商品质量问题7天内可退换;为了确保每位客户都能获得安全和高质量的商品,对于美妆类产品,一经开封或使用即不提供退款或退货服务,质量问题除外;其他特殊商品需联系客服咨询)。
感谢您的理解和支持。

查看详情

由 亚米 销售

亚米电子礼品卡使用规则

若购买时选择自动充值,订单完成后礼卡将自动充值到您的账户中;

若购买时选择发送邮件,订单完成后系统将自动发送卡号和密码到您填写的邮箱;

发送邮件时,任何用户均可使用邮件中的卡号密码进行礼卡充值,请妥善保管邮件信息。

如接收邮件遇到问题,请联系客服处理;

发送邮件时,若礼卡没有被兑换,可以补发邮件。若已经被其他用户兑换,则无法补偿;

亚米网电子礼卡可用于购买自营或第三方商品;

亚米网电子礼卡没有有效期限制,长期有效;

亚米网电子礼卡的金额,可分多次使用;

亚米网电子礼卡业务规则,最终解释权归亚米网所有。

退换政策

已消费的电子礼卡不支持退款。

京东图书 销售

服务保障

Yami 满$49免运费
Yami 最优售后
Yami 美国本土发货

配送信息

  • 美国

    标准配送 $5.99(不包含阿拉斯加,夏威夷),最终价满$49免运费

    本地配送$5.99(加州,纽约州,新泽西,麻省和宾夕法尼亚,以上州部分地区);最终价满$49免运费

    两日达(包含阿拉斯加夏威夷)运费$19.99起

退换政策

提供30天内退还保障。产品需全新未使用原包装内,并附有购买凭据。产品质量问题、或错发漏发等,由商家造成的失误,将进行补发,或退款处理。其它原因需退货费用由客户自行承担。

由 京东图书 销售

服务保障

Yami 跨店满$69免运费
Yami 30天退换保障

亚米-中国集运仓

由亚米从中国精选并集合各大优秀店铺的商品至亚米中国整合中心,合并包裹后将一次合包跨国邮寄至您的地址。跨店铺包邮门槛低至$69。您将在多商家集合提供的广泛选品中选购商品,轻松享受跨店铺包邮后的低邮费。

退换政策

提供30天内退换保障。产品需在全新未使用的原包装内,并附有购买凭据。产品质量问题、错发、或漏发等由商家造成的失误,将进行退款处理。其它原因造成的退换货邮费客户将需要自行承担。由于所有商品均长途跋涉,偶有简易外包压磨等但不涉及内部质量问题者,不予退换。

配送信息

亚米中国集运 Consolidated Shipping 运费$9.99(订单满$69 包邮)

下单后2个工作日中国商家发货,所有包裹抵达亚米中国整合中心(除特别情况及中国境内个别法定节假日外)会合并包裹后通过UPS发往美国。UPS从中国发货后到美国境内的平均时间为10个工作日左右,根据直发单号可随时跟踪查询。受疫情影响,目前物流可能延迟5天左右。包裹需要客人签收。如未签收,客人须承担包裹丢失风险。

由 京东图书 销售

服务保障

满$69免运费
正品保证

配送信息

Yami Consolidated Shipping 运费$9.99(订单满$69包邮)


下单后1-2个工作日内发货。 物流时效预计7-15个工作日。 如遇清关,交货时间将延长3-7天。 最终收货日期以邮政公司信息为准。

积分规则

不参加任何折扣活动以及亚米会员积分制度。

退换政策

提供30天内退还保障。产品需全新未使用原包装内,并附有购买凭据。产品质量问题、或错发漏发等,由商家造成的失误,将进行补发,或退款处理。其它原因需退货费用由客户自行承担。

Yami

下载亚米应用

返回顶部

为你推荐

品牌故事

京东图书

为您推荐

Yami
欣葉
2种选择
欣叶 御大福 芋头麻薯 180g

周销量 600+

$1.66 $1.99 83折
Yami
欣葉
2种选择
欣叶 御大福 芋头麻薯 180g

周销量 600+

$1.66 $1.99 83折
Yami
欣葉
2种选择
欣叶 御大福 芋头麻薯 180g

周销量 600+

$1.66 $1.99 83折
Yami
欣葉
2种选择
欣叶 御大福 芋头麻薯 180g

周销量 600+

$1.66 $1.99 83折
Yami
欣葉
2种选择
欣叶 御大福 芋头麻薯 180g

周销量 600+

$1.66 $1.99 83折
Yami
欣葉
2种选择
欣叶 御大福 芋头麻薯 180g

周销量 600+

$1.66 $1.99 83折

评论{{'('+ commentList.posts_count + ')'}}

分享你的感受,帮助更多用户做出选择。

写评论
{{ totalRating }} 写评论
  • {{i}}星

    {{i}}星

    {{ parseInt(commentRatingList[i]) }}%

Yami Yami
{{ comment.user_name }}

{{ showTranslate(comment) }}收起

{{ strLimit(comment,800) }}查看全部

Show Original

{{ comment.content }}

Yami
查看更多

{{ formatTime(comment.in_dtm) }} 已购买 {{groupData}}

{{ comment.likes_count }} {{ comment.likes_count }} {{ comment.reply_count }} {{comment.in_user==uid ? __('Delete') : __('Report')}}
Yami Yami
{{ comment.user_name }}

{{ showTranslate(comment) }}收起

{{ strLimit(comment,800) }}查看全部

Show Original

{{ comment.content }}

Yami
查看更多

{{ formatTime(comment.in_dtm) }} 已购买 {{groupData}}

{{ comment.likes_count }} {{ comment.likes_count }} {{ comment.reply_count }} {{comment.in_user==uid ? __('Delete') : __('Report')}}

暂无符合条件的评论

评论详情

Yami Yami

{{ showTranslate(commentDetails) }}收起

{{ strLimit(commentDetails,800) }}查看全部

Show Original

{{ commentDetails.content }}

Yami
查看更多

{{ formatTime(commentDetails.in_dtm) }} 已购买 {{groupData}}

{{ commentDetails.likes_count }} {{ commentDetails.likes_count }} {{ commentDetails.reply_count }} {{commentDetails.in_user==uid ? __('Delete') : __('Report')}}

请输入内容

回复{{'(' + replyList.length + ')'}}

Yami Yami

{{ showTranslate(reply) }}收起

{{ strLimit(reply,800) }}查看全部

Show Original

{{ reply.reply_content }}

{{ formatTime(reply.reply_in_dtm) }}

{{ reply.reply_likes_count }} {{ reply.reply_likes_count }} {{ reply.reply_reply_count }} {{reply.reply_in_user==uid ? __('Delete') : __('Report')}}

请输入内容

取消

End

发表评论
商品评分

请输入评论

  • 一个好的昵称,会让你的评论更受欢迎!
  • 修改了这里的昵称,个人资料中的昵称也将被修改。
感谢你的评论
你的好评可以帮助我们的社区发现更好的亚洲商品。

举报

取消

确认删除该评论吗?

取消

历史浏览

品牌故事

京东图书