index [ptgmedia.pearsoncmg.com]ptgmedia.pearsoncmg.com/images/0201721481/index/lippman_index.pdf ·...

43
“primer” — 2005/1/19 — 18:36 — page 843 — #865 Index Bold face numbers refer to the page on which the term was first defined. Numbers in italic refer to the “Defined Terms” section in which the term is defined. ... (ellipsis parameter), 244 /* */ (block comment), 10, 28 // (single-line comment), 10, 28 __DATE__ , 221 __FILE__ , 221 __LINE__ , 221 __TIME__ , 221 __cplusplus, 803 \0 (null character), 40 \Xnnn (hexadecimal escape sequence), 40 \n (newline character), 40 \t (tab character), 40 { } (curly brace), 3, 28 #define, 71 #ifdef, 71 #ifundef, 71 #include,7 ~ classname, see destructor L’c(wchar_t literal), 40 ctrl-d (Unix end-of-file), 20 ctrl-z (Windows end-of-file), 20 ; (semicolon), 3 class definition, 440 ++ (increment), 13, 30, 146, 190 and dereference, 163 iterator, 98, 108, 312 overloaded operator, 527 pointer, 114 prefix yields lvalue, 162 reverse iterator, 412 -- (decrement), 190 and dereference, 163 iterator, 312 overloaded operator, 527 prefix yields lvalue, 162 reverse iterator, 412 * (dereference), 98, 108, 146, 389 iterator, 98 on map yields pair, 362 overloaded operator, 524 pointer, 119 yields lvalue, 99, 120 & (address-of), 115, 146, 511 -> (arrow operator), 164 class member access, 445 overloaded operator, 525 ->* (pointer to member arrow), 783 [] (subscript), 87, 108, 146 bitset, 105 deque, 325 map, 363 string, 87 vector, 94, 325 and multi-dimensioned array, 142 and pointer, 124 array, 113 overloaded operator, 522 reference return, 522 valid subscript range, 88 yields lvalue, 88 () (call operator), 25, 30, 226, 280 overloaded operator, 530 :: (scope operator), 8, 30, 78, 108 base class members, 569 class member, 85, 445 container defined type, 317 member function definition, 262 to override name lookup, 449 = (assignment), 13, 30, 159 and conversion, 179 and equality, 161 class assignment operator, 476 container, 328 overloaded operator, 483, 520 and copy constructor, 484 check for self-assignment, 490 843

Upload: vokhue

Post on 16-Mar-2018

224 views

Category:

Documents


2 download

TRANSCRIPT

Page 1: Index [ptgmedia.pearsoncmg.com]ptgmedia.pearsoncmg.com/images/0201721481/index/lippman_index.pdf · “primer” — 2005/1/19 — 18:36 — page 843 — #865 Index Bold face numbers

“primer” — 2005/1/19 — 18:36 — page 843 — #865��

��

��

��

Index

Bold face numbers refer to the page on which the term was first defined.Numbers in italic refer to the “Defined Terms” section in which the term is defined.

... (ellipsis parameter), 244/* */ (block comment), 10, 28// (single-line comment), 10, 28_ _DATE_ _ , 221_ _FILE_ _ , 221_ _LINE_ _ , 221_ _TIME_ _ , 221_ _cplusplus, 803\0 (null character), 40\Xnnn (hexadecimal escape sequence), 40\n (newline character), 40\t (tab character), 40{ } (curly brace), 3, 28#define, 71#ifdef, 71#ifundef, 71#include, 7~classname, see destructorL’c’ (wchar_t literal), 40ctrl-d (Unix end-of-file), 20ctrl-z (Windows end-of-file), 20; (semicolon), 3

class definition, 440++ (increment), 13, 30, 146, 190

and dereference, 163iterator, 98, 108, 312overloaded operator, 527pointer, 114prefix yields lvalue, 162reverse iterator, 412

-- (decrement), 190and dereference, 163iterator, 312overloaded operator, 527prefix yields lvalue, 162reverse iterator, 412

* (dereference), 98, 108, 146, 389iterator, 98

on map yields pair, 362overloaded operator, 524pointer, 119yields lvalue, 99, 120

& (address-of), 115, 146, 511-> (arrow operator), 164

class member access, 445overloaded operator, 525

->* (pointer to member arrow), 783[ ] (subscript), 87, 108, 146

bitset, 105deque, 325map, 363string, 87vector, 94, 325and multi-dimensioned array, 142and pointer, 124array, 113overloaded operator, 522

reference return, 522valid subscript range, 88yields lvalue, 88

() (call operator), 25, 30, 226, 280overloaded operator, 530

:: (scope operator), 8, 30, 78, 108base class members, 569class member, 85, 445container defined type, 317member function definition, 262to override name lookup, 449

= (assignment), 13, 30, 159and conversion, 179and equality, 161class assignment operator, 476container, 328overloaded operator, 483, 520

and copy constructor, 484check for self-assignment, 490

843

Page 2: Index [ptgmedia.pearsoncmg.com]ptgmedia.pearsoncmg.com/images/0201721481/index/lippman_index.pdf · “primer” — 2005/1/19 — 18:36 — page 843 — #865 Index Bold face numbers

“primer” — 2005/1/19 — 18:36 — page 844 — #866��

��

��

��

844 Index

Message, 490multiple inheritance, 737reference return, 483, 521rule of three, 485use counting, 495, 498valuelike classes, 501

pointer, 120string, 86to signed, 37to unsigned, 37yields lvalue, 160

+= (compound assignment), 13, 30, 161string, 86iterator, 313overloaded operator, 511Sales_item, 521

+ (addition), 150string, 86iterator, 101, 313pointer, 123Sales_item, 517

- (subtraction), 150iterator, 101, 313pointer, 123

* (multiplication), 150/ (division), 150% (modulus), 151== (equality), 30, 154

string, 85algorithm, 421container, 322container adaptor, 350iterator, 98, 312string, 347

!= (inequality), 30, 154container, 322container adaptor, 350iterator, 98, 312string, 347

< (less-than), 30, 153overloaded and containers, 520used by algorithm, 420

<= (less-than-or-equal), 13, 30, 153> (greater-than), 30, 153>= (greater-than-or-equal), 30, 153>> (input operator), 8, 30

Sales_item, 516istream_iterator, 408string, 81, 108overloaded operator, 515

must be nonmember, 514

precedence and associativity, 158<< (output operator), 7, 30

bitset, 106ostream_iterator, 408string, 81, 108formatting, 514overloaded operator, 513

must be nonmember, 514precedence and associativity, 158Sales_item, 514

>> (right-shift), 155, 190<< (left-shift), 155, 190&& (logical AND), 152

operand order of evaluation, 172overloaded operator, 511

|| (logical OR), 152operand order of evaluation, 172overloaded operator, 511

& (bitwise AND), 156, 189Query, 610

! (logical NOT), 153| (bitwise OR), 156, 190

example, 290Query, 610

^ (bitwise XOR), 156, 190~ (bitwise NOT), 155, 189

Query, 610, (comma operator), 168, 189

example, 289operand order of evaluation, 172overloaded operator, 511

?: (conditional operator), 165, 189operand order of evaluation, 172

+ (unary plus), 150- (unary minus), 150\nnn (octal escape sequence), 40ddd.dddL or ddd.dddl (long double lit-

eral), 39numEnum or numenum (double literal),

39numF or numf (float literal), 39numL or numl (long literal), 39numU or numu (unsigned literal), 39class member:constant expression, see bit-

field

Aabnormal termination, stream buffers, 292abort, 692, 748absInt, 530

Page 3: Index [ptgmedia.pearsoncmg.com]ptgmedia.pearsoncmg.com/images/0201721481/index/lippman_index.pdf · “primer” — 2005/1/19 — 18:36 — page 843 — #865 Index Bold face numbers

“primer” — 2005/1/19 — 18:36 — page 845 — #867��

��

��

��

Index 845

abstract base class, 596, 621example, 609

abstract data type, 78, 429, 473abstraction, data, 432, 474access control, 65

in base and derived classes, 570local class, 796nested class, 787using declarations to adjust, 573

access label, 65, 73, 432, 473private, 65, 432protected, 562, 622public, 65, 432

Account, 468accumulate, 396, 823Action, 783adaptor, 348, 353

container, 348function, 533, 535, 553iterator, 399

addition (+), 150string, 86iterator, 101, 313pointer, 123Sales_item, 517

address, 35, 73address-of (&), 115, 146

overloaded operator, 511adjacent_difference, 824adjacent_find, 813algorithm, 392, 424

_copy versions, 400, 421_if versions, 421element type constraints, 394independent of container, 393iterator argument constraints, 397, 415iterator category and, 416, 418naming convention, 420–421overloaded versions, 420parameter pattern, 419–420passing comparison function, 403read-only, 396structure, 419that reorders elements, 421that writes elements, 398type independence, 394, 396using function object as argument,

531with two input ranges, 420

algorithm header, 395alias, namespace, 720, 750

allocator, 755, 755–759, 805allocate, 759

compared to operator new, 761construct, 755, 758

compared to placement new, 762deallocate, 759

compared to operator delete,761

destroy, 755, 759compared to calling destructor, 763

operations, 756alternative operator name, 46ambiguous

conversion, 541–544multiple inheritance, 734

function call, 269, 272, 280multiple base classes, 738

overloaded operator, 550AndQuery, 609

definition, 618eval function, 619

anonymous union, 795, 805app (file mode), 296append, string, 342argc, 244argument, 25, 28, 226, 227, 280

array type, 238C-style string, 242const reference type, 235conversion, 229

with class type conversion, 541copied, 230

uses copy constructor, 478default, 253iterator, 238, 242multi-dimensioned array, 241passing, 229pointer to const, 231pointer to nonconst, 231reference parameter, 233template, see template argumentto main, 243to member function, 260nonconst reference parameter, 235type checking, 229

ellipsis, 244of array type, 239of reference to array, 240with class type conversion, 541

argument deduction, template, 637argument list, 226

Page 4: Index [ptgmedia.pearsoncmg.com]ptgmedia.pearsoncmg.com/images/0201721481/index/lippman_index.pdf · “primer” — 2005/1/19 — 18:36 — page 843 — #865 Index Bold face numbers

“primer” — 2005/1/19 — 18:36 — page 846 — #868��

��

��

��

846 Index

argv, 244arithmetic

iterator, 100, 107, 312, 313pointer, 123, 146

arithmetic operatorand compound assignment, 162function object, 533overloaded operator, 517

arithmetic type, 34, 73conversion, 180, 188

from bool, 182signed to unsigned, 36

conversion to bool, 182array, 40, 73, 110–114

and pointer, 122argument, 238as initializer of vector, 140assignment, 112associative, 388conversion to pointer, 122, 181

and template argument, 639copy, 112default initialization, 111

uses copy constructor, 478uses default constructor, 460

definition, 110elements and destructor, 485function returning, 228initialization, 111multi-dimensioned, 141–144

and pointer, 143definition, 142initialization, 142parameter, 241subscript operator, 142

of char initialization, 112parameter, 238–244

buffer overflow, 242convention, 241–243reference type, 240

size calculation, 309and sizeof, 167subscript operator, 113

arrow operator (->), 164auto_ptr, 704class member access, 445generic handle, 670overloaded operator, 525

assert preprocessor macro, 221, 223assign

container, 328

string, 340assignment

vs. initialization, 49memberwise, 483, 503

assignment (=), 13, 30, 159, 502and conversion, 179and copy constructor, 484check for self-assignment, 490container, 328for derived class, 586Message, 490multiple inheritance, 737overloaded operator, 476, 483, 520

reference return, 483, 521pointer, 120rule of three, 485

exception for virtual destructors,588

string, 86synthesized, 483, 503to base from derived, 578to signed, 37to unsigned, 37use counting, 495, 498usually not virtual, 588valuelike classes, 501yields lvalue, 160

associative array, see map, 388associative container, 356, 388

assignment (=), 328begin, 369clear, 359constructors, 360count, 377element type constraints, 309, 323empty, 359equal_range, 379erase, 359find, 377insert, 364key type constraints, 360lower_bound, 377operations, 358overriding the default comparison,

604rbegin, 412rend, 412returning an, 381reverse_iterator, 412size, 359supports relational operators, 359

Page 5: Index [ptgmedia.pearsoncmg.com]ptgmedia.pearsoncmg.com/images/0201721481/index/lippman_index.pdf · “primer” — 2005/1/19 — 18:36 — page 843 — #865 Index Bold face numbers

“primer” — 2005/1/19 — 18:36 — page 847 — #869��

��

��

��

Index 847

swap, 329types defined by, 361upper_bound, 377

associativity, 149, 170, 188overloaded operator, 507

