did-you-know? rent-now

Amazon no longer offers textbook rentals. We do!

did-you-know? rent-now

Amazon no longer offers textbook rentals. We do!

We're the #1 textbook rental company. Let us show you why.

9780596007614

C++ Cookbook

by
  • ISBN13:

    9780596007614

  • ISBN10:

    0596007612

  • Format: Paperback
  • Copyright: 2005-11-01
  • Publisher: Oreilly & Associates Inc
  • Purchase Benefits
  • Free Shipping Icon Free Shipping On Orders Over $35!
    Your order must be $35 or more to qualify for free economy shipping. Bulk sales, PO's, Marketplace items, eBooks and apparel do not qualify for this offer.
  • eCampus.com Logo Get Rewarded for Ordering Your Textbooks! Enroll Now
List Price: $49.99 Save up to $5.00
  • Buy New
    $48.49
    Add to Cart Free Shipping Icon Free Shipping

    USUALLY SHIPS IN 2-3 BUSINESS DAYS

Supplemental Materials

What is included with this book?

Summary

Despite its highly adaptable and flexible nature, C++ is also one of the more complex programming languages to learn. Once mastered, however, it can help you organise and process information with amazing efficiency and quickness. The C++ Cookbook will make your path to mastery much shorter. This practical, problem-solving guide is ideal if you're an engineer, programmer, or researcher writing an application for one of the legions of platforms on which C++ runs. The algorithms provided in C++ Cookbook will jump-start your development by giving you some basic building blocks that you don't have to develop on your own. This book will move quickly to the top of your list of essential C++ references.

Author Biography

Ryan Stephens is a software engineer, writer, and student living in Tempe, AZ. He enjoys programming in virtually any language, especially C++. His interests include the fields of information retrieval and data mining, and pretty much anything that has to do with algorithms and large data sets. When he's not working, writing, or programming, he plays with his kids, works on his house, or goes cycling.

Christopher Diggins is a freelance software developer and writer who has been programming computers since he was "haut comme trois pommes". Christopher writes regularly for the C++ Users Journal, and is the designer of the Heron programming lanugage.

Jonathan Turkanis is the author of the Boost Iostreams library and several other open source C++ libraries covering areas including smart pointers, runtime reflection, component architectures and aspect-oriented programming. He is a Ph.D. candidate in mathematical logic at the University of California at Berkeley.

Jeff Cogswell has been programming in several languages for many years. His background was previously in telecom, writing software for such strange things as network management protocols. Lately, however, his work has focused more on web development. After spending a few years in both Florida and California, Jeff now lives in Michigan. He's holding out for some warmer weather.

Table of Contents

