Skip to content

C++ Cookbook

Spend $50 to get a free DVD!

ISBN-10: 0596007612

ISBN-13: 9780596007614

Edition: 2005

Authors: Christopher Diggins, Jonathan Turkanis, Jeff Cogswell, D. Ryan Stephens, Jonathan Turkanis

List price: $49.99
Shipping box This item qualifies for FREE shipping.
Blue ribbon 30 day, 100% satisfaction guarantee!
what's this?
Rush Rewards U
Members Receive:
Carrot Coin icon
XP icon
You have reached 400 XP and carrot coins. That is the daily max!

Do you like reinventing the wheel? If so, you can put this book back on the shelf and pretend that you never saw it. But if you're a C++ programmer who likes to get work done, and prefers to spend time solving fresh, new problems, then hold on to this book and make a beeline for the checkout counter, because the C++ Cookbook is a treasure trove of solutions to everyday C++ programming problems. C++ experts D. Ryan Stephens, Christopher Diggins, Jonathan Turkanis, and Jeff Cogswell have collected a wide variety of C++ solutions for your benefit. Topic areas covered in this book include: * Working with numbers * Dates and times * Stream-based input/output * Exception handling * Working with…    
Customers also bought

Book details

List price: $49.99
Copyright year: 2005
Publisher: O'Reilly Media, Incorporated
Publication date: 11/18/2005
Binding: Paperback
Pages: 594
Size: 7.00" wide x 9.25" long x 1.25" tall
Weight: 1.782
Language: English

