C++编程思想:英文版(第2卷 实用编程技术)

C++编程思想:英文版(第2卷 实用编程技术)
作 者: Bruce Eckel Chuck Allison
出版社: 机械工业出版社
丛编项: 经典原版书库
版权说明: 本书为公共版权或经版权方授权,请支持正版图书
标 签: C++
ISBN 出版时间 包装 开本 页数 字数
未知 暂无 暂无 未知 0 暂无

作者简介

  作者:BruceEckelBruceEckel从1986年至今,已经发表了超过150篇计算机技术文章,出版了6本书(其中4本是关于C++的),并且在全世界做了数百次演讲。他是《ThinkinginJava》、《ThinkinginC++》、《C++Inside&Out》《UsingC++》和《ThinkinginPatterns》的作者,同时还是《BlackBeltC++》文集的编辑。他的《ThinkinginC++》一本书在1995年被评为“最佳软件开发图书”,《ThinkinginJava》被评为1999年JavaWorld“最爱读者欢迎图书”,并且赢得了编辑首选图书奖。C++编程思想第2卷:实用编程技术>>更多作品

内容简介

权威的作者、经典的教材、一流的译者、严格的审校、精细的编辑,使我们的图书有了质量的保证。BruceEckel是MindView公司的总裁,向客户提供软件咨询和培训。他是C++标准委员会拥有表决权的成员之一。也是《Java编程思想》、《C++编程思想第1卷》及其他C++著作的作者,已经发表了150多篇论文(其中有许多C++语言方面的论文),他经常参加世界各地研讨会并进行演讲。本书第一版荣获1996年度《软件开发》杂志的Jolt大将,成为年度最佳图书。■介绍实用的编程技术和最佳的实践方法;解决C++开发中最困难的课题。■深入研究标准C++库的功能,包括:字符串、输入输出流、STL算法和容器。■讲述模板的现代用法.包括模板元编程。■解开对多继承的困惑,展示RTTI的实际使用。■深入探究异常处理方法,清晰解释异常安全设计。■介绍被认为是标准C++下一版特征之一的多线程编程技术,并提供最新研究成果。■对书中包含的所有示例代码都提供免费下载,这些代码段经过多个软件平台和编译器(包括基于Windows/Mac/Linux的GNUC++编译器)的测试,稳定可靠。在本书作者的个人网站www.BruceEckel.com上提供:■本书的全文、源代码、练习解答指南、勘误表及补充材料。■?臼橄喙啬谌莸难刑趾妥裳?

图书目录

What's inside

Introduction

Goals

Chapters

Exercises

Exercise solutions

Source code

Compilers

Language standards

Seminars,CD-ROMs

&consulting

Errors

About the cover

Acknowledgements

I:Building Stable Systems

1:Exception Handing

Traditional error handling

Throwing an exception

Catching an exception

The try block

Exception handlers

Termination

and resumption

Exception matching

Catching any exception

Rethrowing an exception

Uncaught exceptions

Cleaning UP

Resource management

Making everything

an object

auto_ptr

Function-level try blocks

Standard exceptions

Exception specifications

Better exception

specifications?

Exception specifications

and inheritance

When not to use

exception specifications

Exception safety

Programming with exceptions

When to avoid exceptions

Typical uses of exceptions

Overhead

Summary

Exercises

2:Defensive Programming

Assertions

A simple Unit test framework

Automated testing

The TestSuite Framework

Test suites

The test framework code

Debugging techniques

Trace macros

Trace file

Finding memory leaks

Summary

Exercises

II:The Standard C++ Library

3:Strings in Depth

What's in a string?

Creating and initializing

C++ strings

Operating on strings

Appending,inserting,and

concatenating strings

Replacing string

characters

Concatenation using nonmember

overloaded operators

Searching in strings

Finding in reverse

Finding first/last of

a set of characters

Removing characters

from strings

Comparing strings

Strings and

character traits

A String application

Summary

Exercises

4:Iostreams

Why iostreams?

Iostreams to the rescue

Inserters and extractors

Common usage

Line-oriented input

Handling stream errors

File iostreams

A File-Processing

Example

Open modes

Iostream buffering

Seeking in iostreams

String iostreams

Input string streams

Output string streams

Output stream formatting

Format flags

Format fields

Width,fill,and precision

