Выбрать главу

  is >> d.day;

  is >> dash;

  if (dash != '-')

    is.setstate(ios::failbit);

  is >> d.year;

  return is;

} ///:~

The file test.txt used in Chapter 6:

//: C06:Test.txt

f a f d A  G f d F a A F h f A d f f a a

///:~

Index

<

<exception> · 59

<memory> · 55

<stdexcept> · 59

A

abort( ): Standard C library function · 46

abstraction: in program design · 664

ANSI/ISO C++ committee · 25

applicator · 231

applying a function to a container · 289

arguments: variable argument list · 181

atof( ) · 209

atoi( ) · 209

atomic operation · 763

auto_ptr · 55

automatic type conversion: and exception handling · 42

awk · 234

B

bad_cast: Standard C++ library exception type · 61

bad_exception class · 65

bad_typeid: Standard C++ library exception type · 61

before( ): run-time type identification · 607

behavioral design patterns · 673

blocking: and threads · 764

blocking and mutexes · 767

book errors, reporting · 26

broadcast( ) · 765

broadcast( ), threading · 772, 787

buffering, iostream · 200

busy wait · 762

busy wait, threading · 773

bytes, reading raw · 191

C

C: basic data types · 181; error handling in C · 34; rand( ), Standard library · 246; Standard C · 25; Standard C library function abort( ) · 46

C++: ANSI/ISO C++ committee · 25; Standard C++ · 25; Standard string class · 182

C++ standards committee: and concurrency · 721

cancel( ), function in ZThread threading library · 746

Cancelable, ZThread threading library · 746

cast: run-time type identification, casting to intermediate levels · 608

catch · 39, 41; catching any exception · 44

chaining, in iostreams · 185

change: vector of change · 664

character: transforming strings to typed values · 209

class: class hierarchies and exception handling · 43; maintaining library source · 235; Standard C++ string · 182; wrapping · 176

cleaning up the stack during exception handling · 48

cohesion · 71

command line: interface · 188

committee, ANSI/ISO C++ · 25

compile time: error checking · 181

compiler error tests · 240

composition: and design patterns · 665

concurrency · 719; blocking · 764; when to use it · 803

ConcurrentExecutor (Concurrency) · 732

Condition class, threading · 772

console I/O · 188

constructor: and exception handling · 50; default constructor · 696; default constructor synthesized by the compiler · 666; exception handling · 48, 80; failing · 80; order of constructor and destructor calls · 610; private constructor · 666; simulating virtual constructors · 691; virtual functions inside constructors · 692

conversion, automatic type conversions and exception handling · 42

cooperation between threads · 771

Coplien, James · 693

CountedPtr, reference-counting template in ZThread library (Concurrency) · 743

covariance: exception specifications · 69

Crahen, Eric · 722

creating: manipulators · 230

creational design patterns · 672

critical section, in thread programming · 749

Cygwin: and ZThreads · 724

D

data: C data types · 181

datalogger · 242

dead, thread · 764

deadlock: conditions for · 800

deadlock, concurrency · 750

deadlock, concurrency (multithreading) · 795

decimaclass="underline" dec in iostreams · 225; dec manipulator in iostreams · 225; formatting · 217

default: constructor · 696

default constructor: synthesized by the compiler · 666

design: abstraction in program design · 664; cohesion · 71; exception-neutral · 74; exception-safe · 70

design patterns · 663; behavioral · 673; creational · 672; observer · 699; structural · 672; vector of change · 664; visitor · 714

destructor: and exception handling · 48; exception handling · 80; order of constructor and destructor calls · 610

dining philosophers, threading · 795

dispatching: double dispatching · 711; multiple dispatching · 710

domain_error: Standard C++ library exception type · 61

double dispatching · 711

dynamic_cast: difference between dynamic_cast and typeid( ), run-time type identification · 609

E

efficiency: and threads · 721; run-time type identification · 613

ellipses, with exception handling · 44

endl, iostreams · 225

errno · 34

error: compile-time checking · 181; error handling in C · 34; handling · 33; recovery · 33; reporting errors in book · 26

error handling · 33

exception · 33; and ZThreads (Concurrency) · 737; catching an · 41; catching any · 45; catching by reference · 42; catching via accessible base · 44; handler · 39; rethrowing an · 45, 74; re-throwing an · 45; safety · 70; throwing an · 38; uncaught · 48

exception class · 58; what( ) · 59

exception handling · 33; asynchronous events · 76; atomic allocations for safety · 52; automatic type conversions · 42; bad_cast Standard C++ library exception type · 61; bad_exception class · 65; bad_typeid Standard C++ library exception type · 61; catching any exception · 44; class hierarchies · 43; cleaning up the stack during a throw · 48; constructors · 48, 50, 80; destructors · 48, 56, 80; domain_error Standard C++ library exception type · 61; ellipses · 44; exception class · 58; exception class, what( ) · 59; exception handler · 39; exception hierarchies · 79; exception matching · 42; exception Standard C++ library exception type · 60; incomplete objects · 48; inheritance · 43; invalid_argument Standard C++ library exception type · 61; length_error Standard C++ library exception type · 61; logic_error Standard C++ library exception type · 60; memory leaks · 48; multiple inheritance · 79; naked pointers · 50; object slicing and exception handling · 42; out_of_range Standard C++ library exception type · 61; overhead of · 81; programming guidelines · 75; references · 54, 80; resource management · 50; runtime_error class · 58; runtime_error Standard C++ library exception type · 60; set_terminate( ) · 46; set_unexpected( ) · 63; specification · 62; specifications and inheritance · 68; specifications, covariance · 69; specifications, when not to use · 70; stack unwinding · 38; Standard C++ library exception type · 60; Standard C++ library exceptions · 58; terminate( ) · 65; termination vs. resumption · 41; testing · 104; throwing & catching pointers · 80; throwing an exception · 37; typical uses of exceptions · 77; uncaught exceptions · 45; unexpected( ) · 63; when to avoid · 75; zero-cost model · 83

exception hierarchies · 79

exception neutral · 74

exception safety · 70

exception specifications · 62; covariance of · 69; inheritance · 68; when not to use · 70

exclusion, mutual, in threads · 749

Executors, ZThread (Concurrency) · 731

exeption handling: logic_error class · 58

extensible program · 181

extractor · 184

F

file: iostreams · 182, 188

FILE, stdio · 177

filclass="underline" width, precision, iostream · 219