Preface
Building C++ Applications
Obtaining and Installing GCC
Building a Simple "Hello, World" Application from the Command Line
Building a Static Library from the Command Line
Building a Dynamic Library from the Command Line
Building a Complex Application from the Command Line
Installing Boost.Build
Building a Simpel "Hello, World" Application Using Boost.Build
Building a Static Library Using Boost.Build
Building a Dynamic Library Using Boost.Build
Building a Complex Application Using Boost.Build
Building a Static Library with an IDE
Building a Dynamic Library with an IDE
Building a Complex Application with an IDE
Obtaining GNU make
Building A Simple "Hello, World" Application with GNU make
Building a Static Library with GNU Make
Building a Dynamic Library with GNU Make
Building a Complex Application with GNU make
Defining a Macro
Specifying a Command-Line Option from Your IDE
Producing a Debug Build
Producing a Release Build
Specifying a Runtime Library Variant
Enforcing Strict Conformance to the C++ Standard
Causing a Source File to Be Linked Automatically Against a Specified Library
Using Exported Templates
Code Organization
Making Sure a Header File Gets Included Only Once
Ensuring You Have Only One Instance of a Variable Across Multiple Source Files
Reducing #includes with Forward Class Declarations
Preventing Name Collisions with Namespaces
Including an Inline File
Numbers
Converting a String to a Numeric Type
Converting Numbers to Strings
Testing Whether a String Contains a Valid Number
Comparing Floating-Point Numbers with Bounded Accuracy
Parsing a String Containing a Number in Scientific Notation
Converting Between Numeric Types
Getting the Minimum and Maximum Values for a Numeric Type
Strings and Text
Padding a String
Trimming a String
Storing Strings in a Sequence
Getting the Length of a String
Reversing a String
Splitting a String
Tokenizing a String
Joining a Sequence of Strings
Finding Things in Strings
Finding the nth Instance of a Substring
Removing a Substring from a String
Converting a String to Lower- or Uppercase
Doing a Case-Insensitive String Comparison
Doing a Case-Insensitive String Search
Converting Between Tabs and Spaces in a Text File
Wrapping Lines in a Text File
Counting the Number of Characters, Words, and Lines in a Text File
Counting Instances of Each Word in a Text File
Add Margins to a Text File
Justify a Text File
Squeeze Whitespace to Single Spaces in a Text File
Autocorrect Text as a Buffer Changes
Reading a Comma-Separated Text File
Using Regular Expressions to Split a String
Dates and Times
Obtaining the Current Date and Time
Formatting a Date/Time as a String
Performing Date and Time Arithmetic
Converting Between Time Zones
Determining a Day's Number Within a Given Year
Defining Constrained Value Types
Managing Data with Containers
Using vectors Instead of Arrays
Using vectors Efficiently
Copying a vector
Storing Pointers in a vector
Storing Objects in a list
Mapping strings to Other Things
Using Hashed Containers
Storing Objects in Sorted Order
Storing Containers in Containers
Algorithms
Iterating Through a Container
Removing Objects from a Container
Randomly Shuffling Data
Comparing Ranges
Merging Data
Sorting a Range
Partitioning a Range
Performing Set Operations on Sequences
Transforming Elements in a Sequence
Writing Your Own Algorithm
Printing a Range to a Stream
Classes
Initializing Class Member Variables
Using a Function to Create Objects (a.k.a. Factory Pattern)
Using Constructors and Destructors to Manage Resources (or RAII)
Automatically Adding New Class Instances to a Container
Ensuring a Single Copy of a Member Variable
Determining an Object's Type at Runtime
Determining if One Object's Class Is a Subclass of Another
Giving Each Instance of a Class a Unique Identifier
Creating a Singleton Class
Creating an Interface with an Abstract Base Class
Writing a Class Template
Writing a Member Function Template
Overloading the Increment and Decrement Operators
Overloading Arithmetic and Assignment Operators for Intuitive Class Behavior
Calling a Superclass Virtual Function
Exceptions and Safety
Creating an Exception Class
Making a Constructor Exception-Safe
Making an Initializer List Exception-Safe
Making Member Functions Exception-Safe
Safely Copying an Object
Streams and Files
Lining Up Text Output
Formatting Floating-Point Output
Writing Your Own Stream Manipulators
Making a Class Writable to a Stream
Making a Class Readable from a Stream
Getting Information About a File
Copying a File
Deleting or Renaming a File
Creating a Temporary Filename and File
Creating a Directory
Removing a Directory
Reading the Contents of a Directory
Extracting a File Extension from a String
Extracting a Filename from a Full Path
Extracting a Path from a Full Path and Filename
Replacing a File Extension
Combining Two Paths into a Single Path
Science and Mathematics
Computing the Number of Elements in a Container
Finding the Greatest or Least Value in a Container
Computing the Sum and Mean of Elements in a Container
Filtering Values Outside a Given Range
Computing Variance, Standard Deviation, and Other Statistical Functions
Generating Random Numbers
Initializing a Container with Random Numbers
Representing a Dynamically Sized Numerical Vector
Representing a Fixed-Size Numerical Vector
Computing a Dot Product
Computing the Norm of a Vector
Computing the Distance Between Two Vectors
Implementing a Stride Iterator
Implementing a Dynamically Sized Matrix
Implementing a Constant-Sized Matrix
Multiplying Matricies
Computing the Fast Fourier Transform
Working with Polar Coordinates
Performing Arithmetic on Bitsets
Representing Large Fixed-Width Integers
Implementing Fixed-Point Numbers
Multithreading
Creating a Thread
Making a Resource Thread-Safe
Notifying One Thread from Another
Initializing Shared Resources Once
Passing an Argument to a Thread Function
Internationalization
Hardcoding a Unicode String
Writing and Reading Numbers
Writing and Reading Dates and Times
Writing and Reading Currency
Sorting Localized Strings
XML
Parsing a Simple XML Document
Working with Xerces Strings
Parsing a Complex XML Document
Manipulating an XML Document
Validating an XML Document with a DTD
Validating an XML Document with a Schema
Transforming an XML Document with XSLT
Evaluating an XPath Expression
Using XML to Save and Restore a Collection of Objects
Miscellaneous
Using Function Pointers for Callbacks
Using Pointers to Class Members
Ensuring That a Function Doesn't Modify an Argument
Ensuring That a Member Function Doesn't Modify Its Object
Writing an Operator That Isn't a Member Function
Initializing a Sequence with Comma-Separated Values
Index