An exhaustive example

Manipulators

Manipulators with

arguments

Creating manipulators

Effectors

Iostream examples

Maintaining class library

soutce code

Detecting compiler errors

A simple data logger

Internationalization

Wide Streams

Locales

Summary

Exercises

5:Templates in Depth

Template parameters

Non-type

template parameters

Default template

arguments

Template template

parameters

The typename keyword

Using the template

Keyword as a hint

Member Templates

Function template issues

Type deduction of function

template arguments

Function template

overloading

Taking the address

of a generated

function template

Applying a function

to an STL sequence

Partial ordering of

function templates

Template specialization

Explicit specialization

Partial Specialization

A Practical example

Preventing template

code bloat

Name lookup issues

Names in templates

Templates and friends

Template programming idioms

Traits

Policies

The curiously recurring

template pattern

Template metaprogramming

Compile-time

Programming

Expression templates

Template compilation models

The inclusion model

Explicit instantiation

The separation model

Summary

Exercises

6:Generic Algorithms

A first look

Predicates

Stream iterators

Algorithm complexity

Function objects

Classification of

function objects

Automatic creation of

function objects

Adaptable function objects

More function

object examples

Function pointer adaptors

Writing your own

function object adaptors

A catalog of STL algorithms

Support tools for

example creation

Filling and generating

Counting

Manipulating sequences

Searching and replacing

Comparing ranges

Removing elements

Sorting and operations

on sorted ranges

Heap operations

Applying an operation to

each element in a range

Numeric algorithms

General utilities

Creating your own

STL-style algorithms

Summary

Exercises

7:Generic Containers

Containers and iterators

STL reference

documentation

A first look

Containers of strings

Inheriting from

STL containers

A Plethora of iterators

Iterators in

reversible containers

Iterator categories

Predefined iterators

The basic sequences

Vector,list,deque

Basic sequence operations

vector

deque

Converting between

sequences

Checked random-access

list

Swapping sequences

Set

A completely

reusable tokenizer

Stack

Queue

Priority queues

Holding bits

bitset<n>

vector<bool>

Associative containers

Generators and fillers

for associative containers

The magic of maps

Multimaps and

duplicate keys

Multisets

Combining STL containers

Cleaning UP

containers of pointers

Creating your own containers

STL extensions

Non-STL containers

Summary

Exercises

III:Special Topics

8:Runtime Type Identification

Runtime casts

The typeid operator

Casting to

intermediate levels

void pointers

Using RTTI

with templates

Multiple inheritance

Sensible uses for RTTI

A trash recycler

Mechanism and

overhead of RTTI

Summary

Exercises

9:Multiple Inheritance

Perspective

Interface inheritance

Implementation inheritance

Duplicate subobjects

Virtual base classes

Name lookup issues

Avoiding MI

Extending an interface

Summary

Exercises

10:Design Patterns

The pattern concept

Prefer composition

to inheritance

Classifying patterns

Features,idioms,

patterns

Simplifying Idioms

Messenger

Collecting Parameter

Singleton

Variations on Singleton

Command:choosing

the operation

Decoupling event handling

with Command

Object decoupling

Proxy:fronting for

another object

State;changing

object behavior

Adapter

Template Method

Strategy:choosing the

algorithm at runtime

Chain of Responsibility

trying a sequence of strategies

Factories:encapsulating

object creation

Polymorphic factories

Abstract factories

Virtual constructors

Builder:creating

complex objects

Observer

The"inner class"idiom

The observer example

Multiple dispatching

Multiple dispatching

with Visitor

Summary

Exercises

11:Concurrency

Motivation

Concurrency in C++

Installing ZThreads

Defining Tasks

Using Threads

Creating responsive

User interfaces

Simplifying with

Executors

Yielding

Sleeping

Priority

Sharing limited resources

Ensuring the

existence of objects

Improperly accessing

resources

Controlling access

Simplified coding

with Guards

Thread local storage

Terminating tasks

Preventing iostream

collision

The ornamental garden

Terminating

when blocked

Interruption

Cooperation between threads

Wait and signal

Producer-consumer

relationships

Solving threading problems

with queues

Broadcast

Deadlock

Summary

Exercises

A:Recommended Reading

General C++

Bruce's books

Chuck's books

In-depth C++

Design Patterns

B:Etc

Index