Вы находитесь на странице: 1из 44

________________________________________

________________________________________________________________________________________________________________________________________________________________

I
________________________________________
________________________________________________________________________________________________________________________________________________________________

Index

Is there another word for synonym?


– anon

## 162 valarray 667


** 263 %: digraph 829
-1 831 %:%: digraph 829
->* 853 %=, valarray 664
.* 853 %> digraph 829
16-bit character 580 &
7-bit char 580 bitset 495
8-bit char 580 bitwise and operator 124
bitset 494 predefined 264
, prohibiting 264
and [] 838 valarray 667
operator 123 &&
predefined 264 logical and operator 123
prohibiting 264 logical_and 516
! valarray 667
for basic_ios 616 &=
logical_not 516 of bitset 494
valarray 664 valarray 664
!= ’, character literal 73
bitset 494 *
complex 680 and [], -> and 290
generated 468 complex 680
iterator 551 iterator 551
not_equal_to 516 multiplies 517
string 591 valarray 667
valarray 667 *=
#, preprocessing directive 813 complex 679
$ character 81 valarray 664
% +
modulus 517 complex 680

The C++ Programming Language, Third Edition by Bjarne Stroustrup. Copyright ©1997 by AT&T.
Published by Addison Wesley Longman, Inc. ISBN 0-201-88954-4. All rights reserved.
870 Index