atdeque, 325vector, 325

ate (file mode), 296auto_ptr, 702, 748

constructor, 703copy and assignment, 704default constructor, 705get member, 705operations, 703pitfalls, 707reset member, 706self-assignment, 705

automatic object, 255, 280see also local variablesee also parameterand destructor, 485

Bback

queue, 352sequential container, 324

back_inserter, 399, 406, 424bad, 289bad_alloc, 175, 219bad_cast, 219, 774bad_typeid, 776badbit, 289base, 414base class, 285, 302, 558, 621

see also virtual functionabstract, 596, 621

example, 609access control, 561, 571assignment operator, usually not vir-

tual, 588can be a derived class, 566constructor, 581

calls virtual function, 589not virtual, 588

conversion from derived, 567access control, 579

definition, 560destructor

calls virtual function, 589

usually virtual, 587friendship not inherited, 575handle class, 599member operator delete, 764member hidden by derived, 593multiple, see multiple base classmust be complete type, 566no conversion to derived, 580object initialized or assigned from de-

rived, 578scope, 590static members, 576user, 563virtual, 751

see virtual base classBasket, 605

total function, 606Bear, 731

as virtual base, 741begin, 353

map, 369set, 372vector, 97container, 317

best match, 269, 280see also function matching

bidirectional iterator, 417, 424list, 417map, 417set, 417

binary (file mode), 296binary function object, 533binary operator, 148, 188binary_search, 814BinaryQuery, 609

definition, 617bind1st, 535bind2nd, 535binder, 535, 552binding, dynamic, 559, 621

requirements for, 566bit-field, 798, 805

access to, 798bitset, 101, 101–106, 107

any, 104count, 104flip, 105

compared to bitwise NOT, 155none, 104reset, 105set, 105

Page 6: Index [ptgmedia.pearsoncmg.com]ptgmedia.pearsoncmg.com/images/0201721481/index/lippman_index.pdf · “primer” — 2005/1/19 — 18:36 — page 843 — #865 Index Bold face numbers

“primer” — 2005/1/19 — 18:36 — page 848 — #870��

��

��

��

848 Index

size, 104test, 105to_ulong, 105compared to bitwise operator, 156constructor, 101–103header, 101output operator, 106subscript operator, 105

bitwise AND (&), 156, 189example, 610

bitwise exclusive or (^), 156, 190bitwise NOT (~), 155, 189

example, 610bitwise operator, 154–159

and compound assignment, 162compared to bitset, 156compound assignment, 157example, 290operand, 155

bitwise OR (|), 156, 190example, 290, 610

block, 3, 13, 28, 193, 223try, 216, 217, 224, 750as target of if, 196function, 227

block scope, 193body, function, 3, 29, 226, 281book finding program

using equal_range, 379using find, 377using upper_bound, 378

bookstore program, 26exception classes, 698

bool, 35and equality operator, 154conversion to arithmetic type, 182literal, 39

boolalpha manipulator, 826brace, curly, 3, 28break statement, 212, 223

and switch, 201–203buffer, 8, 28

flushing, 290buffer overflow, 114

and C-style string, 132array parameter, 242

built-in type, 3, 28, 34–37class member default initialization,

264conversion, 179initialization of, 51

Bulk_itemclass definition, 564constructor, 581constructor using default arguments,

582derived fromDisc_item, 584interface, 558member functions, 559

byte, 35, 73

CC++

calling C function from C++, 801compiling C and C++, 803using C linkage, 802

.C file, 4

.cc file, 4

.cpp file, 4

.cp file, 4C library header, 90C with classes, 430C-style cast, 186C-style string, 112, 130, 130–134, 145

and char*, 131and string literal, 140compared to string, 134, 138definition, 130dynamically allocated, 138initialization, 130parameter, 242pitfalls with generic programs, 671

c_str, 140example, 294

CachedObjadd_to_freelist, 771operator delete, 770operator new, 769allocation explained, 769definition, 767definition of static members, 771design, 766illustration, 767inheriting from, 768

call operator (()), 25, 30, 226, 280execution flow, 226overloaded operator, 530

calling C function from C++, 801candidate function, 270, 280

and function templates, 679namespaces, 728

Page 7: Index [ptgmedia.pearsoncmg.com]ptgmedia.pearsoncmg.com/images/0201721481/index/lippman_index.pdf · “primer” — 2005/1/19 — 18:36 — page 843 — #865 Index Bold face numbers

“primer” — 2005/1/19 — 18:36 — page 849 — #871��

��

��

��

Index 849

overloaded operator, 549capacity

string, 336vector, 331

case label, 201, 201–204, 223default, 203

cassert header, 221cast, 183, 188

checked, see dynamic_castold-style, 186

catch clause, 216, 217, 223, 693, 749catch(...), 696, 748example, 217exception specifier, 693matching, 693ordering of, 694parameter, 693

category, iterator, 425cctype, 88–89, 107

header, 88cerr, 6, 28char, 34

literal, 40char string literal, see string literalcharacter

newline (\n), 40nonprintable, 40, 75null (\0), 40printable, 88tab (\t), 40

checked cast, see dynamic_castCheckedPtr, 526children’s story program, 400

revisited, 531cin, 6, 28

by default tied to cout, 292cl, 4class, 20, 28, 63, 73, 473

static member, 474abstract base, 621

example, 609access labels, 65, 432as friend, 465base, 285, 302, see base class, 621concrete, 433conversion, 552

multiple conversions lead to am-biguities, 546

conversion constructor, 461function matching, 547with standard conversion, 540

data member, 64, 74const vs. mutable, 443const, initialization, 455constraints on type, 438definition, 435initialization, 454mutable, 443reference, initialization, 455static, 469

data member definition, 65default access label, 433default inheritance access label, 574definition, 64, 430–440

and header, 264, 437derived, 285, 302, see derived class,

621destructor definition, 486direct base, see immediate base class,

621explicit constructor, 462forward declaration, 438generic handle, 667, 683handle, see handle class, 599, 622immediate base, 566, 622indirect base, 566, 622local, see local class, 806member, 64, 73, 430member access, 445member function, 25, 29, see mem-

ber functionmember:constant expression, see bit-

fieldmultiple inheritance, see multiple base

classnested, see nested class, 806nonvirtual function, calls resolved at

compile time, 569operator delete, see member op-

eratoroperator new, see member opera-

tor newpointer member

copy control, 492–501copy control strategies, 499default copy behavior, 493

pointer to member, 780definition, 781

pointer to member function, defini-tion, 782

preventing copies, 481private member, 431

Page 8: Index [ptgmedia.pearsoncmg.com]ptgmedia.pearsoncmg.com/images/0201721481/index/lippman_index.pdf · “primer” — 2005/1/19 — 18:36 — page 843 — #865 Index Bold face numbers

“primer” — 2005/1/19 — 18:36 — page 850 — #872��

��

��

��

850 Index

inheritance, 561private member, 75protected member, 562public member, 75, 431

inheritance, 561static member, 467

as default argument, 471data member as constant expres-

sion, 471example, 468inheritance, 576

template member, see member tem-plate

type member, 435undefined member, 482user, 433, 563virtual base, 751virtual function, calls resolved at run

time, 569class, keyword, 64

compared to typename, 631in template parameter, 630in variable definition, 440

class keyword, 473class declaration, 438, 473

of derived class, 566class derivation list, 563, 621

access control, 570default access label, 574multiple base classes, 731virtual base, 742

class scope, 65, 444, 473friend declaration, 466inheritance, 590–595member definition, 445name lookup, 447static members, 470virtual functions, 594

class template, 90, 107, 627, 683see also template parametersee also template argumentsee also instantiationcompiler error detection, 634declaration, 629definition, 627error detection, 635explicit template argument, 636export, 645friend

declaration dependencies, 658explicit template instantiation, 657

nontemplate class or function, 656template class or function, 656

member function, 653defined outside class body, 651instantiation, 653

member specialization, 677member template, see member tem-

platenontype template parameter, 655static member, 665

accessed through an instantiation,666

definition, 666type includes template argument(s),

628, 637type-dependent code, 634uses of template parameter, 649

class template specializationdefinition, 675member, declaration, 677member defined outside class body,

676namespaces, 730

class type, 20, 28, 65class member default initialization,

264conversion, 183initialization of, 52object definition, 439parameter and overloaded operator,

507variable vs. function declaration, 460

cleanup, object, see destructorclear, 289, 290

associative container, 359example, 290, 295sequential container, 327

clog, 6, 28close, 294comma operator (,), 168, 189

example, 289operand order of evaluation, 172overloaded operator, 511

