C++ Notes for Professionals book

    Amazing collection of free programming books

    Collecting
    Free
    Amazing collection of free programming books

    The Notes for Professionals book is compiled from Stack Overflow Documentation, the content is written by the beautiful people at Stack Overflow. Text content is released under Creative Commons BY-SA. See credits at the end of this book whom contributed to the various chapters. Images may be copyright of their respective owners unless otherwise specified

    Book created for educational purposes and is not affiliated with group(s), company(s) nor Stack Overflow. All trademarks belong to their respective company owners

    https://goalkicker.com/

    Content

    1-1Content list
    1-2About
    1-3Chapter 1: Getting started with C++
    1-4Section 1.1: Hello World
    1-5Section 1.2: Comments
    1-6Section 1.3: The standard C++ compilation process
    1-7Section 1.4: Function
    1-8Section 1.5: Visibility of function prototypes and declarations
    1-9Section 1.6: Preprocessor
    1-10Chapter 2: Literals
    1-11Section 2.1: this
    1-12Section 2.2: Integer literal
    1-13Section 2.3: true
    1-14Section 2.4: false
    1-15Section 2.5: nullptr
    1-16Chapter 3: operator precedence
    1-17Section 3.1: Logical && and || operators: short-circuit
    1-18Section 3.2: Unary Operators
    1-19Section 3.3: Arithmetic operators
    1-20Section 3.4: Logical AND and OR operators
    1-21Chapter 4: Floating Point Arithmetic
    1-22Section 4.1: Floating Point Numbers are Weird
    1-23Chapter 5: Bit Operators
    1-24Section 5.1: | - bitwise OR
    1-25Section 5.2: ^ - bitwise XOR (exclusive OR)
    1-26Section 5.3: & - bitwise AND
    1-27Section 5.4: << - left shift
    1-28Section 5.5: >> - right shift
    1-29Chapter 6: Bit Manipulation
    1-30Section 6.1: Remove rightmost set bit
    1-31Section 6.2: Set all bits
    1-32Section 6.3: Toggling a bit
    1-33Section 6.4: Checking a bit
    1-34Section 6.5: Counting bits set
    1-35Section 6.6: Check if an integer is a power of 2
    1-36Section 6.7: Setting a bit
    1-37Section 6.8: Clearing a bit
    1-38Section 6.9: Changing the nth bit to x
    1-39Section 6.10: Bit Manipulation Application: Small to Capital Letter
    1-40Chapter 7: Bit fields
    1-41Section 7.1: Declaration and Usage
    1-42Chapter 8: Arrays
    1-43Section 8.1: Array initialization
    1-44Section 8.2: A fixed size raw array matrix (that is, a 2D raw array)
    1-45Section 8.3: Dynamically sized raw array
    1-46Section 8.4: Array size: type safe at compile time
    1-47Section 8.5: Expanding dynamic size array by using std::vector
    1-48Section 8.6: A dynamic size matrix using std::vector for storage
    1-49Chapter 9: Iterators
    1-50Section 9.1: Overview
    1-51Section 9.2: Vector Iterator
    1-52Section 9.3: Map Iterator
    1-53Section 9.4: Reverse Iterators
    1-54Section 9.5: Stream Iterators
    1-55Section 9.6: C Iterators (Pointers)
    1-56Section 9.7: Write your own generator-backed iterator
    1-57Chapter 10: Basic input/output in c++
    1-58Section 10.1: user input and standard output
    1-59Chapter 11: Loops
    1-60Section 11.1: Range-Based For
    1-61Section 11.2: For loop
    1-62Section 11.3: While loop
    1-63Section 11.4: Do-while loop
    1-64Section 11.5: Loop Control statements : Break and Continue
    1-65Section 11.6: Declaration of variables in conditions
    1-66Section 11.7: Range-for over a sub-range
    1-67Chapter 12: File I/O
    1-68Section 12.1: Writing to a file
    1-69Section 12.2: Opening a file
    1-70Section 12.3: Reading from a file
    1-71Section 12.4: Opening modes
    1-72Section 12.5: Reading an ASCII file into a std::string
    1-73Section 12.6: Writing files with non-standard locale settings
    1-74Section 12.7: Checking end of file inside a loop condition, bad practice?
    1-75Section 12.8: Flushing a stream
    1-76Section 12.9: Reading a file into a container
    1-77Section 12.10: Copying a file
    1-78Section 12.11: Closing a file
    1-79Section 12.12: Reading a `struct` from a formatted text file
    1-80Chapter 13: C++ Streams
    1-81Section 13.1: String streams
    1-82Section 13.2: Printing collections with iostream
    1-83Chapter 14: Stream manipulators
    1-84Section 14.1: Stream manipulators
    1-85Section 14.2: Output stream manipulators
    1-86Section 14.3: Input stream manipulators
    1-87Chapter 15: Flow Control
    1-88Section 15.1: case
    1-89Section 15.2: switch
    1-90Section 15.3: catch
    1-91Section 15.4: throw
    1-92Section 15.5: default
    1-93Section 15.6: try
    1-94Section 15.7: if
    1-95Section 15.8: else
    1-96Section 15.9: Conditional Structures: if, if..else
    1-97Section 15.10: goto
    1-98Section 15.11: Jump statements : break, continue, goto, exit
    1-99Section 15.12: return
    1-100Chapter 16: Metaprogramming
    1-101Section 16.1: Calculating Factorials
    1-102Section 16.2: Iterating over a parameter pack
    1-103Section 16.3: Iterating with std::integer_sequence
    1-104Section 16.4: Tag Dispatching
    1-105Section 16.5: Detect Whether Expression is Valid
    1-106Section 16.6: If-then-else
    1-107Section 16.7: Manual distinction of types when given any type T
    1-108Section 16.8: Calculating power with C++11 (and higher)
    1-109Section 16.9: Generic Min/Max with variable argument count
    1-110Chapter 17: const keyword
    1-111Section 17.1: Avoiding duplication of code in const and non-const getter methods
    1-112Section 17.2: Const member functions
    1-113Section 17.3: Const local variables
    1-114Section 17.4: Const pointers
    1-115Chapter 18: mutable keyword
    1-116Section 18.1: mutable lambdas
    1-117Section 18.2: non-static class member modifier
    1-118Chapter 19: Friend keyword
    1-119Section 19.1: Friend function
    1-120Section 19.2: Friend method
    1-121Section 19.3: Friend class
    1-122Chapter 20: Type Keywords
    1-123Section 20.1: class
    1-124Section 20.2: enum
    1-125Section 20.3: struct
    1-126Section 20.4: union
    1-127Chapter 21: Basic Type Keywords
    1-128Section 21.1: char
    1-129Section 21.2: char16_t
    1-130Section 21.3: char32_t
    1-131Section 21.4: int
    1-132Section 21.5: void
    1-133Section 21.6: wchar_t
    1-134Section 21.7: float
    1-135Section 21.8: double
    1-136Section 21.9: long
    1-137Section 21.10: short
    1-138Section 21.11: bool
    1-139Chapter 22: Variable Declaration Keywords
    1-140Section 22.1: decltype
    1-141Section 22.2: const
    1-142Section 22.3: volatile
    1-143Section 22.4: signed
    1-144Section 22.5: unsigned
    1-145Chapter 23: Keywords
    1-146Section 23.1: asm
    1-147Section 23.2: Dierent keywords
    1-148Section 23.3: typename
    1-149Section 23.4: explicit
    1-150Section 23.5: sizeof
    1-151Section 23.6: noexcept
    1-152Chapter 24: Returning several values from a function
    1-153Section 24.1: Using std::tuple
    1-154Section 24.2: Structured Bindings
    1-155Section 24.3: Using struct
    1-156Section 24.4: Using Output Parameters
    1-157Section 24.5: Using a Function Object Consumer
    1-158Section 24.6: Using std::pair
    1-159Section 24.7: Using std::array
    1-160Section 24.8: Using Output Iterator
    1-161Section 24.9: Using std::vector
    1-162Chapter 25: Polymorphism
    1-163Section 25.1: Define polymorphic classes
    1-164Section 25.2: Safe downcasting
    1-165Section 25.3: Polymorphism & Destructors
    1-166Chapter 26: References
    1-167Section 26.1: Defining a reference
    1-168Chapter 27: Value and Reference Semantics
    1-169Section 27.1: Definitions
    1-170Section 27.2: Deep copying and move support
    1-171Chapter 28: C++ function "call by value" vs. "call by reference"
    1-172Section 28.1: Call by value
    1-173Chapter 29: Copying vs Assignment
    1-174Section 29.1: Assignment Operator
    1-175Section 29.2: Copy Constructor
    1-176Section 29.3: Copy Constructor Vs Assignment Constructor
    1-177Chapter 30: Pointers
    1-178Section 30.1: Pointer Operations
    1-179Section 30.2: Pointer basics
    1-180Section 30.3: Pointer Arithmetic
    1-181Chapter 31: Pointers to members
    1-182Section 31.1: Pointers to static member functions
    1-183Section 31.2: Pointers to member functions
    1-184Section 31.3: Pointers to member variables
    1-185Section 31.4: Pointers to static member variables
    1-186Chapter 32: The This Pointer
    1-187Section 32.1: this Pointer
    1-188Section 32.2: Using the this Pointer to Access Member Data
    1-189Section 32.3: Using the this Pointer to Dierentiate Between Member Data and Parameters
    1-190Section 32.4: this Pointer CV-Qualifiers
    1-191Section 32.5: this Pointer Ref-Qualifiers
    1-192Chapter 33: Smart Pointers
    1-193Section 33.1: Unique ownership (std::unique_ptr)
    1-194Section 33.2: Sharing ownership (std::shared_ptr)
    1-195Section 33.3: Sharing with temporary ownership (std::weak_ptr)
    1-196Section 33.4: Using custom deleters to create a wrapper to a C interface
    1-197Section 33.5: Unique ownership without move semantics (auto_ptr)
    1-198Section 33.6: Casting std::shared_ptr pointers
    1-199Section 33.7: Writing a smart pointer: value_ptr
    1-200Section 33.8: Getting a shared_ptr referring to this
    1-201Chapter 34: Classes/Structures
    1-202Section 34.1: Class basics
    1-203Section 34.2: Final classes and structs
    1-204Section 34.3: Access specifiers
    1-205Section 34.4: Inheritance
    1-206Section 34.5: Friendship
    1-207Section 34.6: Virtual Inheritance
    1-208Section 34.7: Private inheritance: restricting base class interface
    1-209Section 34.8: Accessing class members
    1-210Section 34.9: Member Types and Aliases
    1-211Section 34.10: Nested Classes/Structures
    1-212Section 34.11: Unnamed struct/class
    1-213Section 34.12: Static class members
    1-214Section 34.13: Multiple Inheritance
    1-215Section 34.14: Non-static member functions
    1-216Chapter 35: Function Overloading
    1-217Section 35.1: What is Function Overloading?
    1-218Section 35.2: Return Type in Function Overloading
    1-219Section 35.3: Member Function cv-qualifier Overloading
    1-220Chapter 36: Operator Overloading
    1-221Section 36.1: Arithmetic operators
    1-222Section 36.2: Array subscript operator
    1-223Section 36.3: Conversion operators
    1-224Section 36.4: Complex Numbers Revisited
    1-225Section 36.5: Named operators
    1-226Section 36.6: Unary operators
    1-227Section 36.7: Comparison operators
    1-228Section 36.8: Assignment operator
    1-229Section 36.9: Function call operator
    1-230Section 36.10: Bitwise NOT operator
    1-231Section 36.11: Bit shift operators for I/O
    1-232Chapter 37: Function Template Overloading
    1-233Section 37.1: What is a valid function template overloading?
    1-234Chapter 38: Virtual Member Functions
    1-235Section 38.1: Final virtual functions
    1-236Section 38.2: Using override with virtual in C++11 and later
    1-237Section 38.3: Virtual vs non-virtual member functions
    1-238Section 38.4: Behaviour of virtual functions in constructors and destructors
    1-239Section 38.5: Pure virtual functions
    1-240Chapter 39: Inline functions
    1-241Section 39.1: Non-member inline function definition
    1-242Section 39.2: Member inline functions
    1-243Section 39.3: What is function inlining?
    1-244Section 39.4: Non-member inline function declaration
    1-245Chapter 40: Special Member Functions
    1-246Section 40.1: Default Constructor
    1-247Section 40.2: Destructor
    1-248Section 40.3: Copy and swap
    1-249Section 40.4: Implicit Move and Copy
    1-250Chapter 41: Non-Static Member Functions
    1-251Section 41.1: Non-static Member Functions
    1-252Section 41.2: Encapsulation
    1-253Section 41.3: Name Hiding & Importing
    1-254Section 41.4: Virtual Member Functions
    1-255Section 41.5: Const Correctness
    1-256Chapter 42: Constant class member functions
    1-257Section 42.1: constant member function
    1-258Chapter 43: C++ Containers
    1-259Section 43.1: C++ Containers Flowchart
    1-260Chapter 44: Namespaces
    1-261Section 44.1: What are namespaces?
    1-262Section 44.2: Argument Dependent Lookup
    1-263Section 44.3: Extending namespaces
    1-264Section 44.4: Using directive
    1-265Section 44.5: Making namespaces
    1-266Section 44.6: Unnamed/anonymous namespaces
    1-267Section 44.7: Compact nested namespaces
    1-268Section 44.8: Namespace alias
    1-269Section 44.9: Inline namespace
    1-270Section 44.10: Aliasing a long namespace
    1-271Section 44.11: Alias Declaration scope
    1-272Chapter 45: Header Files
    1-273Section 45.1: Basic Example
    1-274Section 45.2: Templates in Header Files
    1-275Chapter 46: Using declaration
    1-276Section 46.1: Importing names individually from a namespace
    1-277Section 46.2: Redeclaring members from a base class to avoid name hiding
    1-278Section 46.3: Inheriting constructors
    1-279Chapter 47: std::string
    1-280Section 47.1: Tokenize
    1-281Section 47.2: Conversion to (const) char*
    1-282Section 47.3: Using the std::string_view class
    1-283Section 47.4: Conversion to std::wstring
    1-284Section 47.5: Lexicographical comparison
    1-285Section 47.6: Trimming characters at start/end
    1-286Section 47.7: String replacement
    1-287Section 47.8: Converting to std::string
    1-288Section 47.9: Splitting
    1-289Section 47.10: Accessing a character
    1-290Section 47.11: Checking if a string is a prefix of another
    1-291Section 47.12: Looping through each character
    1-292Section 47.13: Conversion to integers/floating point types
    1-293Section 47.14: Concatenation
    1-294Section 47.15: Converting between character encodings
    1-295Section 47.16: Finding character(s) in a string
    1-296Chapter 48: std::array
    1-297Section 48.1: Initializing an std::array
    1-298Section 48.2: Element access
    1-299Section 48.3: Iterating through the Array
    1-300Section 48.4: Checking size of the Array
    1-301Section 48.5: Changing all array elements at once
    1-302Chapter 49: std::vector
    1-303Section 49.1: Accessing Elements
    1-304Section 49.2: Initializing a std::vector
    1-305Section 49.3: Deleting Elements
    1-306Section 49.4: Iterating Over std::vector
    1-307Section 49.5: vector<bool>: The Exception To So Many, So Many Rules
    1-308Section 49.6: Inserting Elements
    1-309Section 49.7: Using std::vector as a C array
    1-310Section 49.8: Finding an Element in std::vector
    1-311Section 49.9: Concatenating Vectors
    1-312Section 49.10: Matrices Using Vectors
    1-313Section 49.11: Using a Sorted Vector for Fast Element Lookup
    1-314Section 49.12: Reducing the Capacity of a Vector
    1-315Section 49.13: Vector size and capacity
    1-316Section 49.14: Iterator/Pointer Invalidation
    1-317Section 49.15: Find max and min Element and Respective Index in a Vector
    1-318Section 49.16: Converting an array to std::vector
    1-319Section 49.17: Functions Returning Large Vectors
    1-320Chapter 50: std::map
    1-321Section 50.1: Accessing elements
    1-322Section 50.2: Inserting elements
    1-323Section 50.3: Searching in std::map or in std::multimap
    1-324Section 50.4: Initializing a std::map or std::multimap
    1-325Section 50.5: Checking number of elements
    1-326Section 50.6: Types of Maps
    1-327Section 50.7: Deleting elements
    1-328Section 50.8: Iterating over std::map or std::multimap
    1-329Section 50.9: Creating std::map with user-defined types as key
    1-330Chapter 51: std::optional
    1-331Section 51.1: Using optionals to represent the absence of a value
    1-332Section 51.2: optional as return value
    1-333Section 51.3: value_or
    1-334Section 51.4: Introduction
    1-335Section 51.5: Using optionals to represent the failure of a function
    1-336Chapter 52: std::function: To wrap any element that is callable
    1-337Section 52.1: Simple usage
    1-338Section 52.2: std::function used with std::bind
    1-339Section 52.3: Binding std::function to a dierent callable types
    1-340Section 52.4: Storing function arguments in std::tuple
    1-341Section 52.5: std::function with lambda and std::bind
    1-342Section 52.6: `function` overhead
    1-343Chapter 53: std::forward_list
    1-344Section 53.1: Example
    1-345Section 53.2: Methods
    1-346Chapter 54: std::pair
    1-347Section 54.1: Compare operators
    1-348Section 54.2: Creating a Pair and accessing the elements
    1-349Chapter 55: std::atomics
    1-350Section 55.1: atomic types
    1-351Chapter 56: std::variant
    1-352Section 56.1: Create pseudo-method pointers
    1-353Section 56.2: Basic std::variant use
    1-354Section 56.3: Constructing a `std::variant`
    1-355Chapter 57: std::iomanip
    1-356Section 57.1: std::setprecision
    1-357Section 57.2: std::setfill
    1-358Section 57.3: std::setiosflags
    1-359Section 57.4: std::setw
    1-360Chapter 58: std::any
    1-361Section 58.1: Basic usage
    1-362Chapter 59: std::set and std::multiset
    1-363Section 59.1: Changing the default sort of a set
    1-364Section 59.2: Deleting values from a set
    1-365Section 59.3: Inserting values in a set
    1-366Section 59.4: Inserting values in a multiset
    1-367Section 59.5: Searching values in set and multiset
    1-368Chapter 60: std::integer_sequence
    1-369Section 60.1: Turn a std::tuple<T...> into function parameters
    1-370Section 60.2: Create a parameter pack consisting of integers
    1-371Section 60.3: Turn a sequence of indices into copies of an element
    1-372Chapter 61: Using std::unordered_map
    1-373Section 61.1: Declaration and Usage
    1-374Section 61.2: Some Basic Functions
    1-375Chapter 62: Standard Library Algorithms
    1-376Section 62.1: std::next_permutation
    1-377Section 62.2: std::for_each
    1-378Section 62.3: std::accumulate
    1-379Section 62.4: std::find
    1-380Section 62.5: std::min_element
    1-381Section 62.6: std::find_if
    1-382Section 62.7: Using std::nth_element To Find The Median (Or Other Quantiles)
    1-383Section 62.8: std::count
    1-384Section 62.9: std::count_if
    1-385Chapter 63: The ISO C++ Standard
    1-386Section 63.1: Current Working Drafts
    1-387Section 63.2: C++17
    1-388Section 63.3: C++11
    1-389Section 63.4: C++14
    1-390Section 63.5: C++98
    1-391Section 63.6: C++03
    1-392Section 63.7: C++20
    1-393Chapter 64: Inline variables
    1-394Section 64.1: Defining a static data member in the class definition
    1-395Chapter 65: Random number generation
    1-396Section 65.1: True random value generator
    1-397Section 65.2: Generating a pseudo-random number
    1-398Section 65.3: Using the generator for multiple distributions
    1-399Chapter 66: Date and time using <chrono> header
    1-400Section 66.1: Measuring time using <chrono>
    1-401Section 66.2: Find number of days between two dates
    1-402Chapter 67: Sorting
    1-403Section 67.1: Sorting and sequence containers
    1-404Section 67.2: sorting with std::map (ascending and descending)
    1-405Section 67.3: Sorting sequence containers by overloaded less operator
    1-406Section 67.4: Sorting sequence containers using compare function
    1-407Section 67.5: Sorting sequence containers using lambda expressions (C++11)
    1-408Section 67.6: Sorting built-in arrays
    1-409Section 67.7: Sorting sequence containers with specifed ordering
    1-410Chapter 68: Enumeration
    1-411Section 68.1: Iteration over an enum
    1-412Section 68.2: Scoped enums
    1-413Section 68.3: Enum forward declaration in C++11
    1-414Section 68.4: Basic Enumeration Declaration
    1-415Section 68.5: Enumeration in switch statements
    1-416Chapter 69: Iteration
    1-417Section 69.1: break
    1-418Section 69.2: continue
    1-419Section 69.3: do
    1-420Section 69.4: while
    1-421Section 69.5: range-based for loop
    1-422Section 69.6: for
    1-423Chapter 70: Regular expressions
    1-424Section 70.1: Basic regex_match and regex_search Examples
    1-425Section 70.2: regex_iterator Example
    1-426Section 70.3: Anchors
    1-427Section 70.4: regex_replace Example
    1-428Section 70.5: regex_token_iterator Example
    1-429Section 70.6: Quantifiers
    1-430Section 70.7: Splitting a string
    1-431Chapter 71: Implementation-defined behavior
    1-432Section 71.1: Size of integral types
    1-433Section 71.2: Char might be unsigned or signed
    1-434Section 71.3: Ranges of numeric types
    1-435Section 71.4: Value representation of floating point types
    1-436Section 71.5: Overflow when converting from integer to signed integer
    1-437Section 71.6: Underlying type (and hence size) of an enum
    1-438Section 71.7: Numeric value of a pointer
    1-439Section 71.8: Number of bits in a byte
    1-440Chapter 72: Exceptions
    1-441Section 72.1: Catching exceptions
    1-442Section 72.2: Rethrow (propagate) exception
    1-443Section 72.3: Best practice: throw by value, catch by const reference
    1-444Section 72.4: Custom exception
    1-445Section 72.5: std::uncaught_exceptions
    1-446Section 72.6: Function Try Block for regular function
    1-447Section 72.7: Nested exception
    1-448Section 72.8: Function Try Blocks In constructor
    1-449Section 72.9: Function Try Blocks In destructor
    1-450Chapter 73: Lambdas
    1-451Section 73.1: What is a lambda expression?
    1-452Section 73.2: Specifying the return type
    1-453Section 73.3: Capture by value
    1-454Section 73.4: Recursive lambdas
    1-455Section 73.5: Default capture
    1-456Section 73.6: Class lambdas and capture of this
    1-457Section 73.7: Capture by reference
    1-458Section 73.8: Generic lambdas
    1-459Section 73.9: Using lambdas for inline parameter pack unpacking
    1-460Section 73.10: Generalized capture
    1-461Section 73.11: Conversion to function pointer
    1-462Section 73.12: Porting lambda functions to C++03 using functors
    1-463Chapter 74: Value Categories
    1-464Section 74.1: Value Category Meanings
    1-465Section 74.2: rvalue
    1-466Section 74.3: xvalue
    1-467Section 74.4: prvalue
    1-468Section 74.5: lvalue
    1-469Section 74.6: glvalue
    1-470Chapter 75: Preprocessor
    1-471Section 75.1: Include Guards
    1-472Section 75.2: Conditional logic and cross-platform handling
    1-473Section 75.3: X-macros
    1-474Section 75.4: Macros
    1-475Section 75.5: Predefined macros
    1-476Section 75.6: Preprocessor Operators
    1-477Section 75.7: #pragma once
    1-478Section 75.8: Preprocessor error messages
    1-479Chapter 76: Data Structures in C++
    1-480Section 76.1: Linked List implementation in C++
    1-481Chapter 77: Templates
    1-482Section 77.1: Basic Class Template
    1-483Section 77.2: Function Templates
    1-484Section 77.3: Variadic template data structures
    1-485Section 77.4: Argument forwarding
    1-486Section 77.5: Partial template specialization
    1-487Section 77.6: Template Specialization
    1-488Section 77.7: Alias template
    1-489Section 77.8: Explicit instantiation
    1-490Section 77.9: Non-type template parameter
    1-491Section 77.10: Declaring non-type template arguments with auto
    1-492Section 77.11: Template template parameters
    1-493Section 77.12: Default template parameter value
    1-494Chapter 78: Expression templates
    1-495Section 78.1: A basic example illustrating expression templates
    1-496Chapter 79: Curiously Recurring Template Pattern (CRTP)
    1-497Section 79.1: The Curiously Recurring Template Pattern (CRTP)
    1-498Section 79.2: CRTP to avoid code duplication
    1-499Chapter 80: Threading
    1-500Section 80.1: Creating a std::thread
    1-501Section 80.2: Passing a reference to a thread
    1-502Section 80.3: Using std::async instead of std::thread
    1-503Section 80.4: Basic Synchronization
    1-504Section 80.5: Create a simple thread pool
    1-505Section 80.6: Ensuring a thread is always joined
    1-506Section 80.7: Operations on the current thread
    1-507Section 80.8: Using Condition Variables
    1-508Section 80.9: Thread operations
    1-509Section 80.10: Thread-local storage
    1-510Section 80.11: Reassigning thread objects
    1-511Chapter 81: Thread synchronization structures
    1-512Section 81.1: std::condition_variable_any, std::cv_status
    1-513Section 81.2: std::shared_lock
    1-514Section 81.3: std::call_once, std::once_flag
    1-515Section 81.4: Object locking for ecient access
    1-516Chapter 82: The Rule of Three, Five, And Zero
    1-517Section 82.1: Rule of Zero
    1-518Section 82.2: Rule of Five
    1-519Section 82.3: Rule of Three
    1-520Section 82.4: Self-assignment Protection
    1-521Chapter 83: RAII: Resource Acquisition Is Initialization
    1-522Section 83.1: Locking
    1-523Section 83.2: ScopeSuccess (c++17)
    1-524Section 83.3: ScopeFail (c++17)
    1-525Section 83.4: Finally/ScopeExit
    1-526Chapter 84: RTTI: Run-Time Type Information
    1-527Section 84.1: dynamic_cast
    1-528Section 84.2: The typeid keyword
    1-529Section 84.3: Name of a type
    1-530Section 84.4: When to use which cast in c++
    1-531Chapter 85: Mutexes
    1-532Section 85.1: Mutex Types
    1-533Section 85.2: std::lock
    1-534Section 85.3: std::unique_lock, std::shared_lock, std::lock_guard
    1-535Section 85.4: Strategies for lock classes: std::try_to_lock, std::adopt_lock, std::defer_lock
    1-536Section 85.5: std::mutex
    1-537Section 85.6: std::scoped_lock (C++ 17)
    1-538Chapter 86: Recursive Mutex
    1-539Section 86.1: std::recursive_mutex
    1-540Chapter 87: Semaphore
    1-541Section 87.1: Semaphore C++ 11
    1-542Section 87.2: Semaphore class in action
    1-543Chapter 88: Futures and Promises
    1-544Section 88.1: Async operation classes
    1-545Section 88.2: std::future and std::promise
    1-546Section 88.3: Deferred async example
    1-547Section 88.4: std::packaged_task and std::future
    1-548Section 88.5: std::future_error and std::future_errc
    1-549Section 88.6: std::future and std::async
    1-550Chapter 89: Atomic Types
    1-551Section 89.1: Multi-threaded Access
    1-552Chapter 90: Type Erasure
    1-553Section 90.1: A move-only `std::function`
    1-554Section 90.2: Erasing down to a Regular type with manual vtable
    1-555Section 90.3: Basic mechanism
    1-556Section 90.4: Erasing down to a contiguous buer of T
    1-557Section 90.5: Type erasing type erasure with std::any
    1-558Chapter 91: Explicit type conversions
    1-559Section 91.1: C-style casting
    1-560Section 91.2: Casting away constness
    1-561Section 91.3: Base to derived conversion
    1-562Section 91.4: Conversion between pointer and integer
    1-563Section 91.5: Conversion by explicit constructor or explicit conversion function
    1-564Section 91.6: Implicit conversion
    1-565Section 91.7: Enum conversions
    1-566Section 91.8: Derived to base conversion for pointers to members
    1-567Section 91.9: void* to T*
    1-568Section 91.10: Type punning conversion
    1-569Chapter 92: Unnamed types
    1-570Section 92.1: Unnamed classes
    1-571Section 92.2: As a type alias
    1-572Section 92.3: Anonymous members
    1-573Section 92.4: Anonymous Union
    1-574Chapter 93: Type Traits
    1-575Section 93.1: Type Properties
    1-576Section 93.2: Standard type traits
    1-577Section 93.3: Type relations with std::is_same<T, T>
    1-578Section 93.4: Fundamental type traits
    1-579Chapter 94: Return Type Covariance
    1-580Section 94.1: Covariant result version of the base example, static type checking
    1-581Section 94.2: Covariant smart pointer result (automated cleanup)
    1-582Chapter 95: Layout of object types
    1-583Section 95.1: Class types
    1-584Section 95.2: Arithmetic types
    1-585Section 95.3: Arrays
    1-586Chapter 96: Type Inference
    1-587Section 96.1: Data Type: Auto
    1-588Section 96.2: Lambda auto
    1-589Section 96.3: Loops and auto
    1-590Chapter 97: Typedef and type aliases
    1-591Section 97.1: Basic typedef syntax
    1-592Section 97.2: More complex uses of typedef
    1-593Section 97.3: Declaring multiple types with typedef
    1-594Section 97.4: Alias declaration with "using"
    1-595Chapter 98: type deduction
    1-596Section 98.1: Template parameter deduction for constructors
    1-597Section 98.2: Auto Type Deduction
    1-598Section 98.3: Template Type Deduction
    1-599Chapter 99: Trailing return type
    1-600Section 99.1: Avoid qualifying a nested type name
    1-601Section 99.2: Lambda expressions
    1-602Chapter 100: Alignment
    1-603Section 100.1: Controlling alignment
    1-604Section 100.2: Querying the alignment of a type
    1-605Chapter 101: Perfect Forwarding
    1-606Section 101.1: Factory functions
    1-607Chapter 102: decltype
    1-608Section 102.1: Basic Example
    1-609Section 102.2: Another example
    1-610Chapter 103: SFINAE (Substitution Failure Is Not An Error)
    1-611Section 103.1: What is SFINAE
    1-612Section 103.2: void_t
    1-613Section 103.3: enable_if
    1-614Section 103.4: is_detected
    1-615Section 103.5: Overload resolution with a large number of options
    1-616Section 103.6: trailing decltype in function templates
    1-617Section 103.7: enable_if_all / enable_if_any
    1-618Chapter 104: Undefined Behavior
    1-619Section 104.1: Reading or writing through a null pointer
    1-620Section 104.2: Using an uninitialized local variable
    1-621Section 104.3: Accessing an out-of-bounds index
    1-622Section 104.4: Deleting a derived object via a pointer to a base class that doesn't have a virtual destructor
    1-623Section 104.5: Extending the `std` or `posix` Namespace
    1-624Section 104.6: Invalid pointer arithmetic
    1-625Section 104.7: No return statement for a function with a non-void return type
    1-626Section 104.8: Accessing a dangling reference
    1-627Section 104.9: Integer division by zero
    1-628Section 104.10: Shifting by an invalid number of positions
    1-629Section 104.11: Incorrect pairing of memory allocation and deallocation
    1-630Section 104.12: Signed Integer Overflow
    1-631Section 104.13: Multiple non-identical definitions (the One Definition Rule)
    1-632Section 104.14: Modifying a const object
    1-633Section 104.15: Returning from a [[noreturn]] function
    1-634Section 104.16: Infinite template recursion
    1-635Section 104.17: Overflow during conversion to or from floating point type
    1-636Section 104.18: Modifying a string literal
    1-637Section 104.19: Accessing an object as the wrong type
    1-638Section 104.20: Invalid derived-to-base conversion for pointers to members
    1-639Section 104.21: Destroying an object that has already been destroyed
    1-640Section 104.22: Access to nonexistent member through pointer to member
    1-641Section 104.23: Invalid base-to-derived static cast
    1-642Section 104.24: Floating point overflow
    1-643Section 104.25: Calling (Pure) Virtual Members From Constructor Or Destructor
    1-644Section 104.26: Function call through mismatched function pointer type
    1-645Chapter 105: Overload resolution
    1-646Section 105.1: Categorization of argument to parameter cost
    1-647Section 105.2: Arithmetic promotions and conversions
    1-648Section 105.3: Overloading on Forwarding Reference
    1-649Section 105.4: Exact match
    1-650Section 105.5: Overloading on constness and volatility
    1-651Section 105.6: Name lookup and access checking
    1-652Section 105.7: Overloading within a class hierarchy
    1-653Section 105.8: Steps of Overload Resolution
    1-654Chapter 106: Move Semantics
    1-655Section 106.1: Move semantics
    1-656Section 106.2: Using std::move to reduce complexity from O(n²) to O(n)
    1-657Section 106.3: Move constructor
    1-658Section 106.4: Re-use a moved object
    1-659Section 106.5: Move assignment
    1-660Section 106.6: Using move semantics on containers
    1-661Chapter 107: Pimpl Idiom
    1-662Section 107.1: Basic Pimpl idiom
    1-663Chapter 108: auto
    1-664Section 108.1: Basic auto sample
    1-665Section 108.2: Generic lambda (C++14)
    1-666Section 108.3: auto and proxy objects
    1-667Section 108.4: auto and Expression Templates
    1-668Section 108.5: auto, const, and references
    1-669Section 108.6: Trailing return type
    1-670Chapter 109: Copy Elision
    1-671Section 109.1: Purpose of copy elision
    1-672Section 109.2: Guaranteed copy elision
    1-673Section 109.3: Parameter elision
    1-674Section 109.4: Return value elision
    1-675Section 109.5: Named return value elision
    1-676Section 109.6: Copy initialization elision
    1-677Chapter 110: Fold Expressions
    1-678Section 110.1: Unary Folds
    1-679Section 110.2: Binary Folds
    1-680Section 110.3: Folding over a comma
    1-681Chapter 111: Unions
    1-682Section 111.1: Undefined Behavior
    1-683Section 111.2: Basic Union Features
    1-684Section 111.3: Typical Use
    1-685Chapter 112: Design pattern implementation in C++
    1-686Section 112.1: Adapter Pattern
    1-687Section 112.2: Observer pattern
    1-688Section 112.3: Factory Pattern
    1-689Section 112.4: Builder Pattern with Fluent API
    1-690Chapter 113: Singleton Design Pattern
    1-691Section 113.1: Lazy Initialization
    1-692Section 113.2: Static deinitialization-safe singleton
    1-693Section 113.3: Thread-safe Singeton
    1-694Section 113.4: Subclasses
    1-695Chapter 114: User-Defined Literals
    1-696Section 114.1: Self-made user-defined literal for binary
    1-697Section 114.2: Standard user-defined literals for duration
    1-698Section 114.3: User-defined literals with long double values
    1-699Section 114.4: Standard user-defined literals for strings
    1-700Section 114.5: Standard user-defined literals for complex
    1-701Chapter 115: Memory management
    1-702Section 115.1: Free Storage (Heap, Dynamic Allocation ...)
    1-703Section 115.2: Placement new
    1-704Section 115.3: Stack
    1-705Chapter 116: C++11 Memory Model
    1-706Section 116.1: Need for Memory Model
    1-707Section 116.2: Fence example
    1-708Chapter 117: Scopes
    1-709Section 117.1: Global variables
    1-710Section 117.2: Simple block scope
    1-711Chapter 118: static_assert
    1-712Section 118.1: static_assert
    1-713Chapter 119: constexpr
    1-714Section 119.1: constexpr variables
    1-715Section 119.2: Static if statement
    1-716Section 119.3: constexpr functions
    1-717Chapter 120: One Definition Rule (ODR)
    1-718Section 120.1: ODR violation via overload resolution
    1-719Section 120.2: Multiply defined function
    1-720Section 120.3: Inline functions
    1-721Chapter 121: Unspecified behavior
    1-722Section 121.1: Value of an out-of-range enum
    1-723Section 121.2: Evaluation order of function arguments
    1-724Section 121.3: Result of some reinterpret_cast conversions
    1-725Section 121.4: Space occupied by a reference
    1-726Section 121.5: Moved-from state of most standard library classes
    1-727Section 121.6: Result of some pointer comparisons
    1-728Section 121.7: Static cast from bogus void* value
    1-729Section 121.8: Order of initialization of globals across TU
    1-730Chapter 122: Argument Dependent Name Lookup
    1-731Section 122.1: What functions are found
    1-732Chapter 123: Attributes
    1-733Section 123.1: [[fallthrough]]
    1-734Section 123.2: [[nodiscard]]
    1-735Section 123.3: [[deprecated]] and [[deprecated("reason")]]
    1-736Section 123.4: [[maybe_unused]]
    1-737Section 123.5: [[noreturn]]
    1-738Chapter 124: Recursion in C++
    1-739Section 124.1: Using tail recursion and Fibonnaci-style recursion to solve the Fibonnaci sequence
    1-740Section 124.2: Recursion with memoization
    1-741Chapter 125: Arithmitic Metaprogramming
    1-742Section 125.1: Calculating power in O(log n)
    1-743Chapter 126: Callable Objects
    1-744Section 126.1: Function Pointers
    1-745Section 126.2: Classes with operator() (Functors)
    1-746Chapter 127: Client server examples
    1-747Section 127.1: Hello TCP Client
    1-748Section 127.2: Hello TCP Server
    1-749Chapter 128: Const Correctness
    1-750Section 128.1: The Basics
    1-751Section 128.2: Const Correct Class Design
    1-752Section 128.3: Const Correct Function Parameters
    1-753Section 128.4: Const Correctness as Documentation
    1-754Chapter 129: Parameter packs
    1-755Section 129.1: A template with a parameter pack
    1-756Section 129.2: Expansion of a parameter pack
    1-757Chapter 130: Build Systems
    1-758Section 130.1: Generating Build Environment with CMake
    1-759Section 130.2: Compiling with GNU make
    1-760Section 130.3: Building with SCons
    1-761Section 130.4: Autotools (GNU)
    1-762Section 130.5: Ninja
    1-763Section 130.6: NMAKE (Microsoft Program Maintenance Utility)
    1-764Chapter 131: Concurrency With OpenMP
    1-765Section 131.1: OpenMP: Parallel Sections
    1-766Section 131.2: OpenMP: Parallel Sections
    1-767Section 131.3: OpenMP: Parallel For Loop
    1-768Section 131.4: OpenMP: Parallel Gathering / Reduction
    1-769Chapter 132: Resource Management
    1-770Section 132.1: Resource Acquisition Is Initialization
    1-771Section 132.2: Mutexes & Thread Safety
    1-772Chapter 133: Storage class specifiers
    1-773Section 133.1: extern
    1-774Section 133.2: register
    1-775Section 133.3: static
    1-776Section 133.4: auto
    1-777Section 133.5: mutable
    1-778Chapter 134: Linkage specifications
    1-779Section 134.1: Signal handler for Unix-like operating system
    1-780Section 134.2: Making a C library header compatible with C++
    1-781Chapter 135: Digit separators
    1-782Section 135.1: Digit Separator
    1-783Chapter 136: C incompatibilities
    1-784Section 136.1: Reserved Keywords
    1-785Section 136.2: Weakly typed pointers
    1-786Section 136.3: goto or switch
    1-787Chapter 137: Side by Side Comparisons of classic C++ examples solved via C++ vs C++11 vs C++14 vs C++17
    1-788Section 137.1: Looping through a container
    1-789Chapter 138: Compiling and Building
    1-790Section 138.1: Compiling with GCC
    1-791Section 138.2: Compiling with Visual Studio (Graphical Interface) - Hello World
    1-792Section 138.3: Online Compilers
    1-793Section 138.4: Compiling with Visual C++ (Command Line)
    1-794Section 138.5: Compiling with Clang
    1-795Section 138.6: The C++ compilation process
    1-796Section 138.7: Compiling with Code::Blocks (Graphical interface)
    1-797Chapter 139: Common compile/linker errors (GCC)
    1-798Section 139.1: undefined reference to `***'
    1-799Section 139.2: error: '***' was not declared in this scope
    1-800Section 139.3: fatal error: ***: No such file or directory
    1-801Chapter 140: More undefined behaviors in C++
    1-802Section 140.1: Referring to non-static members in initializer lists
    1-803Chapter 141: Unit Testing in C++
    1-804Section 141.1: Google Test
    1-805Section 141.2: Catch
    1-806Chapter 142: C++ Debugging and Debug-prevention Tools & Techniques
    1-807Section 142.1: Static analysis
    1-808Section 142.2: Segfault analysis with GDB
    1-809Section 142.3: Clean code
    1-810Chapter 143: Optimization in C++
    1-811Section 143.1: Introduction to performance
    1-812Section 143.2: Empty Base Class Optimization
    1-813Section 143.3: Optimizing by executing less code
    1-814Section 143.4: Using ecient containers
    1-815Section 143.5: Small Object Optimization
    1-816Chapter 144: Optimization
    1-817Section 144.1: Inline Expansion/Inlining
    1-818Section 144.2: Empty base optimization
    1-819Chapter 145: Profiling
    1-820Section 145.1: Profiling with gcc and gprof
    1-821Section 145.2: Generating callgraph diagrams with gperf2dot
    1-822Section 145.3: Profiling CPU Usage with gcc and Google Perf Tools
    1-823Chapter 146: Refactoring Techniques
    1-824Section 146.1: Goto Cleanup
    1-825Credits
    1-826You may also like

    FAQ

    您可以透過手機、平板或是電腦登入 HiSKIO 平台,在【我的學習】>【我的書籍】頁面,選擇想看的電子書。

    Recommendations

    Reviews

    | Collecting

    Sales Plans