iterator 551 ::
plus 517 and virtual function, operator 312
string 593 explicit qualification 847
user-defined 265 namespace and 169
user-defined operator 281 operator 305
valarray 667 scope resolution operator 82, 228
++ ::*, pointer to member 418
increment operator 125 :> digraph 829
iterator 551 <
user-defined operator 264, 291 comparison 467
+= iterator 551
advance() and 551 less 516
complex 679 string 591
iterator 551 template syntax 811
operator 109 valarray 667
string 592 vector 457
user-defined operator 264, 268, 281 <% digraph 829
valarray 664 <: digraph 829
- <<
complex 680 bitset 494
distance() and 551, 554 bitset 495
iterator 551 complex 680
minus 517 for output why 607
negate 517 inserter 608
valarray 664, 667 of char 611
-- of complex 612
decrement operator 125 of pointer to function 631
iterator 551 of streambuf 642
user-defined operator 291 ostream 609
-= output cout 46
complex 679 output operator 607
iterator 551 precedence 608
operator 109 put to 607
valarray 664 string 598
-> valarray 667
and * and [] 290 virtual 612
iterator 551 <<=
member access operator 102 of bitset 494
user-defined operator 289 valarray 664
->*, pointer to member 418 <=
. generated 468
floating-point 74 iterator 551
member access operator 101 less_equal 516
.*, pointer to member 418 string 591
..., ellipsis 154 valarray 667
/ =
complex 680 map 484
divides 517 predefined 264
valarray 667 prohibiting 264
/* comment 161 string 587
// user-defined operator 281
comment 10 valarray 663
difference from C 816 vector 447
/= ==
complex 679 bitset 494
valarray 664 complex 680

The C++ Programming Language, Third Edition by Bjarne Stroustrup. Copyright ©1997 by AT&T.
Published by Addison Wesley Longman, Inc. ISBN 0-201-88954-4. All rights reserved.
Index 871

equal_to 516 valarray 667


equality without 468 ^=
iterator 551 of bitset 494
string 591 valarray 664
user-defined 534 _ character 81
valarray 667 |
vector 457 bitset 495
> bitwise or operator 124
and >> 812 valarray 667
generated 468 |=
greater 516 of bitset 494
iterator 551 valarray 664
string 591 ||
valarray 667 logical or operator 123
>= logical_or 516
generated 468 valarray 667
greater_equal 516 ~, valarray 664
iterator 551 0
string 591 constant-expression 835
valarray 667 false and 71
>> null integer value 830
> and 812 string and 587
bitset 494 zero null 88
bitset 495 -1 and size_t 448
char 615 1, true and 71
complex 680
extractor 608
get from 607 A
input cin 50, 112
Aarhus 536
istream 614
abort() 218, 380
of complex 621
abs() 660– 661, 680
of pointer to function 632
valarray 667
string 598
abstract
valarray 667
and concrete type 771
>>=
class 708
of bitset 494
class 313
valarray 664
class and design 318
?:, arithmetic-if 134
class, class hierarchy and 324
[]
iterator 435
, and 838
node class 774
-> and * and 290
type 34, 767, 769
and insert() 488
abstraction
bitset 494
classes and 733
design of 295
data 30
iterator 551
abstraction, late 437
map 482
abstraction, levels of 733
of vector 445
access 278
on string 584
checked 445
valarray 663
control 225, 402
\
control and base class 405
backslash 830
control and multiple-inheritance 406
escape character 73, 830
control, cast and 414
\’, single quote 830
control, run-time 785
^
control, using-declaration and 407
bitset 495
element 445
bitwise exclusive or operator 124
operator, design of 295

The C++ Programming Language, Third Edition by Bjarne Stroustrup. Copyright ©1997 by AT&T.
Published by Addison Wesley Longman, Inc. ISBN 0-201-88954-4. All rights reserved.
872 Index – A–

to base 850 and de-allocation 127


to member 849 unit of 88
to member class 851 allocator 567
unchecked 445 Pool_alloc 572
accumulate() 682 general 573
acos(), valarray 667 nothrow 823
acquisition, resource 364 use of 568
action 776 user-defined 570
Ada 10, 725 allocator 567
adapter allocator_type 443, 480
member function 520 alternative
pointer to function 521 design 710
adapters, container 469 error handling 192, 355
add element to sequence 529 implementation 320
adding interface 173
to container 555 return 357
to sequence 555 to macro 161
to standard library 434 ambiguity
address of element 454 dynamic_cast and 412
addressing, united of 88 resolution, multiple-inheritance 391
adjacent_difference() 684 ambiguous type conversion 276
adjacent_find() 525 ambition 693
adjustfield 626, 630 analogy
adoption of C++, gradual 718 bridge 724
advance() and += 551 car factory 698
aims plug 728
and means 694 proof by 692
design 700 units 728
Algol68 10 analysis
algorithm 56 design and 696
C-style function and 522 error 711
and member function 520 experimentation and 710
and polymorphic object 63 method, choosing an 696
and polymorphism 520 stage 697
and sequence 508 and C-style string, string 579
and string 584 and
container and 507 keyword 829
conventions 508 operator &, bitwise 124
design 510 operator &&, logical 123
exception container 566 and_eq keyword 829
generalized numeric 682 Annemarie 92
generic 41 anomaly, constructor and destructor 245
modifying sequence 529 anonymous union 841
nonmodifying sequence 523 ANSI
on array 544 C 13
return value 508 C++ 11
summary 509 any() 494
<algorithm> 432, 509 app append to file 639
algorithms, standard library 64 append to file, app 639
alias, namespace 178 append(), string 592
alignment 102 application framework 731, 786
all, catch 362 apply() to valarray 664
allocate array 128 architecture 696
allocate() 567 arg() 680
allocation argc, main() argv 117
C-style 577 argument

The C++ Programming Language, Third Edition by Bjarne Stroustrup. Copyright ©1997 by AT&T.
Published by Addison Wesley Longman, Inc. ISBN 0-201-88954-4. All rights reserved.
– A– Index 873

array 147 valarray 667


command line 117 asm assembler 806
deducing template 335, 855 assembler 8, 10
default 153 asm 806
depend on template 861 Assert() 750
explicit template 335 assert() 750
function template 335 <assert.h> 432
passing 283 assertion checking 750
passing, function 145 assign()
reference 98 char_traits 581
template 331 string 588
type check, function 145 vector 447
type conversion, function 145 assignment
type, difference from C 817 and initialization 283
types, virtual function 310 array 92
undeclared 154 copy 246, 283
value, example of default 227 function call and 99
argv argc, main() 117 map 484
arithmetic of class object 245
conversions, usual 122 operator 110, 268
conversions, usual 836 string 587
function object 517 to self 246
mixed-mode 268 valarray 663
pointer 88, 93, 125 Assoc example 286
type 70 associative
vector 65, 662 array 286, 480
arithmetic-if ?: 134 array – see map
array 26, 88 container 480
algorithm on 544 container, sequence and 461
allocate 128 associativity of operator 121
argument 147 asynchronous event 357
array of 837 at() 53, 445
as container 496 on string 585
assignment 92 out_of_range and 385
associative 286, 480 atan() 660
by string, initialization of 89 valarray 667
deallocate 128 atan2() 660
delete 250 valarray 667
element, constructor for 250 ate 639
element object 244 atexit()
initializer 89 and destructors 218
initializer, difference from C 818 and exception 382
layout 669 atof() 600
multidimensional 668, 677, 836 atoi() 589, 600
new and 423 atol() 600
of array 837 AT&T Bell Laboratories 11
of objects 250 auto 843
passing multidimensional 839 automatic
pointer and 91, 147 garbage collection 247, 844
string and 589 memory 843
valarray and 663 memory management 844
valarray and vector and 662 object 244
arrays, numeric 662 auto_ptr 367
ASCII 580, 829
character set 73, 601
asin() 660

The C++ Programming Language, Third Edition by Bjarne Stroustrup. Copyright ©1997 by AT&T.
Published by Addison Wesley Longman, Inc. ISBN 0-201-88954-4. All rights reserved.
874 Index – B–

B const_iterator 583
const_pointer 583
\b, backspace 830
const_reference 583
back() 445
const_reverse_iterator 583
of queue 476
difference_type 583
back_inserter() 57, 555
iterator 583
back_insert_iterator 555
member type 582
backslash \ 830
pointer 583
backspace \b 830
reference 583
bad() 616
reverse_iterator 583
bad_alloc 129
size_type 583
and new 384
traits_type 583
exception 576
value_type 583
missing 823
basic_stringstream 640
badbit 617
BCPL 10
bad_cast 410
before() 415
and dynamic_cast 384
beg, seekdir and
bad_exception 378, 384
begin() 54, 481
bad_typeid and typeid() 384
basicstring 584
balance 695
iterator 444
base
behavior, undefined 828
access to 850
Bell Laboratories, AT&T 11
and derived class 39, 737
Bi 511
class 303
bibliography, design 719
class, access control and 405
bidirectional iterator 550
class, initialization of 306
bidirectional_iterator_tag 553
class, overriding from virtual 401
big-O notation 464
class, private 743
binary
class, private member of 305
mode, binary 639
class, protected 743
operator, user-defined 263
class, replicated 394
search 540, 546
class, universal 438
binary binary mode 639
class, virtual 396
binary_function 515
member or 740
binary_negate 518
override private 738
not2() and 522
private 405, 742
binary_search() 540
protected 319, 405
bind1st() 518
basefield 626– 627
and binder1st 520
Basic 725
bind2nd() 518
basic_filebuf, class 648
binder1st 518
basic_ios 608, 616, 622, 629
bind1st() and 520
! for 616
binder2nd 518– 519
format state 606
binding
stream state 606
name 860
basic_iostream 637
strength, operator 121, 607
formatting 606
BinOp 511
basic_istream 613
BinPred 511
basic_ofstream 638
bit
basic_ostream 608– 609
field 125, 840
basic_streambuf 645
field, bitset and 492
buffering 606
pattern 73
basicstring
position 492
begin() 584
reference to 492
end() 584
vector 124
rbegin() 584
bitand keyword 829
rend() 584
bitor keyword 829
basic_string 582

The C++ Programming Language, Third Edition by Bjarne Stroustrup. Copyright ©1997 by AT&T.
Published by Addison Wesley Longman, Inc. ISBN 0-201-88954-4. All rights reserved.
– B– Index 875

bits position in 642


in char 658 Buffer 331, 335
in float 658 example 738
in int 658 buffering 642
<bitset> 431 I/O 645
bitset 492 basic_streambuf 606
494 built-in
!= 494 feature vs technique 43
& 495 type 70
&= of 494 type, constructor for 131
<< 495 type, input of 614
<< 494 type, output of 609
<<= of 494 type, user-defined operator and 265
== 494 by
>> 495 reference, catch 360
>> 494 value, catch 359
>>= of 494 byte 76
[] 494
^ 495
^= of 494 C
and bit field 492
C
and enum 492
//, difference from 816
and set 492
ANSI 13
and vector<bool> 492
C++ and 13– 14, 199
constructor 493
and C++ 7
flip() 494
and C++ compatibility 816
input 495
and C++, mixing 719
operation 494
and exception 383
output 495
and, learning 7
reset() 494
argument type, difference from 817
set() 494
array initializer, difference from 818
| 495
declaration and definition, difference from 818
|= of 494
difference from 816
bitset(), invalid_argument and 385
enum, difference from 817
bitwise
function call, difference from 816
and operator & 124
function definition, difference from 817
exclusive or operator ^ 124
initialization and goto, difference from 818
logical operators 124
input and output 651
or operator | 124
int implicit, difference from 817
blackboard as design tool 703
jump past initialization, difference from 818
BLAS 668
linkage to 205
bool 71
macros, difference from 818
conversion to 835
programmer 14
input of 615
scope, difference from 816
output of 610
sizeof, difference from 816
vector of 458
standard library 599
boolalpha 610, 625
struct name, difference from 818
boolalpha() 633
struct scope, difference from 818
break 109, 116
void* assignment, difference from 818
case and 134
with Classes 10
statement 116
with classes 686
bridge analogy 724
C++ 21
bsearch() 546
.c file 202
buffer
cache example 232
memory 575
calculator example 107, 165, 190, 208
ostream and 642
call

The C++ Programming Language, Third Edition by Bjarne Stroustrup. Copyright ©1997 by AT&T.
Published by Addison Wesley Longman, Inc. ISBN 0-201-88954-4. All rights reserved.
876 Index – C–

by reference 98, 146 large programs and 9


by value 146 learning 6, 718, 820
function 145 library, first 686
of destructor, explicit 256 misuse of 725
callback 371 mixing C and 719
stream 650 procedural programming and 725
call-by reference 282 programmer 14
callC() example 384 properties of 724
call_from_C() example 384 standardization 11
calloc() 577 style subscript 674
capacity() 455 teaching and 12
car factory analogy 698 use of 12
Car example 772 change 700
card, CRC 703 incremental 684
c_array 496 response to 698
carriage return \r 830 size of sequence 529
CASE 711, 725, 730 changing interface 774
case and break 134 char 73, 76
case-sensitive compare 591 7-bit 580
<cassert> 432 8-bit 580
cast << of 611
C-style 131 >> 615
and access control 414 bits in 658
cross 408 character type 71
deprecated C-style 819 get() 620
down 408 input 618
up 408 input of 615
casting away const 414 output of 610
catch all 362 signed 831
catch 186, 361 unsigned 831
all 362 char*, specialization and 344
by reference 360 character 580
by value 359 $ 81
every exception 54 16-bit 580
catch(...) 54 \, escape 73, 830
category, iterator 553 _ 81
<cctype> 432, 601 buffer, streambuf and 642
ceil() 660 classification, wide 601
cerr 609 literal ’ 73
and clog 624 name, universal 831
initialization 637 national 829
<cerrno> 432 set 829
<cfloat> 433, 660 set, ASCII 73, 601
C-function and exception 382 set, large 831
C++ 10 set, restricted 829
ANSI 11 special 830
C and 7 string 432
ISO 11 traits 580
and C 13– 14, 199 type 580
compatibility, C and 816 type char 71
design of 7, 10 value of 580
feature summary 819 characters in name 81
functional decomposition and 726 CHAR_BIT 660
gradual adoption of 718 char_traits 580
gradual approach to learning 7 assign() 581
introducing 718 char_type 580

The C++ Programming Language, Third Edition by Bjarne Stroustrup. Copyright ©1997 by AT&T.
Published by Addison Wesley Longman, Inc. ISBN 0-201-88954-4. All rights reserved.
– C– Index 877

compare() 581 forward reference to 278


copy() 581 friend 279
eof() 581 function 776
eq() 581 handle 782
eq_int_type() 581 hierarchy 15, 307, 734
find() 581 hierarchy and abstract class 324
get_state() 581 hierarchy and template 345
int_type() 581 hierarchy design 314
length() 581 hierarchy, reorganization of 707
lt() 581 initialization of base 306
move() 581 interface 778
not_eof() 581 member, constructor for 247
off_type 581 member of derived 304
pos_type 581 member, private 225
state_type 581 member, public 225
to_char_type() 581 node 772
to_int_type() 581 object, assignment of 245
char_traits<char> 580 operations, set of 237
char_traits<wchart> 581 overriding from virtual base 401
char_type 608 pointer to 304
char_traits 580 private base 743
check, range 445, 561 private member of base 305
checked protected base 743
access 445 storage 244
iterator 561 use of 725
pointer 291 class 16, 32
Checked example 565 abstract 708
Checked_iter example 561 abstract node 774
checking access to member 851
assertion 750 and concept 223
for, wild pointer 722 base and derived 39, 737
invariant 749 concrete 236, 241, 766
checking, late, missing 823 concrete node 774
checking declaration 225
of exception-specification 376 definition 225
range 275, 781 free-standing 732
choosing function-like 514
a design method 696 helper 293
an analysis method 696 hierarchy 38, 389
cin 614 hierarchy navigation 411
>>, input 50, 112 kind of 765
cout and 624 lattice 389
initialization 637 leaf 774
value of 276 member 293
circle and ellipse 703 namespace and 849
class nested 293
abstract 313 not a 705
and design, abstract 318 random number 685
and type 724 string 292
base 303 struct and 234
basic_filebuf 648 template and 348
concept and 301 union and 843
constructor for derived 306 universal base 438
conversion of pointer to 304 user-defined type 224
derived 15, 303 classes
destructor for derived 306 and abstraction 733

The C++ Programming Language, Third Edition by Bjarne Stroustrup. Copyright ©1997 by AT&T.
Published by Addison Wesley Longman, Inc. ISBN 0-201-88954-4. All rights reserved.
878 Index – C–

and concepts 732 comparison


and real-world 734 < 467
design and 732 default 467
find the 702 equality and 457
finding the 734 in map 484
stream 637 requirement 467
use of 733 string 590
classic() locale 649 user-supplied 467
classification 703 compatibility 13
cleanup, initialization and 364 C and C++ 816
clear goal 698 compilation
clear() , 487, 616 separate 27, 198
failure and 385 template separate 351
<climits> 433, 660 unit of 197
<clocale> 433, 650 compile time, header and 211
Clock example 398 compile-time polymorphism 347
clog 609 compl keyword 829
cerr and 624 complete encapsulation 283
initialization 637 complex 64, 267
clone 424 != 680
clone() 426 * 680
close() 639 *= 679
closing + 680
of file 638 += 679
of stream 639 - 680
closure 676 -= 679
cloud example 700 / 680
Clu 10 /= 679
Club_eq 516 << 680
<cmath> 434, 660 << of 612
Cmp 339, 511 == 680
Cobol 725 >> 680
code >> of 621
bloat, curbing 342 and complex<> 680
uniformity of 767 conversion 681
coders and designers 695 cos() 680
coercion 267 cosh() 680
collaboration, design 708 expr() 680
collating sequence 338 input 680
collector, log() 680
conservative 846 log10() 680
copying 846 mathematical functions 680
comma and subscripting 838 operations 679
command line argument 117 output 680
comment 138 pow() 680
/* 161 sin() 680
// 10 sinh() 680
common sqrt() 680
code and constructor 624 tanh() 680
code and destructor 624 complex<>, complex and 680
commonality 301 complexity divide and conquer 693
communication 694– 695, 717 component 701, 755
compare, case-sensitive 591 standard 698, 714
compare() composite operator 268
char_traits 581 composition of namespace 181
string 590 compositor 677

The C++ Programming Language, Third Edition by Bjarne Stroustrup. Copyright ©1997 by AT&T.
Published by Addison Wesley Longman, Inc. ISBN 0-201-88954-4. All rights reserved.
– C– Index 879

computation, numerical 64 and destruction, order or 414


concatenation, string 592– 593 order of 248, 252
concept 15 valarray 662
and class 301 constructor 32– 33, 226, 706
class and 223 and C-style initialization 270
independent 327 and conversion 272
concepts, classes and 732 and destructor 242, 246– 247
concrete and destructor anomaly 245
class 236, 241, 766 and initializer list 270
class, derive from 780 and template, copy 348
node class 774 and type conversion 269, 275
type 33, 236, 766– 767 and union 257
type, abstract and 771 and virtual base 397
type and derivation 768 bitset 493
type, problems with 37 common code and 624
type, reuse of 241 copy 246, 283
type, reuse of 768 default 243
condition 753 default copy 271
declaration in 135 exception in 367
conditional expression 134 exceptions in 371
conj() 680 explicit 284
connection between input and output 623 for array element 250
const 94 for built-in type 131
C-style string and 90 for class member 247
and linkage 199 for derived class 306
and overloading 600 for free store object 246
casting away 414 for global variable 252
function, inspector 706 for local variable 245
iterator 443 map 484
member 249 pointer to 424
member function 229 string 585
physical and logical 231 vector 447
pointer 96 virtual 323, 424
pointer to 96 constructors, exceptions and 366
constant cont iterator 508
expression 833 container 40, 52
in-class definition of 249 STL 441
member 249 Simula-style 438
time 464 Smalltalk-style 438
constant-expression 0 835 adapters 469
const_cast 131, 232 adding to 555
const_iterator 54, 443, 480 algorithm, exception 566
basic_string 583 and algorithm 507
const_mem_fun1_ref_t 518, 521 and iterator 435, 444
const_mem_fun1_t 518, 521 and polymorphism 520
const_mem_fun_ref_t 518, 521 array as 496
const_mem_fun_t 518, 521 associative 480
const_pointer 443 container, based 438
basic_string 583 container
const_reference 443, 480 design 434, 441
basic_string 583 implementation of 465
const_reverse_iterator 443, 480 input into 451
basic_string 583 intrusive 438
construct() 567 iterator 464
construction kind of 461
and destruction 244 memory management 455, 567

The C++ Programming Language, Third Edition by Bjarne Stroustrup. Copyright ©1997 by AT&T.
Published by Addison Wesley Longman, Inc. ISBN 0-201-88954-4. All rights reserved.
880 Index – C–

operation on 464 copy 229, 245, 271


optimal 435 assignment 246, 283
representation of 465 constructor 246, 283
sequence and 512 constructor and template 348
standard library 56 constructor, default 271
standard-library 442 delayed 295
string as 491 memberwise 283
summary 464 of exception 362
user-defined 497 requirement 466
valarray as 492 copy() 42, 529, 589
containers 431 char_traits 581
containment 738 _copy suffix 533
and inheritance 740 copy_backward() 529
context copyfmt() 627
of template definition 860 copyfmt_event 651
of template instantiation 860 copyfmt_event, copyfmt() 651
continue 116 copy_if() not standard 530
statement 116 copying, elimination of 675
contravariance 420 copy-on-write 295
control, format 625 cos() 660
controlled statement 136 complex 680
convenience valarray 667
and orthogonality 431 cosh() 660
vs. safety 847 complex 680
conventions valarray 667
algorithm 508 cost of exception 381
lexical 794 count() 57, 494, 526
national 649 in map 485
conversion 706 count_if() 62, 526
ambiguous type 276 counting, reference 783
complex 681 coupling, efficiency and 768
constructor and 272 cout 609
constructor and type 269, 275 <<, output 46
explicit 284 and cin 624
floating-point 834 initialization 637
implicit 275, 281, 284 Cowboy example 778
implicit type 76, 276, 833 __cplusplus 206
integer 834 CRC card 703
of pointer to class 304 create dependency 745
of string, implicit 590 creation
operator, type 275 localization of object 322
pointer 834 object 242
signed unsigned integer 834 criteria
string 589 sorting 534
to bool 835 standard library 430
to floating-point 835 cross cast 408
to integer type 835 <csetjmp> 433
to integral 835 cshift() 664
undefined enum 77 <csignal> 433
user-defined 347 <cstdarg> 433
user-defined pointer 349 <cstdio> 202, 432
user-defined type 267, 281 <cstdlib> 219, 432, 434, 546, 577, 600, 661
conversions 747 c_str() 589
usual arithmetic 122 <cstring> 432, 577, 599
conversions, usual, arithmetic 836 C-style
cookbook method 692 allocation 577

The C++ Programming Language, Third Edition by Bjarne Stroustrup. Copyright ©1997 by AT&T.
Published by Addison Wesley Longman, Inc. ISBN 0-201-88954-4. All rights reserved.
– C– Index 881

cast 131 deducing template argument 335, 855


cast, deprecated 819 default
error handling 661 argument 153
function and algorithm 522 argument value, example of 227
initialization, constructor and 270 comparison 467
string and const 90 constructor 243
string, string and 579 copy constructor 271
string, string and 589 template argument 340, 824
<ctime> 431, 433 value 239
<ctype.h> 432, 601 value, supplying 500
cur, seekdir and default 109
curbing code bloat 342 #define 160
Currying 520 definition 78
<cwchar> 432 class 225
<cwtype> 432, 601 context of template 860
<cwtype.h> 601 difference from C declaration and 818
cycle, development 698 function 144
in-class 235
namespace member declaration and 167
D of constant, in-class 249
of virtual function 310
data
point of 861
abstraction 30
using-directive and 180
abstraction vs inheritance 727
delayed copy 295
member, pointer to 853
delaying decision 706
per-object 573
delegation 290
per-type 573
delete
data() 589
element from sequence 529, 534
date, format of 649
from hash_map 501
Date example 236
delete
DBL_MINEXP 660
and garbage collection 845
deallocate array 128
array 250
deallocate() 567
delete[] and 250
de-allocation, allocation and 127
operator 127
debugging 226
size and 421
dec 626– 627, 634
delete(), operator 129, 576
decimal 73
delete[] 128
output 626
and delete 250
decision, delaying 706
delete[](), operator 423, 576
declaration 23, 78– 79
delete_ptr() example 531
and definition, difference from C 818
denorm_min() 659
and definition, namespace member 167
depend on template argument 861
class 225
dependencies 724
friend 279
dependency 15
function 143
create 745
in condition 135
inheritance 737
in for statement 137
minimize 173
of member class, forward 293
use 745
point of 82
deprecated
declaration 803
C-style cast 819
declarations, keeping consistent 201
static 818
declarator operator 80
<deque> 431
declarator 807
deque, double-ended queue 474
decomposition, functional 725
derivation, concrete type and 768
decrement
derive
increment and 291
from concrete class 780
operator -- 125

The C++ Programming Language, Third Edition by Bjarne Stroustrup. Copyright ©1997 by AT&T.
Published by Addison Wesley Longman, Inc. ISBN 0-201-88954-4. All rights reserved.
882 Index – D–

without virtual 780 and union 257


derived anomaly, constructor and 245
and friend 852 common code and 624
class 15, 303 constructor and 242, 246– 247
class, base and 39, 737 exception in 373
class, constructor for 306 explicit call of 256
class, destructor for 306 for derived class 306
class, member of 304 virtual 319
exceptions 359 destructors
design 696 atexit() and 218
I/O 605 exceptions and 366
abstract class and 318 development
aims 700 cycle 698
algorithm 510 process 696
alternative 710 software 692
and analysis 696 stage 697
and classes 732 diagnostics 432
and language 724 diamond-shaped inheritance 399
and language, gap between 725 dictionary 480
and programming 692 – see map
bibliography 719 difference
class hierarchy 314 from C 816
collaboration 708 from C // 816
container 434, 441 from C argument type 817
error 711 from C array initializer 818
for testing 712 from C declaration and definition 818
how to start a 708 from C enum 817
hybrid 718 from C function call 816
inheritance and 707 from C function definition 817
integrity of 716 from C initialization and goto 818
language and programming language 730 from C int implicit 817
method 694 from C jump past initialization 818
method, choosing a 696 from C macros 818
object-oriented 692, 726 from C scope 816
of C++ 7, 10 from C sizeof 816
of [] 295 from C struct name 818
of access operator 295 from C struct scope 818
reuse 709 from C void* assignment 818
stability of 708 difference_type 443, 480, 552
stage 697 basic_string 583
standard library 429– 430 digits 658
steps 701 digits10 659
string 579 digraph
template in 757 %: 829
tool, blackboard as 703 %:%: 829
tool, presentation as 704 %> 829
tool, tutorial as 708 :> 829
tools 711 <% 829
unit of 755 <: 829
designers, coders and 695 direct manipulation 730
destroy() 567 directed acyclic graph 308
destruction direction
construction and 244 of seek, seekdir
order or construction and 414 of seekg()
destructor 33, 283 of seekp()
and garbage collection 846 directive

The C++ Programming Language, Third Edition by Bjarne Stroustrup. Copyright ©1997 by AT&T.
Published by Addison Wesley Longman, Inc. ISBN 0-201-88954-4. All rights reserved.
– D– Index 883

#, preprocessing 813 access, list 472


template instantiation 866 access, map 482
discrimination of exception 188 address of 454
disguised pointer 844 constructor for array 250
dispatch, double 326 first 445
distance() and - 551, 554 from sequence, delete 529, 534
distribution last 445
exponential 685 object, array 244
uniform 685 requirements for 466
div() 661 to sequence, add 529
divide and conquer, complexity 693 eliminate_duplicates() example 534
divides / 517 eliminating programmers 730
div_t 661 elimination
do statement 114, 137 of copying 675
documentation 714– 715 of temporary 675
do_it() example 777 ellipse, circle and 703
domain error 661 ellipsis ... 154
dominance 401 else 134
Donald Knuth 713 emphasis, examples and 5
dot product 684 Employee example 302
double empty string 585
dispatch 326 empty() 455, 489
quote 830 string 598
double 74 encapsulation 754
output 626 complete 283
double-ended queue deque 474 end, seekdir and
doubly-linked list 470 end() 54, 481
down cast 408 basicstring 584
draw_all() example 520 iterator 444
Duff’s device 141 #endif 162
dynamic endl 634
memory 127, 576, 843 ends 634
store 34 engineering, viewgraph 704
type checking 727 enum 76
type checking, mis-use of 439 and integer 77
dynamic_cast 407– 408 bitset and 492
and ambiguity 412 conversion, undefined 77
and polymorphism 409 difference from C 817
and static_cast 413 member 249
bad_cast and 384 sizeof 78
implementation of 409 user-defined operator and 265
to reference 410 enumeration 76
use of 774 switch on 77
enumerator 76
EOF 620, 653
E eof() 616
char_traits 581
eatwhite() 620
eofbit 617
eback() 645
epptr() 645
EDOM 661
epsilon() 659
efficiency 8, 713
eq(), char_traits 581
and coupling 768
eq_int_type(), char_traits 581
and generality 431
equal() 527
of operation 464
equality
egptr() 645
and comparison 457
element
hash_map 497
access 445

The C++ Programming Language, Third Edition by Bjarne Stroustrup. Copyright ©1997 by AT&T.
Published by Addison Wesley Longman, Inc. ISBN 0-201-88954-4. All rights reserved.
884 Index – E–

without == 468 Form 635


equal_range() 540 Hello, world! 46
in map 485 Io 776
equal_to == 516 Io_circle 775
equivalence, type 104 Io_obj 774
Erand 685 Ival_box 315, 407
ERANGE 601, 661 Lock_ptr 366
erase() Math_container 346
from map 487 Matrix 282
from vector 452 Object 417
in string 595 Plane 729
errno 383, 601, 661 Pool 570
<errno.h> 432 Range 781
error Rational 747
analysis 711 Saab 728
design 711 Set 769
domain 661 Set_controller 785
exception and 622 Shape 774
handling 115, 186, 383, 566 Slice_iter 670
handling, C-style 661 Stack 27
handling alternative 192, 355 Storable 396
handling, multilevel 383 String 328
linkage 199 Substring 596
loop and 523 Table 243
range 661 Vector 341, 780
recovery 566 Vehicle 734
reporting 186 Window 398
run-time 29, 355 cache 232
sequence 512 calculator 107, 165, 190, 208
string 586 callC() 384
errors, exceptions and 355, 374 call_from_C() 384
escape character \ 73, 830 cloud 700
essential operators 283 delete_ptr() 531
evaluation do_it() 777
lazy 707 draw_all() 520
order of 122 eliminate_duplicates() 534
short-circuit 123, 134 identity() 531
event iocopy() 617
asynchronous 357 iosbase::Init 639
driven simulation 326 iseq() 513
event 651 of default argument value 227
event_callback 651 of input 114
example of operator overloading 292
(bad), Shape 417 of reference 292
Assoc 286 of user-defined memory management 292
Buffer 738 of virtual function 646
Car 772 oseq() 556
Checked 565 scrollbar 743
Checked_iter 561 sort() 158, 334
Clock 398 example:, member template 349
Cowboy 778 examples and emphasis 5
Date 236 exception 29, 186, 355
Employee 302 C and 383
Expr 424 C-function and 382
Extract_officers 524 I/O 622
Filter 786 and error 622

The C++ Programming Language, Third Edition by Bjarne Stroustrup. Copyright ©1997 by AT&T.
Published by Addison Wesley Longman, Inc. ISBN 0-201-88954-4. All rights reserved.
– E– Index 885

and function 375 expr() 660


and interface 375 complex 680
and main() 54 expression
and member initialization 373 conditional 134
and multiple inheritance 360 constant 833
and new 367, 369 expression, full 254
and recursive function 374 expression 798
atexit() and 382 extended type information 416
bad_alloc 576 extensibility 700
catch every 54 extensible I/O 605
container algorithm 566 extern 205
copy of 362 extern 198
cost of 381 external linkage 199
discrimination of 188 Extract_officers example 524
handler 812 extractor, >> 608
in constructor 367
in destructor 373
mapping 378 F
new and 576
\f, formfeed 830
qsort() and 382
fabs() 660
standard 384
facilities, standard library 66, 429
type of 379
factory 323
<exception> 379– 380, 384– 385, 433
fail() 616
exception hierarchy 385
failbit 617
exceptions 357
failure 709, 716
and constructors 366
failure and clear() 385
and destructors 366
false and 0 71
and errors 355, 374
fat interface 439, 761
derived 359
fault tolerance 383
grouping of 358
feature
in constructor 371
summary, C++ 819
uncaught 380
vs technique, built-in 43
unexpected 377
features, portability and 815
exceptions() 622
feedback 695, 698
exception-specification 375
field
checking of 376
bit 125, 840
exclusive or operator ^, bitwise 124
output 629– 630
exhaustion
type of 75
free store 129
fields, order of 75
resource 369
file
exit() 116, 218
.c 202
exp(), valarray 667
.h 201
experimentation and analysis 710
and stream 637
explicit
closing of 638
call of destructor 256
header 27, 201
conversion 284
input from 637
qualification :: 847
mode of 639
template argument 335
opening of 638
template instantiation 866
output to 637
type conversion 130
position in 642
explicit constructor 284
source 197
exponent, size of 659
filebuf 649
exponential distribution 685
fill() 537, 629
exponentiation, vector 667
fill_n() 537
export 205
Filter example 786
Expr example 424
finally 362

The C++ Programming Language, Third Edition by Bjarne Stroustrup. Copyright ©1997 by AT&T.
Published by Addison Wesley Longman, Inc. ISBN 0-201-88954-4. All rights reserved.
886 Index – F–

find the classes 702 format


find() 57, 525 control 625
char_traits 581 information, locale 606
in map 485 object 635
in string 594 of date 649
find_end() 528 of integer 649
find_first_not_of() in string 594 state 625
find_first_of() 525 state, basic_ios 606
in string 594 state, ios_base 606
find_if() 62, 525 string 652
finding the classes 734 formatted output 625
find_last() 444 formatting
find_last_of() in string 594 basic_iostream 606
firewall 383 in core 641
first formfeed \f 830
C++ library 686 for-statement initializer 825
element 445 Fortran
first-time switch 253, 640 style subscript 674
fixed 626, 628 vector 668
fixed() 634 forward
flag manipulation 626 and output iterator 554
flags() 626 declaration of member class 293
flexibility 700 iterator 550
flip() bitset 494 reference to class 278
float 74 forwarding function 778, 780
bits in 658 forward_iterator_tag 553
output 626 foundation operator 706
float_denorm_style 659 fragmentation, memory 846
floatfield 626, 628 framework, application 731, 786
<float.h> 433 free
floating store 34, 127, 421, 576, 843
point output 626, 628 store exhaustion 129
point type 74 store object 244
floating-point store object, constructor for 246
. 74 free() 577
conversion 834 free-standing
conversion to 835 class 732
literal 74 function 732
promotion 833 frexp() 660
float_round_style 659 friend 16, 278, 852
floor() 660 and member 265, 280
FLT_RADIX 660 class 279
flush 634 declaration 279
flush() 631, 642 derived and 852
flushing of output 626 function 279
fmod() 660 of friend 852
For 511 template and 854
for front operation 472
statement 26, 136 front() 445, 472
statement, declaration in 137 of queue 476
for(;;) 109 front_inserter() 555
for_each() 62, 523 front_insert_iterator 555
Form example 635 <fstream> 432, 638
formal fstream 638
methods 711 function
model 730 adapter, pointer to 521

The C++ Programming Language, Third Edition by Bjarne Stroustrup. Copyright ©1997 by AT&T.
Published by Addison Wesley Longman, Inc. ISBN 0-201-88954-4. All rights reserved.
– F– Index 887

and algorithm, C-style 522 sequence 469


argument passing 145 type 23, 70
argument type check 145
argument type conversion 145
argument types, virtual 310 G
call 145
game 685
call and assignment 99
gap between design and language 725
call, difference from C 816
garbage
class 776
collection, automatic 247, 844
const member 229
collection, delete and 845
declaration 143
collection, destructor and 846
definition 144
collector 128, 130
definition, difference from C 817
gargantuanism 713
definition of virtual 310
gbump() 645
definition, old-style 817
gcount() 618
example of virtual 646
general allocator 573
exception and 375
generality
forwarding 778, 780
efficiency and 431
free-standing 732
of sequence 512
friend 279
of solution 701
get() 759
generalized
helper 273
numeric algorithm 682
higher-order 518
slice 677
implementation of virtual 36
general-purpose programming-language 21
inline 144
generate() 537
inline member 235
generated
inspector const 706
!= 468
member 224, 238
<= 468
name, overloaded 149
> 468
nested 806
>= 468
object 287, 514, 776
specialization 859
object, arithmetic 517
generate_n() 537
only, instantiate used 866
generator
operator :: and virtual 312
random number 537
pointer to 156
type 348
pointer to member 418
generic
pure virtual 313
algorithm 41
set() 759
programming 40, 757– 758
specialization 344
programming, template and 327
static member 278
get
template 334
area 645
template argument 335
from, >> 607
template overloading 336
position, tellp() 642
type of overriding 424
get() 618, 643
value return 148
char 620
virtual 310, 390, 706
function 759
virtual 15
get_allocator() 457
virtual output 612
from string 598
functional
getchar() 653
decomposition 725
getline() 51, 618
decomposition and C++ 726
into string 598
<functional> 431, 516– 519, 521
getloc() 646, 650
function-like class 514
get_state(), char_traits 581
functions, list of operator 262
get_temporary_buffer() 575
functor 514
global 16
fundamental
initialization of 217

The C++ Programming Language, Third Edition by Bjarne Stroustrup. Copyright ©1997 by AT&T.
Published by Addison Wesley Longman, Inc. ISBN 0-201-88954-4. All rights reserved.
888 Index – G–

namespace 847 has_infinity 659


object 244, 252 has_quiet_NaN 659
objects 640 has_signaling_NaN 659
scope 82, 847 header 117, 201
variable 200, 228 .h 821
variable, constructor for 252 and compile time 211
variable, use of 111 file 27, 201
global() locale 649 standard 431
goal, clear 698 standard library 202
good() 616 heap 34, 543, 576
goodbit 617 and priority_queue 543
goto memory 843
difference from C initialization and 818 store 127
nonlocal 357 heap, priority_queue and 479
statement 137 Hello, world! example 46
gptr() 645 helper
gradual class 293
adoption of C++ 718 function 273
approach to learning C++ 7 function and namespace 240
grammar 793 hex 626– 627, 634
graph, directed acyclic 308 hexadecimal 73
greater > 516 output 626
greater_equal >= 516 hiding
grouping of exceptions 358 information 27
growing system 711 name 82
gslice 677 hierarchies, interface 708
gslice_array 677 hierarchy 732
guarantees, standard 827 class 38, 389
class 15, 307, 734
design, class 314
H exception 385
navigation, class 411
.h
object 739, 748
file 201
reorganization of class 707
header 821
stream 637
hack, struct 809
traditional 315
half-open sequence 512
higher-order function 518
handle
high-level language 7
class 782
Histogram 455
intrusive 783
horizontal tab \t 830
handler, exception 812
how to start a design 708
hardware 75
human activity, programming as a 693
has-a 741
hybrid design 718
has_denorm 659
has_denorm_loss 659
hash
function 502
I
function, hash_map 497 ideas, real-world as source of 734
table 497 identifier 81
hashing 502 identity() example 531
hash_map 497 IEC-559, is_iec559 659
delete from 501 if
equality 497 statement 133
hash function 497 switch and 134
lookup 500 _if suffix 525
representation 498 #ifdef 162
resize() 502 #ifndef 216

The C++ Programming Language, Third Edition by Bjarne Stroustrup. Copyright ©1997 by AT&T.
Published by Addison Wesley Longman, Inc. ISBN 0-201-88954-4. All rights reserved.
– I– Index 889

ifstream 638 containment and 740


ignore() 618 data abstraction vs 727
imag() 679– 680 dependency 737
imbue() 645, 647, 650 diamond-shaped 399
imbue_event 651 implementation 400, 743
imbue_event, imbue() 651 interface 400, 743
implementation multiple 308, 390, 735
alternative 320 template and 347
and interface 317 using multiple 399
dependency type of integer literal 832 using-declaration and 392
inheritance 400, 743 using-directive and 392
interface and 224, 314, 399, 758, 771 initialization 79, 226, 244
iterator 59 and cleanup 364
of I/O 606 and goto, difference from C 818
of RTTI 409 assignment and 283
of container 465 cerr 637
of dynamic_cast 409 cin 637
of virtual function 36 clog 637
pre-standard 820 constructor and C-style 270
priority_queue 478 cout 637
stack 475– 476 difference from C jump past 818
stage 697 library 640
implementation-defined 827 main() and 217
implicit member 248
conversion 275, 281, 284 of array by string 89
conversion of string 590 of base class 306
type conversion 76, 276, 833 of global 217
implicit_cast 335 of reference 98
in core formatting 641 of structure 102
In 511 order of member 247
in open for reading 639 reference member 244, 250
in_avail() 644, 646 run-time 217
in-class initializer
definition 235 array 89
definition of constant 249 for-statement 825
#include guard 216 list, constructor and 270
include directory, standard 201 member 247
#include 27, 117, 183, 201 initiative 695
includes() 542 inline
inclusion, template 350 and linkage 199
increment function 144
and decrement 291 member function 235
operator ++ 125 inner product 684
incremental change 684 inner_product() 683
indentation 138 innovation 717
independent concept 327 inplace_merge() 541
index 454 input
indirect_array 679 and output 432, 605
indirection 290 and output, C 651
individual 716 and output, connection between 623
inertia, organizational 713 bitset 495
infinity() 659 char 618
information hiding 27 cin >> 50, 112
inheritance 39, 303, 307, 703 complex 680
and design 707 example of 114
and template 349 from file 637

The C++ Programming Language, Third Edition by Bjarne Stroustrup. Copyright ©1997 by AT&T.
Published by Addison Wesley Longman, Inc. ISBN 0-201-88954-4. All rights reserved.
890 Index – I–

into container 451 type 70


into vector 451 integration 728
iterator 550 integrity of design 716
manipulator 632 interface
of bool 615 alternative 173
of built-in type 614 and implementation 224, 314, 399, 758, 771
of char 615 changing 774
of pointer 615 class 778
of user-defined type 621 exception and 375
sequence 513 fat 439, 761
string 598 hierarchies 708
unbuffered 642 implementation and 317
unformatted 618 inheritance 400, 743
valarray 668 module and 165
width() of 616 multiple 172
input_iterator_tag 553 public and protected 645
insert() 55 specifying 707
[] and 488 internal
into map 487 linkage 199
into vector 452 structure 694
string 592 internal 625, 630
inserter, << 608 internal() 634
inserter() 555 INT_MAX 660
insertion, overwriting vs 555 introducing C++ 718
insert_iterator 555 intrusive
inspector const function 706 container 438
inspiration 734 handle 783
instantiate used function only 866 int_type 608
instantiation int_type(), char_traits 581
context of template 860 invalid_argument and bitset() 385
directive, template 866 invariant 748
explicit template 866 checking 749
multiple 867 I/O 47, 50
point of 863 buffering 645
template 859 design 605
int 73, 76 exception 622
bits in 658 extensible 605
implicit, difference from C 817 implementation of 606
largest 658 iterator and 60
output bits of 495 object 774
smallest 658 sentry 624
integer system, organization of 606
conversion 834 type safe 607
conversion, signed unsigned 834 unbuffered 647
enum and 77 wide character 608
format of 649 Io example 776
literal 73, 76 Io_circle example 775
literal, implementation dependency type of 832 iocopy() example 617
literal, type of 832 <iomanip> 432, 633
output 627 Io_obj example 774
type 70, 73 <ios> 432, 608
type, conversion to 835 ios 625, 822
value 0, null 830 ios_base 626, 628– 629, 650
integral format state 606
conversion to 835 iosbase::Init example 639
promotion 833 <iosfwd> 432, 607

The C++ Programming Language, Third Edition by Bjarne Stroustrup. Copyright ©1997 by AT&T.
Published by Addison Wesley Longman, Inc. ISBN 0-201-88954-4. All rights reserved.
– I– Index 891

iostate 617, 822 STL 441


io_state 822 Sink 532
<iostream> 46, 432, 609, 614 [] 551
<istream> and 613 abstract 435
<ostream> and 608 and I/O 60
iostream 637 and sequence 550
sentry 624 begin() 444
is-a 741 bidirectional 550
isalnum() 601 category 553
isalpha() 113, 601 checked 561
is_bounded 659 const 443
iscntrl() 601 cont 508
isdigit() 601 container 464
Iseq 513 container and 435, 444
iseq() example 513 end() 444
is_exact 659 forward 550
isgraph() 601 forward and output 554
is_iec559 IEC-559 659 implementation 59
is_integer 658 input 550
islower() 601 istream and 559
is_modulo 659 istreambuf 559
ISO map 481
646 829 naming convention 511
C++ 11 operation 551
isprint() 601 ostream and 558
is_signed 658 ostreambuf 560
isspace() 601, 615 output 550
whitespace 114 random-access 550
is_specialized 658 rbegin() 444
<istream> 432 read through 551
and <iostream> 613 rend() 444
istream 614, 643 reverse 443, 557
>> 614 stream 558
and iterator 559 string 584
istreambuf iterator 559 user-defined 561
istreambuf_iterator 559 valarray 670
istream_iterator 60, 559 valid 550
istringstream 641 write through 551
istrstream 656 <iterator> 432
isupper() 601 iterator 54, 443, 480
isxdigit() 601 basic_string 583
iterator 57, 549 iterator_category 552
!= 551 iterator_traits 552
* 551 iter_swap() 538
+ 551 itoa() 155
++ 551 Itor 435
+= 551 Ival_box example 315, 407
- 551 Ival_slider 399
-- 551 iword() 650
-= 551
-> 551
< 551 J
<= 551
jump past initialization, difference from C 818
== 551
> 551
>= 551

The C++ Programming Language, Third Edition by Bjarne Stroustrup. Copyright ©1997 by AT&T.
Published by Addison Wesley Longman, Inc. ISBN 0-201-88954-4. All rights reserved.
892 Index – K–

K ldexp() 660
ldiv() 661
keeping consistent declarations 201
ldiv_t 661
Kernighan and Ritchie 654
leaf class 774
key 55
learning
and value 480
C and 7
key,
C++ 6, 718, 820
duplicate 480, 490
C++, gradual approach to 7
unique 480
left 625, 630
key_comp() 485
left() 634
key_compare 480, 485
legacy 708
key_type 480
length of valarray 664, 679
keyword 793– 794
length()
and 829
char_traits 581
and_eq 829
of string 598
bitand 829
string 586
bitor 829
less 515
compl 829
< 516
not 829
less_equal <= 516
not_eq 829
less_than 519
or 829
levels of abstraction 733
or_eq 829
lexical conventions 794
xor 829
lexicographical_compare() of sequence 544
xor_eq 829
libraries, standard 700
kind
library 15, 701, 714, 755
of class 765
C standard 599
of container 461
algorithms, standard 64
kinds of object 244
container, standard 56
Knuth, Donald 713
facilities, standard 66, 429
first C++ 686
L header, standard 202
initialization 640
L’, wide-character literal 73 language and 45
labs() 661 non-standard 45
lack of modularity 309 standard 45, 182
language standard – see standard library
and library 45 lifetime
design and 724 of object 84
gap between design and 725 of temporary 254
high-level 7 limits, numeric 658
low-level 8 <limits> 433, 658
people and machines 9 <limits.h> 433, 660
programming 15 line, read 618
programming styles technique 6 linear time 464
support 433– 434 Link 394
large linkage
character set 831 and namespace 207
program 211– 212 and pointer to function 207
programs and C++ 9 const and 199
largest int 658 error 199
last element 445 external 199
last-time switch 640 inline and 199
Latin-1 580 internal 199
lattice, class 389 to C 205
layout, array 669 type-safe 198
lazy evaluation 707 linker 198

The C++ Programming Language, Third Edition by Bjarne Stroustrup. Copyright ©1997 by AT&T.
Published by Addison Wesley Longman, Inc. ISBN 0-201-88954-4. All rights reserved.
– L– Index 893

Liskov substitution 743 operators, bitwise 124


Lisp 725 or operator || 123
list structure of program 198
of operator functions 262 logical_and && 516
operation 452 logical_not 515
<list> 431 ! 516
List 435 logical_or || 516
list 54 long namespace name 178
doubly-linked 470 long 73
element access 472 long double 74
merge() algorithm and 541 longer term 699
merge() stable 470 lookup, hash_map 500
remove() 472 loop
remove_if() 472 and error 523
reverse() 472 merging 675
sort() stable 470 statement 116
unique() 472 lower_bound() 540
literal in map 485
’, character 73 low-level language 8
L’, wide-character 73 lt(), char_traits 581
floating-point 74 lvalue 84, 264, 281
implementation dependency type of integer 832 lying 705
integer 73, 76
of user-defined type 273
string 294 M
string 46, 90
machines, language people and 9
type of integer 832
macro 160
loader 198
alternative to 161
local
macros, difference from C 818
fix 697
main() 46, 116, 218
scope 82
and initialization 217
static 145
argv argc 117
static store 251
exception and 54
variable, constructor for 245
maintenance 212
<locale> 433, 649
software 712
locale 649
make_heap() 543
POSIX 649
make_pair() 482
classic() 649
malloc() 577
format information 606
management 713
global() 649
memory 843
locale() 649
manipulator
<locale.h> 433, 650
input 632
locality 212
output 631
localization of object creation 322
standard 633
locking 366, 785
user-defined 635
Lock_ptr example 366
with argument 633
log() 660
mantissa, size of 659
complex 680
manual overload resolution 151
valarray 667
map 480
log10() 660
<map> 431
complex 680
map 55, 480
valarray 667
= 484
logarithmic time 464
[] 482
logical
assignment 484
and operator && 123
comparison in 484
const, physical and 231
constructor 484

The C++ Programming Language, Third Edition by Bjarne Stroustrup. Copyright ©1997 by AT&T.
Published by Addison Wesley Longman, Inc. ISBN 0-201-88954-4. All rights reserved.
894 Index – M–

count() in 485 function, algorithm and 520


element access 482 function, const 229
equal_range() in 485 function, inline 235
erase() from 487 function, pointer to 418
find() in 485 function, static 278
insert() into 487 initialization 248
iterator 481 initialization, exception and 373
lower_bound() in 485 initialization, order of 247
member type 480 initialization, reference 244, 250
modify a 487 initializer 247
subscripting 482 object 244
upper_bound() in 485 object, union 244
use of 774 of base class, private 305
mapped type, value 55 of derived class 304
mapped_type 480 of template, static 854
mapping exception 378 or base 740
Marian 79 or pointer 738
masks_array 678 pointer to data 853
Math_container example 346 private class 225
mathematical protected 404– 405
functions, complex 680 public class 225
functions, standard 660 reference 740
functions, valarray 667 static 228, 421
functions, vector 667 template 330
model 711 template example: 349
<math.h> 434, 660 template, missing 823
Matrix 672 type, basic_string 582
example 282 type, map 480
max() 544, 658 type, vector 442
valarray 664 union 257, 843
max_element() of sequence 544 member-declaration 808
max_exponent 659 memberwise copy 283
max_exponent10 659 memchr() 577
max_size() 455, 489 memcmp() 577
of string 598 memcpy() 577
meaning for operator, predefined 264 mem_fun() 63, 518, 521
means, aims and 694 mem_fun1_ref_t 518, 521
measurement, productivity 716 mem_fun1_t 518, 521
member mem_fun_ref() 518, 521
->*, pointer to 418 mem_fun_ref_t 518, 521
.*, pointer to 418 mem_fun_t 518, 520– 521
::*, pointer to 418 memmove() 577
access operator -> 102 memory
access operator . 101 automatic 843
access to 849 buffer 575
and nonmember operators 267 dynamic 127, 576, 843
class 293 fragmentation 846
class, access to 851 heap 843
class, forward declaration of 293 management 843
const 249 management, automatic 844
constant 249 management, container 455, 567
constructor for class 247 management, example of user-defined 292
enum 249 stack 843
friend and 265, 280 static 843
function 224, 238 uninitialized 574
function adapter 520 <memory> 431, 574

The C++ Programming Language, Third Edition by Bjarne Stroustrup. Copyright ©1997 by AT&T.
Published by Addison Wesley Longman, Inc. ISBN 0-201-88954-4. All rights reserved.
– M– Index 895

memset() 577 multidimensional


merge() 541 array 668, 677, 836
algorithm and list 541 array, passing 839
stable, list 470 multilevel error handling 383
message queue 477 multimap 490
method 310 multi-method 326
choosing a design 696 multiple
choosing an analysis 696 inheritance 308, 390, 735
cookbook 692 inheritance, exception and 360
design 694 inheritance, use of 776
methods, formal 711 inheritance, using 399
min() 544, 658 instantiation 867
valarray 664 interface 172
min_element() of sequence 544 multiple-inheritance
min_exponent 659 access control and 406
min_exponent10 659 ambiguity resolution 391
minimalism 706 multiplies * 517
minimize dependency 173 multiset 491
minus - 517 mutable 232
mismatch() 516, 527 mutual reference 278
missing
bad_alloc 823
checking, late 823 N
member template 823
\n, newline 830
namespace 822
name 81
specialization partial 823
binding 860
standard library 822
binding, template 859
mis-use
characters in 81
of RTTI 439
clash 176
of dynamic type checking 439
hiding 82
misuse
long namespace 178
of C++ 725
namespace qualified 169
of RTTI 417
short namespace 178
mixed-mode arithmetic 268
names, reserved 81
mixin 402
namespace
mixing C and C++ 719
nested 848
ML 10
transition to 182
mode of file 639
namespace 27, 167, 847
model
alias 178
formal 730
and :: 169
mathematical 711
and class 849
waterfall 697
and overloading 183
models 708
composition 179
modf() 660
composition of 181
modifier 706
global 847
modify a map 487
helper function and 240
modifying sequence algorithm 529
is open 184
modular programming 26
linkage and 207
modularity 312
member declaration and definition 167
lack of 309
missing 822
module
name, long 178
and interface 165
name, short 178
and type 30
operators and 265
modulus % 517
purpose of 180
moron 713, 717
qualified name 169
move(), char_traits 581
relops 468

The C++ Programming Language, Third Edition by Bjarne Stroustrup. Copyright ©1997 by AT&T.
Published by Addison Wesley Longman, Inc. ISBN 0-201-88954-4. All rights reserved.
896 Index – N–

selection from 180 not1() 518


std 46 and unary_negate 522
unnamed 177, 200 not2() 518
using 183 and binary_negate 522
naming convention, iterator 511 notation, value of 261
narrow() 645 not_eof(), char_traits 581
n-ary operators 675 not_eq keyword 829
national not_equal_to != 516
character 829 nothrow 576
conventions 649 allocator 823
natural operation 767 nouppercase() 634
NDEBUG 750 npos 586
negate - 517 nth_element() 540
nested null
class 293 0 zero 88
function 806 integer value 0 830
namespace 848 NULL 88, 433
nesting 756 number, size of 75
<new> 384, 433, 576 numeric
new algorithm, generalized 682
and array 423 arrays 662
and exception 576 limits 658
bad_alloc and 384 <numeric> 434, 682
exception and 367, 369 numerical computation 64
operator 127 numeric_limits 658
placement 255
size and 421
new() O
operator 129, 576
O notation 464
placement 576
object 32, 84
new[](), operator 423, 576
I/O 774
new_handler 129, 576
array element 244
_new_handler 370
automatic 244
newline \n 830
constructor for free store 246
next_permutation() 545
creation 242
Nicholas 49
creation, localization of 322
noboolalpha() 633
format 635
Nocase 467
free store 244
node
function 287, 514, 776
class 772
global 244, 252
class, abstract 774
hierarchy 739, 748
class, concrete 774
kinds of 244
non-C++ program 217
lifetime of 84
none() 494
member 244
nonlocal goto 357
placement of 255
nonmember operators, member and 267
real-world 732
nonmodifying sequence algorithm 523
state of 748
non-standard library 45
static 244
non-type template parameter 331
temporary 244, 254
norm() 680
union member 244
noshowbase() 634
variably-sized 243
noshowpoint() 634
Object 438
noshowpos() 634
example 417
noskipws() 634
object-oriented
not a class 705
design 692, 726
not keyword 829
programming 37– 38, 301

The C++ Programming Language, Third Edition by Bjarne Stroustrup. Copyright ©1997 by AT&T.
Published by Addison Wesley Longman, Inc. ISBN 0-201-88954-4. All rights reserved.
– O– Index 897

pure 732 :: and virtual function 312


objects ::, scope resolution 82, 228
array of 250 <<, output 607
global 640 =, user-defined 281
oct 626– 627 ^, bitwise exclusive or 124
oct() 634 and built-in type, user-defined 265
octal 73 and enum, user-defined 265
output 626 assignment 110, 268
ODR the one-definition-rule 203 associativity of 121
offset, pointer to member and 419 binding strength 121, 607
off_type 608, 643 composite 268
char_traits 581 declarator 80
ofstream 638 delete 127
old-style function definition 817 design of access 295
one right way 693 foundation 706
one-beyond-last 512 new 127
one-definition-rule, ODR the 203 overloaded 241
Op 511 overloading, example of 292
open precedence 121
for reading, in 639 predefined meaning for 264
for writing, out 639 stack 450
namespace is 184 summary 119
opening of file 638 ternary 636
openmode 639 type conversion 275
operation user-defined 263
bitset 494 user-defined binary 263
efficiency of 464 user-defined unary 263
front 472 |, bitwise or 124
iterator 551 ||, logical or 123
list 452 operator
natural 767 delete() 129, 576
on container 464 delete[]() 423, 576
operations functions, list of 262
complex 679 new() 129, 576
on references 97 new[]() 423, 576
on structure 102 void*() 616
selecting 705 operator() 287
set of class 237 operator[] 286
valarray 664, 667 operator 810
vector 664, 667 operators
operator and namespace 265
, 123 bitwise logical 124
&, bitwise and 124 essential 283
&&, logical and 123 member and nonmember 267
+, user-defined 281 n-ary 675
++, increment 125 optimal container 435
++, user-defined 264, 291 optimization 675
+= 109 or
+=, user-defined 264, 268, 281 keyword 829
--, decrement 125 operator |, bitwise 124
--, user-defined 291 operator ||, logical 123
-= 109 order 467
->, member access 102 of construction 248, 252
->, user-defined 289 of evaluation 122
., member access 101 of fields 75
:: 305 of member initialization 247

The C++ Programming Language, Third Edition by Bjarne Stroustrup. Copyright ©1997 by AT&T.
Published by Addison Wesley Longman, Inc. ISBN 0-201-88954-4. All rights reserved.
898 Index – O–

of specialization 343 padding 625


or construction and destruction 414 sequence 556
or_eq keyword 829 string 598
organization to file 637
of I/O system 606 unbuffered 642
standard library 431 valarray 668
organizational inertia 713 why, << for 607
orthogonality, convenience and 431 output_iterator_tag 553
oseq() example 556 overflow, stack 476
<ostream> 432 overflow() 647
and <iostream> 608 overflow_error and to_ulong() 385
ostream 608, 642 overhead 8
<< 609 overlapping sequences 529
and buffer 642 overload
and iterator 558 resolution 149
and streambuf 642 resolution, manual 151
put() 609 return type and 151
template and 608 scope and 151
write() 609 overloaded
ostreambuf iterator 560 function name 149
ostreambuf_iterator 560 operator 241
ostream_iterator 60, 558 overloading
ostringstream 641 const and 600
ostrstream 656 example of operator 292
Out 511 function template 336
out open for writing 639 namespace and 183
out_of_range 53, 446 override 313
and at() 385 private base 738
string 586 overriding 395
output 47 from virtual base class 401
C input and 651 function, type of 424
bits of int 495 overwriting vs insertion 555
bitset 495
complex 680
connection between input and 623 P
cout << 46
padding 630
decimal 626
output 625
double 626
pair 482
field 629– 630
paradigm, programming 22
float 626
parameter
floating point 626, 628
non-type template 331
flushing of 626
template 331
formatted 625
parameterization
function, virtual 612
policy 757
hexadecimal 626
template 707
input and 432, 605
parametric polymorphism 347
integer 627
parentheses, uses of 123
iterator 550
parser, recursive decent 108
manipulator 631
partial
octal 626
sort 539
of bool 610
specialization 342
of built-in type 609
partial_sort() 539
of char 610
partial_sort_copy() 539
of pointer 611
partial_sum() 684
of user-defined type 612
partition 542
operator << 607
partition() 542

The C++ Programming Language, Third Edition by Bjarne Stroustrup. Copyright ©1997 by AT&T.
Published by Addison Wesley Longman, Inc. ISBN 0-201-88954-4. All rights reserved.
– P– Index 899

partitioning of program 208, 211 to member and offset 419


passing multidimensional array 839 to member function 418
pattern 709 to void 100
specialization 342 type 569
pbackfail() 647 pointer 443, 552, 567
pbase() 645 basic_string 583
pbump() 645 pointers and union 845
peek() 643 pointer_to_binary_function 521
people and machines, language 9 pointer_to_unary_function 518, 521
perfection 43 polar() 680
permutation 545 policy parameterization 757
per-object data 573 polymorphic 35
per-type data 573 object, algorithm and 63
phone_book example 52 polymorphism 158, 312
physical algorithm and 520
and logical const 231 compile-time 347
structure of program 198 container and 520
placement dynamic_cast and 409
new 255 parametric 347
new() 576 run-time 347
of object 255 see virtual function
Plane example 729 Pool example 570
plug analogy 728 Pool_alloc allocator 572
plus + 517 pop()
point of priority_queue 478
of declaration 82 of queue 476
of definition 861 of stack 475
of instantiation 863 pop_back() 450
pointer 26, 87 pop_front() 472
and array 91, 147 pop_heap() 543
arithmetic 88, 93, 125 portability 9, 700, 828
checked 291 and features 815
checking for, wild 722 position
const 96 bit 492
conversion 834 in buffer 642
conversion, user-defined 349 in file 642
disguised 844 POSIX locale 649
input of 615 postcondition 753
member or 738 pos_type 608, 643
output of 611 char_traits 581
semantics 294 pow() 660
size of 75 complex 680
smart 289, 291 valarray 667
to class 304 pptr() 645
to class, conversion of 304 precedence
to const 96 << 608
to constructor 424 operator 121
to data member 853 precision() 628
to function 156 precondition 753
to function, << of 631 Pred 511
to function, >> of 632 predefined
to function adapter 521 , 264
to function, linkage and 207 & 264
to member ->* 418 = 264
to member .* 418 meaning for operator 264
to member ::* 418 predicate 61, 63, 515

The C++ Programming Language, Third Edition by Bjarne Stroustrup. Copyright ©1997 by AT&T.
Published by Addison Wesley Longman, Inc. ISBN 0-201-88954-4. All rights reserved.
900 Index – P–

standard library 516 language 15


user-defined 516 language, design language and 730
prefix code 624 modular 26
preprocessing directive # 813 object-oriented 37– 38, 301
presentation as design tool 704 paradigm 22
pre-standard implementation 820 procedural 23
prev_permutation() 545 purpose of 694
printf() 651 style 22
priority queue 478 styles technique language 6
priority_queue template and generic 327
and heap 479 programming-language, general-purpose 21
heap and 543 prohibiting
implementation 478 , 264
pop() of 478 & 264
push() of 478 = 264
top() of 478 promotion
private floating-point 833
class member 225 integral 833
member of base class 305 standard 833
private 402 proof by analogy 692
base 405, 742 properties of C++ 724
base class 743 protected 402
base, override 738 base 319, 405
public protected 849– 850 base class 743
private: 234 interface, public and 645
problems member 404– 405
of scale 715 private, public 849– 850
with concrete type 37 protection 226
procedural unit of 754
programming 23 prototypes 710
programming and C++ 725 proxy 785
process, development 696 Ptr 349
product ptrdiff_t 122, 433
dot 684 ptrfun() 518
inner 684 ptr_fun() 521
productivity measurement 716 pubimbue() 646
program 46, 798 public class member 225
large 211– 212 public 402
logical structure of 198 and protected interface 645
non-C++ 217 protected private 849– 850
partitioning of 208, 211 public: 225, 234
physical structure of 198 pubseekoff()
size of 8 pubseekpos()
start 217 pubsetbuf() 646
structure of 8 pubsync() 646
termination 218 pure
programmed-in relationship 746 object-oriented 732
programmer virtual function 313
C 14 purpose
C++ 14 of namespace 180
programmers, eliminating 730 of programming 694
programming 16 push()
and C++, procedural 725 of priority_queue 478
as a human activity 693 of queue 476
design and 692 of stack 475
generic 40, 757– 758 push_back() 55, 450

The C++ Programming Language, Third Edition by Bjarne Stroustrup. Copyright ©1997 by AT&T.
Published by Addison Wesley Longman, Inc. ISBN 0-201-88954-4. All rights reserved.
– P– Index 901

and realloc() 451 checking Vec 53


push_front() 55, 472 error 661
push_heap() 543 sequence and 512
put Range example 781
area 645 Rational example 747
to, << 607 raw storage 574
put(), ostream 609 raw_storage_iterator 575
putback() 643 rbegin() 481
pword() 650 basicstring 584
iterator 444
rdbuf() 644
Q rdstate() 616
read
qsort() 158, 546
line 618
and exception 382
through iterator 551
quadratic time 464
read() 618
qualification ::, explicit 847
readsome() 643
qualified name, namespace 169
real() 679– 680
qualifier, template as 858
realloc() 577
quality 717
push_back() and 451
queue
real-world
deque, double-ended 474
as source of ideas 734
priority 478
classes and 734
<queue> 431
object 732
queue
rebind 567
back() of 476
use of 569
front() of 476
recursion 148
message 477
recursive
pop() of 476
decent parser 108
push() of 476
function, exception and 374
quiet_NaN() 659
reduce 683
quote
reduction 683
\’, single 830
redundancy 712
double 830
reference 97
quotient 661
argument 98
call by 98, 146
R call-by 282
count 292
\r, carriage return 830 counting 783
Ran 511 dynamic_cast to 410
rand(), random number 685 example of 292
Randint 685 initialization of 98
RAND_MAX 685 member 740
random member initialization 244, 250
number 538 mutual 278
number class 685 return by 148
number generator 537 return by 283
number rand() 685 to class, forward 278
random-access iterator 550 reference 443, 480, 552, 567
random_access_iterator_tag 553 basic_string 583
random_shuffle() 537 to bit 492
range references, operations on 97
check 445, 561 register 806
check of string 584 register_callback() 651
check, valarray 664 reinterpret_cast 130, 256
checking 275, 781 relationship, programmed-in 746

The C++ Programming Language, Third Edition by Bjarne Stroustrup. Copyright ©1997 by AT&T.
Published by Addison Wesley Longman, Inc. ISBN 0-201-88954-4. All rights reserved.
902 Index – R–

relationships between templates 348 type, relaxation of 424


relaxation of return type 424 value 283
release, resource 364 value, algorithm 508
reliability 383 value type check 148
relops, namespace 468 value type conversion 148
remainder 661 return
remove() 536 alternative 357
list 472 by reference 148
remove_copy_if() 536 by value 148
remove_if() 536 function value 148
list 472 of void expression 148
renaming virtual function 778 return; 148
rend() 481 return_temporary_buffer() 575
basicstring 584 reuse 714
iterator 444 design 709
reorganization of class hierarchy 707 of concrete type 241
replace() 535 of concrete type 768
in string 595 reverse iterator 443, 557
replace_copy() 535 reverse() 537
replace_copy_if() 535 list 472
replace_if() 535 reverse_copy() 537
replicated base class 394 reverse_iterator 443, 480, 557
representation basic_string 583
hash_map 498 reward 713
of container 465 rfind() in string 594
requirement right 625, 630
comparison 467 right() 634
copy 466 Ritchie, Kernighan and 654
requirements for element 466 rotate() 537
reserve() 455 rotate_copy() 537
reserved names 81 round_error() 659
reset() bitset 494 RTTI 407
resetiosflags() 634 implementation of 409
resize() 52, 455 mis-use of 439
hash_map 502 misuse of 417
of string 598 use of 417
of valarray 664 rule of two 741
valarray 666 run time support 8
resource run-time
acquisition 364 access control 785
exhaustion 369 error 29, 355
release 364 initialization 217
response to change 698 polymorphism 347
responsibility 700, 706 type identification 407
restricted character set 829 type information 407, 774
restriction 9
result
of sizeof 122 S
type 122
Saab example 728
resumption 370
safety, convenience vs. 847
re-throw 362, 379
Satellite 390
return
saving space 840
\r, carriage 830
sbumpc() 646
by reference 283
scale 212, 692
type and overload 151
problems of 715
type of virtual 424
scaling 665

The C++ Programming Language, Third Edition by Bjarne Stroustrup. Copyright ©1997 by AT&T.
Published by Addison Wesley Longman, Inc. ISBN 0-201-88954-4. All rights reserved.
– S– Index 903

scientific 626, 628 max_element() of 544


scientific() 634 min_element() of 544
scope 278 output 556
and overload 151 set operation on 542
difference from C 816 sorted 539
global 82, 847 string 579
local 82 sequences, overlapping 529
resolution operator :: 82, 228 set 124
scrollbar example 743 of class operations 237
search, binary 540, 546 operation on sequence 542
search() 528 position, seekp()
search_n() 528 <set> 431
seekdir Set example 769
and beg 643 set 491
and cur 643 bitset and 492
and end 643 of Shape* 348
direction of seek set()
seekg() bitset 494
direction of 643 function 759
seekoff() setbase() 634
seekp() setbuf() 647
direction of 643 Set_controller example 785
set position 642 set_difference() 543
seekpos() setf() 626, 630
selecting operations 705 setfill() 634
selection from namespace 180 setg() 645
self, assignment to 246 set_intersection() 542
self-reference this 230 setiosflags() 634
semantics <setjmp.h> 433
pointer 294 set_new_handler() 129, 576
value 294 setp() 645
sentry setprecision() 633– 634
I/O 624 setstate() 616
iostream 624 set_symmetric_difference() 543
separate set_terminate() 380
compilation 27, 198 set_unexpected() 379
compilation, template 351 set_union() 542
separation of concerns 694 setw() 634
sequence 41, 469 sgetc() 646
add element to 529 sgetn() 646
adding to 555 Shakespeare 709
algorithm and 508 Shape
algorithm, modifying 529 example 774
algorithm, nonmodifying 523 example 37
and associative container 461 example (bad) 417
and container 512 Shape*, set of 348
and range 512 shift() 664
change size of 529 short namespace name 178
delete element from 529, 534 short 73
error 512 short-circuit evaluation 123, 134
fundamental 469 showbase 626, 628
generality of 512 showbase() 634
half-open 512 showmanyc() 647
input 513 showpoint 626
iterator and 550 showpoint() 634
lexicographical_compare() of 544 showpos 626

The C++ Programming Language, Third Edition by Bjarne Stroustrup. Copyright ©1997 by AT&T.
Published by Addison Wesley Longman, Inc. ISBN 0-201-88954-4. All rights reserved.
904 Index – S–

showpos() 634 smanip 633


shuffle 538 smart pointer 289, 291
sign extension 831 snextc() 646
signal 357 software
<signal.h> 157, 433 development 692
signaling_NaN() 659 maintenance 712
signed solution, generality of 701
char 831 sort 546
type 73 partial 539
unsigned integer conversion 834 stable 539
Simula 10, 38 sort() 56, 539
Simula-style container 438 example 158, 334
simulation 685, 711 stable, list 470
event driven 326 sorted sequence 539
sin() 660 sort_heap() 543
complex 680 sorting 338
valarray 667 criteria 534
single quote \’ 830 source
sinh() 660 code, template 350
complex 680 file 197
valarray 667 of ideas, real-world as 734
Sink iterator 532 space, saving 840
size special character 830
and delete 421 specialization 859
and new 421 and char* 344
of exponent 659 and void* 341
of mantissa 659 function 344
of number 75 generated 859
of pointer 75 order of 343
of program 8 partial 342
of sequence, change 529 partial, missing 823
of string 147 pattern 342
of structure 102 template 341
size() 455, 489, 494 use of 865
of string 598 user 859
of valarray 664 specialized, more 343
string 586 specifying interface 707
sizeof 75 splice() 470
difference from C 816 sputbackc() 646
enum 78 sputc() 646
result of 122 sputn() 646
size_t 122, 433 sqrt() 660
-1 and 448 complex 680
size_type 443, 480 valarray 667
basic_string 583 srand() 685
skipws 625 <sstream> 119, 432, 640
skipws() 634 stability of design 708
slice, generalized 677 stable
slice 664, 668 list merge() 470
slice_array 671 list sort() 470
Slice_iter example 670 sort 539
slicing 307 stable_partition() 542
smallest int 658 stable_sort() 539
Smalltalk 725 stack
style 417 memory 843
Smalltalk-style container 438 operator 450

The C++ Programming Language, Third Edition by Bjarne Stroustrup. Copyright ©1997 by AT&T.
Published by Addison Wesley Longman, Inc. ISBN 0-201-88954-4. All rights reserved.
– S– Index 905

<stack> 431 while 136


Stack example 27 statement 802
stack state_type, char_traits 581
implementation 475– 476 static
overflow 476 memory 843
pop() of 475 type checking 727
push() of 475 static
top() of 475 anachronism 200
underflow 476 deprecated 818
stage local 145
analysis 697 member 228, 421
design 697 member function 278
development 697 member of template 854
implementation 697 object 244
standard store, local 251
component 698, 714 static_cast 130, 159
exception 384 dynamic_cast and 413
guarantees 827 std, namespace 46
header 431 std:: 46
include directory 201 <stdarg.h> 155, 433
libraries 700 <stddef> 433
library 45, 182 <stddef.h> 433
library, C 599 <stdexcept> 385, 432
library, adding to 434 <stdio.h> 182, 202, 432
library algorithms 64 <stdlib.h> 432, 434, 546, 577, 600, 661
library container 56 steps, design 701
library criteria 430 STL 66
library design 429– 430 container 441
library facilities 66, 429 iterator 441
library header 202 Storable example 396
library, missing 822 storage
library organization 431 class 244
library predicate 516 raw 574
manipulator 633 store
mathematical functions 660 dynamic 34
promotion 833 free 34, 127, 421, 576, 843
standardization, C++ 11 heap 127
standard-library container 442 local static 251
start, program 217 strcat() 599
starting from scratch 708 strchr() 599
state strcmp() 599
format 625 strcpy() 599
machine 730 strcspn() 599
of object 748 stream 432
stream 616 callback 650
statement classes 637
break 116 closing of 639
continue 116 file and 637
controlled 136 hierarchy 637
do 114, 137 iterator 558
for 26, 136 state 616
goto 137 state, basic_ios 606
if 133 string 640– 641
loop 116 <streambuf> 432
summary 132 streambuf 646– 647, 649
switch 25, 133 << of 642

The C++ Programming Language, Third Edition by Bjarne Stroustrup. Copyright ©1997 by AT&T.
Published by Addison Wesley Longman, Inc. ISBN 0-201-88954-4. All rights reserved.
906 Index – S–

and character buffer 642 insert() 592


ostream and 642 iterator 584
streamoff 609 length() 586
streamsize 609 length() of 598
stride() 668 literal 294
string max_size() of 598
and const, C-style 90 of user-defined type 583
character 432 out_of_range 586
format 652 output 598
initialization of array by 89 range check of 584
literal 46, 90 replace() in 595
size of 147 resize() of 598
<string> 48, 432, 580 rfind() in 594
String example 328 sequence 579
string 48, 582 size() 586
!= 591 size() of 598
+ 593 stream 640– 641
+= 592 subscripting of 584
< 591 substr() of 596
<< 598 swap() 599
<= 591 unsigned 583
= 587 stringbuf 649
== 591 <string.h> 432, 577, 599
> 591 stringstream 641
>= 591 strlen() 599
>> 598 strncat() 599
[] on 584 strncmp() 599
algorithm and 584 strncpy() 599
and 0 587 strpbrk() 599
and C-style string 579 strrchr() 599
and C-style string 589 strstr() 599
and array 589 <strstream.h> 656
append() 592 struct 101
as container 491 and class 234
assign() 588 hack 809
assignment 587 name, difference from C 818
at() on 585 scope, difference from C 818
class 292 structure 101
compare() 590 initialization of 102
comparison 590 internal 694
concatenation 592– 593 of program 8
constructor 585 operations on 102
conversion 589 size of 102
design 579 style, programming 22
empty 585 subarray 663, 671, 677– 679
empty() 598 subarrays 668
erase() in 595 subclass 303
error 586 superclass and 39
find() in 594 subrange 781
find_first_not_of() in 594 subscript
find_first_of() in 594 C++ style 674
find_last_of() in 594 Fortran style 674
get_allocator() from 598 subscripting 445, 454
getline() into 598 comma and 838
implicit conversion of 590 map 482
input 598 of string 584

The C++ Programming Language, Third Edition by Bjarne Stroustrup. Copyright ©1997 by AT&T.
Published by Addison Wesley Longman, Inc. ISBN 0-201-88954-4. All rights reserved.
– S– Index 907

user-defined 286 complex 680


valarray 663 valarray 667
substitution, Liskov 743 Task 394
substr() of string 596 taxonomy 703
substring 596 teaching and C++ 12
Substring example 596 technique
subtype 743 built-in feature vs 43
subtyping 730, 742 language, programming styles 6
successful large system 709 tellg() 643
suffix tellp() get position 642
_copy 533 template, use of 776
_if 525 template 16, 40, 328, 854
code 624 and class 348
Sum 514 and friend 854
sum() of valarray 664 and generic programming 327
summary and inheritance 347
algorithm 509 and ostream 608
container 464 argument 331
syntax 793 argument, deducing 335, 855
sungetc() 646 argument, default 340, 824
superclass 303 argument, depend on 861
and subclass 39 argument, explicit 335
supplying default value 500 argument, function 335
support 714 as qualifier 858
run time 8 as template parameter 855
swap() 344, 457– 458, 489, 538 class hierarchy and 345
string 599 copy constructor and 348
swap_ranges() 538 definition, context of 860
switch example:, member 349
first-time 253, 640 function 334
last-time 640 in design 757
on type 417 inclusion 350
switch 109 inheritance and 349
and if 134 instantiation 859
on enumeration 77 instantiation, context of 860
statement 25, 133 instantiation directive 866
sync() 643, 647 instantiation, explicit 866
sync_with_stdio() 651 member 330
synonym, see typedef missing member 823
syntax name binding 859
<, template 811 overloading, function 336
summary 793 parameter 331
system parameter, non-type 331
growing 711 parameter, template as 855
successful large 709 parameterization 707
working 709 separate compilation 351
source code 350
specialization 341
T static member of 854
syntax < 811
\t, horizontal tab 830
template-declaration 811
tab
templates, relationships between 348
\t, horizontal 830
temporary 98
\v, vertical 830
elimination of 675
Table example 243
lifetime of 254
tan(), valarray 667
object 244, 254
tanh() 660

The C++ Programming Language, Third Edition by Bjarne Stroustrup. Copyright ©1997 by AT&T.
Published by Addison Wesley Longman, Inc. ISBN 0-201-88954-4. All rights reserved.
908 Index – T–

variable 244, 254 built-in 70


term, longer 699 char, character 71
terminate() 380 character 580
terminate_handler 380 check, function argument 145
termination 370 check, return value 148
program 218 checking, dynamic 727
ternary operator 636 checking, mis-use of dynamic 439
test() 494 checking, static 727
testing 712 class and 724
design for 712 class user-defined 224
this 278 concrete 33, 236, 766– 767
self-reference 230 constructor for built-in 131
throw 186, 362, 379 conversion, ambiguous 276
tie() 623 conversion, constructor and 269, 275
time conversion, explicit 130
constant 464 conversion, function argument 145
linear 464 conversion, implicit 76, 276, 833
logarithmic 464 conversion operator 275
quadratic 464 conversion, return value 148
<time.h> 431, 433 conversion, unions and 842
Tiny 275 conversion, user-defined 267, 281
tinyness_before 659 equivalence 104
to_char_type(), char_traits 581 floating point 74
to_int_type(), char_traits 581 fundamental 23, 70
tools, design 711 generator 348
top() identification, run-time 407
of priority_queue 478 information, extended 416
of stack 475 information, run-time 407, 774
to_ulong() 494 input of built-in 614
overflow_error and 385 input of user-defined 621
toupper() 591 integer 70, 73
traditional hierarchy 315 integral 70
traits, character 580 literal of user-defined 273
traits_type 608 module and 30
basic_string 583 of exception 379
transform() 530 of field 75
transition 717– 718 of integer literal 832
and using-directive 183 of integer literal, implementation dependency 832
to namespace 182 of overriding function 424
translation unit 197 of virtual, return 424
traps 659 output of built-in 609
traversal 61 output of user-defined 612
tree 307 pointer 569
trigraphs 829 problems with concrete 37
true and 1 71 relaxation of return 424
trunc truncate file 639 result 122
truncate file, trunc 639 reuse of concrete 241
truncation 835 safe I/O 607
try 187 signed 73
try-block 187, 812 string of user-defined 583
tutorial as design tool 708 switch on 417
two, rule of 741 unsigned 73
type 23, 69 user-defined 32, 70
abstract 34, 767, 769 user-defined operator and built-in 265
abstract and concrete 771 typedef 84
arithmetic 70 type-field 308

The C++ Programming Language, Third Edition by Bjarne Stroustrup. Copyright ©1997 by AT&T.
Published by Addison Wesley Longman, Inc. ISBN 0-201-88954-4. All rights reserved.
– T– Index 909

typeid() 414 of design 755


bad_typeid and 384 of protection 754
<typeinfo> 384, 415, 433 translation 197
type_info 414 unitbuf 626
typename 443, 856 united of addressing 88
type-safe linkage 198 units analogy 728
universal
base class 438
U character name 831
UNIX 8, 13
uflow() 647
unnamed
unary operator, user-defined 263
namespace 177, 200
unary_function 515
union 841
unary_negate 518
unsetf() 626
not1() and 522
unsigned
unbuffered
char 831
I/O 647
integer conversion, signed 834
input 642
string 583
output 642
type 73
uncaught exceptions 380
up cast 408
uncaught_exception() 373
upper_bound() 540
unchecked access 445
in map 485
undeclared argument 154
uppercase 626
#undef 162
uppercase() 634
undefined
Urand 685
behavior 828
use
enum conversion 77
case 704
underflow, stack 476
count 292
underflow() 647
dependency 745
unexpected exceptions 377
of C++ 12
unexpected() 375
of RTTI 417
unexpected_handler 379
of allocator 568
unformatted input 618
of class 725
unget() 643
of classes 733
Unicode 580
of dynamic_cast 774
uniform distribution 685
of global variable 111
uniformity of code 767
of map 774
uninitialized memory 574
of multiple inheritance 776
uninitialized_copy() 574
of rebind 569
uninitialized_fill() 574
of specialization 865
uninitialized_fill_n() 574
of template 776
union 841
used function only, instantiate 866
and class 843
user specialization 859
anonymous 841
user-defined
constructor and 257
+ 265
destructor and 257
== 534
member 257, 843
allocator 570
member object 244
binary operator 263
pointers and 845
container 497
unnamed 841
conversion 347
unions and type conversion 842
iterator 561
unique() 532
manipulator 635
list 472
memory management, example of 292
unique_copy() 56, 532
operator 263
unit
operator + 281
of allocation 88
operator ++ 264, 291
of compilation 197

The C++ Programming Language, Third Edition by Bjarne Stroustrup. Copyright ©1997 by AT&T.
Published by Addison Wesley Longman, Inc. ISBN 0-201-88954-4. All rights reserved.
910 Index – U–

operator += 264, 268, 281 / 667


operator -- 291 /= 664
operator -> 289 < 667
operator = 281 << 667
operator and built-in type 265 <<= 664
operator and enum 265 <= 667
pointer conversion 349 = 663
predicate 516 == 667
subscripting 286 > 667
type 32, 70 >= 667
type, class 224 >> 667
type conversion 267, 281 >>= 664
type, input of 621 [] 663
type, literal of 273 ^ 667
type, output of 612 ^= 664
type, string of 583 abs() 667
unary operator 263 acos() 667
user-supplied comparison 467 and array 663
uses of parentheses 123 and vector and array 662
using multiple inheritance 399 apply() to 664
using as container 492
namespace 183 asin() 667
namespace, using vs. 847 assignment 663
vs. using namespace 847 atan() 667
using-declaration 169, 180 atan2() 667
and access control 407 construction 662
and inheritance 392 cos() 667
vs. using-directive 847 cosh() 667
using-directive 171 exp() 667
and definition 180 input 668
and inheritance 392 iterator 670
transition and 183 length of 664, 679
using-declaration vs. 847 log() 667
usual arithmetic conversions 122 log10() 667
utilities 431 mathematical functions 667
<utility> 431, 468 max() 664
min() 664
operations 664, 667
V output 668
pow() 667
\v, vertical tab 830
range check 664
va_arg() 155
resize() 666
<valarray> 434, 662
resize() of 664
valarray 65, 662
sin() 667
! 664
sinh() 667
!= 667
size() of 664
% 667
sqrt() 667
%= 664
subscripting 663
& 667
sum() of 664
&& 667
tan() 667
&= 664
tanh() 667
* 667
| 667
*= 664
|= 664
+ 667
|| 667
+= 664
~ 664
- 664, 667
valid iterator 550
-= 664

The C++ Programming Language, Third Edition by Bjarne Stroustrup. Copyright ©1997 by AT&T.
Published by Addison Wesley Longman, Inc. ISBN 0-201-88954-4. All rights reserved.
– V– Index 911

value virtual 34
call by 146 << 612
default 239 base class 396
key and 480 base class, overriding from 401
mapped type 55 base, constructor and 397
of character 580 constructor 323, 424
of cin 276 derive without 780
of notation 261 destructor 319
return 283 function 310, 390, 706
return by 148 function argument types 310
return, function 148 function, definition of 310
semantics 294 function, example of 646
value_comp() 485 function, implementation of 36
value_compare 485 function, operator :: and 312
value_type 443, 480, 552 function, pure 313
basic_string 583 output function 612
variable return type of 424
constructor for global 252 vision 698
constructor for local 245 void 76
global 200, 228 expression, return of 148
temporary 244, 254 pointer to 100
variably-sized object 243 void*
Vec, range checking 53 assignment, difference from C 818
vector specialization and 341
Fortran 668 void*(), operator 616
arithmetic 65, 662 volatile 808
bit 124
exponentiation 667
mathematical functions 667 W
operations 664, 667
waterfall model 697
<vector> 431
wcerr 609
Vector 435
<wchar.h> 432
example 341, 780
wchar_t 72– 73
vector 52, 442, 469
wcin 614
< 457
wcout and 624
= 447
wclog 609
== 457
wcout 609
[] of 445
and wcin 624
and array, valarray and 662
wfilebuf 649
assign() 447
wfstream 638
constructor 447
while statement 136
erase() from 452
whitespace 614– 615
input into 451
isspace() 114
insert() into 452
wide
member type 442
character I/O 608
of bool 458
character classification 601
of vector 836
wide-character literal L’ 73
vector of 836
widen() 645
vector<bool> 458
width() 629
bitset and 492
of input 616
Vehicle example 734
wifstream 638
vertical tab \v 830
wild pointer checking for 722
viewgraph engineering 704
Window example 398
virtual
wiostream 637
function 15
wistream 614
function, renaming 778
wistringstream 641

The C++ Programming Language, Third Edition by Bjarne Stroustrup. Copyright ©1997 by AT&T.
Published by Addison Wesley Longman, Inc. ISBN 0-201-88954-4. All rights reserved.
912 Index – W–

wofstream 638
word 76
working system 709
wostream 608
wostringstream 641
wrapper 781
write through iterator 551
write(), ostream 609
ws 634
wstreambuf 649
wstring 582
wstringbuf 649
wstringstream 641
<wtype.h> 432

X
X3J16 11
xalloc() 650
xgetn() 647
xor keyword 829
xor_eq keyword 829
xputn() 647

Y
Year 285

Z
zero null, 0 88

The C++ Programming Language, Third Edition by Bjarne Stroustrup. Copyright ©1997 by AT&T.
Published by Addison Wesley Longman, Inc. ISBN 0-201-88954-4. All rights reserved.

Вам также может понравиться