comment, 10, 28block (/* */), 10, 28single-line (//), 10, 28

compareplain function, 624string, 347template version, 625

instantiatied with pointer, 671

Page 9: Index [ptgmedia.pearsoncmg.com]ptgmedia.pearsoncmg.com/images/0201721481/index/lippman_index.pdf · “primer” — 2005/1/19 — 18:36 — page 843 — #865 Index Bold face numbers

“primer” — 2005/1/19 — 18:36 — page 851 — #873��

��

��

��

Index 851

specialization, 672compilation

and header, 67conditional, 220inclusion model for templates, 644needed when class changes, 434needed when inline function changes,

258separate, 67, 76

of templates, 643separate model for templates, 644

compilerextension, 112flag for inclusion compilation model,

645GNU, 4Microsoft, 4template errors diagnosed at link time,

635compiler extension, 145compiling C and C++, 803composition vs. inheritance, 573compound assignment (e.g.,+=), 13, 30, 161

string, 86bitwise operator, 157iterator, 313overloaded operator, 511, 518Sales_item, 521

compound expression, 168, 188compound statement, 193, 223compound type, 58, 73, 145compute, 542

overloaded version, 545concatenation

Screen operations, 441string, 86string literal, 41

concrete class, 433initialization, 464

condition, 13, 28and conversion, 179assignment in, 161in do while statement, 211in for statement, 15, 207in if statement, 18, 195in logical operator, 152in while statement, 205stream type as, 19, 183, 288string input operation as, 82

condition state, 287, 302conditional compilation, 220

conditional operator (?:), 165, 189operand order of evaluation, 172

console window, 6const, 57

and dynamically allocated array, 136conversion to, 182, 231

and template argument, 639iterator vs. const_iterator, 100object scope, 57, 69overloading and, 267, 275parameter, 231pointer, 128reference, 59

initialization, 60const object, constructor, 453const data member

static data member, 470compared to mutable, 443initialization, 455

const member function, 261, 262, 280,431, 473

overloaded, 442reference return, 442static, 469

const pointer, see also pointer to constconversion from nonconst, 182

const referenceargument, 235conversion from nonconst, 182parameter, 235

overloading, 275return type, 249

const void*, 127, 145const_cast, 183, 184const_iterator, 99, 415

compared to const iterator, 100container, 316

const_reference, 317const_reverse_iterator, 412

container, 316constant expression, 62, 74

and header file, 69array index, 110bit-field, 798enumerator, 62nontype template parameter, 633static data member, 471

construction, order of, 456, 749derived objects, 581, 582multiple base classes, 732virtual base classes, 746

Page 10: Index [ptgmedia.pearsoncmg.com]ptgmedia.pearsoncmg.com/images/0201721481/index/lippman_index.pdf · “primer” — 2005/1/19 — 18:36 — page 843 — #865 Index Bold face numbers

“primer” — 2005/1/19 — 18:36 — page 852 — #874��

��

��

��

852 Index

constructor, 49, 74, 262, 281, 431const objects, 453conversion, 461, 474

function matching, 547with standard conversion, 540

copy, 476–482, 502base from derived, 578multiple inheritance, 737

default, 52, 74, 262, 281, 458–461, 474default argument in, 458derived class, 581

initializes immediate base class, 583initializes virtual base, 744

execution flow, 454explicit, 462, 474

copy-initialization, 477for associative container, 360for sequential container, 307–309function try block, 696in constructor initializer list, 457inheritance, 581initializer, 452may not be virtual, 588object creation, 452order of construction, 456

derived objects, 581, 582multiple base classes, 732virtual base classes, 746

overloaded, 452pair, 357resource allocation, 700synthesized copy, 479, 503synthesized default, 264, 281, 459, 474virtual inheritance, 744

constructor initializer list, 263, 281, 431,453–458, 474

compared to assignment, 454derived classes, 582function try block, 696initializers, 457multiple base classes, 733sometimes required, 455virtual base class, 745

container, 90, 107, 306, 353see also sequential containersee also associative containerand generic algorithms, 393as element type, 311assignment (=), 328associative, 356, 388begin, 317

clear, 327const_iterator, 316const_reference, 317const_reverse_iterator, 316element type constraints, 309, 323elements and destructor, 485elements are copies, 318empty, 323end, 317erase, 402has bidirectional iterator, 417inheritance, 597insert, 319iterator, 316rbegin, 317, 412reference, 317rend, 317, 412returning a, 381reverse_iterator, 316, 412sequential, 306, 354size, 323size_type, 316supports relational operators, 321swap, 329types defined by, 316

continue statement, 214, 223example, 290

control, flow of, 192, 224conversion, 178, 188

ambiguous, 541–544and assignment, 159argument, 229

with class type conversion, 541arithmetic type, 180, 188array to pointer, 122, 238

and template argument, 639class type, 183, 535, 552

design considerations, 544example, 537multiple conversions lead to am-

biguities, 546operator, 537, 537–540, 552operator and function matching,

545used implicitly, 538with standard conversion, 539

constructor, 461function matching, 547with standard conversion, 540

derived to base, 567, 580access control, 579

Page 11: Index [ptgmedia.pearsoncmg.com]ptgmedia.pearsoncmg.com/images/0201721481/index/lippman_index.pdf · “primer” — 2005/1/19 — 18:36 — page 843 — #865 Index Bold face numbers

“primer” — 2005/1/19 — 18:36 — page 853 — #875��

��

��

��

Index 853

enumeration type to integer, 182from istream, 183function matching of template and

nontemplate functions, 681function to pointer, 277

and template argument, 639implicit, 189inheritance, 577integral promotion, 180multi-dimensioned array to pointer,

143multiple inheritance, 734nontemplate type argument, 640of return value, 246rank for function matching, 272rank of class type conversions, 545signed type, 180signed to unsigned, 36template argument, 638to const pointer, 127to const, 182

and template argument, 639parameter matching, 231

virtual base, 743conversion constructor, 474copy, 815copy constructor, 476, 476–482, 502

and assignment operator, 484argument passing, 478base from derived, 578for derived class, 586initialization, 478Message, 489parameter, 480pointer members, 480rule of three, 485

exception for virtual destructors,588

synthesized, 479, 503use counting, 495, 497valuelike classes, 500

copy control, 476, 502handle class, 601inheritance, 584–590message handling example, 489multiple inheritance, 737of pointer members, 499

copy-initialization, 48using constructor, 477

copy_backward, 816count, use, 495, 503

count, 812book finding program, 377map, 367multimap, 377multiset, 377set, 372

count_if, 404, 812with function object argument, 532

cout, 6, 28by default tied to cin, 292

cstddef header, 104, 123cstdlib header, 247cstring header, 132curly brace, 3, 28

Ddangling else, 198, 223dangling pointer, 176, 188

returning pointer to local variable,249

synthesized copy control, 494data abstraction, 432, 474

advantages, 434data hiding, 434data structure, 20, 28data type, abstract, 473dec manipulator, 827decimal literal, 38declaration, 52, 74

class, 438, 473class template member specialization,

677dependencies and template friends,

658derived class, 566export, 645forward, 438, 474function, 251

exception specification, 708function template specialization, 672,

673member template, 661template, 629using, 78, 108, 720, 750

access control, 573class member access, 574overloaded inherited functions, 593

declaration statement, 193, 224decrement (--), 190

iterator, 312

Page 12: Index [ptgmedia.pearsoncmg.com]ptgmedia.pearsoncmg.com/images/0201721481/index/lippman_index.pdf · “primer” — 2005/1/19 — 18:36 — page 843 — #865 Index Bold face numbers

“primer” — 2005/1/19 — 18:36 — page 854 — #876��

��

��

��

854 Index

overloaded operator, 526prefix yields lvalue, 162reverse iterator, 412

deduction, template argument, 637default argument, 253

and header file, 254function matching, 270in constructor, 458initializer, 254overloaded function, 267virtual functions, 570

default case label, 203, 224default constructor, 52, 74, 262, 281, 458–

461, 474Sales_item, 263string, 52, 81default argument, 458synthesized, 264, 281, 459, 474used implicitly, 459variable definition, 460

definition, 52, 74array, 110base class, 560C-style string, 130class, 64, 430–440class data member, 65, 435class static member, 469class template, 627static member, 666

class template specialization, 675member defined outside class body,

676class type object, 439derived class, 563destructor, 486dynamically allocated array, 135dynamically allocated object, 174function, 3inside an if condition, 196inside a switch expression, 203inside a while condition, 205map, 360, 373multi-dimensioned array, 142namespace, 712

can be discontiguous, 714member, 716

of variable after case label, 204overloaded operator, 482pair, 356pointer, 115pointer to function, 276

static data member, 470variable, 48

delete, 145, 176, 188, 806compared to operatordelete, 760const object, 178execution flow, 760member operator, 806member operator

and inheritance, 764interface, 764

memory leak, 177, 485null pointer, 176runs destructor, 485

delete [], 135and dynamically allocated array, 137

deque, 353as element type, 311assign, 328assignment (=), 328at, 325back, 324begin, 317clear, 327const_iterator, 316const_reference, 317const_reverse_iterator, 316constructor from element count, uses

copy constructor, 478constructors, 307–309difference_type, 316element type constraints, 309, 323empty, 323end, 317erase, 326

invalidates iterator, 326front, 324insert, 319

invalidates iterator, 320iterator, 316iterator supports arithmetic, 312performance characteristics, 334pop_back, 326pop_front, 326push_back, 318

invalidates iterator, 321push_front, 318

invalidates iterator, 321random-access iterator, 417rbegin, 317, 412reference, 317relational operators, 321

Page 13: Index [ptgmedia.pearsoncmg.com]ptgmedia.pearsoncmg.com/images/0201721481/index/lippman_index.pdf · “primer” — 2005/1/19 — 18:36 — page 843 — #865 Index Bold face numbers

“primer” — 2005/1/19 — 18:36 — page 855 — #877��

��

��

��

Index 855

rend, 317, 412resize, 323reverse_iterator, 316, 412size, 323size_type, 316subscript ([ ]), 325supports relational operators, 313swap, 329types defined by, 316value_type, 317

dereference (*), 98, 108, 146, 389and increment, 163auto_ptr, 704iterator, 98on map iterator yields pair, 362overloaded operator, 524pointer, 119yields lvalue, 99, 120

derivation list, class, 563, 621access control, 570default access label, 574

derived class, 285, 302, 558, 621see also virtual functionaccess control, 561, 572as base class, 566assgined or copied to base object, 578assignment (=), 586constructor, 581

calls virtual function, 589for remote virtual base, 744initializes immediate base class, 583

constructor initializer list, 582conversion to base, 567

access control, 579copy constructor, 586default derivation label, 574definition, 563destructor, 587

calls virtual function, 589friendship not inherited, 576handle class, 599member operator delete, 764member hides member in base, 593multiple base classes, 731no conversion from base, 580scope, 590scope (::) to access base class mem-

ber, 569static members, 576using declaration

inherited functions, 593

member access, 574with remote virtual base, 742

derived objectcontains base part, 565multiple base classes, contains base

part for each, 732design

CachedObj, 766class member access control, 563class type conversions, 544consistent definitions of equality and

relational operators, 520is-a relationship, 573Message class, 486namespace, 714of handle classes, 599of header files, 67export, 646inclusion compilation model, 644separate compilation model, 645

optimizing new and delete, 764using freelist, 766

overloaded operator, 510–513overview of use counting, 495Query classes, 609–611Queue, 647resource allocation is initialization,

700–701Sales_item handle class, 599TextQuery class, 380vectormemory allocation strategy,

756writing generic code, 634

pointer template argument, 671destruction, order of, 749

derived objects, 587multiple base classes, 733virtual base classes, 747

destructor, 476, 484, 502called during exception handling, 691container elements, 485definition, 486derived class, 587explicit call to, 762implicitly called, 484library classes, 709Message, 491multiple inheritance, 737order of destruction, 485

derived objects, 587multiple base classes, 733

Page 14: Index [ptgmedia.pearsoncmg.com]ptgmedia.pearsoncmg.com/images/0201721481/index/lippman_index.pdf · “primer” — 2005/1/19 — 18:36 — page 843 — #865 Index Bold face numbers

“primer” — 2005/1/19 — 18:36 — page 856 — #878��

��

��

��

856 Index

virtual base classes, 747resource deallocation, 700rule of three, 485

exception for virtual destructors,588

should not throw exception, 692synthesized, 485, 486use counting, 495, 497valuelike classes, 500virtual, multiple inheritance, 736virtual in base class, 587

development environment, integrated, 3difference_type, 101, 107, 316dimension, 110, 145direct base class, see immediate base class,

621direct-initialization, 48

using constructor, 477directive, using, 721, 751

pitfalls, 724Disc_item, 583

class definition, 583discriminant, 794, 806divides<T>, 534division (/), 150do while statement, 210

condition in, 211domain_error, 219dot operator (.), 25, 30

class member access, 445double, 37

literal (numEnum or numenum), 39long double, 37notation outptu format control, 830output format control, 828

duplicate word program, 400–404revisited, 531

dynamic binding, 559, 621in C++, 569requirements for, 566

dynamic type, 568, 622dynamic_cast, 183, 773, 806

example, 773throws bad_cast, 774to pointer, 773to reference, 774

dynamically allocated, 145const object, 177array, 134, 134–139delete, 137definition, 135

initialization, 136of const, 136

C-style string, 138memory and object construction, 754object, 174auto_ptr, 702constructor, 453destructor, 485exception, 700

Eedit-compile-debug, 16, 28

errors at link time, 635else, see if statement

dangling, 198, 223empty

string, 83, 107vector, 93, 107associative container, 359container, 323priority_queue, 352queue, 352stack, 351

encapsulation, 432, 474advantages, 434

end, 353map, 369set, 372vector, 97container, 317

end-of-file, 19, 28, 835entering from keyboard, 20

Endangered, 731endl, 8

manipulator flushes the buffer, 291ends, manipulator flushes the buffer, 291enum keyword, 62enumeration, 62, 74

conversion to integer, 182function matching, 274

enumerator, 62, 74conversion to integer, 182

environment, integrated development, 3eof, 289eofbit, 289equal, 814equal member function, 778equal_range, 814

associative container, 379book finding program, 379

Page 15: Index [ptgmedia.pearsoncmg.com]ptgmedia.pearsoncmg.com/images/0201721481/index/lippman_index.pdf · “primer” — 2005/1/19 — 18:36 — page 843 — #865 Index Bold face numbers

“primer” — 2005/1/19 — 18:36 — page 857 — #879��

��

��

��

Index 857

equal_to<T>, 534equality (==), 30, 154

string, 85algorithm, 421and assignment, 161container, 322container adaptor, 350iterator, 98, 312overloaded operator, 512, 518

consistent with equality, 520string, 347

eraseassociative container, 359container, 402invalidates iterator, 326map, 368multimap, 376multiset, 376sequential container, 326set, 372string, 340

error, standard, 6escape sequence, 40, 74

hexadecimal (\Xnnn), 40octal (\nnn), 40

evaluationorder of, 149, 189short-circuit, 152

exception, raise, see throwexception

class, 216, 224class hierarchy, 698constructor, 220extending the hierarchy, 697header, 219what member, 218, 697

exception handling, 215–220, 749see also throwsee also catch clauseand terminate, 219compared to assert, 221exception in destrutor, 692finding a catch clause, 693function try block, 696, 749handler, see catch clauselibrary class destructors, 709local objects destroyed, 691specifier, 217, 224, 693, 749

nonreference, 693reference, 694types related by inheritance, 694

stack unwinding, 691uncaught exception, 692unhandled exception, 219

exception object, 690, 749array or function, 689initializes catch parameter, 693must be copyable, 689pointer to local object, 690rethrow, 695

exception safety, 700, 749exception specification, 706, 749

throw(), 708function pointers, 711unexpected, 708violation, 708virtual functions, 710

executable file, 4EXIT_FAILURE, 247EXIT_SUCCESS, 247explicit constructor, 462, 474

copy-initialization, 477export, 645

and header design, 646keyword, 645, 683

exporting C++ to C, 802expression, 7, 28, 148, 189

and operand conversion, 179compound, 168, 188constant, 62, 74throw, 689, 750

expression statement, 192, 224extended_compute, 542extension, compiler, 145extern, 53extern ’C’, see linkage directiveextern const, 57

Ffactorial program, 250fail, 289failbit, 289file

executable, 4object, 68source, 4, 29

file mode, 296, 302combinations, 298example, 299

file static, 719, 749fill, 816

Page 16: Index [ptgmedia.pearsoncmg.com]ptgmedia.pearsoncmg.com/images/0201721481/index/lippman_index.pdf · “primer” — 2005/1/19 — 18:36 — page 843 — #865 Index Bold face numbers

“primer” — 2005/1/19 — 18:36 — page 858 — #880��

��

��

��

858 Index

fill_n, 815find, 392, 812

book finding program, 377map, 368multimap, 377multiset, 377set, 372string, 344

find last word program, 414find_first_of, 812find_first_not_of, string, 346find_end, 812find_first_of, 396, 812

string, 345find_if, 421, 812find_last_not_of, string, 346find_last_of, string, 346find_val program, 234fixed manipulator, 830float, 37

literal (numF or numf), 39floating point

notation output format control, 830output format control, 828

floating point literal, see double literalflow of control, 192, 224flush, manipulator flushes the buffer, 291Folder, see Messagefor statement, 29, 207

condition in, 207execution flow, 208expression, 207for header, 207initialization statement, 207scope, 15

for statementfor statement, 14for_each, 813format state, 825forward declaration of class type, 438forward iterator, 417, 424fp_compute, 542free store, 135, 145freelist, 766, 806friend, 465, 474

class, 465class template

explicit template instantiation, 657nontemplate class or function, 656template class or function, 656

function template, example, 659inheritance, 575

member function, 466overloaded function, 467overloaded operator, 509scope considerations, 466

namespaces, 727template example, 658

friend keyword, 465front

queue, 352sequential container, 324

front_inserter, 406, 424compared to inserter, 406

fstream, 285, 293–299, 302see also istreamsee also ostreamclose, 294constructor, 293file marker, 838file mode, 296

combinations, 298example, 299

file random access, 838header, 285, 293off_type, 839open, 293pos_type, 839random IO sample program, 840seek and tell members, 838–842

function, 2, 29, 225, 281equal member, 778inline, 257, 281candidate, 270, 280conversion to pointer, 277

and template argument, 639function returning, 228inline and header, 257member, 25, 29, see member function,

474nonvirtual, calls resolved at compile

time, 569overloaded, 265, 281

compared to redeclaration, 266friend declaration, 467scope, 268virtual, 593

pure virtual, 596, 622example, 609

recursive, 249, 281viable, 270, 282virtual, 559, 566–570, 622

assignment operator, 588

Page 17: Index [ptgmedia.pearsoncmg.com]ptgmedia.pearsoncmg.com/images/0201721481/index/lippman_index.pdf · “primer” — 2005/1/19 — 18:36 — page 843 — #865 Index Bold face numbers

“primer” — 2005/1/19 — 18:36 — page 859 — #881��

��

��

��

Index 859

calls resolved at run time, 568compared to run-time type iden-

tification, 777default argument, 570derived classes, 564destructor, 587destructor and multiple inheritance,

736exception specifications, 710in constructors, 589in destructor, 589introduction, 561multiple inheritance, 735no virtual constructor, 588overloaded, 593overloaded operator, 615overriding run-time binding, 570return type, 564run-time type identification, 772scope, 594to copy unknown type, 602type-sensitive equality, 778

function adaptor, 533, 535, 553bind1st, 535bind2nd, 535binder, 535negator, 535not1, 535not2, 535

function body, 3, 29, 226, 281function call

ambiguous, 269, 272execution flow, 226overhead, 257through pointer to function, 278through pointer to member, 784to overloaded operator, 509to overloaded postfix operator, 529using default argument, 253

function declaration, 251and header file, 252exception specification, 708

function definition, 3function matching, 269, 281

and overloaded function templates,679–682

examples, 680argument conversion, 269conversion operator, 545conversion rank, 272

class type conversions, 545

enumeration parameter, 274integral promotion, 273multiple parameters, 272namespaces, 727of member functions, 436overloaded operator, 547–551

function name, 3, 29function object, 531, 553

algorithms, 531example, 534

binary, 533library defined, 533unary, 533

function pointer, 276–279and template argument deduction,

640definition, 276exception specifications, 711function returning, 228initialization, 277overloaded functions, 279parameter, 278return type, 278typedef, 276

function prototype, 251, 281function return type, 226, 227, 281

const reference, 249no implicit return type, 228nonreference, 247

uses copy constructor, 478reference, 248reference yields lvalue, 249void, 245

function scope, 227function table, 785

pointer to member, 785function template, 625, 683

see also template parametersee also template argumentsee also instantiationas friend, 659compiler error detection, 634declaration, 629error detection, 635explicit template argument, 642

and function pointer, 643specifying, 642

export, 645inline, 626instantiation, 637template argument deduction, 637

Page 18: Index [ptgmedia.pearsoncmg.com]ptgmedia.pearsoncmg.com/images/0201721481/index/lippman_index.pdf · “primer” — 2005/1/19 — 18:36 — page 843 — #865 Index Bold face numbers

“primer” — 2005/1/19 — 18:36 — page 860 — #882��

��

��

��

860 Index

type-dependent code, 634function template specialization

compared to overloaded function, 673declaration, 672, 673example, 672namespaces, 730scope, 674

function try block, 696, 749

Gg++, 4gcd program, 226generate, 816generate_n, 815generic algorithm, see algorithmgeneric handle class, 667, 683generic memory management, see CachedObjgeneric programming, 95, 624

and pointer template argument, 671type-independent code, 634

getline, 82, 107example, 300, 386

global namespace, 716, 750global scope, 54, 74global variable, lifetime, 254GNU compiler, 4good, 289goto statement, 214, 224greater-than (>), 30, 153greater-than-or-equal (>=), 30, 153greater<T>, 534greater_equal<T>, 534GT6 program, 403GT_cls, 532guard header, 71, 74

H.h file, 21Handle, 667

int instantiation, 668operations, 668Sales_item instantiation, 669

handle class, 599, 622copy control, 601copying unknown type, 602design, 599generic, 667, 683that hides inheritance hierarchy, 610using a, 603

handler, see catch clausehas-a relationship, 573HasPtr

as a smart pointer, 495using synthesized copy control, 493with value semantics, 499

header, 7, 29, 67, 74bitset, 101cctype, 88, 107cstddef, 104iomanip, 829string, 80vector, 90algorithm, 395and constant expression, 69and library names, 810C library, 90cassert, 221class definition, 264, 437cstddef, 123cstdlib, 247cstring, 132default argument, 254deque, 307design, 67export, 646inclusion compilation model, 644namespace members, 714separate compilation model, 645

exception, 219fstream, 285, 293function declaration, 252inline function, 257inlinemember function definition,

437iostream, 285iterator, 399list, 307map, 360, 375new, 219numeric, 395programmer-defined, 67–72queue, 349Sales_item, 21, 67, 264set, 373, 375sstream, 285, 300stack, 349stdexcept, 217, 219type_info, 219using declaration, 80utility, 356

Page 19: Index [ptgmedia.pearsoncmg.com]ptgmedia.pearsoncmg.com/images/0201721481/index/lippman_index.pdf · “primer” — 2005/1/19 — 18:36 — page 843 — #865 Index Bold face numbers

“primer” — 2005/1/19 — 18:36 — page 861 — #883��

��

��

��

Index 861

vector, 307header file, naming convention, 264header guard, 71, 74heap, 135, 145hex manipulator, 827hexadecimal, literal (0Xnum or 0xnum),

38hexadecimal escape sequence (\Xnnn), 40hides, names in base hidden by names in

derived, 592hierarchy, inheritance, 558, 566, 622high-order bits, 102, 107

IIDE, 3identification, run-time type, 772–780, 807identifier, 46, 74

naming convention, 47reserved, 47

if statement, else branch, 224if statement, 17, 29, 195, 224

compared to switch, 199dangling else, 198else branch, 18, 197

ifstream, 285, 293–299see also istreamclose, 294constructor, 293file marker, 838file mode, 296

combinations, 298example, 299

file random access, 838off_type, 839open, 293pos_type, 839random IO sample program, 840seek and tell members, 838–842

immediate base class, 566, 622implementation, 63, 74, 432implementation inheritance, 573implicit this pointer, overloaded opera-

tor, 508implicit conversion, see conversion, 189implicit return, 245

from main allowed, 247implicit this pointer, 260, 281, 431, 440

in and overloaded operator, 483static member functions, 469

in (file mode), 296

include, see #includeincludes, 822inclusion compilation model, 644, 683incomplete type, 438, 474

restriction on use, 438, 566, 693increment (++), 13, 30, 146, 190

reverse iterator, 412and dereference, 163iterator, 98, 108, 312overloaded operator, 526pointer, 114prefix yields lvalue, 162

indentation, 14, 197index, 87, 107indirect base class, 566, 622inequality (!=), 30, 154

iterator, 98container, 322container adaptor, 350iterator, 312overloaded operator, 512, 519string, 347

inheritance, 284, 302containers, 597conversions, 577default access label, 574friends, 575handle class, 599implementation, 573interface, 573iostream diagram, 285multiple, see multiple base class, 731private, 622static members, 576virtual, 741, 751

inheritance hierarchy, 558, 566, 622inheritance vs. composition, 573initialization, 9

vs. assignment, 49array, 111array of char, 112built-in type, 51C-style string, 130class data member, 454class member of built-in type, 264class member of class type, 264class type, 52, 452const static data member, 470dynamically allocated array, 136dynamically allocated object, 174map, 373

Page 20: Index [ptgmedia.pearsoncmg.com]ptgmedia.pearsoncmg.com/images/0201721481/index/lippman_index.pdf · “primer” — 2005/1/19 — 18:36 — page 843 — #865 Index Bold face numbers

“primer” — 2005/1/19 — 18:36 — page 862 — #884��

��

��

��

862 Index

memberwise, 479, 503multi-dimensioned array, 142objects of concrete class type, 464pair, 356parameter, 229pointer, 117–119pointer to function, 277return value, 247value, 92, 108variable, 48, 50, 76

initialization vs. assignment, 456initialized, 48, 75initializer list, constructor, 263, 281, 431,

453–458, 474inline function, 257, 281

and header, 257function template, 626member function, 437

and header, 437inner_product, 823inplace_merge, 816input, standard, 6input (>>), 8, 30

Sales_item, 516istream_iterator, 408string, 81, 108overloaded operator, 515

error handling, 516–517must be nonmember, 514

precedence and associativity, 158input iterator, 416, 424insert

inserter, 406invalidates iterator, 320map, 364multimap, 376multiset, 376return type fromset::insert, 373sequential container, 319set, 373string, 340

insert iterator, 399, 405, 425inserter, 406inserter, 425

compared to front_inserter, 406instantiation, 625, 684

class template, 628, 636, 654member function, 653nontype parameter, 655type, 637

error detection, 635

function template, 637from function pointer, 640nontemplate argument conversion,

640nontype template parameter, 633template argument conversion, 638

member template, 663nested class template, 788, 791on use, 636static class member, 665

int, 34literal, 38

Integral, 539integral promotion, 180, 189

function matching, 273integral type, 34, 75integrated development environment, 3interface, 63, 75, 432interface inheritance, 573internal manipulator, 832interval, left-inclusive, 314, 354invalid_argument, 219invalidated iterator, 315, 353IO stream, see streamiomanip header, 829iostate, 289iostream, 6, 29, 285

see also istreamsee also ostreamheader, 285inheritance hierarchy, 740seek and tell members, 838

is-a relationship, 573isalnum, 88isalpha, 88ISBN, 2isbn_mismatch, 699

destructor explained, 709iscntrl, 88isdigit, 88isgraph, 88islower, 88isprint, 88ispunct, 88isShorter program, 235, 403isspace, 88istream, 6, 29, 285

see also manipulatorcondition state, 287flushing input buffer, 290format state, 825

Page 21: Index [ptgmedia.pearsoncmg.com]ptgmedia.pearsoncmg.com/images/0201721481/index/lippman_index.pdf · “primer” — 2005/1/19 — 18:36 — page 843 — #865 Index Bold face numbers

“primer” — 2005/1/19 — 18:36 — page 863 — #885��

��

��

��

Index 863

gcount, 837get, 834

multi-byte version, 836returns int, 835, 836

getline, 82, 836getline, example, 300ignore, 837inheritance hierarchy, 740input (>>), 8

precedence and associativity, 158no containers of, 310no copy or assign, 287peek, 834put, 834putback, 835read, 837seek and tell members, 838unformatted operation, 834

multi-byte, 837single-byte, 834

unget, 835write, 837

istream_iterator, 407, 425and class type, 410constructors, 408input iterator, 417input operator (>>), 408limitations, 411operations, 409used with algorithms, 411

istringstream, 285, 299–301see also istreamword per line processing, 300, 370str, 301word per line processing, 386

isupper, 88isxdigit, 88Item_base

class definition, 560constructor, 580interface, 558member functions, 559

iter_swap, 816iterator, 95, 95–101, 107, 311–316, 354

argument, 238arrow (->), 164bidirectional, 417, 424compared to reverse iterator, 413, 414destination, 399, 419equality, 98, 312forward, 417, 424

generic algorithms, 394inequality, 98, 312input, 416, 424insert, 399, 405, 425invalidated, 315, 353invalidated byassign, 328erase, 326insert, 321push_back, 321push_front, 321resize, 324

off-the-end, 97, 394, 425operations, 311output, 416, 425parameter, 238, 242random-access, 417, 425relational operators, 313reverse, 405, 412–415, 425stream, 425

iterator, 362, 374container, 316

iterator header, 399iterator arithmetic, 100, 107, 312, 313

relational operators, 313iterator category, 416–418, 425

algorithm and, 416, 418bidirectional iterator, 417forward iterator, 417hierarchy, 417input iterator, 416output iterator, 416random-access iterator, 417

iterator range, 314, 314–316, 354algorithms constraints on, 397, 415erase, 327generic algorithms, 394insert, 320

Kkey_type, 388

associative containers, 362keyword

enum, 62friend, 465namespace, 712protected, 562template, 625try, 217union, 793

Page 22: Index [ptgmedia.pearsoncmg.com]ptgmedia.pearsoncmg.com/images/0201721481/index/lippman_index.pdf · “primer” — 2005/1/19 — 18:36 — page 843 — #865 Index Bold face numbers

“primer” — 2005/1/19 — 18:36 — page 864 — #886��

��

��

��

864 Index

virtual, 559export, 645

keyword table, 46Koenig lookup, 726

Llabel

case, 201, 201–204, 223access, 65, 73, 432, 473statement, 214

labeled statement, 214, 224left manipulator, 832left-inclusive interval, 314, 354left-shift (<<), 155, 190length_error, 219less-than (<), 30, 153

overloaded and containers, 520used by algorithm, 420

less-than-or-equal (<=), 13, 30, 153less<T>, 534less_equal<T>, 534lexicographical_compare, 823library, standard, 5, 29library names to header table, 810library type, 29lifetime, object, 254, 281link time errors from template, 635linkage directive, 801, 806

C++ to C, 802compound, 802overloaded function, 803parameter or return type, 804pointer to function, 803single, 801

linking, 68, 75list, 354

as element type, 311assign, 328assignment (=), 328back, 324begin, 317bidirectional iterator, 417clear, 327const_iterator, 316const_reference, 317const_reverse_iterator, 316constructor from element count, uses

copy constructor, 478constructors, 307–309element type constraints, 309, 323

empty, 323end, 317erase, 326front, 324insert, 319iterator, 316merge, 423performance characteristics, 334pop_back, 326pop_front, 326push_back, 318push_front, 318rbegin, 317, 412reference, 317relational operators, 321remove, 423remove_if, 423rend, 317, 412resize, 323reverse, 423reverse_iterator, 316, 412size, 323size_type, 316specific algorithms, 421splice, 423swap, 329types defined by, 316unique, 423value_type, 317

literal, 37, 37–42, 75bool, 39char, 40decimal, 38double (numEnum or numenum), 39float (numF or numf), 39hexadecimal (0Xnum or 0xnum), 38int, 38long (numL or numl), 38long double (ddd.dddL or ddd.dddl),

39multi-line, 42octal (0num), 38string, 9, 30, 40unsigned (numU or numu), 39wchar_t, 40

local class, 796, 806access control, 796name lookup, 797nested class in, 797restrictions on, 796

local scope, 54, 75

Page 23: Index [ptgmedia.pearsoncmg.com]ptgmedia.pearsoncmg.com/images/0201721481/index/lippman_index.pdf · “primer” — 2005/1/19 — 18:36 — page 843 — #865 Index Bold face numbers

“primer” — 2005/1/19 — 18:36 — page 865 — #887��

��

��

��

Index 865

local static object, 255, 281local variable, 227, 281

destructor, 485lifetime, 254reference return type, 248

logic_error, 219logical AND (&&), 152

operand order of evaluation, 172overloaded operator, 511

logical NOT (!), 153logical operator, 152

function object, 533logical OR (||), 152

operand order of evaluation, 172overloaded operator, 511

logical_and<T>, 534logical_not<T>, 534logical_or<T>, 534long, 34

literal (numL or numl), 38long double, 37long double, literal (ddd.dddL or ddd.dddl),

39lookup, name, 447, 474

and templates, 647before type checking, 269, 593

multiple inheritance, 738class member declaration, 447class member definition, 448, 450class member definition, examples,

449collisions under inheritance, 591depends on static type, 590

multiple inheritance, 735inheritance, 590, 595local class, 797multiple inheritance, 737

ambiguous names, 738namespace names, 724

argument-dependent lookup, 726nested class, 791overloaded virtual functions, 593virtual inheritance, 743

low-order bits, 102, 107lower_bound, 814

associative container, 377book finding program, 378

lvalue, 45, 75assignment, 160dereference, 99function reference return type, 249

prefix decrement, 162prefix increment, 162subscript, 88

Mmachine-dependent

bitfield layout, 798char representation, 36division and modulus result, 151end-of-file character, 20iostate type, 288linkage directive language, 802nonzero return from main, 247pre-compiled headers, 67random file access, 837reinterpret_cast, 185representation of enum type, 274return from exception what oper-

ation, 220signed and out-of-range value, 37signed types and bitwise operators,

155size of arithmetic types, 34template compilation optimization,

645terminate function, 219type_info members, 779vectormemory allocation size, 331volatile implementation, 799

magic number, 56, 75main, 2, 29

arguments to, 243not recursive, 251return type, 3return value, 2–5, 247returns 0 by default, 247

make_pair, 358make_plural program, 248manip, 542manipulator, 8, 29, 825

boolalpha, 826dec, 827fixed, 830hex, 827internal, 832left, 832noboolalpha, 827noshowbase, 828noshowpoint, 832noskipws, 833

Page 24: Index [ptgmedia.pearsoncmg.com]ptgmedia.pearsoncmg.com/images/0201721481/index/lippman_index.pdf · “primer” — 2005/1/19 — 18:36 — page 843 — #865 Index Bold face numbers

“primer” — 2005/1/19 — 18:36 — page 866 — #888��

��

��

��

866 Index

nouppercase, 828oct, 827right, 832scientific, 830setfill, 832setprecision, 829setw, 832showbase, 827showpoint, 831skipws, 833uppercase, 828boolalpha, 826change format state, 825dec, 827endl flushes the buffer, 291ends flushes the buffer, 291fixed, 830flush flushes the buffer, 291hex, 827internal, 832left, 832noboolalpha, 827noshowbase, 828noshowpoint, 832noskipws, 833nouppercase, 828oct, 827right, 832scientific, 830setfill, 832setprecision, 829setw, 832showbase, 827showpoint, 831skipws, 833unitbuf flushes the buffer, 291uppercase, 828

map, 356, 388as element type, 311assignment (=), 328begin, 369bidirectional iterator, 417clear, 359constructors, 360count, 367definition, 360dereference yields pair, 362element type constraints, 309empty, 359end, 369equal_range, 379

erase, 359, 368find, 368header, 360insert, 364iterator, 362key type constraints, 360key_type, 362lower_bound, 377mapped_type, 362, 388operations, 358overriding the default comparison,

604rbegin, 412rend, 412return type from insert, 365reverse_iterator, 412size, 359subscript operator, 363supports relational operators, 359swap, 329upper_bound, 377value_type, 361

mapped_type, map, multimap, 362match, best, 269, 280max, 822max_element, 822member, see also class member

mutable data, 474pointer to, 780, 807

member function, 25, 29, 431, 474const, 280equal, 778as friend, 466base member hidden by derived, 593class template, 653

defined outside class body, 651instantiation, 653

const, 261, 262defined outside class body, 261, 431definition, 258–262

in class scope, 445name lookup, 448name lookup, examples, 449

function template, see member tem-plate

implicitly inline, 259inline, 437

and header, 437overloaded, 436overloaded on const, 442overloaded operator, 483, 508

Page 25: Index [ptgmedia.pearsoncmg.com]ptgmedia.pearsoncmg.com/images/0201721481/index/lippman_index.pdf · “primer” — 2005/1/19 — 18:36 — page 843 — #865 Index Bold face numbers

“primer” — 2005/1/19 — 18:36 — page 867 — #889��

��

��

��

Index 867

pointer to, definition, 782returning *this, 442static, 467this pointer, 469

undefined, 482member operator delete, 764, 806

and inheritance, 764example, 769CachedObj, 770interface, 764

member operator delete [], 765member operator new, 764, 806

example, 769CachedObj, 769interface, 764

member operator new [], 765member template, 660, 684

declaration, 661defined outside class body, 662examples, 660instantiation, 663template parameters, 663

memberwise assignment, 483, 503memberwise initialization, 479, 503memory exhaustion, 175memory leak, 177, 485

after exception, 700memory management, generic, see CachedObjmerge, 816

list, 423Message, 486–491

assignment operator, 490class definition, 488copy constructor, 489design, 486destructor, 491put_Msg_in_Folder, 489remove_Msg_from_Folder, 491

method, see member function, 29Microsoft compiler, 4min, 822min_element, 822minus<T>, 534mismatch, 814mode, file, 296, 302modulus (%), 151modulus<T>, 534multi-dimensioned array, 141–144

and pointer, 143conversion to pointer, 143definition, 142

initialization, 142parameter, 241subscript operator, 142

multi-line literal, 42multimap, 375, 388

assignment (=), 328begin, 369clear, 359constructors, 360count, 377dereference yields pair, 362element type constraints, 309empty, 359equal_range, 379erase, 359, 376find, 377has no subscript operator, 376insert, 376iterator, 362, 376key type constraints, 360key_type, 362lower_bound, 377mapped_type, 362operations, 358, 376overriding the default comparison,

604rbegin, 412rend, 412return type from insert, 365reverse_iterator, 412size, 359supports relational operators, 359swap, 329upper_bound, 377value_type, 361

multiple base class, 750see also virtual base classambiguities, 738ambiguous conversion, 734avoiding potential name ambiguities,

738conversions, 734definition, 731destructor usually virtual, 736name lookup, 737object composition, 732order of construction, 732scope, 737virtual functions, 735

multiple inheritance, see multiple base class,731

Page 26: Index [ptgmedia.pearsoncmg.com]ptgmedia.pearsoncmg.com/images/0201721481/index/lippman_index.pdf · “primer” — 2005/1/19 — 18:36 — page 843 — #865 Index Bold face numbers

“primer” — 2005/1/19 — 18:36 — page 868 — #890��

��

��

��

868 Index

multiplication (*), 150multiplies<T>, 534multiset, 375, 388

assignment (=), 328begin, 372clear, 359constructors, 372count, 377element type constraints, 309end, 372equal_range, 379erase, 359, 376find, 377insert, 376iterator, 376key type constraints, 360lower_bound, 377Sales_item, 605operations, 358, 376overriding the default comparison,

604rbegin, 412rend, 412return type from insert, 373reverse_iterator, 412supports relational operators, 359swap, 329upper_bound, 377

example, 607value_type, 372

mutable data member, 443, 474

N\n (newline character), 40name lookup, 447, 474

and templates, 647before type checking, 269, 593

multiple inheritance, 738class member declaration, 447class member definition, 448, 450class member definition, examples,

449collisions under inheritance, 591depends on static type, 590

multiple inheritance, 735inheritance, 590, 595local class, 797multiple inheritance, 737

ambiguous names, 738namespace names, 724

argument-dependent lookup, 726nested class, 791overloaded virtual functions, 593virtual inheritance, 743

name resolution, see name lookupnamespace, 8, 29, 712, 750

class friend declaration scope, 727cplusplus_primer, 714definition, 712design, 714discontiguous definition, 714function matching, 727global, 716member, 713member definition, 716

outside namespace, 716restrictions, 716

nested, 717scope, 713–717unnamed, 718

local to file, 718replace file static, 719

namespace keyword, 712namespace alias, 720, 750namespace pollution, 712, 750naming convention

header file, 264source file, 264

NDEBUG, 220negate<T>, 534negator, 535, 553nested class, 786, 806

access control, 787class defined outside enclosing class,

789in class template, 788in local class, 797member defined outside class body,

788name lookup, 791QueueItem example, 787relationship to enclosing class, 787,

790scope, 786static members, 790union, 794

nested namespace, 717nested type, see nsted class786new, 145, 174, 189, 806

compared to operator new, 760execution flow, 760

Page 27: Index [ptgmedia.pearsoncmg.com]ptgmedia.pearsoncmg.com/images/0201721481/index/lippman_index.pdf · “primer” — 2005/1/19 — 18:36 — page 843 — #865 Index Bold face numbers

“primer” — 2005/1/19 — 18:36 — page 869 — #891��

��

��

��

Index 869

header, 219member operator, 806member operator, interface, 764placement, 761, 807

compared to construct, 762new [], 135new failure, 175next_permutation, 821noboolalpha manipulator, 827NoDefault, 459nonconst reference, 60

parameter, 232limitations, 235

nonportable, 42nonprintable character, 40, 75nonreference

parameter, 230uses copy constructor, 478

return type, 247uses copy constructor, 478

nontype template parameter, 625, 628, 632,684

see also template parameterclass template, 655must be constant expression, 633

nonvirtual function, calls resolved at com-pile time, 569

noshowbase manipulator, 828noshowpoint manipulator, 832noskipws manipulator, 833not equal, see inequalitynot1, 535not2, 535not_equal_to<T>, 534NotQuery, 609

definition, 616eval function, 620

nouppercase manipulator, 828nth_element, 818NULL, 118null pointer, 118

delete of, 176null statement, 192, 224null-terminated array, see C-style stringnumber, magic, 56, 75numeric header, 395numeric literal

float (numF or numf), 39long (numL or numl), 39long double (ddd.dddL or ddd.dddl),

39

unsigned (numU or numu), 39

Oobject, 46, 75

automatic, 255, 280function, 553is not polymorphic, 569local static, 255, 281temporary, 247

object cleanup, see destructorobject creation

constructor, 452order of construction, 456

derived objects, 581, 582multiple base classes, 732virtual base classes, 745

order of destruction, 485derived objects, 587multiple base classes, 733virtual base classes, 747

object file, 68object lifetime, 254, 281

and destructor, 485compared to scope, 254

object-oriented programming, 285, 302, 622key ideas in, 558–560

oct manipulator, 827octal, literal (0num), 38octal escape sequence (\nnn), 40off-the-end iterator, 97, 394, 425

istream_iterator, 408off-the-end pointer, 125ofstream, 285, 293–299

see also ostreamclose, 294constructor, 293file marker, 838file mode, 296

combinations, 298example, 299

file random access, 838off_type, 839open, 293pos_type, 839random IO sample program, 840seek and tell members, 838–842

open, 293open_file, example of, 370, 383open_file program, 299operand, 148, 189

Page 28: Index [ptgmedia.pearsoncmg.com]ptgmedia.pearsoncmg.com/images/0201721481/index/lippman_index.pdf · “primer” — 2005/1/19 — 18:36 — page 843 — #865 Index Bold face numbers

“primer” — 2005/1/19 — 18:36 — page 870 — #892��

��

��

��

870 Index

order of evaluationcomma operator, 172conditional operator, 172logical operator, 172

operator, 148, 189sizeof, 167typeid, 775, 807addition (+), 150string, 86iterator, 101, 313pointer, 123

address-of (&), 115arrow (->), 164

class member access, 445assignment (=), 13, 30, 159

and conversion, 179and equality, 161container, 328multiple inheritance, 737pointer, 120string, 86to signed, 37to unsigned, 37yields lvalue, 160

binary, 148, 188bitwise AND (&), 156bitwise exclusive or (^), 156bitwise not (~), 155bitwise OR (|), 156bitwise OR (|), example, 290call (()), 30, 226comma (,), 168

operand order of evaluation, 172comma (,), example, 289compound assginment (e.g.,+=), it-

erator, 313compound assignment (e.g.,+=), 13,

30, 161string, 86arithmetic, 162bitwise, 162

conditional (?:), 165operand order of evaluation, 172

decrement (--)iterator, 312prefix yields lvalue, 162reverse iterator, 412

dereference (*), 98and increment, 163iterator, 98on map yields pair, 362

pointer, 119yields lvalue, 99, 120

division (/), 150dot (.), 25, 30

class member access, 445equality (==), 30, 154string, 85algorithm, 421container, 322container adaptor, 350iterator, 98, 312string, 347

greater-than (>), 30, 153greater-than-or-equal (>=), 30, 153increment (++), 13, 30

and dereference, 163iterator, 98, 312pointer, 114prefix yields lvalue, 162reverse iterator, 412

inequality (!=), 30, 154container, 322container adaptor, 350iterator, 98, 312string, 347

input (>>), 8, 30Sales_item, 516istream_iterator, 408string, 81precedence and associativity, 158

left-shift (<<), 155, 190less-than (<), 30, 153

used by algorithm, 420less-than-or-equal (<=), 13, 30, 153logical AND (&&), 152

operand order of evaluation, 172logical NOT (!), 153logical OR (||), 152

operand order of evaluation, 172modulus (%), 151multiplication (*), 150output (<<), 7, 30bitset, 106ostream_iterator, 408string, 81precedence and associativity, 158

overloaded, 189, 482, 503pointer to member

arrow (->*), 783dot (.*), 783

right-shift (>>), 155, 190

Page 29: Index [ptgmedia.pearsoncmg.com]ptgmedia.pearsoncmg.com/images/0201721481/index/lippman_index.pdf · “primer” — 2005/1/19 — 18:36 — page 843 — #865 Index Bold face numbers

“primer” — 2005/1/19 — 18:36 — page 871 — #893��

��

��

��

Index 871

scope (::), 8, 30, 78class member, 85, 445container defined type, 317member function definition, 262to override name lookup, 449

shift, 155, 190sizeof, 167subscript ([ ])bitset, 105deque, 325map, 363string, 87vector, 94, 325and multi-dimensioned array, 142and pointer, 124array, 113valid subscript range, 88yields lvalue, 88

subtraction (-), 150iterator, 101, 313pointer, 123

unary, 148, 189unary minus (-), 150unary plus (+), 150

operator alternative name, 46operator delete function, 760, 806

compared to deallocate, 761compared to delete expression, 760

operator delete member, 764and inheritance, 764example, 769CachedObj, 770interface, 764

operator delete [] member, 765operator new function, 760, 806

compared to allocate, 761compared to new expression, 760

operator new member, 764example, 769CachedObj, 769interface, 764

operator new [] member, 765operator overloading, see overloaded op-

eratoroptions to main, 243order of construction, 456, 749

derived objects, 581, 582multiple base classes, 732virtual base classes, 746

order of destruction, 485, 749derived objects, 587

multiple base classes, 733virtual base classes, 747

order of evaluation, 149, 189comma operator, 172conditional operator, 172logical operator, 172

ordering, strict weak, 360, 389OrQuery, 609

definition, 618eval function, 619

ostream, 6, 29, 285see also manipulatorcondition state, 287floatfield member, 831flushing output buffer, 290format state, 825inheritance hierarchy, 740no containers of, 310no copy or assign, 287not flushed if program crashes, 292output (<<), 7

precedence and associativity, 158precision member, 829seek and tell members, 838tie member, 292unsetf member, 831

ostream_iterator, 407, 425and class type, 410constructors, 408limitations, 411operations, 410output iterator, 417output operator (<<), 408used with algorithms, 411

ostringstream, 285, 299–301see also ostreamstr, 301

out (file mode), 296out_of_range, 219, 325out_of__stock, 699output, standard, 6output (<<), 7, 30

bitset, 106ostream_iterator, 408string, 81, 108overloaded operator, 513

formatting, 514must be nonmember, 514

precedence and associativity, 158Sales_item, 514

output iterator, 416, 425

Page 30: Index [ptgmedia.pearsoncmg.com]ptgmedia.pearsoncmg.com/images/0201721481/index/lippman_index.pdf · “primer” — 2005/1/19 — 18:36 — page 843 — #865 Index Bold face numbers

“primer” — 2005/1/19 — 18:36 — page 872 — #894��

��

��

��

872 Index

overflow, 150overflow_error, 219overload resolution, see function match-

ingoverloaded function, 265, 281

using declarations, 728using directive, 729compared to redeclaration, 266compared to template specialization,

673friend declaration, 467linkage directive, 803namespaces, 727scope, 268virtual, 593

overloaded member function, 436on const, 442

overloaded operator, 189, 482, 503<< (output operator), 513* (dereference), 524& (address-of), 511-> (arrow operator), 525[ ] (subscript), 522

reference return, 522() (call operator), 530= (assignment), 476, 483, 520

and copy constructor, 484check for self-assignment, 490Message, 490reference return, 483, 521rule of three, 485use counting, 495, 498valuelike classes, 501

>> (input operator), 515error handling, 516–517must be nonmember, 514

<< (output operator)formatting, 514must be nonmember, 514Sales_item, 514

&& (logical AND), 511|| (logical OR), 511, (comma operator), 511addition (+), Sales_item, 517ambiguous, 550arithmetic operators, 517as virtual function, 615binary operator, 508candidate functions, 549compound assignment (e.g.,+=), 511Sales_item, 521

consistency between relational andequality operators, 520

definition, 482, 506design, 510–513equality operators, 512, 518explicit call to, 509explicit call to postfix operators, 529function matching, 547–551member and this pointer, 483member vs. nonmember function,

508, 512postfix increment (++) and decrement

(--) operators, 528precedence and associativity, 507prefix increment (++) and decrement

(--) operators, 527relational operators, 511, 520require class-type parameter, 507unary operator, 508

overloading, see overloaded functionoperator, see overloaded operator

Ppair, 356, 388

as return type from map::insert,365

as return type from set::insert,373

default constructor, 357definition, 356initialization, 356make_pair, 358operations, 357public data members, 357

Panda, 731virtual inheritance, 741

parameter, 226, 227, 281array and buffer overflow, 242array type, 238–244C-style string, 242const, 231const reference, 235

overloading, 275ellipsis, 244function pointer, 278

linkage directive, 804initialization of, 229iterator, 238, 242library container, 237lifetime, 255

Page 31: Index [ptgmedia.pearsoncmg.com]ptgmedia.pearsoncmg.com/images/0201721481/index/lippman_index.pdf · “primer” — 2005/1/19 — 18:36 — page 843 — #865 Index Bold face numbers

“primer” — 2005/1/19 — 18:36 — page 873 — #895��

��

��

��

Index 873

local copy, 230matching, 229

ellipsis, 244template specialization, 673with class type conversion, 541

multi-dimensioned array, 241nonconst reference, 232nonreference type, 230

uses copy constructor, 478of member function, 260vector type, 237passing, 229pointer to const, 231

overloading, 275pointer to function, 278

linkage directive, 804pointer to nonconst, 231pointer type, 231, 239reference

to array type, 240to pointer, 236

template, see template parameterand main, 243type checking

and template argument, 638of reference to array, 240

parameter list, 3, 29, 226, 228member function definition, 446

parentheses, override precedence, 169partial specialization, 678, 684partial_sort, 818partial_sort_copy, 818partial_sum, 824partition, 817placement new, 761, 807

compared to construct, 762plus<T>, 534pointer, 114, 114–126, 146

array, 122arrow (->), 164as initializer of vector, 140as parameter, 231assignment, 120char*, see C-style stringclass member copy control, 492–501

copy constructor, 480destructor, 485strategies, 499

compared to iterator, 114compared to reference, 121const, 128

const pointer to const, 129container constructor from, 308conversion from derived to base, 567conversion from derived to multiple

base, 734conversion to bool, 182conversion to void, 181dangling, 176, 188

synthesized copy control, 494declaration style, 116–117definition, 115delete, 176dynamic_cast, example, 773function returning, 228implicit this, 260, 281initialization, 117–119is polymorphic, 569multi-dimensioned array, 143new, 174null, 118off-the-end, 125pitfalls with generic programs, 671reference parameter, 236relational operator, 132return type and local variable, 249smart, 495, 503, 553

handle class, 599overloaded-> (arrow operator) and* (dereference), 524

overloaded (++) and (*), 526subscript operator, 124to pointer, 122typedef, 129typeid operator, 776uninitialized, 117volatile, 800

pointer arithmetic, 123, 146pointer to const, 127

argument, 231conversion from nonconst, 127parameter, 231

overloading, 275pointer to function, 276–279

definition, 276exception specifications, 711function returning, 228initialization, 277linkage directive, 803overloaded functions, 279parameter, 278return type, 278

Page 32: Index [ptgmedia.pearsoncmg.com]ptgmedia.pearsoncmg.com/images/0201721481/index/lippman_index.pdf · “primer” — 2005/1/19 — 18:36 — page 843 — #865 Index Bold face numbers

“primer” — 2005/1/19 — 18:36 — page 874 — #896��

��

��

��

874 Index

typedef, 276pointer to member, 780, 807

and typedef, 783arrow (->*), 783definition, 781dot (.*), 783function pointer, 782function table, 785

pointer to nonconstargument, 231parameter, 231

polymorphism, 558, 622compile time polymorphism via tem-

plates, 624run time polymorphism in C++, 569

poppriority_queue, 352queue, 352stack, 351

pop_back, sequential container, 326pop_front, sequential container, 326portable, 797postfix decrement (--)

overloaded operator, 528yields rvalue, 163

postfix increment (++)and dereference, 163overloaded operator, 528

precedence, 124, 146, 149, 168, 189of assignment, 160of conditional, 166of dot and derefernece, 164of increment and dereference, 163of IO operator, 158of pointer to member and call oper-

ator, 782overloaded operator, 507pointer parameter declaration, 241

precedence table, 170predicate, 402, 425prefix decrement (--), 163

overloaded operator, 527yields lvalue, 162

prefix increment (++)and dereference, 163overloaded operator, 527yields lvalue, 162

preprocessor, 70, 75directive, 7, 29macro, 221, 224variable, 71

prev_permutation, 821preventing copies of class objects, 481print_total, 559

explained, 568printable character, 88printValues program, 240, 242, 243priority_queue, 348, 354

constructors, 349relational operator, 350

privateclass, 496copy constructor, 481inheritance, 571member, 75, 474

private access label, 65, 432inheritance, 561

private inheritance, 622program

factorial, 250find_val, 234gcd, 226isShorter, 235make_plural, 248open_file, 299printValues, 240, 242, 243ptr_swap, 237rgcd, 250swap, 233, 245vector capacity, 331book finding

using equal_range, 379using find, 377using upper_bound, 378

bookstore, 26bookstore exception classes, 698CachedObj, 766duplicate words, 400–404

revisited, 531find last word, 414GT6, 403Handle class, 667int instantiation, 668operations, 668Sales_item instantiation, 669

isShorter, 403message handling classes, 486Query

design, 609–611interface, 610operations, 607

Queue, 648

Page 33: Index [ptgmedia.pearsoncmg.com]ptgmedia.pearsoncmg.com/images/0201721481/index/lippman_index.pdf · “primer” — 2005/1/19 — 18:36 — page 843 — #865 Index Bold face numbers

“primer” — 2005/1/19 — 18:36 — page 875 — #897��

��

��

��

Index 875

copy_elems member, 652destroy member, 651pop member, 651push member, 652

random IO example, 840restricted word count, 374Sales_item handle class, 599Screen class template, 655TextQuery, 383

class definition, 382design, 380interface, 381

vector, capacity, 331vowel counting, 200word count, 363word transformation, 370ZooAnimal class hierarchy, 731

programmer-defined header, 67–72programming

generic, 95, 624object-oriented, 285, 302, 622

promotion, integral, 180, 189protected, inheritance, 571, 622protected access label, 562, 622protected keyword, 562prototype, function, 251, 281ptr_swap program, 237ptrdiff_t, 123, 146public

inheritance, 571, 622member, 75, 474

public access label, 65, 432inheritance, 561

pure virtual function, 596, 622example, 609

pushpriority_queue, 352queue, 352stack, 351

push_back, 94, 108vector, 94back_inserter, 399sequential container, 318

push_frontfront_inserter, 406sequential container, 318

put_Msg_in_Folder, 489

QQuery, 610

& (bitwise AND), 610definition, 614

~ (bitwise NOT), 610definition, 614

| (bitwise OR), 610definition, 614

<< (output operator), 615definition, 613design, 609–611interface, 610operations, 607

Query_base, 609definition, 612member functions, 609

Queue<< (output operator), 659assign, 662copy_elems member, 652, 662definition, 648design, 647destroy member, 651final class definition, 664interface, 627member template declarations, 661operations, 627pop member, 651push, specialized, 677push member, 652template version, char*, 675

queue, 348, 354constructors, 349relational operator, 350

QueueItem, 648as nested class, 787

constructor, 789definition, 788

friendship, 658CachedObj, 768

allocation explained, 769

RRaccoon as virtual base, 741RAII, see resource allocation is initializa-

tionraise, 750raise exception, see throwrandom file IO, 838random-access iterator, 417, 425

deque, 417string, 417

Page 34: Index [ptgmedia.pearsoncmg.com]ptgmedia.pearsoncmg.com/images/0201721481/index/lippman_index.pdf · “primer” — 2005/1/19 — 18:36 — page 843 — #865 Index Bold face numbers

“primer” — 2005/1/19 — 18:36 — page 876 — #898��

��

��

��

876 Index

vector, 417random_shuffle, 820range

iterator, 314, 314–316, 354left-inclusive, 314

range_error, 219rbegin, container, 317, 412rdstate, 290recursive function, 249, 281refactoring, 583, 622referece, 317reference, 58, 75

and pointer, 121const reference, 59

initialization, 60conversion from derived to base, 567conversion from derived to multiple

base, 734dynamic_cast operator, example,

774is polymorphic, 569nonconst reference, 60parameter, 232–237pointer parameter, 236return type, is lvalue, 249return type and class object, 440return type and local variable, 249return value, 248to array parameter, 240

reference count, see use countreference data member, initialization, 455reference to const, see const referencereinterpret_cast, 183, 185relational operator, 153

string, 85associative container, 359container, 321container adaptor, 350function object, 533overloaded operator, 511, 520

consistent with equality, 520pointer, 132

remove, 819list, 423

remove_copy, 820remove_copy_if, 820remove_if, 819

list, 423remove_Msg_from_Folder, 491rend, container, 317, 412replace, 400, 816

string, 342replace_copy, 400, 815replace_copy_if, 815replace_if, 816reserve

string, 336vector, 331

reserved identifier, 47resize, sequential container, 323Resource, 700resource allocation is initialization, 700–

701auto_ptr, 702

restricted word count program, 374result, 148, 189rethrow, 695, 750return, container, 381return statement, 245–251

from main, 247implicit, 245local variable, 247, 249

return type, 3, 29, 226, 227const reference, 249function, 281function pointer, 278linkage directive, 804member function definition, 446no implicit return type, 228nonreference, 247

uses copy constructor, 478of virtual function, 564pointer to function, 278reference, 248reference yields lvalue, 249void, 245

return valueconversion, 246copied, 247

reverse, 819list, 423

reverse iterator, 405, 412–415, 425-- (decrement), 412++ (increment), 412base, 414compared to iterator, 413, 414example, 414requires -- (decrement), 413

reverse_copy, 819reverse_iterator, 412

container, 316rfind, string, 346

Page 35: Index [ptgmedia.pearsoncmg.com]ptgmedia.pearsoncmg.com/images/0201721481/index/lippman_index.pdf · “primer” — 2005/1/19 — 18:36 — page 843 — #865 Index Bold face numbers

“primer” — 2005/1/19 — 18:36 — page 877 — #899��

��

��

��

Index 877

rgcd program, 250right manipulator, 832right-shift (>>), 155, 190rotate, 819rotate_copy, 820rule of three, 485, 503

exception for virtual destructors, 588run time, 75

error, 38run-time type identification, 772–780, 807

classes with virtual functions, 772compared to virtual functions, 777dynamic_cast, 773

example, 773throws bad_cast, 774to poiner, 773to reference, 774

type-sensitive equality, 778typeid, 775

and virtual functions, 775example, 776returns type_info, 776

runtime_error, 217, 219constructor from string, 218

rvalue, 45, 75

Ssafety, exception, 700Sales_item, 21

addition (+), 23, 517throws exception, 217, 699

class definition, 64, 258–265compare function, 604compound assignment (e.g.,+=), 521conversion, 461default constructor, 263equality operators (==), (!=), 519explicit constructor, 462handle class, 599clone function, 602constructor, 601, 602definition, 600design, 599multiset of, 605using generic Handle, 669

header, 21, 67, 264input (>>), 516istream constructor, 452no relational operators, 520operations, 21

output (<<), 514avg_price definition, 261same_isbn, 24, 258string constructor, 452

scientific manipulator, 830scope, 54, 75

const object, 57, 69block, 193class, 65, 444, 473compared to object lifetime, 254for statement, 15friend declaration, 466function, 227function template specialization, 674global, 54, 74local, 54, 75multiple inheritance, 737namespace, 713–717statement, 194template parameter, 629using declaration, 720using directive, 721

example, 722name collisions, 723

scope (::)base class members, 569namespace member, 750

scope operator (::), 8, 30, 78, 108class member, 85, 445container defined type, 317member function definition, 262namespace member, 713to override class-specific memory al-

location, 765to override name lookup, 449

Screen, 435class template, 655concatenating operations, 441display, 442do_display, 442friends, 465get definition, 446get members, 436get_cursor definition, 446CachedObj, 768Menu function table, 785move members, 441set members, 441simplified, 781size_type, 435

ScreenPtr, 523

Page 36: Index [ptgmedia.pearsoncmg.com]ptgmedia.pearsoncmg.com/images/0201721481/index/lippman_index.pdf · “primer” — 2005/1/19 — 18:36 — page 843 — #865 Index Bold face numbers

“primer” — 2005/1/19 — 18:36 — page 878 — #900��

��

��

��

878 Index

arrow operator (->), 525dereference (*), 524use counted, 523

ScrPtr, 523search, 813search_n, 813self-assignment

auto_ptr, 705check, 490use counting, 498

semantics, value, 499, 503semicolon (;), 3semicolon (;), class definition, 440sentinel, 97, 108separate compilation, 67, 76

inclusion model for templates, 644of templates, 643separate compilation model for tem-

plates, 645, 684sequence, escape, 74sequence (\Xnnn), hexadecimal escape, 40sequential container, 306, 354

assign, 328assignment (=), 328back, 324clear, 327const_iterator, 316const_reverse_iterator, 316constructor from element count

uses copy constructor, 478uses element default constructor,

460constructors, 307–309deque, 306element type constraints, 309, 323empty, 323erase, 326front, 324insert, 319iterator, 316list, 306operations, 316–330performance characteristics, 333pop_back, 326pop_front, 326priority_queue, 348push_back, 318push_front, 318queue, 348rbegin, 412rend, 412

resize, 323returning a, 381reverse_iterator, 316, 412size, 323size_type, 316stack, 348supports relational operators, 321swap, 329types defined by, 316value_type, 317vector, 306

set, 356, 388as element type, 311assignment (=), 328begin, 372bidirectional iterator, 417clear, 359constructors, 372count, 372element type constraints, 309empty, 359end, 372equal_range, 379erase, 359, 372find, 372insert, 373iterator, 374key type constraints, 360lower_bound, 377operations, 358overriding the default comparison,

604rbegin, 412rend, 412return alternatives, 381return type from insert, 373reverse_iterator, 412size, 359supports relational operators, 359swap, 329upper_bound, 377value_type, 372

set_difference, 822set_intersection, 619, 822set_symmetric_difference, 822set_union, 822setfill manipulator, 832setprecision manipulator, 829setstate, 289, 290setw manipulator, 832shift operator, 155, 190

Page 37: Index [ptgmedia.pearsoncmg.com]ptgmedia.pearsoncmg.com/images/0201721481/index/lippman_index.pdf · “primer” — 2005/1/19 — 18:36 — page 843 — #865 Index Bold face numbers

“primer” — 2005/1/19 — 18:36 — page 879 — #901��

��

��

��

Index 879

short, 34short-circuit evaluation, 152

overloaded operator, 508shorterString, 248showbase manipulator, 827showpoint manipulator, 831signed, 35, 76

conversion to unsigned, 36, 180size, 108

string, 83vector, 93associative container, 359priority_queue, 352queue, 352sequential container, 323stack, 351

size_t, 104, 108, 146and array, 113

size_type, 84, 108string, 84vector, 93container, 316

sizeof operator, 167skipws manipulator, 833sliced, 579, 622SmallInt, 536, 550

conversion operator, 537smart pointer, 495, 503, 553

handle class, 599overloaded -> (arrow operator) and

* (dereference), 524overloaded (++) and (*), 526

sort, 401, 817source file, 4, 29

naming convention, 264specialization

class templatedefinition, 675member defined outside class body,

676partial, 678partial specialization, 684

class template member, 677declaration, 677

function templatecompared to overloaded function,

673declaration, 672, 673example, 672scope, 674

template, namespaces, 730

specifier, type, 48, 76splice, list, 423sstream

header, 285, 300str, 301

stable_partition, 817stable_sort, 403, 817stack, 348, 354

constructors, 349relational operator, 350

stack unwinding, 691, 750standard error, 6, 29standard input, 6, 29standard library, 5, 29standard output, 6, 30state, condition, 302statement, 2, 30

break, 212, 223continue, 214, 223do while, 210for, 29, 207goto, 214, 224if, 17, 29, 195, 224return, 245–251switch, 199, 224while, 12, 30, 204, 224compound, 193, 223declaration, 193, 224expression, 192, 224for statementfor, 14labeled, 214, 224null, 192, 224return, local variable, 247, 249

statement block, see blockstatement label, 214statement scope, 194statementfor statement, for, 14static (file static), 719static class member, 467, 474

as default argument, 471class template, 665

accessed through an instantiation,666

definition, 666const data member, initialization,

470const member function, 469data member, 469

as constant expression, 471inheritance, 576member function, 467

Page 38: Index [ptgmedia.pearsoncmg.com]ptgmedia.pearsoncmg.com/images/0201721481/index/lippman_index.pdf · “primer” — 2005/1/19 — 18:36 — page 843 — #865 Index Bold face numbers

“primer” — 2005/1/19 — 18:36 — page 880 — #902��

��

��

��

880 Index

this pointer, 469static object, local, 255, 281static type, 568, 622

determines name lookup, 590multiple inheritance, 735

static type checking, 44, 76argument, 229function return value, 246

static_cast, 183, 185std, 8, 30stdexcept header, 217, 219store, free, 135, 145str, 301strcat, 133strcmp, 133strcpy, 133stream

istream_iterator, 407ostream_iterator, 407flushing buffer, 290iterator, 405, 407–412

and class type, 410limitations, 411used with algorithms, 411

not flushed if program crashes, 292type as condition, 19

stream iterator, 425strict weak ordering, 360, 389string, C-style, see C-style stringstring, 80–89

addition, 86addition to string literal, 87and string literal, 81, 140append, 342are case sensitive, 344as sequential container, 335assign, 340assignment (=), 86c_str, 140c_str, example, 294capacity, 336compare, 347compared to C-style string, 134compound assignment, 86concatenation, 86constructor, 80, 338–339default constructor, 52empty, 83equality (==), 85equality operator, 347erase, 340

find, 344find_first_not_of, 346find_first_of, 345find_last_not_of, 346find_last_of, 346getline, 82getline, example, 300header, 80input operation as condition, 82input operator, 81insert, 340output operator, 81random-access iterator, 417relational operator, 85, 347replace, 342reserve, 336rfind, 346size, 83size_type, 84subscript operator, 87substr, 342

string literal, 9, 30, 40addition to string, 87and string library type, 81, 140and C-style string, 140concatenation, 41

stringstream, 285, 299–301, 302see also istreamsee also ostreamstr, 301

strlen, 133strncat, 133strncpy, 133struct, see also class

default access label, 433default inheritance access label, 574

struct, keyword, 66, 76, 474in variable definition, 440

structure, data, 20, 28Studio, Visual, 4subscript ([ ]), 87, 108, 146, 389

bitset, 105deque, 325map, 363string, 87vector, 94, 325and multi-dimensioned array, 142and pointer, 124array, 113overloaded operator, 522

reference return, 522

Page 39: Index [ptgmedia.pearsoncmg.com]ptgmedia.pearsoncmg.com/images/0201721481/index/lippman_index.pdf · “primer” — 2005/1/19 — 18:36 — page 843 — #865 Index Bold face numbers

“primer” — 2005/1/19 — 18:36 — page 881 — #903��

��

��

��

Index 881

valid subscript range, 88yields lvalue, 88

subscript rangestring, 88vector, 96array, 114

substr, string, 342subtraction (-), 150

iterator, 101, 313pointer, 123

swap, 329, 816container, 329

swap program, 233, 245swap_ranges, 816switch statement, 199, 224

default label, 203and break, 201–203case label, 201compared to if, 199execution flow, 201expression, 203variable definition, 204

synthesized assignment (=), 483, 503multiple inheritance, 737pointer members, 493

synthesized copy constructor, 479, 503multiple inheritance, 737pointer members, 493virtual base class, 747

synthesized copy control, volatile, 800synthesized default constructor, 264, 281,

459, 474inheritance, 581

synthesized destructor, 485, 486multiple inheritance, 737pointer members, 493

T\t (tab character), 40table of library name and header, 810template

see also class templatesee also function templatesee also instantiationclass, 90, 107class member, see member templatelink time errors, 635overview, 624

template keyword, 625template argument, 625, 684

and function argument type check-ing, 638

class template, 628conversion, 638deduction, 684

from function pointer, 640deduction for class template mem-

ber function, 653deduction for function template, 637explicit and class template, 636explicit and function template, 642

and function pointer, 643specifying, 642

pointer, 671template argument deduction, 637template class, see class templatetemplate function, see function templatetemplate parameter, 625, 628–633, 684

and member templates, 663name, 628

restrictions on use, 629nontype parameter, 625, 628, 632, 684

class template, 655must be constant expression, 633

scope, 629type parameter, 625, 628, 630, 684uses of inside class definition, 649

template parameter list, 625, 684template specialization, 672, 684

class member declaration, 677compared to overloaded function, 673definition, 675example, 672function declaration, 672, 673member defined outside class body,

676member of class template, 677parameter matching, 673partial specialization, 678, 684scope, 674

template<>, see template specializationtemporary object, 247terminate, 219, 219, 224, 692, 750TextQuery

class definition, 382main program using, 383program design, 380program interface, 381revisited, 609

this pointerimplicit, 260, 281

Page 40: Index [ptgmedia.pearsoncmg.com]ptgmedia.pearsoncmg.com/images/0201721481/index/lippman_index.pdf · “primer” — 2005/1/19 — 18:36 — page 843 — #865 Index Bold face numbers

“primer” — 2005/1/19 — 18:36 — page 882 — #904��

��

��

��

882 Index

implicit parameter, 431, 440in overloaded operator, 483overloaded operator, 508static member functions, 469

three, rule of, 485, 503throw, 216, 216, 224, 689, 750

example, 217, 290execution flow, 218, 691pointer to local object, 690rethrow, 695

tolower, 88top

priority_queue, 352stack, 351

toupper, 88transform, 815transformation program, word, 370translation unit, see source filetrunc (file mode), 296try block, 216, 217, 224, 750try keyword, 217type

abstract data, 78, 473arithmetic, 34, 73built-in, 3, 28, 34–37class, 20, 28, 65compound, 58, 73, 145dynamic, 568, 622function return, 281incomplete, 438, 474integral, 34, 75library, 29nested, see nsted class786return, 3, 29, 226, 227static, 568, 622

determines name lookup, 590name lookup and multiple inher-

itance, 735type checking, 44

argument, 229with class type conversion, 541

ellipsis parameter, 244name lookup, 269reference to array argument, 240

type identification, run-time, 772–780, 807type specifier, 48, 76type template parameter, 628, 630, 684

see also template parametertype_info, 807

header, 219name member, 780

no copy or assign, 780operations, 779returned from typeid, 776

typedefand pointer, 129and pointer to member, 783pointer to function, 276

typedef, 61, 76typeid operator, 775, 807

and virtual functions, 775example, 776returns type_info, 776

typename, keywordcompared to class, 631in template parameter, 630inside template definition, 632

UU_Ptr, 496unary function object, 533unary minus (-), 150unary operator, 148, 189unary plus (+), 150uncaught exception, 692undefined behavior, 41, 76

dangling pointer, 176synthesized copy control, 494

invalidated iterator, 315uninitialized class data member, 459uninitialized pointer, 117uninitialized variable, 51

underflow_error, 219unexpected, 708, 750uninitialized, 8, 30, 51, 76uninitialized pointer, 117uninitialized_copy, 755, 759uninitialized_fill, 755union, 792, 807

anonymous, 795, 805as nested type, 794example, 794limitations on, 793

union keyword, 793unique, 402, 819

list, 423unique_copy, 412, 820unitbuf, manipulator flushes the buffer,

291unnamed namespace, 718, 750

local to file, 718

Page 41: Index [ptgmedia.pearsoncmg.com]ptgmedia.pearsoncmg.com/images/0201721481/index/lippman_index.pdf · “primer” — 2005/1/19 — 18:36 — page 843 — #865 Index Bold face numbers

“primer” — 2005/1/19 — 18:36 — page 883 — #905��

��

��

��

Index 883

replace file static, 719unsigned, 35, 76

conversion to signed, 36, 180literal (numU or numu), 39

unsigned char, 36unwinding, stack, 691, 750upper_bound, 814

associative container, 377book finding program, 378example, 607

uppercase manipulator, 828use count, 495, 503

design overview, 495generic class, 667held in companion class, 496pointer to, 600self-assignment check, 498

user, 433, 563using declaration, 78, 108, 720, 750

access control, 573class member access, 574in header, 80overloaded function, 728overloaded inherited functions, 593scope, 720

using directive, 721, 751overloaded function, 729pitfalls, 724scope, 721

example, 722name collisions, 723

utility header, 356

Vvalue initialization, 92, 108

map subscript operator, 363vector, 92and dynamically allocated array, 136dequedeque, 309listlist, 309of dynamically allocated object, 175and resize, 324sequential container, 309vectorvector, 309

value semantics, 499, 503value_type, 389

map, multimap, 361sequential container, 317set, multiset, 372

varargs, 244

variable, 8, 30, 43–55define before use, 44defined after case label, 204definition, 48definitions and goto, 215initialization, 48, 50, 76

constructor, 452local, 227, 281scope, 55

Vector, 757capacity, 757memory allocation strategy, 757push_back, 758reallocate, 758size, 757using operator new and delete,

761using explicit destructor call, 763using placement new, 762

vector, 90–95, 354argument, 237as element type, 311assign, 328assignment (=), 328at, 325back, 324begin, 97, 317capacity, 331clear, 327const_iterator, 99, 316const_reference, 317const_reverse_iterator, 316constructor from element count, uses

copy constructor, 478constructor taking iterators, 140constructors, 91–92, 307–309difference_type, 316element type constraints, 309, 323empty, 93, 323end, 97, 317erase, 326, 402

invalidates iterator, 326front, 324header, 90initialization from pointer, 140insert, 319

invalidates iterator, 320iterator, 97, 316iterator supports arithmetic, 312memory allocation strategy, 756memory management strategy, 330

Page 42: Index [ptgmedia.pearsoncmg.com]ptgmedia.pearsoncmg.com/images/0201721481/index/lippman_index.pdf · “primer” — 2005/1/19 — 18:36 — page 843 — #865 Index Bold face numbers

“primer” — 2005/1/19 — 18:36 — page 884 — #906��

��

��

��

884 Index

parameter, 237performance characteristics, 334pop_back, 326push_back, 94, 318

invalidates iterator, 321random-access iterator, 417rbegin, 317, 412reference, 317relational operators, 321rend, 317, 412reserve, 331resize, 323reverse_iterator, 316, 412size, 93, 323size_type, 93, 316subscript ([ ]), 325subscript operator, 94supports relational operators, 313swap, 329type, 91types defined by, 316value_type, 317

vector capacity program, 331viable function, 270, 282

with class type conversion, 545virtual base class, 741, 751

ambiguities, 743conversion, 743defining base as, 742derived class constructor, 744name lookup, 743order of construction, 746stream types, 741

virtual function, 559, 566–570, 622assignment operator, 588calls resolved at run time, 568compared to run-time type identifi-

cation, 777default argument, 570derived classes, 564destructor, 587

multiple inheritance, 736exception specifications, 710in constructors, 589in destructor, 589introduction, 561multiple inheritance, 735no virtual constructor, 588overloaded, 593overloaded operator, 615overriding run-time binding, 570

pure, 596, 622example, 609

return type, 564run-time type identification, 772scope, 594static, 469to copy unknown type, 602type-sensitive equality, 778

virtual inheritance, 741, 751virtual keyword, 559Visual Studio, 4void, 34, 76

return type, 245void*, 119, 146

const void*, 127, 145volatile, 800, 807

pointer, 800synthesized copy control, 800

vowel counting program, 200

Wwcerr, 286wchar_t, 34

literal, 40wchar_t streams, 286wcin, 286wcout, 286weak ordering, strict, 360, 389wfstream, 286what, see exceptionwhile statement, 12, 30, 204, 224

condition in, 205whitespace, 81wide character streams, 286wifstream, 286window, console, 6Window_Mgr, 465wiostream, 286wistream, 286wistringstream, 286wofstream, 286word, 35, 76word count program, 363

restricted, 374word per line processing

istringstream, 386istringstreamistringstream, 370

istringstream, 300word transformation program, 370WordQuery, 609

Page 43: Index [ptgmedia.pearsoncmg.com]ptgmedia.pearsoncmg.com/images/0201721481/index/lippman_index.pdf · “primer” — 2005/1/19 — 18:36 — page 843 — #865 Index Bold face numbers

“primer” — 2005/1/19 — 18:36 — page 885 — #907��

��

��

��

Index 885

definition, 616wostream, 286wostringstream, 286wrap around, 38wstringstream, 286

X\Xnnn (hexadecimal escape sequence), 40

ZZooAnimal, using virtual inheritance, 741ZooAnimal class hierarchy, 731