
C++ Recipes
Description
Alles über E-Books | Antworten auf Fragen rund um E-Books, Kopierschutz und Dateiformate finden Sie in unserem Info- & Hilfebereich.
C++ Recipes: A Problem-Solution Approach is a handy code cookbook reference guide that cover the latest C++ 14 as well as some of the code templates available in the latest Standard Template Library (STL).
In this handy reference, you'll find numbers, strings, dates, times, classes, exceptions, streams, flows, pointers and more. Also, you'll see various code samples, templates for C++ algorithms, parallel processing, multithreading and numerical processes. These have many applications including game development, big data analytics, financial engineering and analysis, enterprise applications and more. A wealth of STL templates on function objects, adapters, allocators, and extensions are also available.
This is a "must have", contemporary reference for your technical library.
More details
Other editions
Additional editions

Person
Content
- Intro
- Contents at a Glance
- Contents
- About the Author
- About the Technical Reviewers
- Acknowledgments
- Introduction
- Chapter 1: Beginning C++
- Recipe 1-1. Finding a Text Editor
- Problem
- Solution
- Recipe 1-2. Installing Clang on Ubuntu
- Problem
- Solution
- How It Works
- Recipe 1-3. Installing Clang on Windows
- Problem
- Solution
- How It Works
- Recipe 1-4. Installing Clang on OS X
- Problem
- Solution
- How It Works
- Recipe 1-5. Building Your First C++ Program
- Problem
- Solution
- Recipe 1-6. Debugging C++ programs using GDB in Cygwin or Linux
- Problem
- Solution
- How It Works
- Recipe 1-7. Debugging Your C++ Programs on OS X
- Problem
- Solution
- How It Works
- Recipe 1-8. Switching C++ Compilation Modes
- Problem
- Solution
- How It Works
- Recipe 1-9. Building with the Boost Library
- Problem
- Solution
- How It Works
- Chapter 2: Modern C++
- Recipe 2-1. Initializing Variables
- Problem
- Solution
- How It Works
- Recipe 2-2. Initializing Objects with Initializer Lists
- Problem
- Solution
- How It Works
- Recipe 2-3. Using Type Deduction
- Problem
- Solution
- How It Works
- Recipe 2-4. Using auto with Functions
- Problem
- Solution
- How It Works
- Recipe 2-5. Working with Compile Time Constants
- Problem
- Solution
- How It Works
- Recipe 2-6. Working with Lambdas
- Problem
- Solution
- How It Works
- Recipe 2-7. Working with Time
- Problem
- Solution
- How It Works
- Getting the Current Date and Time
- Comparing Times
- Recipe 2-8. Understanding lvalue and rvalue References
- Problem
- Solution
- How It Works
- Recipe 2-9. Using Managed Pointers
- Problem
- Solution
- How It Works
- Using unique_ptr
- Using shared_ptr Instances
- Using a weak_ptr
- Chapter 3: Working with Text
- Recipe 3-1. Representing Strings in Code Using Literals
- Problem
- Solution
- How It Works
- Recipe 3-2. Localizing User Facing Text
- Problem
- Solution
- How It Works
- Recipe 3-3. Reading Strings from a File
- Problem
- Solution
- How It Works
- Recipe 3-4. Reading the Data from an XML File
- Problem
- Solution
- How It Works
- Recipe 3-5. Inserting Runtime Data into Strings
- Problem
- Solution
- How It Works
- Chapter 4: Working with Numbers
- Recipe 4-1. Using the Integer Types in C++
- Problem
- Solution
- How It Works
- Working with the int Type
- Working with Different Types of Integers
- Working with Unsigned Integers
- Recipe 4-2. Making Decisions with Relational Operators
- Problem
- Solution
- How It Works
- The Equality Operator
- The Inequality Operator
- The Greater-than Operator
- The Less-than Operator
- Recipe 4-3. Chaining Decisions with Logical Operators
- Problem
- Solution
- How It Works
- The && Operator
- The Logical || Operator
- Recipe 4-4. Using Hexadecimal Values
- Problem
- Solution
- How It Works
- Recipe 4-5. Bit Twiddling with Binary Operators
- Problem
- Solution
- How It Works
- The & (Bitwise And) Operator
- The | (Bitwise Or) Operator
- The ^ (Exclusive Or) Operator
- The && and && Operators
- Chapter 5: Classes
- Recipe 5-1. Defining a Class
- Problem
- Solution
- How It Works
- Recipe 5-2. Adding Data to a Class
- Problem
- Solution
- How It Works
- Recipe 5-3. Adding Methods
- Problem
- Solution
- How It Works
- Recipe 5-4. Using Access Modifiers
- Problem
- Solution
- How It Works
- Recipe 5-5. Initializing Class Member Variables
- Problem
- Solution
- How It Works
- Uniform Initialization
- Using Constructors
- Recipe 5-6. Cleaning Up Classes
- Problem
- Solution
- How It Works
- Recipe 5-7. Copying Classes
- Problem
- Solution
- How It Works
- Implicit and Default Copy Constructors and Assignment Operators
- Explicit Copy Constructors and Assignment Operators
- Disallowing Copy and Assignment
- Custom Copy Constructors and Assignment Operators
- Recipe 5-8. Optimizing Code with Move Semantics
- Problem
- Solution
- How It Works
- Chapter 6: Inheritance
- Recipe 6-1. Inheriting from a Class
- Problem
- Solution
- How It Works
- Recipe 6-2. Controlling Access to Member Variables and Methods in Derived Classes
- Problem
- Solution
- How It Works
- The public Access Specifier
- The private Access Specifier
- The protected Access Specifier
- Recipe 6-3. Hiding Methods in Derived Classes
- Problem
- Solution
- How It Works
- Recipe 6-4. Using Polymorphic Base Classes
- Problem
- Solution
- How It Works
- Recipe 6-5. Preventing Method Overrides
- Problem
- Solution
- How It Works
- Recipe 6-6. Creating Interfaces
- Problem
- Solution
- How It Works
- Recipe 6-7. Multiple Inheritance
- Problem
- Solution
- How It Works
- Chapter 7: The STL Containers
- Recipe 7-1. Storing a Fixed Number of Objects
- Problem
- Solution
- How It Works
- Recipe 7-2. Storing a Growing Number of Objects
- Problem
- Solution
- How It Works
- Recipe 7-3. Storing a Set of Elements that Is Constantly Altered
- Problem
- Solution
- How It Works
- Recipe 7-4. Storing Sorted Objects in a Container that Enables Fast Lookups
- Problem
- Solution
- How It Works
- Recipe 7-5. Storing Unsorted Elements in a Container for Very Fast Lookups
- Problem
- Solution
- How It Works
- Chapter 8: The STL Algorithms
- Recipe 8-1. Using an iterator to Define a Sequence within a Container
- Problem
- Solution
- How It Works
- Recipe 8-2. Calling a Function on Every Element in a Container
- Problem
- Solution
- How It Works
- Recipe 8-3. Finding the Maximum and Minimum Values in a Container
- Problem
- Solution
- How It Works
- Finding the Minimum Value in a Container
- Finding the Maximum Values in a Container
- Recipe 8-4. Counting Instances of a Value in a Sequence
- Problem
- Solution
- How It Works
- Recipe 8-5. Finding Values in a Sequence
- Problem
- Solution
- How It Works
- Recipe 8-6. Sorting Elements in a Sequence
- Problem
- Solution
- How It Works
- Chapter 9: Templates
- 9-1. Creating a Template Function
- Problem
- Solution
- How It Works
- Creating a Template Function
- Explicit vs. Implicit Template Specialization
- 9-2. Partially Specializing a Template
- Problem
- Solution
- How It Works
- 9-3. Creating Class Templates
- Problem
- Solution
- How It Works
- 9-4. Creating Singletons
- Problem
- Solution
- How It Works
- 9-5. Calculating Values at Compile Time
- Problem
- Solution
- How It Works
- Chapter 10: Memory
- 10-1. Using Static Memory
- Problem
- Solution
- How It Works
- 10-2. Using Stack Memory
- Problem
- Solution
- How It Works
- 10-3. Using Heap Memory
- Problem
- Solution
- How It Works
- 10-4. Using Automated Shared Memory
- Problem
- Solution
- How It Works
- 10-5. Creating Single-Instance Dynamic Objects
- Problem
- Solution
- How It Works
- 10-6. Creating Smart Pointers
- Problem
- Solution
- How It Works
- 10-7. Debugging Memory Problems by Overloading new and delete
- Problem
- Solution
- How It Works
- 10-8. Calculating Performance Impacts of Code Changes
- Problem
- Solution
- How It Works
- 10-9. Understanding the Performance Impacts of Memory Choices
- Problem
- Solution
- How It Works
- 10-10. Reducing Memory Fragmentation
- Problem
- Solution
- How It Works
- Chapter 11: Concurrency
- 11-1. Using Threads to Execute Concurrent Tasks
- Problem
- Solution
- How It Works
- Detecting the Number of Logical CPU Cores
- Creating Threads
- Cleaning Up After Threads
- 11-2. Creating thread Scope Variables
- Problem
- Solution
- How It Works
- 11-3. Accessing Shared Objects Using Mutual Exclusion
- Problem
- Solution
- How It Works
- 11-4. Creating Threads that Wait for Events
- Problem
- Solution
- How It Works
- 11-5. Retrieving Results from a Thread
- Problem
- Solution
- How It Works
- Using the promise and future Classes
- 11-6. Synchronizing Queued Messages between Threads
- Problem
- Solution
- How It Works
- Chapter 12: Networking
- 12-1. Setting Up a Berkeley Sockets Application on OS X
- Problem
- Solution
- How It Works
- 12-2. Setting Up a Berkeley Sockets Application in Eclipse on Ubuntu
- Problem
- Solution
- How It Works
- 12-3. Setting Up a Winsock 2 Application in Visual Studio on Windows
- Problem
- Solution
- How It Works
- 12-4. Creating a Socket Connection between Two Programs
- Problem
- Solution
- How It Works
- 12-5. Creating a Networking Protocol between Two Programs
- Problem
- Solution
- How It Works
- Chapter 13: Scripting
- 13-1. Creating a Lua Library Project in Visual Studio
- Problem
- Solution
- How It Works
- 13-2. Creating a Lua Library Project in Eclipse
- Problem
- Solution
- How It Works
- 13-3. Creating a Lua Project in Xcode
- Problem
- Solution
- How It Works
- 13-4. Using the Lua Programming Language
- Problem
- Solution
- How It Works
- Working with Variables
- Working with Functions
- Working with Tables
- Using Flow Control
- 13-5. Calling Lua Functions from C++
- Problem
- Solution
- How It Works
- 13-6. Calling C Functions from Lua
- Problem
- Solution
- How It Works
- 13-7. Creating Asynchronous Lua Functions
- Problem
- Solution
- How It Works
- Chapter 14: 3D Graphics Programming
- 14-1. An Introduction to GLFW
- Problem
- Solution
- How It Works
- 14-2. Rendering a Triangle
- Problem
- Solution
- How It Works
- 14-3. Creating a Textured Quad
- Problem
- Solution
- How It Works
- 14-4. Loading Geometry from a File
- Problem
- Solution
- How It Works
- Index
System requirements
File format: PDF
Copy protection: Watermark-DRM (Digital Rights Management)
System requirements:
- Computer (Windows; MacOS X; Linux): Use the free software Adobe Reader, Adobe Digital Editions, or any other PDF viewer of your choice (see eBook Help).
- Tablet/Smartphone (Android; iOS): Install the free app Adobe Digital Editions or another reading app for eBooks, e.g., PocketBook (see eBook Help).
- E-reader: Bookeen, Kobo, Pocketbook, Sony, Tolino and many more (only limited: Kindle).
The file format PDF always displays a book page identically on any hardware. This makes PDF suitable for complex layouts such as those used in textbooks and reference books (images, tables, columns, footnotes). Unfortunately, on the small screens of e-readers or smartphones, PDFs are rather annoying, requiring too much scrolling.
This eBook uses Watermark-DRM, a „soft” copy protection. This means that there are no technical restrictions to prevent illegal distribution. However, there is a personalised watermark embedded in the eBook that can be used to identify the purchaser of the eBook in the event of misuse and to provide evidence for legal purposes.
For more information, see our eBook Help page.