Preface xi
Building C++ Applications
1(104)
Obtaining and Installing GCC
15(3)
Building a Simple ``Hello, World'' Application from the Command Line
18(5)
Building a Static Library from the Command Line
23(2)
Building a Dynamic Library from the Command Line
25(8)
Building a Complex Application from the Command Line
33(5)
Installing Boost.Build
38(2)
Building a Simple ``Hello, World'' Application Using Boost.Build
40(4)
Building a Static Library Using Boost.Build
44(1)
Building a Dynamic Library Using Boost.Build
45(1)
Building a Complex Application Using Boost.Build
46(4)
Building a Static Library with an IDE
50(3)
Building a Dynamic Library with an IDE
53(4)
Building a Complex Application with an IDE
57(5)
Obtaining GNU make
62(2)
Building A Simple ``Hello, World'' Application with GNU make
64(8)
Building a Static Library with GNU Make
72(5)
Building a Dynamic Library with GNU Make
77(1)
Building a Complex Application with GNU make
78(4)
Defining a Macro
82(2)
Specifying a Command-Line Option from Your IDE
84(1)
Producing a Debug Build
85(4)
Producing a Release Build
89(3)
Specifying a Runtime Library Variant
92(3)
Enforcing Strict Conformance to the C++ Standard
95(4)
Causing a Source File to Be Linked Automatically Against a Specified Library
99(2)
Using Exported Templates
101(4)
Code Organization
105(15)
Making Sure a Header File Gets Included Only Once
107(1)
Ensuring You Have Only One Instance of a Variable Across Multiple Source Files
108(2)
Reducing #includes with Forward Class Declarations
110(1)
Preventing Name Collisions with Namespaces
111(7)
Including an Inline File
118(2)
Numbers
120(19)
Converting a String to a Numeric Type
120(3)
Converting Numbers to Strings
123(3)
Testing Whether a String Contains a Valid Number
126(3)
Comparing Floating-Point Numbers with Bounded Accuracy
129(2)
Parsing a String Containing a Number in Scientific Notation
131(2)
Converting Between Numeric Types
133(3)
Getting the Minimum and Maximum Values for a Numeric Type
136(3)
Strings and Text
139(59)
Padding a String
140(2)
Trimming a String
142(5)
Storing Strings in a Sequence
147(4)
Getting the Length of a String
151(2)
Reversing a String
153(1)
Splitting a String
154(3)
Tokenizing a String
157(2)
Joining a Sequence of Strings
159(3)
Finding Things in Strings
162(3)
Finding the nth Instance of a Substring
165(2)
Removing a Substring from a String
167(1)
Converting a String to Lower- or Uppercase
168(3)
Doing a Case-Insensitive String Comparison
171(2)
Doing a Case-Insensitive String Search
173(2)
Converting Between Tabs and Spaces in a Text File
175(3)
Wrapping Lines in a Text File
178(2)
Counting the Number of Characters, Words, and Lines in a Text File
180(3)
Counting Instances of Each Word in a Text File
183(2)
Add Margins to a Text File
185(3)
Justify a Text File
188(2)
Squeeze Whitespace to Single Spaces in a Text File
190(1)
Autocorrect Text as a Buffer Changes
191(3)
Reading a Comma-Separated Text File
194(2)
Using Regular Expressions to Split a String
196(2)
Dates and Times
198(15)
Obtaining the Current Date and Time
198(3)
Formatting a Date/Time as a String
201(3)
Performing Date and Time Arithmetic
204(1)
Converting Between Time Zones
205(2)
Determining a Day's Number Within a Given Year
207(1)
Defining Constrained Value Types
208(5)
Managing Data with Containers
213(35)
Using vectors Instead of Arrays
214(4)
Using vectors Efficiently
218(4)
Copying a vector
222(2)
Storing Pointers in a vector
224(2)
Storing Objects in a list
226(5)
Mapping strings to Other Things
231(6)
Using Hashed Containers
237(5)
Storing Objects in Sorted Order
242(3)
Storing Containers in Containers
245(3)
Algorithms
248(37)
Iterating Through a Container
249(7)
Removing Objects from a Container
256(3)
Randomly Shuffling Data
259(1)
Comparing Ranges
260(4)
Merging Data
264(4)
Sorting a Range
268(3)
Partitioning a Range
271(1)
Performing Set Operations on Sequences
272(4)
Transforming Elements in a Sequence
276(2)
Writing Your Own Algorithm
278(3)
Printing a Range to a Stream
281(4)
Classes
285(45)
Initializing Class Member Variables
286(3)
Using a Function to Create Objects (a.k.a. Factory Pattern)
289(2)
Using Constructors and Destructors to Manage Resources (for RAII)
291(3)
Automatically Adding New Class Instances to a Container
294(2)
Ensuring a Single Copy of a Member Variable
296(1)
Determining an Object's Type at Runtime
297(2)
Determining if One Object's Class Is a Subclass of Another
299(2)
Giving Each Instance of a Class a Unique Identifier
301(2)
Creating a Singleton Class
303(3)
Creating an Interface with an Abstract Base Class
306(4)
Writing a Class Template
310(5)
Writing a Member Function Template
315(3)
Overloading the Increment and Decrement Operators
318(2)
Overloading Arithmetic and Assignment Operators for Intuitive Class Behavior
320(8)
Calling a Superclass Virtual Function
328(2)
Exceptions and Safety
330(21)
Creating an Exception Class
330(5)
Making a Constructor Exception-Safe
335(3)
Making an Initializer List Exception-Safe
338(3)
Making Member Functions Exception-Safe
341(5)
Safely Copying an Object
346(5)
Streams and Files
351(43)
Lining Up Text Output
352(4)
Formatting Floating-Point Output
356(3)
Writing Your Own Stream Manipulators
359(4)
Making a Class Writable to a Stream
363(3)
Making a Class Readable from a Stream
366(2)
Getting Information About a File
368(2)
Copying a File
370(4)
Deleting or Renaming a File
374(2)
Creating a Temporary Filename and File
376(2)
Creating a Directory
378(2)
Removing a Directory
380(3)
Reading the Contents of a Directory
383(2)
Extracting a File Extension from a String
385(1)
Extracting a Filename from a Full Path
386(2)
Extracting a Path from a Full Path and Filename
388(1)
Replacing a File Extension
389(1)
Combining Two Paths into a Single Path
390(4)
Science and Mathematics
394(52)
Computing the Number of Elements in a Container
395(1)
Finding the Greatest or Least Value in a Container
396(3)
Computing the Sum and Mean of Elements in a Container
399(3)
Filtering Values Outside a Given Range
402(1)
Computing Variance, Standard Deviation, and Other Statistical Functions
403(4)
Generating Random Numbers
407(2)
Initializing a Container with Random Numbers
409(1)
Representing a Dynamically Sized Numerical Vector
410(2)
Representing a Fixed-Size Numerical Vector
412(3)
Computing a Dot Product
415(1)
Computing the Norm of a Vector
416(1)
Computing the Distance Between Two Vectors
417(2)
Implementing a Stride Iterator
419(4)
Implementing a Dynamically Sized Matrix
423(3)
Implementing a Constant-Sized Matrix
426(3)
Multiplying Matricies
429(2)
Computing the Fast Fourier Transform
431(2)
Working with Polar Coordinates
433(2)
Performing Arithmetic on Bitsets
435(4)
Representing Large Fixed-Width Integers
439(4)
Implementing Fixed-Point Numbers
443(3)
Multithreading
446(20)
Creating a Thread
447(3)
Making a Resource Thread-Safe
450(8)
Notifying One Thread from Another
458(4)
Initializing Shared Resources Once
462(1)
Passing an Argument to a Thread Function
463(3)
Internationalization
466(18)
Hardcoding a Unicode String
467(1)
Writing and Reading Numbers
468(4)
Writing and Reading Dates and Times
472(5)
Writing and Reading Currency
477(4)
Sorting Localized Strings
481(3)
XML
484(55)
Parsing a Simple XML Document
485(9)
Working with Xerces Strings
494(2)
Parsing a Complex XML Document
496(12)
Manipulating an XML Document
508(4)
Validating an XML Document with a DTD
512(5)
Validating an XML Document with a Schema
517(3)
Transforming an XML Document with XSLT
520(7)
Evaluating an XPath Expression
527(6)
Using XML to Save and Restore a Collection of Objects
533(6)
Miscellaneous
539(16)
Using Function Pointers for Callbacks
539(2)
Using Pointers to Class Members
541(3)
Ensuring That a Function Doesn't Modify an Argument
544(2)
Ensuring That a Member Function Doesn't Modify Its Object
546(2)
Writing an Operator That Isn't a Member Function
548(2)
Initializing a Sequence with Comma-Separated Values
550(5)
Index 555

Supplemental Materials

What is included with this book?

The New copy of this book will include any supplemental materials advertised. Please check the title of the book to determine if it should include any access cards, study guides, lab manuals, CDs, etc.

The Used, Rental and eBook copies of this book are not guaranteed to include any supplemental materials. Typically, only the book itself is included. This is true even if the title states it includes any access cards, study guides, lab manuals, CDs, etc.

Rewards Program