DOC HOME
SITE MAP
MAN PAGES
GNU INFO
SEARCH
PRINT BOOK
Using the C++ Standard Components
Preface
Benefits
Description
Documentation
The Standard Components Product
Product History
Getting Started
C++ Standard Components
Relationship to the C++ Standard Library
We provide general-purpose components
You provide application-specific components
How we decided what components to provide
Who uses C++ Standard Components?
A true story
The String component
Abstraction and simplification
Array manipulation
Array reallocation errors
Algorithmic array errors
Bit manipulation
Component: a precise definition
Component names and component documentation
Compiling and Linking with C++ Standard Components
Thread Safety
Where Are Some Other Components?
Naming Conventions
Classification of components
Simple types
Low-level types
Container types
Treatment of errors
Client errors
Internal errors
A bigger example
Description of the problem
Start by assembling the obvious components
Reading the appointments
Choosing a representation for the Calendar
Choosing a representation for a day's appointments
Implementing the queries
Making the program robust and user-friendly
Complete Electronic Calendar Program
The Design of C++ Standard Components
Kinds of efficiency
Execution speed
Algorithms and data structures
Techniques for speeding execution
Using inline functions
Using copy-avoidance techniques
Avoiding init objects
More about avoiding init objects
Not checking for client errors
Avoiding language features with execution speed penalties
Compilation time
Minimizing interface dependencies
Minimizing type conversions
Breaking up large header files
Executable size
Minimizing inlines
Minimizing linkage dependencies
Minimizing the number of static objects defined in headers
Inheritance: why we have mostly avoided it
Two uses of inheritance
Using inheritance to factor out common code
Using inheritance to overcome problems in the type system
Conclusions
References
A Flexible UNIX Command Line Processing Facility - Args(C++)
Options and option values
Args
Multiple options:
-I
Suboptions:
-D
Intermixing
`+' options
Keyword options
Invocation errors
The final program
No More Array Errors (Part I) - Block(C++)
What is array reallocation?
Introduction to
Block(C++)
Creating Blocks of a Given Size
Other Bells and Whistles
Accessing Block Elements
How this is possible
Changing Block Size
The reserve operation
The size operation
Conclusion
No More Array Errors (Part II) - Array_alg(C++)
Using Block(C++) with Array Algorithms
An array-based implementation of Set(C++)
The Array_set representation
Array_set insertion
Array_set membership
Array_set removal
Array_set relations
Selecting an arbitrary Array_set element
Array_set algebra
Performance
Algorithm families
Conclusion
Example
No More Memory Leaks - fs(C++)
The Problem
fs
to the Rescue
Looking at the freestore
Freestore events
The Marriage of fs and Debuggers
fs and debug
Program #1: A memory leak
Program #2: Setting a watchpoint
The Implementation
Conclusion
Using Simple Finite State Machines - Fsm(C++)
What is a Finite State Machine?
Examples
A Simple Vending Machine
A Simple Finite State Acceptor
A Simple Translator
A Simple Dynamically-Programmed Fsm
Preconditions
Tracing Execution
Displaying an Fsm in Human-Readable Form
G2++ Tutorial - G2++(C++)
The rationale for G2 (and G2++)
A G2 Example
Introduction to G2++
G2++ Programming Language Interface
Support for iostream(C++)
Support for String(C++)
Support for Vblock(C++)
Arbitrary Size Strings and Arrays
The Initial Capacity of Strings and Arrays
Pathological Record Definitions
Using G2++ with User-Defined Types
Record Definition
Null Values
Providing Inserters and Extractors for User-Defined Types
Strings Containing Nonprintable Characters
Pointers
Stream Errors
Adding Builtin C Types to the Repertoire of G2++ Types
G2 Data Language Reference
G2 Records
Language Syntax
Record Definition
C Interface
Compiled Interface
Interpreted Interface
Guidelines for Using G2
The C++ Graph Classes: A Tutorial - Graph(C++) and Graph_alg(C++)
Introduction
What is a Graph?
Example: Manufacturing Process of a Widget
Using the Graph Classes to Create Objects
Creating, Inserting, Removing, and Destroying the User Graph Types
Where is a Given Module Needed?
Graphs and Sets
Answering the Second Question: Which Modules are Immediately Needed to Compose Module K?
The Graph Classes
Graph Constructors and Destructors
Graph Operators
Graph Component Insertion and Removal
Graph Information Retrieval
Graph Subgraph Creation
Vertex Constructors and Destructors
Vertex Operators
Vertex Information Retrieval
Vertex Traversal Support
Edge Constructors and Destructors
Edge Operators
Edge Information Retrieval
Edge Traversal Support
Graph Algorithms
Traversals
Components
Cycles
Performance
Source Code for the Widget Manufacturing Example (Complete Listing)
A List Class Library for C++ - List(C++)
What is a List?
List declarations
Operations on Lists
Basic operations
Assignment
Concatenation
Conversions
Length
Comparisons
Sort operation
Queue-oriented operations
Head
Tail
Put
Get
Unget
Unput
Element selection
Operator []
Replacement
Output
List iterators
List iterator declarations
Operations on List iterators
Assignment
Comparisons
Checking Current Position
Changing Current Position
Reading Elements from a List
Inserting and Deleting Elements
Iterating
Iterating over constant Lists
Example
Associative Arrays in C++ - Map(C++)
Introduction
An Example
Defining
Map
Classes
Key and Value Types
Using a Map
Copying a Map
Iterators
An Iterator Example
Performance
Suggested Applications
Implementation Notes and Warnings
Another Example: Topological Sorting
The Problem
Implementation
Performance
Conclusion
An Objection Class for Rudimentary Error Handling - Objection(C++)
Objections for the Software Author
Declaring and Instantiating Objections
Raising Objections
Instantiating Objections with a Default Action
Documenting Software using Objections
Objections for the Software Client
Sustaining an Objection
Ignoring an Objection
Superseding an Objection
Changing Actions Midstream
Setjmp and Longjmp with Objections
Conclusion
A UNIX Path Name Library for C++ - Path(C++)
Terminology
The class Path
The basic operations
The ksh ``test'' function
Search paths
Wildcards
Implementation
Fast Special-purpose Memory Allocation for C++ - Pool(C++)
Introduction
The
Pool
Class
Using the
Pool
Class
Performance
Traps and Pitfalls
A Portable C++ Regular Expression Facility - Regex(C++)
Introduction
Constructing and matching
Invalid patterns
More on matching
Subexpressions
Regex iteration
A final example
Sets - Sets(C++)
A Set example
A Bag example
A Pointer set example
Space-time tradeoffs
Modifying elements in place
Internal representation of Sets
Symbol(C++) as an application of sets
Measuring Program Execution Time with Stopwatch(C++) - Stopwatch(C++)
The Stopwatch Analogy
Constructors
Stopwatch Status
Setting Operations
Reading Operations
Getting Meaningful Stopwatch Measurements
No More String Errors - String(C++)
Declarations
Operations
Basic Operations
Queue-Oriented Operations
Input and Output
Element Selection and Substrings
Comparison Operations
String functions
UNIX System and Library Calls
Implementation
Unsafe Programming with Strings
Miscellaneous
Programming Examples
Replace
Reverse
Reserve
A Class for Efficient Key Lookup in C++ - Symbol(C++)
Symbol tables
Remembering the hash
A perfect hash
Removing the baggage
An example
Summary comparison
No more ctime(S) errors - Time(C++)
Introduction to Time(C++)
The relationship between Time, Place, and Duration
Duration
Duration constants
Constructors
Functions for expressing Durations in natural units
Component extractors
Relational operators
Fixed point arithmetic operators
Approximate arithmetic operators
Conversion to and from string
Stream insertion
Time
Time constants
Enumerations
Constructors
Julian date operations
Component extractors
Day-of-week operations
Relational operators
Arithmetic operators
Conversion to and from strings
Conversion from Time to String
Conversion from string to Time
Stream insertion
Conversion to and from
time_t
Auxiliary Time functions
Place
Error handling
Preconditions
Objections
Example 1: handling
Duration::string_objection
Example 2: handling
Time::environment_objection