Modern C++:Efficient and Scalable Application Development
Richard Grimes Marius Bancila更新时间:2021-06-10 18:29:32
最新章节:Leave a Review - Let Other Readers Know What You Thinkcoverpage
Title Page
About Packt
Why Subscribe?
Packt.com
Contributors
About the Authors
About the Reviewers
Packt Is Searching for Authors Like You
Preface
Who This Book Is For
What This Book Covers
To Get the Most out of This Book
How to generate projects for Visual Studio 2017
Download the Example Code Files
Download the color images
Conventions Used
Get in Touch
Reviews
Understanding Language Features
Writing C++
Using whitespace
Formatting Code
Writing Statements
Working with Expressions
Using the Comma Operator
Using Types and Variables
Using constants and literals
Defining constants
Using Constant Expressions
Using Enumerations
Declaring Pointers
Using Namespaces
C++ Scoping of Variables
Using Operators
Exploring the Built-in Operators
Arithmetic Operators
Increment and Decrement Operators
Bitwise Operators
Boolean Operators
Bitwise Shift Operators
Assignment Operators
Controlling Execution Flow
Using Conditional Statements
Selecting
Looping
Looping with Iteration
Conditional Loops
Jumping
Using C++ language features
Summary
Working with Memory Arrays and Pointers
Using memory in C++
Using C++ pointer syntax
Using Null Pointers
Types of Memory
Pointer Arithmetic
Using Arrays
Function parameters
Multidimensional Arrays
Passing Multidimensional Arrays to Functions
Using arrays of characters
Comparing strings
Preventing Buffer Overruns
Using Pointers in C++
Accessing out of Bounds
Pointers to Deallocated Memory
Converting Pointers
Constant Pointers
Changing the Type Pointed To
Allocating memory in code
Allocating individual objects
Allocating Arrays of Objects
Handling failed allocations
Using Other Versions of the New Operator
Memory lifetime
The Windows SDK and Pointers
Memory and the C++ Standard Library
Standard Library arrays
Using the stack-based array class
Using the Dynamically Allocated Vector Class
References
Constant References
Returning References
Temporaries and References
The rvalue References
Ranged for and References
Using Pointers in Practice
Creating the Project
Adding a Task Object to the List
Deleting the task list
Iterating the task list
Inserting Items
Summary
Using Functions
Defining C++ functions
Declaring and defining functions
Specifying linkage
Inlining
Determining the return type
Naming the function
Function parameters
Specifying exceptions
Function body
Using function parameters
Passing Initializer lists
Using default parameters
Variable number of parameters
Initializer lists
Argument lists
Function features
Call stack
Specifying calling conventions
Using C linkage
Specifying how the stack Is maintained
Using recursion
Overloading functions
Functions and scope
Deleted functions
Passing by value and passing by reference
Designing functions
Pre- and post-conditions
Using invariants
Function pointers
Remember the parentheses!
Declaring function pointers
Using function pointers
Templated functions
Defining templates
Using template parameter values
Specialized templates
Variadic templates
Overloaded operators
Function objects
Introducing lambda expressions
Using functions in C++
Summary
Classes
Writing classes
Reviewing structures
Defining classes
Defining class behavior
Using the this pointer
Using the scope resolution operator
Defining class state
Creating objects
Construction of objects
Defining constructors
Delegating constructors
Copy constructor
Converting between types
Making friends
Marking constructors as explicit
Destructing objects
Assigning objects
Move semantics
Declaring static members
Defining static members
Using static and global objects
Named constructors
Nested classes
Accessing const objects
Using objects with pointers
Getting pointers to object members
Operator overloading
Defining function classes
Defining conversion operators
Managing resources
Writing wrapper classes
Using smart pointers
Managing exclusive ownership
Sharing ownership
Handling dangling pointers
Templates
Using classes
Summary
Using the Standard Library Containers
Working with pairs and tuples
Containers
Sequence containers
List
Forward list
Vector
Deque
Associative containers
Maps and multimaps
Sets and multisets
Unordered containers
Special purpose containers
Using iterators
Input and output iterators
Stream iterators
Using iterators with the C Standard Library
Algorithms
Iteration of items
Getting information
Comparing containers
Changing Items
Finding Items
Sorting items
Using the numeric libraries
Compile time arithmetic
Complex numbers
Using the Standard Library
Summary
Using Strings
Using the string class as a container
Getting information about a string
Altering strings
Searching strings
Internationalization
Using facets
Strings and numbers
Converting strings to numbers
Converting numbers to strings
Using stream classes
Outputting floating point numbers
Outputting integers
Outputting time and money
Converting numbers to strings using streams
Reading numbers from strings using streams
Using regular expressions
Defining regular expressions
Standard Library classes
Matching expressions
Using iterators
Replacing strings
Using strings
Creating the project
Processing header subitems
Summary
Diagnostics and Debugging
Preparing your code
Invariants and conditions
Conditional compilation
Using pragmas
Adding informational messages
Compiler switches for debugging
Pre-processor symbols
Producing diagnostic messages
Trace messages with the C runtime
Tracing messages with Windows
Using asserts
Application termination
Error values
Obtaining message descriptions
Using the Message Compiler
C++ exceptions
Exception specifications
C++ exception syntax
Standard exception classes
Catching exceptions by type
Function try blocks
System errors
Nested exceptions
Structured Exception Handling
Compiler exception switches
Mixing C++ and SEH exception handling
Writing exception-safe classes
Summary
Learning Modern Core Language Features
Using auto whenever possible
How to do it...
How it works...
See also
Creating type aliases and alias templates
How to do it...
How it works...
Understanding uniform initialization
Getting ready
How to do it...
How it works...
There's more
See also
Understanding the various forms of non-static member initialization
How to do it...
How it works...
Controlling and querying object alignment
Getting ready
How to do it...
How it works...
Using scoped enumerations
How to do it...
How it works...
Using override and final for virtual methods
Getting ready
How to do it...
How it works...
Using range-based for loops to iterate on a range
Getting ready
How to do it...
How it works...
See also
Enabling range-based for loops for custom types
Getting ready
How to do it...
How it works...
See also
Using explicit constructors and conversion operators to avoid implicit conversion
Getting ready
How to do it...
How it works...
See also
Using unnamed namespaces instead of static globals
Getting ready
How to do it...
How it works...
See also
Using inline namespaces for symbol versioning
Getting ready
How to do it...
How it works...
See also
Using structured bindings to handle multi-return values
Getting ready
How to do it...
How it works...
Working with Numbers and Strings
Converting between numeric and string types
Getting ready
How to do it...
How it works...
See also
Limits and other properties of numeric types
Getting ready
How to do it...
How it works...
Generating pseudo-random numbers
Getting ready
How to do it...
How it works...
See also
Initializing all bits of internal state of a pseudo-random number generator
Getting ready
How to do it...
How it works...
Creating cooked user-defined literals
Getting ready
How to do it...
How it works...
There's more...
See also
Creating raw user-defined literals
Getting ready
How to do it...
How it works...
See also
Using raw string literals to avoid escaping characters
Getting ready
How to do it...
How it works...
See also
Creating a library of string helpers
Getting ready
How to do it...
How it works...
See also
Verifying the format of a string using regular expressions
Getting ready
How to do it...
How it works...
There's more...
See also
Parsing the content of a string using regular expressions
Getting ready
How to do it...
How it works...
See also
Replacing the content of a string using regular expressions
Getting ready
How to do it...
How it works...
See also
Using string_view instead of constant string references
Getting ready
How to do it...
How it works...
See also
Exploring Functions
Defaulted and deleted functions
Getting started
How to do it...
How it works...
Using lambdas with standard algorithms
Getting ready
How to do it...
How it works...
There's more...
See also
Using generic lambdas
Getting started
How to do it...
How it works...
See also
Writing a recursive lambda
Getting ready
How to do it...
How it works...
Writing a function template with a variable number of arguments
Getting ready
How to do it...
How it works...
See also
Using fold expressions to simplify variadic function templates
Getting ready
How to do it...
How it works...
There's more...
See also
Implementing higher-order functions map and fold
Getting ready
How to do it...
How it works...
There's more...
See also
Composing functions into a higher-order function
Getting ready
How to do it...
How it works...
There's more...
See also
Uniformly invoking anything callable
Getting ready
How to do it...
How it works...
See also
Standard Library Containers Algorithms and Iterators
Using vector as a default container
Getting ready
How to do it...
How it works...
There’s more...
See also
Using bitset for fixed-size sequences of bits
Getting ready
How to do it...
How it works...
There's more...
See also
Using vector<bool> for variable-size sequences of bits
Getting ready...
How to do it...
How it works...
There's more...
See also
Finding elements in a range
Getting ready
How to do it...
How it works...
There's more...
See also
Sorting a range
Getting ready
How to do it...
How it works...
There's more...
See also
Initializing a range
Getting ready
How to do it...
How it works...
See also
Using set operations on a range
Getting ready
How to do it...
How it works...
See also
Using iterators to insert new elements in a container
Getting ready
How to do it...
How it works...
There's more...
See also
Writing your own random access iterator
Getting ready
How to do it...
How it works...
There's more...
See also
Container access with non-member functions
Getting ready
How to do it...
How it works...
There's more...
See also
Math Problems
Problems
1. Sum of naturals divisible by 3 and 5
2. Greatest common divisor
3. Least common multiple
4. Largest prime smaller than given number
5. Sexy prime pairs
6. Abundant numbers
7. Amicable numbers
8. Armstrong numbers
9. Prime factors of a number
10. Gray code
11. Converting numerical values to Roman
12. Largest Collatz sequence
13. Computing the value of Pi
14. Validating ISBNs
Solutions
1. Sum of naturals divisible by 3 and 5
2. Greatest common divisor
3. Least common multiple
4. Largest prime smaller than given number
5. Sexy prime pairs
6. Abundant numbers
7. Amicable numbers
8. Armstrong numbers
9. Prime factors of a number
10. Gray code
11. Converting numerical values to Roman
12. Largest Collatz sequence
13. Computing the value of Pi
14. Validating ISBNs
Language Features
Problems
15. IPv4 data type
16. Enumerating IPv4 addresses in a range
17. Creating a 2D array with basic operations
18. Minimum function with any number of arguments
19. Adding a range of values to a container
20. Container any all none
21. System handle wrapper
22. Literals of various temperature scales
Solutions
15. IPv4 data type
16. Enumerating IPv4 addresses in a range
17. Creating a 2D array with basic operations
18. Minimum function with any number of arguments
19. Adding a range of values to a container
20. Container any all none
21. System handle wrapper
22. Literals of various temperature scales
Strings and Regular Expressions
Problems
23. Binary to string conversion
24. String to binary conversion
25. Capitalizing an article title
26. Joining strings together separated by a delimiter
27. Splitting a string into tokens with a list of possible delimiters
28. Longest palindromic substring
29. License plate validation
30. Extracting URL parts
31. Transforming dates in strings
Solutions
23. Binary to string conversion
24. String to binary conversion
25. Capitalizing an article title
26. Joining strings together separated by a delimiter
27. Splitting a string into tokens with a list of possible delimiters
28. Longest palindromic substring
29. License plate validation
30. Extracting URL parts
31. Transforming dates in strings
Streams and Filesystems
Problems
32. Pascal's triangle
33. Tabular printing of a list of processes
34. Removing empty lines from a text file
35. Computing the size of a directory
36. Deleting files older than a given date
37. Finding files in a directory that match a regular expression
38. Temporary log files
Solutions
32. Pascal's triangle
33. Tabular printing of a list of processes
34. Removing empty lines from a text file
35. Computing the size of a directory
36. Deleting files older than a given date
37. Finding files in a directory that match a regular expression
38. Temporary log files
Date and Time
Problems
39. Measuring function execution time
40. Number of days between two dates
41. Day of the week
42. Day and week of the year
43. Meeting time for multiple time zones
44. Monthly calendar
Solutions
39. Measuring function execution time
40. Number of days between two dates
41. Day of the week
42. Day and week of the year
43. Meeting time for multiple time zones
44. Monthly calendar
Algorithms and Data Structures
Problems
45. Priority queue
46. Circular buffer
47. Double buffer
48. The most frequent element in a range
49. Text histogram
50. Filtering a list of phone numbers
51. Transforming a list of phone numbers
52. Generating all the permutations of a string
53. Average rating of movies
54. Pairwise algorithm
55. Zip algorithm
56. Select algorithm
57. Sort algorithm
58. The shortest path between nodes
59. The Weasel program
60. The Game of Life
Solutions
45. Priority queue
46. Circular buffer
47. Double buffer
48. The most frequent element in a range
49. Text histogram
50. Filtering a list of phone numbers
51. Transforming a list of phone numbers
52. Generating all the permutations of a string
53. Average rating of movies
54. Pairwise algorithm
55. Zip algorithm
56. Select algorithm
57. Sort algorithm
58. The shortest path between nodes
59. The Weasel program
60. The Game of Life
Other Books You May Enjoy
Leave a Review - Let Other Readers Know What You Think
更新时间:2021-06-10 18:29:32