Professional C++
Essential reading for experienced developers who are determined to master the latest release of C++ Although C++ is often the language of choice from game programming to major commercial software applications, it is also one of the most difficult to master. With this no-nonsense book, you will learn...
Gespeichert in:
| Hauptverfasser: | , , |
|---|---|
| Format: | E-Book |
| Sprache: | Englisch |
| Veröffentlicht: |
Hoboken
John Wiley & Sons, Incorporated
2011
|
| Ausgabe: | 2 |
| Schlagworte: | |
| ISBN: | 1118545699, 9781118545690 |
| Online-Zugang: | Volltext |
| Tags: |
Tag hinzufügen
Keine Tags, Fügen Sie den ersten Tag hinzu!
|
Inhaltsangabe:
- Intro -- Professional C++ -- Contents -- Introduction -- Part I: Introduction to Professional C++ -- Chapter 1: A Crash Course in C++ -- The Basics of C++ -- The Obligatory Hello, World -- Namespaces -- Variables -- Operators -- Types -- Conditionals -- Loops -- Arrays -- Functions -- Those Are the Basics -- Diving Deeper into C++ -- Pointers and Dynamic Memory -- Strings in C++ -- References -- Exceptions -- The Many Uses of const -- C++ as an Object- Oriented Language -- Declaring a Class -- The Standard Library -- Your First Useful C++ Program -- An Employee Records System -- The Employee Class -- The Database Class -- The User Interface -- Evaluating the Program -- Summary -- Chapter 2: Designing Professional C++ Programs -- What Is Programming Design? -- The Importance of Programming Design -- What's Different about C++ Design? -- Two Rules for C++ Design -- Abstraction -- Reuse -- Reusing Code -- A Note on Terminology -- Deciding Whether or Not to Reuse Code -- Strategies for Reusing Code -- Bundling Third-Party Applications -- Open-Source Libraries -- The C++ Standard Library -- Designing with Patterns and Techniques -- Designing a Chess Program -- Requirements -- Design Steps -- Summary -- Chapter 3: Designing With Objects -- Am I Thinking Procedurally? -- The Object-Oriented Philosophy -- Classes -- Components -- Properties -- Behaviors -- Bringing It All Together -- Living in a World of Objects -- Overobjectification -- Overly General Objects -- Object Relationships -- The Has-A Relationship -- The Is-A Relationship (Inheritance) -- The Fine Line between Has-A and Is-A -- The Not-A Relationship -- Hierarchies -- Multiple Inheritance -- Mix-in Classes -- Abstraction -- Interface versus Implementation -- Deciding on an Exposed Interface -- Designing a Successful Abstraction -- Summary -- Chapter 4: Designing for Reuse
- The Reuse Philosophy -- How to Design Reusable Code -- Use Abstraction -- Structure Your Code for Optimal Reuse -- Design Usable Interfaces -- Reconciling Generality and Ease of Use -- Summary -- Chapter 5: Coding with Style -- The Importance of Looking Good -- Thinking Ahead -- Elements of Good Style -- Documenting Your Code -- Reasons to Write Comments -- Commenting Styles -- Comments in This Book -- Decomposition -- Decomposition through Refactoring -- Decomposition by Design -- Decomposition in This Book -- Naming -- Choosing a Good Name -- Naming Conventions -- Using Language Features with Style -- Use Constants -- Use References Instead of Pointers -- Use Custom Exceptions -- Formatting -- The Curly Brace Alignment Debate -- Coming to Blows over Spaces and Parentheses -- Spaces and Tabs -- Stylistic Challenges -- Summary -- Part II: C++ Coding the Professional Way -- Chapter 6: Gaining Proficiency with Classes and Objects -- Introducing the Spreadsheet Example -- Writing Classes -- Class Definitions -- Defining Methods -- Using Objects -- Object Life Cycles -- Object Creation -- Object Destruction -- Assigning to Objects -- Distinguishing Copying from Assignment -- Summary -- Chapter 7: mastering classes and Objects -- Dynamic Memory Allocation in Objects -- The Spreadsheet Class -- Freeing Memory with Destructors -- Handling Copying and Assignment -- Different Kinds of Data Members -- static Data Members -- const Data Members -- Reference Data Members -- const Reference Data Members -- More about Methods -- static Methods -- const Methods -- Method Overloading -- Default Parameters -- Inline Methods -- Nested Classes -- Enumerated Types Inside Classes -- Friends -- Operator Overloading -- Example: Implementing Addition for SpreadsheetCells -- Overloading Arithmetic Operators -- Overloading Comparison Operators
- Duration
- Variable-Length Argument Lists -- Preprocessor Macros -- Summary -- Chapter 10: Handling Errors -- Errors and Exceptions -- What Are Exceptions, Anyway? -- Why Exceptions in C++ Are a Good Thing -- Why Exceptions in C++ Are a Bad Thing -- Our Recommendation -- Exception Mechanics -- Throwing and Catching Exceptions -- Exception Types -- Throwing and Catching Multiple Exceptions -- Uncaught Exceptions -- Throw Lists -- Exceptions and Polymorphism -- The Standard Exception Hierarchy -- Catching Exceptions in a Class Hierarchy -- Writing Your Own Exception Classes -- Nested Exceptions -- Stack Unwinding and Cleanup -- Use Smart Pointers -- Catch, Cleanup, and Rethrow -- Common Error-Handling Issues -- Memory Allocation Errors -- Errors in Constructors -- Function-Try-Blocks for Constructors -- Errors in Destructors -- Putting It All Together -- Summary -- Chapter 11: Delving into the Standard Library -- Coding Principles -- Use of Templates -- Use of Operator Overloading -- Overview of the C++ Standard Library -- Strings -- I/O Streams -- Localization -- Smart Pointers -- Exceptions -- Mathematical Utilities -- Time Utilities -- Random Numbers -- Compile-Time Rational Arithmetic -- Tuples -- Regular Expressions -- The Standard Template Library -- STL Algorithms -- What's Missing from the STL -- Summary -- Chapter 12: Understanding Containers and Iterators -- Containers Overview -- Requirements on Elements -- Exceptions and Error Checking -- Iterators -- C++11 Changes -- Sequential Containers -- vector -- The vector< -- bool> -- Specialization -- deque -- list -- array -- forward_list -- Container Adapters -- queue -- priority_queue -- stack -- Associative Containers -- The pair Utility Class -- map -- multimap -- set -- multiset -- Unordered Associative Containers/Hash Tables -- Hash Functions -- unordered_map -- unordered_map Example: Phone Book
- Building Types with Operator Overloading -- Building Stable Interfaces -- Using Interface and Implementation Classes -- Summary -- Chapter 8: Discovering Inheritance Techniques -- Building Classes with Inheritance -- Extending Classes -- Overriding Methods -- Inheritance for Reuse -- The WeatherPrediction Class -- Adding Functionality in a Subclass -- Replacing Functionality in a Subclass -- Respect Your Parents -- Parent Constructors -- Parent Destructors -- Referring to Parent Names -- Casting Up and Down -- Inheritance for Polymorphism -- Return of the Spreadsheet -- Designing the Polymorphic Spreadsheet Cell -- The Spreadsheet Cell Base Class -- The Individual Subclasses -- Leveraging Polymorphism -- Future Considerations -- Multiple Inheritance -- Inheriting from Multiple Classes -- Naming Collisions and Ambiguous Base Classes -- Interesting and Obscure Inheritance Issues -- Changing the Overridden Method's Characteristics -- Inherited Constructors -- Special Cases in Overriding Methods -- Copy Constructors and the Equals Operator in Subclasses -- The Truth about virtual -- Run Time Type Facilities -- Non-Public Inheritance -- Virtual Base Classes -- Summary -- Chapter 9: Understanding C++ Quirks and Oddities -- References -- Reference Variables -- Reference Data Members -- Reference Parameters -- Reference Return Values -- Deciding between References and Pointers -- Rvalue References -- Keyword Confusion -- The const Keyword -- The static Keyword -- Order of Initialization of Nonlocal Variables -- Types and Casts -- typedefs -- typedefs for Function Pointers -- Type Aliases -- Casts -- Scope Resolution -- C++11 -- Uniform Initialization -- Alternative Function Syntax -- Null Pointer Constant -- Angle Brackets -- Initializer Lists -- Explicit Conversion Operators -- Attributes -- User Defined Literals -- Header Files -- C Utilities
- unordered_multimap -- unordered_set/unordered_multiset -- Other Containers -- Standard C-Style Arrays -- strings -- Streams -- bitset -- Summary -- Chapter 13: Mastering STL Algorithms -- Overview of Algorithms -- The find and find_if Algorithms -- The accumulate Algorithms -- C++11 Move Semantics with Algorithms -- Lambda Expressions -- Syntax -- Capture Block -- Lambda Expressions as Return Type -- Lambda Expressions as Parameters -- Examples -- Function Objects -- Arithmetic Function Objects -- Comparison Function Objects -- Logical Function Objects -- Bitwise Function Objects -- Function Object Adapters -- Writing Your Own Function Objects -- Algorithm Details -- Utility Algorithms -- Non-Modifying Algorithms -- Modifying Algorithms -- Sorting Algorithms -- Set Algorithms -- Algorithms Example: Auditing Voter Registrations -- The Voter Registration Audit Problem Statement -- The auditVoterRolls Function -- The getDuplicates Function -- Testing the auditVoterRolls Function -- Summary -- Chapter 14: Using Strings and Regular Expressions -- Dynamic Strings -- C-Style Strings -- String Literals -- The C++ string Class -- Raw String Literals -- Localization -- Localizing String Literals -- Wide Characters -- Non-Western Character Sets -- Locales and Facets -- Regular Expressions -- ECMAScript Syntax -- The regex Library -- regex_match() -- regex_search() -- regex_iterator -- regex_token_iterator -- regex_replace() -- Summary -- Chapter 15: Demystifying C++ I/ O -- Using Streams -- What Is a Stream, Anyway? -- Stream Sources and Destinations -- Output with Streams -- Input with Streams -- Input and Output with Objects -- String Streams -- File Streams -- Jumping around with seek() and tell() -- Linking Streams Together -- Bidirectional I/O -- Summary -- Chapter 16: Additional Library Utilities -- std::function -- Ratios -- The Chrono Library

