Synopses & Reviews
Many programmers are unaware that C++ is more than an object-oriented language. C++ is also a language for generic programming, a methodology that can greatly enhance your ability to write efficient and reusable software components.
Written by noted C++ authority Matthew H. Austern, Generic Programming and the STL introduces you to the generic programming paradigm and to the most important instance of that paradigm--the C++ Standard Template Library (STL). This book reveals that the STL is more than a set of convenient container classes: It is also an extensible framework for generic and interoperable components.
Generic Programming and the STL explains the central ideas underlying generic programming--concepts, modeling, and refinement--and shows how these ideas lead to the fundamental concepts of the STL: iterators, containers, and function objects. In this way you will conceive the STL as a library of concepts rather than a library of specific functions and classes. You will learn its formal structure and be able to take full advantage of its potential power. This book enables you to:
- Extend the STL with your own library of portable and interoperable general-purpose components
- Create algorithms that are decoupled from the types and data structures they operate on, thus eliminating the need to rewrite basic algorithms and data structures
- Write more elegant, efficient, and effective code that can be used and reused across platforms
With the knowledge and understanding you will gain, you can achieve greater skill in creating the reusable and portable software that is now invaluable in our diverse and interconnected computing environment.
0201309564B04062001
Description
Includes bibliographical references (p. 531-533) and index.
About the Author
Matthew H. Austern, PhD, studied at MIT and UC Berkeley. He now works in the Silicon Graphics compiler group, where he is one of the principal authors of SGI's implementation of the C++ Standard Template Library. Dr. Austern is also a contributor to
Dr. Dobb's Journal and
C++ Report, a moderator of the newsgroup comp.std.c++, and an active member of the ISO/ANSI C++ Standards Committee.
0201309564AB04062001
Table of Contents
Preface.
I. INTRODUCTION TO GENERIC PROGRAMMING. 1. A Tour of the STL.
A Simple Example.
Summary. 2. Algorithms and Ranges.
Linear Search.
Linear Search in C.
Ranges.
Linear Search in C++.
Concepts and Modeling.
Iterators.
Input Iterators.
Output Iterators.
Forward Iterators.
Bidirectional Iterators.
Random Access Iterators.
Refinement.
Summary. 3. More about Iterators.
Iterator Traits and Associated Types.
Value Types.
Difference Type.
Reference and Pointer Types.
Dispatching Algorithms and Iterator Tags.
Putting It All Together.
Iterator Traits without iterator_traits.
Defining New Components.
Iterator Adaptors.
Advice for Defining an Iterator.
Advice for Defining an Algorithm.
Summary. 4. Function Objects.
Generalizing Linear Search.
Function Object Concepts.
Unary and Binary Function Objects.
Predicates and Binary Predicates.
Associated Types.
Function Object Adaptors.
Predefined Function Objects.
Summary. 5. Containers.
A Simple Container.
An Array Class.
How It Works.
Finishing Touches.
Container Concepts.
Containment of Elements.
Iterators.
The Hierarchy of Containers.
The Trivial Container.
Variable Size Container Concepts.
Sequences.
Associative Containers.
Allocators.
Summary.
Which Container Should You Use?
Defining Your Own Container.
II. REFERENCE MANUAL: STL CONCEPTS. 6. Basic Concepts.
Assignable.
Default Constructible.
Equality Comparable.
Ordering.
LessThan Comparable.
Strict Weakly Comparable. 7. Iterators.
Trivial Iterator.
Input Iterator.
Output Iterator.
Forward Iterator.
Bidirectional Iterator.
Random Access Iterator. 8. Function Objects.
Basic Function Objects.
Generator.
Unary Function.
Binary Function.
Adaptable Function Objects.
Adaptable Generator.
Adaptable Unary Function.
Adaptable Binary Function.
Predicates.
Predicate.
Binary Predicate.
Adaptable Predicate.
Adaptable Binary Predicate.
Strict Weak Ordering.
Specialized Concepts.
Random Number Generator.
Hash Function. 9. Containers.
General Container Concepts.
Container.
Forward Container.
Reversible Container.
Random Access Container.
Sequences.
Sequence.
Front Insertion Sequence.
Back Insertion Sequence.
Associative Containers.
Associative Container.
Unique Associative Container.
Multiple Associative Container.
Simple Associative Container.
Pair Associative Container.
Sorted Associative Container.
Hashed Associative Container.
Allocator.
III. REFERENCED MANUAL: ALGORITHMS AND CLASSES. 10. Basic Components.
pair.
Iterator Primitives.
iterator_traits.
Iterator Tag Classes.
distance.
advance.
Iterator Base Class.
allocator.
Memory Management Primitives.
construct.
destroy.
uninitialized_copy.
uninitialized_fill.
uninitialized_fill_n.
Temporary Buffers.
get_temporary_buffer.
return_temporary_buffer. 11. Nonmutating Algorithms.
Linear Search.
find.
find_if.
adjacent_find.
find_first_of.
Subsequence Matching.
search.
find_end.
search_n.
Counting Elements.
count.
count_if.
for_each.
Comparing Two Ranges.
equal.
mismatch.
lexicographical_compare.
Minimum and Maximum.
min.
max.
min_element.
max_element. 12. Basic Mutating Algorithms.
Copying Ranges.
copy.
copy_backward.
Swapping Elements.
swap.
iter_swap.
swap_ranges.
transform.
Replacing Elements.
replace.
replace_if.
replace_copy.
replace_copy_if.
Filling Ranges.
fill.
fill_n.
generate.
generate_n.
Removing Elements.
remove.
remove_if.
remove_copy.
remove_copy_if.
unique.
unique_copy.
Permuting Algorithms.
reverse.
reverse_copy.
rotate.
rotate_copy.
next_permutation.
prev_permutation.
Partitions.
partition.
stable_partition.
Random Shuffling and Sampling.
random_shuffle.
random_sample.
random_sample_n.
Generalized Numeric Algorithms.
accumulate.
inner_product.
partial_sum.
adjacent_difference. 13. Sorting and Searching.
Sorting Ranges.
sort.
stable_sort.
partial_sort.
partial_sort_copy.
nth_element.
is_sorted.
Operations on Sorted Ranges.
Binary Search.
Merging Two Sorted Ranges.
Set Operations on Sorted Ranges.
Heap Operations.
make_heap.
push_heap.
pop_heap.
sort_heap.
is_heap. 14. Iterator Classes.
Insert Iterators.
front_insert_iterator.
back_insert_iterator.
insert_iterator.
Stream Iterators.
istream_iterator.
ostream_iterator.
istreambuf_iterator.
ostreambuf_iterator.
reverse_iterator.
raw_storage_iterator. 15. Function Object Classes.
Function Object Base Classes.
unary_function.
binary_function.
Arithmetic Operations.
plus.
minus.
multiplies.
divides.
modulus.
negate.
Comparisons.
equal_to.
not_equal_to.
less.
greater.
less_equal.
greater_equal.
Logical Operations.
logical_and.
logical_or.
logical_not.
Identity and Projection.
identity.
project1st.
project2nd.
select1st.
select2nd.
Specialized Function Objects.
hash.
subtractive_rng.
Member Function Adaptors.
mem_fun_t.
mem_fun_ref_t.
mem_fun1_t.
mem_fun1_ref_t.
const_mem_fun_t.
const_mem_fun_ref_t.
const_mem_fun1_t.
const_mem_fun1_ref_t.
Other Adaptors.
binder1st.
binder2nd.
pointer_to_unary_function.
pointer_to_binary_function.
unary_negate.
binary_negate.
unary_compose.
binary_compose. 16. Container Classes.
Sequences.
vector.
list.
slist.
deque.
Associative Containers.
set.
map.
multiset.
multimap.
hash_set.
hash_map.
hash_multiset.
hash_multimap.
Container Adaptors.
stack.
queue.
priority_queue. Appendix A. Portability and Standardization.
Language Changes.
The Template Compilation Model.
Default Template Parameters.
Member Templates.
Partial Specialization.
New Keywords.
Library Changes.
Allocators.
Container Adaptors.
Minor Library Changes.
Naming and Packaging. Bibliography.
Index. 0201309564T04062001