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.

What’s new in C++11

= default, 265, 506

= delete, 507

allocator, construct forwards to any constructor, 482

array container, 327

auto, 68

for type abbreviation, 88, 129

not with dynamic array, 478

with dynamic object, 459

begin function, 118

bind function, 397

bitset enhancements, 726

constexpr

constructor, 299

function, 239

variable, 66

container

cbegin and cend, 109, 334

emplace members, 345

insert return type, 344

nonmember swap, 339

of container, 97, 329

shrink_to_fit, 357

decltype, 70

function return type, 250

delegating constructor, 291

deleted copy-control, 624

division rounding, 141

end function, 118

enumeration

controlling representation, 834

forward declaration, 834

scoped, 832

explicit conversion operator, 582

explicit instantiation, 675

final class, 600

format control for floating-point, 757

forward function, 694

forward_list container, 327

function interface to callable objects, 577

in-class initializer, 73, 274

inherited constructor, 628, 804

initializer_list, 220

inline namespace, 790

lambda expression, 388

list initialization

= (assignment), 145

container, 336, 423

dynamic array, 478

dynamic object, 459

pair, 431

return value, 226, 427

variable, 43

vector, 98

long long, 33

mem_fn function, 843

move function, 533

move avoids copies, 529

move constructor, 534

move iterator, 543

move-enabled this pointer, 546

noexcept

exception specification, 535, 779

operator, 780

nullptr, 54

random-number library, 745

range for statement, 91, 187

not with dynamic array, 477

regular expression-library, 728

rvalue reference, 532

cast from lvalue, 691

reference collapsing, 688

sizeof data member, 157

sizeof... operator, 700

smart pointer, 450

shared_ptr, 450

unique_ptr, 470

weak_ptr, 473

string

numeric conversions, 367

parameter with IO types, 317

template

function template default template argument, 670

type alias, 666

type parameter as friend, 666

variadic, 699

varidadics and forwarding, 704

trailing return type, 229

in function template, 684

in lambda expression, 396

tuple, 718

type alias declaration, 68

union member of class type, 848

unordered containers, 443

virtual function

final, 606

override, 596, 606

Symbols

... (ellipsis parameter), 222

/* */ (block comment), 9, 26

// (single-line comment), 9, 26

= default, 265, 306

copy-control members, 506

default constructor, 265

= delete, 507

copy control, 507508

default constructor, 507

function matching, 508

move operations, 538

_ _DATE_ _, 242

_ _FILE_ _, 242

_ _LINE_ _, 242

_ _TIME_ _, 242

_ _cplusplus, 860

(null character), 39

Xnnn (hexadecimal escape sequence), 39

(newline character), 39

(tab character), 39

nnn (octal escape sequence), 39

{ } (curlybrace), 2, 26

#include, 6, 28

standard header, 6

user-defined header, 21

#define, 77, 80

#endif, 77, 80

#ifdef, 77, 80

#ifndef, 77, 80

~classname, see destructor

; (semicolon), 3

class definition, 73

null statement, 172

++ (increment), 12, 28, 147149, 170

iterator, 107, 132

overloaded operator, 566568

pointer, 118

precedence and associativity, 148

reverse iterator, 407

StrBlobPtr, 566

-- (decrement), 13, 28, 147149, 170

iterator, 107

overloaded operator, 566568

pointer, 118

precedence and associativity, 148

reverse iterator, 407, 408

StrBlobPtr, 566

* (dereference), 53, 80, 448

iterator, 107

map iterators, 429

overloaded operator, 569

pointer, 53

precedence and associativity, 148

smart pointer, 451

StrBlobPtr, 569

& (address-of), 52, 80

overloaded operator, 554

-> (arrow operator), 110, 132, 150

overloaded operator, 569

StrBlobPtr, 569

. (dot), 23, 28, 150

->* (pointer to member arrow), 837

.* (pointer to member dot), 837

[] (subscript), 93

array, 116, 132

array, 347

bitset, 727

deque, 347

does not add elements, 104

map, and unordered_map, 435, 448

adds element, 435

multidimensional array, 127

out-of-range index, 93

overloaded operator, 564

pointer, 121

string, 93, 132, 347

StrVec, 565

subscript range, 95

vector, 103, 132, 347

() (call operator), 23, 28, 202, 252

absInt, 571

const member function, 573

execution flow, 203

overloaded operator, 571

PrintString, 571

ShorterString, 573

SizeComp, 573

:: (scope operator), 8, 28, 82

base-class member, 607

class type member, 88, 282

container, type members, 333

global namespace, 789, 818

member function, definition, 259

overrides name lookup, 286

= (assignment), 12, 28, 144147

see also copy assignment

see also move assignment

associativity, 145

base from derived, 603

container, 89, 103, 337

conversion, 145, 159

derived class, 626

in condition, 146

initializer_list, 563

list initialization, 145

low precedence, 146

multiple inheritance, 805

overloaded operator, 500, 563

pointer, 55

to signed, 35

to unsigned, 35

vs. == (equality), 146

vs. initialization, 42

+= (compound assignment), 12, 28, 147

bitwise operators, 155

iterator, 111

overloaded operator, 555, 560

Sales_data, 564

exception version, 784

string, 89

+ (addition), 6, 140

iterator, 111

pointer, 119

Sales_data, 560

exception version, 784

Sales_item, 22

SmallInt, 588

string, 89

- (subtraction), 140

iterator, 111

pointer, 119

* (multiplication), 140

/ (division), 140

rounding, 141

% (modulus), 141

grading program, 176

== (equality), 18, 28

arithmetic conversion, 144

container, 88, 102, 340, 341

iterator, 106, 107

overloaded operator, 561, 562

pointer, 55, 120

Sales_data, 561

string, 88

tuple, 720

unordered container key_type, 443

used in algorithms, 377, 385, 413

vs. = (assignment), 146

!= (inequality), 28

arithmetic conversion, 144

container, 88, 102, 340, 341

iterator, 106, 107

overloaded operator, 562

pointer, 55, 120

Sales_data, 561

string, 88

tuple, 720

< (less-than), 28, 143

container, 88, 340

ordered container key_type, 425

overloaded operator, 562

strict weak ordering, 562

string, 88

tuple, 720

used in algorithms, 378, 385, 413

<= (less-than-or-equal), 12, 28, 143

container, 88, 340

string, 88

> (greater-than), 28, 143

container, 88, 340

string, 88

>= (greater-than-or-equal), 28, 143

container, 88, 340

string, 88

>> (input operator), 8, 28

as condition, 15, 86, 312

chained-input, 8

istream, 8

istream_iterator, 403

overloaded operator, 558559

precedence and associativity, 155

Sales_data, 558

Sales_item, 21

string, 85, 132

<< (output operator), 7, 28

bitset, 727

chained output, 7

ostream, 7

ostream_iterator, 405

overloaded operator, 557558

precedence and associativity, 155

Query, 641

Sales_data, 557

Sales_item, 21

string, 85, 132

>> (right-shift), 153, 170

<< (left-shift), 153, 170

&& (logical AND), 94, 132, 142, 169

order of evaluation, 138

overloaded operator, 554

short-circuit evaluation, 142

|| (logical OR), 142

order of evaluation, 138

overloaded operator, 554

short-circuit evaluation, 142

& (bitwise AND), 154, 169

Query, 638, 644

! (logical NOT), 87, 132, 143, 170

|| (logical OR), 132, 170

| (bitwise OR), 154, 170

Query, 638, 644

^ (bitwise XOR), 154, 170

~ (bitwise NOT), 154, 170

Query, 638, 643

, (comma operator), 157, 169

order of evaluation, 138

overloaded operator, 554

?: (conditional operator), 151, 169

order of evaluation, 138

precdence and associativity, 151

+ (unary plus), 140

- (unary minus), 140

L'c' (wchar_t literal), 38

ddd.dddL or ddd.dddl (long double literal), 41

numEnum or numenum (double literal), 39

numF or numf (float literal), 41

numL or numl (long literal), 41

numLL or numll (long long literal), 41

numU or numu (unsigned literal), 41

class member:constant expression, see bit-field

A

absInt, 571

() (call operator), 571

abstract base class, 610, 649

BinaryQuery, 643

Disc_quote, 610

Query_base, 636

abstract data type, 254, 305

access control, 611616

class derivation list, 596

default inheritance access, 616

default member access, 268

derived class, 613

derived-to-base conversion, 613

design, 614

inherited members, 612

local class, 853

nested class, 844

private, 268

protected, 595, 611

public, 268

using declaration, 615

access specifier, 268, 305

accessible, 611, 649

derived-to-base conversion, 613

Account, 301

accumulate, 379, 882

bookstore program, 406

Action, 839

adaptor, 372

back_inserter, 402

container, 368, 368371

front_inserter, 402

inserter, 402

make_move_iterator, 543

add, Sales_data, 261

add_item, Basket, 633

add_to_Folder, Message, 522

address, 33, 78

adjacent_difference, 882

adjacent_find, 871

advice

always initialize a pointer, 54

avoid casts, 165

avoid undefined behavior, 36

choosing a built-in type, 34

define small utility functions, 277

define variables near first use, 48

don’t create unnecessary regex objects, 733

forwarding parameter pattern, 706

keep lambda captures simple, 394

managing iterators, 331, 354

prefix vs. postfix operators, 148

rule of five, 541

use move sparingly, 544

use constructor initializer lists, 289

when to use overloading, 233

writing compound expressions, 139

aggregate class, 298, 305

initialization, 298

algorithm header, 376

algorithms, 376, 418

see also Appendix A

architecture

_copy versions, 383, 414

_if versions, 414

naming convention, 413414

operate on iterators not containers, 378

overloading pattern, 414

parameter pattern, 412413

read-only, 379380

reorder elements, 383385, 414

write elements, 380383

associative container and, 430

bind as argument, 397

can’t change container size, 385

element type requirements, 377

function object arguments, 572

istream_iterator, 404

iterator category, 410412

iterator range, 376

lambda as argument, 391, 396

library function object, 575

ostream_iterator, 404

sort comparison, requires strict weak ordering, 425

supplying comparison operation, 386, 413

function, 386

lambda, 389, 390

two input ranges, 413

type independence, 377

use element’s == (equality), 385, 413

use element’s < (less-than), 385, 413

accumulate, 379

bookstore program, 406

copy, 382

count, 378

equal_range, 722

equal, 380

fill_n, 381

fill, 380

find_if, 388, 397, 414

find, 376

for_each, 391

replace_copy, 383

replace, 383

set_intersection, 647

sort, 384

stable_sort, 387

transform, 396

unique, 384

alias declaration

namespace, 792, 817

template type, 666

type, 68

all_of, 871

alloc_n_copy, StrVec, 527

allocate, allocator, 481

allocator, 481, 481483, 491, 524531

allocate, 481, 527

compared to operator new, 823

construct, 482

forwards to constructor, 527

deallocate, 483, 528

compared to operator delete, 823

destroy, 482, 528

alternative operator name, 46

alternative_sum, program, 682

ambiguous

conversion, 583589

multiple inheritance, 806

function call, 234, 245, 251

multiple inheritance, 808

overloaded operator, 588

AndQuery, 637

class definition, 644

eval function, 646

anonymous union, 848, 862

any, bitset, 726

any_of, 871

app (file mode), 319

append, string, 362

argc, 219

argument, 23, 26, 202, 251

array, 214219

buffer overflow, 215

to pointer conversion, 214

C-style string, 216

conversion, function matching, 234

default, 236

forwarding, 704

initializes parameter, 203

iterator, 216

low-level const, 213

main function, 218

multidimensional array, 218

nonreference parameter, 209

pass by reference, 210, 252

pass by value, 209, 252

uses copy constructor, 498

uses move constructor, 539, 541

passing, 208212

pointer, 214

reference parameter, 210, 214

reference to const, 211

top-level const, 212

argument list, 202

argument-dependent lookup, 797

move and forward, 798

argv, 219

arithmetic

conversion, 35, 159, 168

in equality and relational operators, 144

integral promotion, 160, 169

signed to unsigned, 34

to bool, 162

operators, 139

compound assignment (e.g., +=), 147

function object, 574

overloaded, 560

type, 32, 78

machine-dependent, 32

arithmetic (addition and subtraction)

iterators, 111, 131

pointers, 119, 132

array, 113130

[] (subscript), 116, 132

argument and parameter, 214219

argument conversion, 214

auto returns pointer, 117

begin function, 118

compound type, 113

conversion to pointer, 117, 161

function arguments, 214

template argument deduction, 679

decltype returns array type, 118

definition, 113

dimension, constant expression, 113

dynamically allocated, 476, 476484

allocator, 481

can’t use begin and end, 477

can’t use range for statement, 477

delete[], 478

empty array, 478

new[], 477

shared_ptr, 480

unique_ptr, 479

elements and destructor, 502

end function, 118

initialization, 114

initializer of vector, 125

multidimensional, 125130

no copy or assign, 114

of char initialization, 114

parameter

buffer overflow, 215

converted to pointer, 215

function template, 654

pointer to, 218

reference to, 217

return type, 204

trailing, 229

type alias, 229

decltype, 230

sizeof, 157

subscript range, 116

subscript type, 116

understanding complicated declarations, 115

array

see also container

see also sequential container

[] (subscript), 347

= (assignment), 337

assign, 338

copy initialization, 337

default initialization, 336

definition, 336

header, 329

initialization, 334337

list initialization, 337

overview, 327

random-access iterator, 412

swap, 339

assert preprocessor macro, 241, 251

assign

array, 338

invalidates iterator, 338

sequential container, 338

string, 362

assignment, vs. initialization, 42, 288

assignment operators, 144147

associative array, see map

associative container, 420, 447

and library algorithms, 430

initialization, 423, 424

key_type requirements, 425, 445

members

begin, 430

count, 437, 438

emplace, 432

end, 430

equal_range, 439

erase, 434

find, 437, 438

insert, 432

key_type, 428, 447

mapped_type, 428, 448

value_type, 428, 448

override default comparison, 425

override default hash, 446

overview, 423

associativity, 134, 136137, 168

= (assignment), 145

?: (conditional operator), 151

dot and dereference, 150

increment and dereference, 148

IO operator, 155

overloaded operator, 553

at

deque, 348

map, 435

string, 348

unordered_map, 435

vector, 348

ate (file mode), 319

auto, 68, 78

cbegin, 109, 379

cend, 109, 379

for type abbreviation, 88, 129

of array, 117

of reference, 69

pointer to function, 249

with new, 459

auto_ptr deprecated, 471

automatic object, 205, 251

see also local variable

see also parameter

and destructor, 502

avg_price, Sales_data, 259

B

back

queue, 371

sequential container, 346

StrBlob, 457

back_inserter, 382, 402, 417

requires push_back, 382, 402

bad, 313

bad_alloc, 197, 460

bad_cast, 197, 826

bad_typeid, 828

badbit, 312

base, reverse iterator, 409

base class, 592, 649

see also virtual function

abstract, 610, 649

base-to-derived conversion, not automatic, 602

can be a derived class, 600

definition, 594

derived-to-base conversion, 597

accessibility, 613

key concepts, 604

multiple inheritance, 805

final, 600

friendship not inherited, 614

initialized or assigned from derived, 603

member hidden by derived, 619

member new and delete, 822

multiple, see multiple inheritance

must be complete type, 600

protected member, 611

scope, 617

inheritance, 617621

multiple inheritance, 807

virtual function, 620

static members, 599

user of, 614

virtual, see virtual base class

virtual destructor, 622

Basket, 631

add_item, 633

total, 632

Bear, 803

virtual base class, 812

before_begin, forward_list, 351

begin

associative container, 430

container, 106, 131, 333, 372

function, 118, 131

not with dynamic array, 477

multidimensional array, 129

StrBlob, 475

StrVec, 526

bernoulli_distribution, 752

best match, 234, 251

see also function matching

bidirectional iterator, 412, 417

biggies program, 391

binary (file mode), 319

binary operators, 134, 168

overloaded operator, 552

binary predicate, 386, 417

binary_function deprecated, 579

binary_search, 873

BinaryQuery, 637

abstract base class, 643

bind, 397, 417

check_size, 398

generates callable object, 397

from pointer to member, 843

placeholders, 399

reference parameter, 400

bind1st deprecated, 401

bind2nd deprecated, 401

binops desk calculator, 577

bit-field, 854, 862

access to, 855

constant expression, 854

bitset, 723, 723728, 769

[] (subscript), 727

<< (output operator), 727

any, 726

count, 727

flip, 727

grading program, 728

header, 723

initialization, 723725

from string, 724

from unsigned, 723

none, 726

reset, 727

set, 727

test, 727

to_ulong, 727

bitwise, bitset, operators, 725

bitwise operators, 152156

+= (compound assignment), 155

compound assignment (e.g., +=), 147

grading program, 154

operand requirements, 152

Blob

class template, 659

constructor, 662

initializer_list, 662

iterator parameters, 673

instantiation, 660

member functions, 661662

block, 2, 12, 26, 173, 199

function, 204

scope, 48, 80, 173

try, 193, 194, 200, 818

block (/* */), comment, 9, 26

book from author program, 438440

bookstore program

Sales_data, 255

using algorithms, 406

Sales_item, 24

bool, 32

conversion, 35

literal, 41

in condition, 143

boolalpha, manipulator, 754

brace, curly, 2, 26

braced list, see list initialization

break statement, 190, 199

in switch, 179181

bucket management, unordered container, 444

buffer, 7, 26

flushing, 314

buffer overflow, 105, 116, 131

array parameter, 215

C-style string, 123

buildMap program, 442

built-in type, 2, 26, 3234

default initialization, 43

Bulk_quote

class definition, 596

constructor, 598, 610

derived from Disc_quote, 610

design, 592

synthesized copy control, 623

byte, 33, 78

C

.C file, 4

.cc file, 4

.cpp file, 4

.cp file, 4

C library header, 91

C-style cast, 164

C-style string, 114, 122, 122123, 131

buffer overflow, 123

initialization, 122

parameter, 216

string, 124

c_str, 124

call by reference, 208, 210, 251

call by value, 209, 251

uses copy constructor, 498

uses move constructor, 539

call signature, 576, 590

callable object, 388, 417, 571572

absInt, 571

bind, 397

call signature, 576

function and function pointers, 388

function objects, 572

pointer to member

and bind, 843

and function, 842

and mem_fn, 843

not callable, 842

PrintString, 571

ShorterString, 573

SizeComp, 573

with function, 576579

with algorithms, 390

candidate function, 243, 251

see also function matching

function template, 695

namespace, 800

overloaded operator, 587

capacity

string, 356

StrVec, 526

vector, 356

capture list, see lambda expression

case label, 179, 179182, 199

default, 181

constant expression, 179

case sensitive, string, 365

cassert header, 241

cast, see also named cast, 168

checked, see dynamic_cast

old-style, 164

to rvalue reference, 691

catch, 193, 195, 199, 775, 816

catch(...), 777, 816

exception declaration, 195, 200, 775, 816

exception object, 775

matching, 776

ordering of, 776

runtime_error, 195

catch all (catch(...)), 777, 816

caution

ambiguous conversion operator, 581

conversions to unsigned, 37

dynamic memory pitfalls, 462

exception safety, 196

IO buffers, 315

overflow, 140

overloaded operator misuse, 555

overloaded operators and conversion operators, 586

smart pointer, pitfalls, 469

uninitialized variables, 45

using directives cause pollution, 795

cbegin

auto, 109, 379

decltype, 109, 379

container, 109, 333, 334, 372

cctype

functions, 9193

header, 91

cend

auto, 109, 379

decltype, 109, 379

container, 109, 333, 334, 372

cerr, 6, 26

chained input, 8

chained output, 7

char, 32

signed, 34

unsigned, 34

array initialization, 114

literal, 39

representation, 34

char16_t, 33

char32_t, 33

character

newline ( ), 39

nonprintable, 39, 79

null (), 39

tab ( ), 39

character string literal, see string literal

check

StrBlob, 457

StrBlobPtr, 474

check_size, 398

bind, 398

checked cast, see dynamic_cast

children’s story program, 383391

chk_n_alloc, StrVec, 526

cin, 6, 26

tied to cout, 315

cl, 5

class, 19, 26, 72, 305

see also constructor

see also destructor

see also member function

see also static member

access specifier, 268

default, 268

private, 268, 306

public, 268, 306

aggregate, 298, 305

assignment operator

see copy assignment

see move assignment

base, see base class, 649

data member, 73, 78

const vs. mutable, 274

const, initialization, 289

in-class initializer, 274

initialization, 263, 274

must be complete type, 279

mutable, 274, 306

order of destruction, 502

order of initialization, 289

pointer, not deleted, 503

reference, initialization, 289

sizeof, 157

declaration, 278, 305

default inheritance specifier, 616

definition, 72, 256267

ends with semicolon, 73

derived, see derived class, 649

exception, 193, 200

final specifier, 600

forward declaration, 279, 306

friend, 269, 280

class, 280

function, 269

member function, 280

overloaded function, 281

scope, 270, 281

template class or function, 664

implementation, 254

interface, 254

literal, 299

local, see local class

member, 73, 78

member access, 282

member new and delete, 822

member:constant expression, see bit-field

multiple base classes, see multiple inheritance

name lookup, 284

nested, see nested class

pointer to member, see pointer to member

preventing copies, 507

scope, 73, 282, 282287, 305

synthesized, copy control, 267, 497, 500, 503, 537

template member, see member template

type member, 271

:: (scope operator), 282

user of, 255

valuelike, 512

without move constructor, 540

class

compared to typename, 654

default access specifier, 268

default inheritance specifier, 616

template parameter, 654

class derivation list, 596

access control, 612

default access specifier, 616

direct base class, 600

indirect base class, 600

multiple inheritance, 803

virtual base class, 812

class template, 96, 131, 658, 659, 658667, 713

see also template parameter

see also instantiation

Blob, 659

declaration, 669

default template argument, 671

definition, 659

error detection, 657

explicit instantiation, 675, 675676

explicit template argument, 660

friend, 664

all instantiations, 665

declaration dependencies, 665

same instantiation, 664

specific instantiation, 665

instantiation, 660

member function

defined outside class body, 661

instantiation, 663

member template, see member template

specialization, 707, 709712, 714

hash<key_type>, 709, 788

member, 711

namespace, 788

partial, 711, 714

static member, 667

accessed through an instantiation, 667

definition, 667

template argument, 660

template parameter, used in definition, 660

type parameter as friend, 666

type-dependent code, 658

class type, 19, 26

conversion, 162, 305, 590

ambiguities, 587

conversion operator, 579

converting constructor, 294

impact on function matching, 584

overloaded function, 586

with standard conversion, 581

default initialization, 44

initialization, 73, 84, 262

union member of, 848

variable vs. function declaration, 294

clear

sequential container, 350

stream, 313

clog, 6, 26

close, file stream, 318

cmatch, 733

cmath header, 751, 757

collapsing rule, reference, 688

combine, Sales_data, 259

comma (,) operator, 157

comment, 9, 26

block (/* */), 9, 26

single-line (//), 9, 26

compare

default template argument, 670

function template, 652

default template argument, 670

explicit template argument, 683

specialization, 706

string literal version, 654

template argument deduction, 680

string, 366

compareIsbn

and associative container, 426

Sales_data, 387

compilation

common errors, 16

compiler options, 207

conditional, 240

declaration vs. definition, 44

mixing C and C++, 860

needed when class changes, 270

templates, 656

error detection, 657

explicit instantiation, 675676

compiler

extension, 114, 131

GNU, 5

Microsoft, 5

options for separate compilation, 207

composition vs. inheritance, 637

compound assignment (e.g., +=)

arithmetic operators, 147

bitwise operators, 147

compound expression, see expression

compound statement, 173, 199

compound type, 50, 5058, 78

array, 113

declaration style, 57

understanding complicated declarations, 115

concatenation

string, 89

string literal, 39

condition, 12, 26

= (assignment) in, 146

conversion, 159

do while statement, 189

for statement, 13, 185

if statement, 18, 175

in IO expression, 156

logical operators, 141

smart pointer as, 451

stream type as, 15, 162, 312

while statement, 12, 183

condition state, IO classes, 312, 324

conditional compilation, 240

conditional operator (?:), 151

connection, 468

console window, 6

const, 59, 78

and typedef, 68

conversion, 162

template argument deduction, 679

dynamically allocated

destruction, 461

initialization, 460

initialization, 59

class type object, 262

low-level const, 64

argument and parameter, 213

conversion from, 163

conversion to, 162

overloaded function, 232

template argument deduction, 693

member function, 258, 305

() (call operator), 573

not constructors, 262

overloaded function, 276

reference return, 276

parameter, 212

function matching, 246

overloaded function, 232

pointer, 63, 78

pointer to, 62, 79

conversion from nonconst, 162

initialization from nonconst, 62

overloaded parameter, 232

reference, see reference to const

top-level const, 64

and auto, 69

argument and parameter, 212

decltype, 71

parameter, 232

template argument deduction, 679

variable, 59

declared in header files, 76

extern, 60

local to file, 60

const_cast, 163, 163

const_iterator, container, 108, 332

const_reference, container, 333

const_reverse_iterator, container, 332, 407

constant expression, 65, 78

array dimension, 113

bit-field, 854

case label, 179

enumerator, 833

integral, 65

nontype template parameter, 655

sizeof, 156

static data member, 303

constexpr, 66, 78

constructor, 299

declared in header files, 76

function, 239, 251

nonconstant return value, 239

function template, 655

pointer, 67

variable, 66

construct

allocator, 482

forwards to constructor, 527

constructor, 262, 264, 262266, 305

see also default constructor

see also copy constructor

see also move constructor

calls to virtual function, 627

constexpr, 299

converting, 294, 305

function matching, 585

Sales_data, 295

with standard conversion, 580

default argument, 290

delegating, 291, 306

derived class, 598

initializes direct base class, 610

initializes virtual base, 813

explicit, 296, 306

function try block, 778, 817

inherited, 628

initializer list, 265, 288292, 305

class member initialization, 274

compared to assignment, 288

derived class, 598

function try block, 778, 817

sometimes required, 288

virtual base class, 814

initializer_list parameter, 662

not const, 262

order of initialization, 289

derived class object, 598, 623

multiple inheritance, 804

virtual base classes, 814

overloaded, 262

StrBlob, 456

StrBlobPtr, 474

TextQuery, 488

Blob, 662

initializer_list, 662

iterator parmeters, 673

Bulk_quote, 598, 610

Disc_quote, 609

Sales_data, 264266

container, 96, 131, 326, 372

see also sequential container

see also associative container

adaptor, 368, 368371

equality and relational operators, 370

initialization, 369

requirements on container, 369

and inheritance, 630

as element type, 97, 329

associative, 420, 447

copy initialization, 334

element type constraints, 329, 341

elements and destructor, 502

elements are copies, 342

initialization from iterator range, 335

list initialization, 336

members

see also iterator

= (assignment), 337

== (equality), 341

!= (inequality), 341

begin, 106, 333, 372

cbegin, 109, 333, 334, 372

cend, 109, 333, 334, 372

const_iterator, 108, 332

const_reference, 333

const_reverse_iterator, 332, 407

crbegin, 333

crend, 333

difference_type, 131, 332

empty, 87, 102, 131, 340

end, 106, 131, 333, 373

equality and relational operators, 88, 102, 340

iterator, 108, 332

rbegin, 333, 407

reference, 333

relational operators, 341

rend, 333, 407

reverse_iterator, 332, 407

size, 88, 102, 132, 340

size_type, 88, 102, 132, 332

swap, 339

move operations, 529

moved-from object is valid but unspecified, 537

nonmember swap, 339

of container, 97, 329

overview, 328

sequential, 326, 373

type members, :: (scope operator), 333

continue statement, 191, 199

control, flow of, 11, 172, 200

conversion, 78, 159, 168

= (assignment), 145, 159

ambiguous, 583589

argument, 203

arithmetic, 35, 159, 168

array to pointer, 117

argument, 214

exception object, 774

multidimensional array, 128

template argument deduction, 679

base-to-derived, not automatic, 602

bool, 35

class type, 162, 294, 305, 590

ambiguities, 587

conversion operator, 579

function matching, 584, 586

with standard conversion, 581

condition, 159

derived-to-base, 597, 649

accessibility, 613

key concepts, 604

shared_ptr, 630

floating-point, 35

function to pointer, 248

exception object, 774

template argument deduction, 679

integral promotion, 160, 169

istream, 162

multiple inheritance, 805

ambiguous, 806

narrowing, 43

operand, 159

pointer to bool, 162

rank, 245

return value, 223

Sales_data, 295

signed type, 160

signed to unsigned, 34

to const, 162

from pointer to nonconst, 62

from reference to nonconst, 61

template argument deduction, 679

unscoped enumeration to integer, 834

unsigned, 36

virtual base class, 812

conversion operator, 580, 580587, 590

design, 581

explicit, 582, 590

bool, 583

function matching, 585, 586

SmallInt, 580

used implicitly, 580

with standard conversion, 580

converting constructor, 294, 305

function matching, 585

with standard conversion, 580

_copy algorithms, 383, 414

copy, 382, 874

copy and swap assignment, 518

move assignment, 540

self-assignment, 519

copy assignment, 500501, 549

= default, 506

= delete, 507

base from derived, 603

copy and swap, 518, 549

derived class, 626

HasPtr

reference counted, 516

valuelike, 512

memberwise, 500

Message, 523

preventing copies, 507

private, 509

reference count, 514

rule of three/five, 505

virtual destructor exception, 622

self-assignment, 512

StrVec, 528

synthesized, 500, 550

deleted function, 508, 624

derived class, 623

multiple inheritance, 805

union with class type member, 852

valuelike class, 512

copy constructor, 496, 496499, 549

= default, 506

= delete, 507

base from derived, 603

derived class, 626

HasPtr

reference counted, 515

valuelike, 512

memberwise, 497

Message, 522

parameter, 496

preventing copies, 507

private, 509

reference count, 514

rule of three/five, 505

virtual destructor exception, 622

StrVec, 528

synthesized, 497, 550

deleted function, 508, 624

derived class, 623

multiple inheritance, 805

union with class type member, 851

used for copy-initialization, 498

copy control, 267, 496, 549

= delete, 507508

inheritance, 623629

memberwise, 267, 550

copy assignment, 500

copy constructor, 497

move assignment, 538

move constructor, 538

multiple inheritance, 805

synthesized, 267

as deleted function, 508

as deleted in derived class, 624

move operations as deleted function, 538

unions, 849

virtual base class, synthesized, 815

copy initialization, 84, 131, 497, 497499, 549

array, 337

container, 334

container elements, 342

explicit constructor, 498

invalid for arrays, 114

move vs. copy, 539

parameter and return value, 498

uses copy constructor, 497

uses move constructor, 541

copy_backward, 875

copy_if, 874

copy_n, 874

copyUnion, Token, 851

count, reference, 550

count

algorithm, 378, 871

associative container, 437, 438

bitset, 727

count_calls, program, 206

count_if, 871

cout, 6, 26

tied to cin, 315

cplusplus_primer, namespace, 787

crbegin, container, 333

cref, binds reference parameter, 400, 417

cregex_iterator, 733, 769

crend, container, 333

cstddef header, 116, 120

cstdio header, 769

cstdlib header, 54, 227, 778, 823

cstring

functions, 122123

header, 122

csub_match, 733, 769

ctime header, 749

curly brace, 2, 26

D

dangling else, 177, 199

dangling pointer, 225, 463, 491

undefined behavior, 463

data abstraction, 254, 306

data hiding, 270

data member, see class data member

data structure, 19, 26

deallocate, allocator, 483, 528

debug_rep program

additional nontemplate versions, 698

general template version, 695

nontemplate version, 697

pointer template version, 696

DebugDelete, member template, 673

dec, manipulator, 754

decimal, literal, 38

declaration, 45, 78

class, 278, 305

class template, 669

class type, variable, 294

compound type, 57

dependencies

member function as friend, 281

overloaded templates, 698

template friends, 665

template instantiation, 657

template specializations, 708

variadic templates, 702

derived class, 600

explicit instantiation, 675

friend, 269

function template, 669

instantiation, 713

member template, 673

template, 669

template specialization, 708

type alias, 68

using, 82, 132

access control, 615

overloaded inherited functions, 621

variable, 45

const, 60

declarator, 50, 79

decltype, 70, 79

array return type, 230

cbegin, 109, 379

cend, 109, 379

depends on form, 71

for type abbreviation, 88, 106, 129

of array, 118

of function, 250

pointer to function, 249

top-level const, 71

yields lvalue, 71, 135

decrement operators, 147149

default argument, 236, 251

adding default arguments, 237

and header file, 238

constructor, 290

default constructor, 291

function call, 236

function matching, 243

initializer, 238

static member, 304

virtual function, 607

default case label, 181, 199

default constructor, 263, 306

= default, 265

= delete, 507

default argument, 291

Sales_data, 262

StrVec, 526

synthesized, 263, 306

deleted function, 508, 624

derived class, 623

Token, 850

used implicitly

default initialization, 293

value initialization, 293

default initialization, 43

array, 336

built-in type, 43

class type, 44

string, 44, 84

uses default constructor, 293

vector, 97

default template argument, 670

class template, 671

compare, 670

function template, 670

template<>, 671

default_random_engine, 745, 769

defaultfloat manipulator, 757

definition, 79

array, 113

associative container, 423

base class, 594

class, 72, 256267

class template, 659

member function, 661

static member, 667

class template partial specialization, 711

derived class, 596

dynamically allocated object, 459

explicit instantiation, 675

function, 577

in if condition, 175

in while condition, 183

instantiation, 713

member function, 256260

multidimensional array, 126

namespace, 785

can be discontiguous, 786

member, 788

overloaded operator, 500, 552

pair, 426

pointer, 52

pointer to function, 247

pointer to member, 836

reference, 51

sequential container, 334

shared_ptr, 450

static member, 302

string, 84

template specialization, 706712

unique_ptr, 470, 472

variable, 41, 45

const, 60

variable after case label, 182

vector, 97

weak_ptr, 473

delegating constructor, 291, 306

delete, 460, 460463, 491

const object, 461

execution flow, 820

memory leak, 462

null pointer, 461

pointer, 460

runs destructor, 502

delete[], dynamically allocated array, 478

deleted function, 507, 549

deleter, 469, 491

shared_ptr, 469, 480, 491

unique_ptr, 472, 491

deprecated, 401

auto_ptr, 471

binary_function, 579

bind1st, 401

bind2nd, 401

generalized exception specification, 780

ptr_fun, 401

unary_function, 579

deque, 372

see also container, container member

see also sequential container

[] (subscript), 347

at, 348

header, 329

initialization, 334337

list initialization, 336

overview, 327

push_back, invalidates iterator, 354

push_front, invalidates iterator, 354

random-access iterator, 412

value initialization, 336

deref, StrBlobPtr, 475

derived class, 592, 649

see also virtual function

:: (scope operator) to access base-class member, 607

= (assignment), 626

access control, 613

as base class, 600

assgined or copied to base object, 603

base-to-derived conversion, not automatic, 602

constructor, 598

initializer list, 598

initializes direct base class, 610

initializes virtual base, 813

copy assignment, 626

copy constructor, 626

declaration, 600

default derivation specifier, 616

definition, 596

derivation list, 596, 649

access control, 612

derived object

contains base part, 597

multiple inheritance, 803

derived-to-base conversion, 597

accessibility, 613

key concepts, 604

multiple inheritance, 805

destructor, 627

direct base class, 600, 649

final, 600

friendship not inherited, 615

indirect base class, 600, 650

is user of base class, 614

member new and delete, 822

move assignment, 626

move constructor, 626

multiple inheritance, 803

name lookup, 617

order of destruction, 627

multiple inheritance, 805

order of initialization, 598, 623

multiple inheritance, 804

virtual base classes, 814

scope, 617

hidden base members, 619

inheritance, 617621

multiple inheritance, 807

name lookup, 618

virtual function, 620

static members, 599

synthesized

copy control members, 623

deleted copy control members, 624

using declaration

access control, 615

overloaded inherited functions, 621

virtual function, 596

derived-to-base conversion, 597, 649

accessible, 613

key concepts, 604

multiple inheritance, 805

not base-to-derived, 602

shared_ptr, 630

design

access control, 614

Bulk_quote, 592

conversion operator, 581

Disc_quote, 608

equality and relational operators, 562

generic programs, 655

inheritance, 637

Message class, 520

namespace, 786

overloaded operator, 554556

Query classes, 636639

Quote, 592

reference count, 514

StrVec, 525

destination sequence, 381, 413

destroy, allocator, 482, 528

destructor, 452, 491, 501, 501503, 549

= default, 506

called during exception handling, 773

calls to virtual function, 627

container elements, 502

derived class, 627

doesn’t delete pointer mambers, 503

explicit call to, 824

HasPtr

reference counted, 515

valuelike, 512

local variables, 502

Message, 522

not deleted function, 508

not private, 509

order of destruction, 502

derived class, 627

multiple inheritance, 805

virtual base classes, 815

reference count, 514

rule of three/five, 505

virtual destructor, exception, 622

run by delete, 502

shared_ptr, 453

should not throw exception, 774

StrVec, 528

synthesized, 503, 550

deleted function, 508, 624

derived class, 623

multiple inheritance, 805

Token, 850

valuelike class, 512

virtual function, 622

virtual in base class, 622

development environment, integrated, 3

difference_type, 112

vector, 112

container, 131, 332

string, 112

direct base class, 600

direct initialization, 84, 131

emplace members use, 345

Disc_quote

abstract base class, 610

class definition, 609

constructor, 609

design, 608

discriminant, 849, 862

Token, 850

distribution types

bernoulli_distribution, 752

default template argument, 750

normal_distribution, 751

random-number library, 745

uniform_int_distribution, 746

uniform_real_distribution, 750

divides<T>, 575

division rounding, 141

do while statement, 189, 200

domain_error, 197

double, 33

literal (numEnum or numenum), 38

output format, 755

output notation, 757

dynamic binding, 593, 650

requirements for, 603

static vs. dynamic type, 605

dynamic type, 601, 650

dynamic_cast, 163, 825, 825, 862

bad_cast, 826

to pointer, 825

to reference, 826

dynamically allocated, 450, 491

array, 476, 476484

allocator, 481

can’t use begin and end, 477

can’t use range for statement, 477

delete[], 478

empty array, 478

new[], 477

returns pointer to an element, 477

shared_ptr, 480

unique_ptr, 479

delete runs destructor, 502

lifetime, 450

new runs constructor, 458

object, 458463

const object, 460

delete, 460

factory program, 461

initialization, 459

make_shared, 451

new, 458

shared objects, 455, 486

shared_ptr, 464

unique_ptr, 470

E

echo command, 4

ECMAScript, 730, 739

regular expression library, 730

edit-compile-debug, 16, 26

errors at link time, 657

element type constraints, container, 329, 341

elimDups program, 383391

ellipsis, parameter, 222

else, see if statement

emplace

associative container, 432

priority_queue, 371

queue, 371

sequential container, 345

stack, 371

emplace_back

sequential container, 345

StrVec, 704

emplace_front, sequential container, 345

empty

container, 87, 102, 131, 340

priority_queue, 371

queue, 371

stack, 371

encapsulation, 254, 306

benefits of, 270

end

associative container, 430

container, 106, 131, 333, 373

function, 118, 131

multidimensional array, 129

StrBlob, 475

StrVec, 526

end-of-file, 15, 26, 762

character, 15

Endangered, 803

endl, 7

manipulator, 314

ends, manipulator, 315

engine, random-number library, 745, 770

default_random_engine, 745

max, min, 747

retain state, 747

seed, 748, 770

enum, unscoped enumeration, 832

enum class, scoped enumeration, 832

enumeration, 832, 863

as union discriminant, 850

function matching, 835

scoped, 832, 864

unscoped, 832, 864

conversion to integer, 834

unnamed, 832

enumerator, 832, 863

constant expression, 833

conversion to integer, 834

eof, 313

eofbit, 312

equal, 380, 872

equal virtual function, 829

equal_range

algorithm, 722, 873

associative container, 439

equal_to<T>, 575

equality operators, 141

arithmetic conversion, 144

container adaptor, 370

container member, 340

iterator, 106

overloaded operator, 561

pointer, 120

Sales_data, 561

string, 88

vector, 102

erase

associative container, 434

changes container size, 385

invalidates iterator, 349

sequential container, 349

string, 362

error, standard, 6

error_type, 732

error_msg program, 221

ERRORLEVEL, 4

escape sequence, 39, 79

hexadecimal (Xnnn), 39

octal (nnn), 39

eval function

AndQuery, 646

NotQuery, 647

OrQuery, 645

exception

class, 193, 200

class hierarchy, 783

deriving from, 782

Sales_data, 783

header, 197

initialization, 197

what, 195, 782

exception handling, 193198, 772, 817

see also throw

see also catch

exception declaration, 195, 775, 816

and inheritance, 775

must be complete type, 775

exception in destructor, 773

exception object, 774, 817

finding a catch, 776

function try block, 778, 817

handler, see catch

local variables destroyed, 773

noexcept specification, 535, 779, 817

nonthrowing function, 779, 818

safe resource allocation, 467

stack unwinding, 773, 818

terminate function, 196, 200

try block, 194, 773

uncaught exception, 773

unhandled exception, 196

exception object, 774, 817

catch, 775

conversion to pointer, 774

initializes catch parameter, 775

pointer to local object, 774

rethrow, 777

exception safety, 196, 200

smart pointers, 467

exception specification argument, 780

generalized, deprecated, 780

noexcept, 779

nonthrowing, 779

pointer to function, 779, 781

throw(), 780

violation, 779

virtual function, 781

executable file, 5, 251

execution flow

() (call operator), 203

delete, 820

for statement, 186

new, 820

switch statement, 180

throw, 196, 773

EXIT_FAILURE, 227

EXIT_SUCCESS, 227

expansion

forward, 705

parameter pack, 702, 702704, 714

function parameter pack, 703

template parameter pack, 703

pattern, 702

explicit

constructor, 296, 306

copy initialization, 498

conversion operator, 582, 590

conversion to bool, 583

explicit call to

destructor, 824

overloaded operator, 553

postfix operators, 568

explicit instantiation, 675, 713

explicit template argument, 660, 713

class template, 660

forward, 694

function template, 682

function pointer, 686

template argument deduction, 682

exporting C++ to C, 860

expression, 7, 27, 134, 168

callable, see callable object

constant, 65, 78

lambda, see lambda expression

operand conversion, 159

order of evaluation, 137

parenthesized, 136

precedence and associativity, 136137

regular, see regular expression

expression statement, 172, 200

extension, compiler, 114, 131

extern

and const variables, 60

explicit instantiation, 675

variable declaration, 45

extern 'C', see linkage directive

F

fact program, 202

factorial program, 227

factory program

new, 461

shared_ptr, 453

fail, 313

failbit, 312

failure, new, 460

file, source, 4

file extension, program, 730

version 2, 738

file marker, stream, 765

file mode, 319, 324

file redirection, 22

file static, 792, 817

file stream, see fstream

fill, 380, 874

fill_n, 381, 874

final specifier, 600

class, 600

virtual function, 607

find

algorithm, 376, 871

associative container, 437, 438

string, 364

find last word program, 408

find_char program, 211

find_first_of, 872

find_first_not_of, string, 365

find_first_of, 872

string, 365

find_if, 388, 397, 414, 871

find_if_not, 871

find_if_not_of, 871

find_last_not_of, string, 366

find_last_of, string, 366

findBook, program, 721

fixed manipulator, 757

flip

bitset, 727

program, 694

flip1, program, 692

flip2, program, 693

float, 33

literal (numF or numf), 41

floating-point, 32

conversion, 35

literal, 38

output format, 755

output notation, 757

flow of control, 11, 172, 200

flush, manipulator, 315

Folder, see Message

for statement, 13, 27, 185, 185187, 200

condition, 13

execution flow, 186

for header, 185

range, 91, 187, 187189, 200

can’t add elements, 101, 188

multidimensional array, 128

for_each, 391, 872

format state, stream, 753

formatted IO, 761, 769

forward, 694

argument-dependent lookup, 798

explicit template argument, 694

pack expansion, 705

passes argument type unchanged, 694, 705

usage pattern, 706

forward declaration, class, 279, 306

forward iterator, 411, 417

forward_list

see also container

see also sequential container

before_begin, 351

forward iterator, 411

header, 329

initialization, 334337

list initialization, 336

merge, 415

overview, 327

remove, 415

remove_if, 415

reverse, 415

splice_after, 416

unique, 415

value initialization, 336

forwarding, 692694

passes argument type unchanged, 694

preserving type information, 692

rvalue reference parameters, 693, 705

typical implementation, 706

variadic template, 704

free, StrVec, 528

free library function, 823, 863

free store, 450, 491

friend, 269, 306

class, 280

class template type parameter, 666

declaration, 269

declaration dependencies

member function as friend, 281

template friends, 665

function, 269

inheritance, 614

member function, 280, 281

overloaded function, 281

scope, 270, 281

namespace, 799

template as, 664

front

queue, 371

sequential container, 346

StrBlob, 457

front_inserter, 402, 417

compared to inserter, 402

requires push_front, 402

fstream, 316320

close, 318

file marker, 765

file mode, 319

header, 310, 316

initialization, 317

off_type, 766

open, 318

pos_type, 766

random access, 765

random IO program, 766

seek and tell, 763768

function, 2, 27, 202, 251

see also return type

see also return value block, 204

body, 2, 27, 202, 251

callable object, 388

candidate, 251

candidate function, 243

constexpr, 239, 251

nonconstant return value, 239

declaration, 206

declaration and header file, 207

decltype returns function type, 250

default argument, 236, 251

adding default arguments, 237

and header file, 238

initializer, 238

deleted, 507, 549

function matching, 508

exception specification

noexcept, 779

throw(), 780

friend, 269

function to pointer conversion, 248

inline, 238, 252

and header, 240

linkage directive, 859

member, see member function

name, 2, 27

nonthrowing, 779, 818

overloaded

compared to redeclaration, 231

friend declaration, 281

scope, 234

parameter, see parameter

parameter list, 2, 27, 202, 204

prototype, 207, 251

recursive, 227

variadic template, 701

scope, 204

viable, 252

viable function, 243

virtual, see virtual function

function, 577, 576579, 590

and pointer to member, 842

definition, 577

desk calculator, 577

function call

ambiguous, 234, 245, 251

default argument, 236

execution flow, 203

overhead, 238

through pointer to function, 248

through pointer to member, 839

to overloaded operator, 553

to overloaded postfix operator, 568

function matching, 233, 251

= delete, 508

argument, conversion, 234

candidate function, 243

overloaded operator, 587

const arguments, 246

conversion, class type, 583587

conversion operator, 585, 586

conversion rank, 245

class type conversions, 586

default argument, 243

enumeration, 835

function template, 694699

specialization, 708

integral promotions, 246

member function, 273

multiple parameters, 244

namespace, 800

overloaded operator, 587589

prefers more specialized function, 695

rvalue reference, 539

variadic template, 702

viable function, 243

function object, 571, 590

argument to algorithms, 572

arithmetic operators, 574

is callable object, 571

function parameter, see parameter

function parameter pack, 700

expansion, 703

pattern, 704

function pointer, 247250

callable object, 388

definition, 247

exception specification, 779, 781

function template instantiation, 686

overloaded function, 248

parameter, 249

return type, 204, 249

using decltype, 250

template argument deduction, 686

type alias declaration, 249

typedef, 249

function table, 577, 577, 590, 840

function template, 652, 713

see also template parameter

see also template argument deduction

see also instantiation argument conversion, 680

array function parameters, 654

candidate function, 695

compare, 652

string literal version, 654

constexpr, 655

declaration, 669

default template argument, 670

error detection, 657

explicit instantiation, 675, 675676

explicit template argument, 682

compare, 683

function matching, 694699

inline function, 655

nontype parameter, 654

overloaded function, 694699

parameter pack, 713

specialization, 707, 714

compare, 706

is an instantiation, 708

namespace, 788

scope, 708

vs. overloading, 708

trailing return type, 684

type-dependent code, 658

function try block, 778, 817

functional header, 397, 399, 400, 575, 577, 843

G

g++, 5

gcount, istream, 763

generate, 874

generate_n, 874

generic algorithms, see algorithms

generic programming, 108

type-independent code, 655

get

istream, 761

multi-byte version, istream, 762

returns int, istream, 762, 764

get<n>, 719, 770

getline, 87, 131

istream, 762

istringstream, 321

TextQuery constructor, 488

global function

operator delete, 863

operator new, 863

global namespace, 789, 817

:: (scope operator), 789, 818

global scope, 48, 80

global variable, lifetime, 204

GNU compiler, 5

good, 313

goto statement, 192, 200

grade clusters program, 103

greater<T>, 575

greater_equal<T>, 575

H

.h file header, 19

handler, see catch

has-a relationship, 637

hash<key_type>, 445, 447

override, 446

specialization, 709, 788

compatible with == (equality), 710

hash function, 443, 447

HasPtr

reference counted, 514516

copy assignment, 516

destructor, 515

valuelike, 512

copy assignment, 512

move assignment, 540

move constructor, 540

swap, 516

header, 6, 27

iostream, 27

C library, 91

const and constexpr, 76

default argument, 238

function declaration, 207

.h file, 19

#include, 6, 21

inline function, 240

inline member function definition, 273

namespace members, 786

standard, 6

table of library names, 866

template definition, 656

template specialization, 708

user-defined, 21, 7677, 207, 240

using declaration, 83

Sales_data.h, 76

Sales_item.h, 19

algorithm, 376

array, 329

bitset, 723

cassert, 241

cctype, 91

cmath, 751, 757

cstddef, 116, 120

cstdio, 757

cstdlib, 54, 227, 778, 823

cstring, 122

ctime, 749

deque, 329

exception, 197

forward_list, 329

fstream, 310, 316

functional, 397, 399, 400, 575, 577, 843

initializer_list, 220

iomanip, 756

iostream, 6, 310, 762

iterator, 119, 382, 401

list, 329

map, 420

memory, 450, 451, 481, 483

new, 197, 460, 478, 821

numeric, 376, 881

queue, 371

random, 745

regex, 728

set, 420

sstream, 310, 321

stack, 370

stdexcept, 194, 197

string, 74, 76, 84

tuple, 718

type_info, 197

type_traits, 684

typeinfo, 826, 827, 831

unordered_map, 420

unordered_set, 420

utility, 426, 530, 533, 694

vector, 96, 329

header guard, 77, 79

preprocessor, 77

heap, 450, 491

hex, manipulator, 754

hexadecimal

escape sequence (Xnnn), 39

literal (0Xnum or 0xnum), 38

hexfloat manipulator, 757

high-order bits, 723, 770

I

i before e, program, 729

version 2, 734

IDE, 3

identifier, 46, 79

reserved, 46

_if algorithms, 414

if statement, 17, 27, 175, 175178, 200

compared to switch, 178

condition, 18, 175

dangling else, 177

else branch, 18, 175, 200

ifstream, 311, 316320, 324

see also istream

close, 318

file marker, 765

file mode, 319

initialization, 317

off_type, 766

open, 318

pos_type, 766

random access, 765

random IO program, 766

seek and tell, 763768

ignore, istream, 763

implementation, 254, 254, 306

in (file mode), 319

in scope, 49, 79

in-class initializer, 73, 73, 79, 263, 265, 274

#include

standard header, 6, 21

user-defined header, 21

includes, 880

incomplete type, 279, 306

can’t be base class, 600

not in exception declaration, 775

restrictions on use, 279

incr, StrBlobPtr, 475

increment operators, 147149

indentation, 19, 177

index, 94, 131

see also [] (subscript)

indirect base class, 600, 650

inferred return type, lambda expression, 396

inheritance, 650

and container, 630

conversions, 604

copy control, 623629

friend, 614

hierarchy, 592, 600

interface class, 637

IO classes, 311, 324

name collisions, 618

private, 612, 650

protected, 612, 650

public, 612, 650

vs. composition, 637

inherited, constructor, 628

initialization

aggregate class, 298

array, 114

associative container, 423, 424

bitset, 723725

C-style string, 122

class type objects, 73, 262

const

static data member, 302

class type object, 262

data member, 289

object, 59

copy, 84, 131, 497, 497499, 549

default, 43, 293

direct, 84, 131

dynamically allocated object, 459

exception, 197

istream_iterator, 405

list, see list initialization

lvalue reference, 532

multidimensional array, 126

new[], 477

ostream_iterator, 405

pair, 426

parameter, 203, 208

pointer, 5254

to const, 62

queue, 369

reference, 51

data member, 289

to const, 61

return value, 224

rvalue reference, 532

sequential container, 334337

shared_ptr, 464

stack, 369

string, 8485, 360361

string streams, 321

tuple, 718

unique_ptr, 470

value, 98, 132, 293

variable, 42, 43, 79

vector, 97101

vs. assignment, 42, 288

weak_ptr, 473

initializer_list, 220, 220222, 252

= (assignment), 563

constructor, 662

header, 220

inline function, 238, 252

and header, 240

function template, 655

member function, 257, 273

and header, 273

inline namespace, 790, 817

inner scope, 48, 79

inner_product, 882

inplace_merge, 875

input, standard, 6

input iterator, 411, 418

insert

associative container, 432

multiple key container, 433

sequential container, 343

string, 362

insert iterator, 382, 401, 402, 418

back_inserter, 402

front_inserter, 402

inserter, 402

inserter, 402, 418

compared to front_inserter, 402

instantiation, 96, 131, 653, 656, 713

Blob, 660

class template, 660

member function, 663

declaration, 713

definition, 713

error detection, 657

explicit, 675676

function template from function pointer, 686

member template, 674

static member, 667

int, 33

literal, 38

integral

constant expression, 65

promotion, 134, 160, 169

function matching, 246

type, 32, 79

integrated development environment, 3

interface, 254, 306

internal, manipulator, 759

interval, left-inclusive, 373

invalid pointer, 52

invalid_argument, 197

invalidated iterator

and container operations, 354

undefined behavior, 353

invalidates iterator

assign, 338

erase, 349

resize, 352

IO

formatted, 761, 769

unformatted, 761, 770

IO classes

condition state, 312, 324

inheritance, 324

IO stream, see stream

iomanip header, 756

iostate, 312

machine-dependent, 313

iostream, 5

file marker, 765

header, 6, 27, 310

off_type, 766

pos_type, 766

random access, 765

random IO program, 766

seek and tell, 763768

virtual base class, 810

iota, 882

is-a relationship, 637

is_partitioned, 876

is_permutation, 879

is_sorted, 877

is_sorted_until, 877

isalnum, 92

isalpha, 92

isbn

Sales_data, 257

Sales_item, 23

ISBN, 2

isbn_mismatch, 783

iscntrl, 92

isdigit, 92

isgraph, 92

islower, 92

isprint, 92

ispunct, 92

isShorter program, 211

isspace, 92

istream, 5, 27, 311

see also manipulator

>> (input operator), 8 precedence and associativity, 155

as condition, 15

chained input, 8

condition state, 312

conversion, 162

explicit conversion to bool, 583

file marker, 765

flushing input buffer, 314

format state, 753

gcount, 763

get, 761

multi-byte version, 762

returns int, 762, 764

getline, 87, 321, 762

ignore, 763

no copy or assign, 311

off_type, 766

peek, 761

pos_type, 766

put, 761

putback, 761

random access, 765

random IO program, 766

read, 763

seek and tell, 763768

unformatted IO, 761

multi-byte, 763

single-byte, 761

unget, 761

istream_iterator, 403, 418

>> (input operator), 403

algorithms, 404

initialization, 405

off-the-end iterator, 403

operations, 404

type requirements, 406

istringstream, 311, 321, 321323

see also istream

word per line processing, 442

file marker, 765

getline, 321

initialization, 321

off_type, 766

phone number program, 321

pos_type, 766

random access, 765

random IO program, 766

seek and tell, 763768

TextQuery constructor, 488

isupper, 92

isxdigit, 92

iter_swap, 875

iterator, 106, 106112, 131

++ (increment), 107, 132

-- (decrement), 107

* (dereference), 107

+= (compound assignment), 111

+ (addition), 111

- (subtraction), 111

== (equality), 106, 107

!= (inequality), 106, 107

algorithm type independence, 377

arithmetic, 111, 131

compared to reverse iterator, 409

destination, 413

insert, 401, 418

move, 401, 418, 543

uninitialized_copy, 543

off-the-beginning

before_begin, 351

forward_list, 351

off-the-end, 106, 132, 373

istream_iterator, 403

parameter, 216

regex, 734

relational operators, 111

reverse, 401, 407409, 418

stream, 401, 403406, 418

used as destination, 382

iterator

compared to reverse_iterator, 408

container, 108, 332

header, 119, 382, 401

set iterators are const, 429

iterator category, 410, 410412, 418

bidirectional iterator, 412, 417

forward iterator, 411, 417

input iterator, 411, 418

output iterator, 411, 418

random-access iterator, 412, 418

iterator range, 331, 331332, 373

algorithms, 376

as initializer of container, 335

container erase member, 349

container insert member, 344

left-inclusive, 331

off-the-end, 331

K

key concept

algorithms

and containers, 378

iterator arguments, 381

class user, 255

classes define behavior, 20

defining an assignment operator, 512

dynamic binding in C++, 605

elements are copies, 342

encapsulation, 270

headers for template code, 657

indentation, 19

inheritance and conversions, 604

is A and has A relationships, 637

name lookup and inheritance, 619

protected members, 614

refactoring, 611

respecting base class interface, 599

specialization declarations, 708

type checking, 46

types define behavior, 3

use concise expressions, 149

key_type

associative container, 428, 447

requirements

ordered container, 425

unordered container, 445

keyword table, 47

Koenig lookup, 797

L

L'c' (wchar_t literal), 38

label

case, 179, 199

statement, 192

labeled statement, 192, 200

lambda expression, 388, 418

arguments, 389

biggies program, 391

reference capture, 393

capture list, 388, 417

capture by reference, 393

capture by value, 390, 392

implicit capture, 394

inferred return type, 389, 396

mutable, 395

parameters, 389

passed to find_if, 390

passed to stable_sort, 389

synthesized class type, 572574

trailing return type, 396

left, manipulator, 758

left-inclusive interval, 331, 373

length_error, 197

less<T>, 575

less_equal<T>, 575

letter grade, program, 175

lexicographical_compare, 881

library function objects, 574

as arguments to algorithms, 575

library names to header table, 866

library type, 5, 27, 82

lifetime, 204, 252

compared to scope, 204

dynamically allocated objects, 450, 461

global variable, 204

local variable, 204

parameter, 205

linkage directive, 858, 863

C++ to C, 860

compound, 858

overloaded function, 860

parameter or return type, 859

pointer to function, 859

return type, 859

single, 858

linker, 208, 252

template errors at link time, 657

list, 373

see also container

see also sequential container

bidirectional iterator, 412

header, 329

initialization, 334337

list initialization, 336

merge, 415

overview, 327

remove, 415

remove_if, 415

reverse, 415

splice, 416

unique, 415

value initialization, 336

list initialization, 43, 79

= (assignment), 145

array, 337

associative container, 423

container, 336

dynamically allocated, object, 459

pair, 427, 431, 527

preferred, 99

prevents narrowing, 43

return value, 226, 427, 527

sequential container, 336

vector, 98

literal, 38, 3841, 79

bool, 41

in condition, 143

char, 39

decimal, 38

double (numEnum or numenum), 38

float (numF or numf), 41

floating-point, 38

hexadecimal (0Xnum or 0xnum), 38

int, 38

long (numL or numl), 38

long double (ddd.dddL or ddd.dddl), 41

long long (numLL or numll), 38

octal (0num), 38

string, 7, 28, 39

unsigned (numU or numu), 41

wchar_t, 40

literal type, 66

class type, 299

local class, 852, 863

access control, 853

name lookup, 853

nested class in, 854

restrictions, 852

local scope, see block scope

local static object, 205, 252

local variable, 204, 252

destroyed during exception handling, 467, 773

destructor, 502

lifetime, 204

pointer, return value, 225

reference, return value, 225

return statement, 224

lock, weak_ptr, 473

logic_error, 197

logical operators, 141, 142

condition, 141

function object, 574

logical_and<T>, 575

logical_not<T>, 575

logical_or<T>, 575

long, 33

literal (numL or numl), 38

long double, 33

literal (ddd.dddL or ddd.dddl), 41

long long, 33

literal (numLL or numll), 38

lookup, name, see name lookup

low-level const, 64, 79

argument and parameter, 213

conversion from, 163

conversion to, 162

overloaded function, 232

template argument deduction, 693

low-order bits, 723, 770

lower_bound

algorithm, 873

ordered container, 438

lround, 751

lvalue, 135, 169

cast to rvalue reference, 691

copy initialization, uses copy constructor, 539

decltype, 135

reference collapsing rule, 688

result

-> (arrow operator), 150

++ (increment) prefix, 148

-- (decrement) prefix, 148

* (dereference), 135

[] (subscript), 135

= (assignment), 145

, (comma operator), 158

?: (conditional operator), 151

cast, 163

decltype, 71

function reference return type, 226

variable, 533

lvalue reference, see also reference, 532, 549

collapsing rule, 688

compared to rvalue reference, 533

function matching, 539

initialization, 532

member function, 546

overloaded, 547

move, 533

template argument deduction, 687

M

machine-dependent

bit-field layout, 854

char representation, 34

end-of-file character, 15

enum representation, 835

iostate, 313

linkage directive language, 861

nonzero return from main, 227

random IO, 763

reinterpret_cast, 164

return from exception what, 198

signed out-of-range value, 35

signed types and bitwise operators, 153

size of arithmetic types, 32

terminate function, 196

type_info members, 831

vector, memory management, 355

volatile implementation, 856

main, 2, 27

not recursive, 228

parameters, 218

return type, 2

return value, 24, 227

make_move_iterator, 543

make_pair, 428

make_plural program, 224

make_shared, 451

make_tuple, 718

malloc library function, 823, 863

manipulator, 7, 27, 753, 770

boolalpha, 754

change format state, 753

dec, 754

defaultfloat, 757

endl, 314

ends, 315

fixed, 757

flush, 315

hex, 754

hexfloat, 757

internal, 759

left, 758

noboolalpha, 754

noshowbase, 755

noshowpoint, 758

noskipws, 760

nouppercase, 755

oct, 754

right, 758

scientific, 757

setfill, 759

setprecision, 756

setw, 758

showbase, 755

showpoint, 758

skipws, 760

unitbuf, 315

uppercase, 755

map, 420, 447

see also ordered container

* (dereference), 429

[] (subscript), 435, 448

adds element, 435

at, 435

definition, 423

header, 420

insert, 431

key_type requirements, 425

list initialization, 423

lower_bound, 438

map, initialization, 424

TextQuery class, 485

upper_bound, 438

word_count program, 421

mapped_type, associative container, 428, 448

match

best, 251

no, 252

match_flag_type, regex_constants, 743

max, 881

max_element, 881

mem_fn, 843, 863

generates callable, 843

member, see class data member

member access operators, 150

member function, 23, 27, 306

as friend, 281

base member hidden by derived, 619

class template

defined outside class body, 661

instantiation, 663

const, 258, 305

() (call operator), 573

reference return, 276

declared but not defined, 509

defined outside class, 259

definition, 256260

:: (scope operator), 259

name lookup, 285

parameter list, 282

return type, 283

explicitly inline, 273

function matching, 273

implicit this parameter, 257

implicitly inline, 257

inline and header, 273

move-enabled, 545

name lookup, 287

overloaded, 273

on const, 276

on lvalue or rvalue reference, 547

overloaded operator, 500, 552

reference qualified, 546, 550

returning *this, 260, 275

rvalue reference parameters, 544

scope, 282

template, see member template

member template, 672, 714

Blob, iterator constructor, 673

DebugDelete, 673

declaration, 673

defined outside class body, 674

instantiation, 674

template parameters, 673, 674

memberwise

copy assignment, 500

copy constructor, 497

copy control, 267, 550

destruction is implicit, 503

move assignment, 538

move constructor, 538

memory

see also dynamically allocated

exhaustion, 460

leak, 462

memory header, 450, 451, 481, 483

merge, 874

list and forward_list, 415

Message, 519524

add_to_Folder, 522

class definition, 521

copy assignment, 523

copy constructor, 522

design, 520

destructor, 522

move assignment, 542

move constructor, 542

move_Folders, 542

remove_from_Folders, 523

method, see member function

Microsoft compiler, 5

min, 881

min_element, 881

minmax, 881

minus<T>, 575

mismatch, 872

mode, file, 324

modulus<T>, 575

move, 530, 533, 874

argument-dependent lookup, 798

binds rvalue reference to lvalue, 533

explained, 690692

inherently dangerous, 544

Message, move operations, 541

moved from object has unspecified value, 533

reference collapsing rule, 691

StrVec reallocate, 530

remove_reference, 691

move assignment, 536, 550

copy and swap, 540

derived class, 626

HasPtr, valuelike, 540

memberwise, 538

Message, 542

moved-from object destructible, 537

noexcept, 535

rule of three/five, virtual destructor exception, 622

self-assignment, 537

StrVec, 536

synthesized

deleted function, 538, 624

derived class, 623

multiple inheritance, 805

sometimes omitted, 538

move constructor, 529, 534, 534536, 550

and copy initialization, 541

derived class, 626

HasPtr, valuelike, 540

memberwise, 538

Message, 542

moved-from object destructible, 534, 537

noexcept, 535

rule of three/five, virtual destructor exception, 622

string, 529

StrVec, 535

synthesized

deleted function, 624

derived class, 623

multiple inheritance, 805

sometimes omitted, 538

move iterator, 401, 418, 543, 550

make_move_iterator, 543

StrVec, reallocate, 543

uninitialized_copy, 543

move operations, 531548

function matching, 539

move, 533

noexcept, 535

rvalue references, 532

valid but unspecified, 537

move_backward, 875

move_Folders, Message, 542

multidimensional array, 125130

[] (subscript), 127

argument and parameter, 218

begin, 129

conversion to pointer, 128

definition, 126

end, 129

initialization, 126

pointer, 128

range for statement and, 128

multimap, 448

see also ordered container

* (dereference), 429

definition, 423

has no subscript operator, 435

insert, 431, 433

key_type requirements, 425

list initialization, 423

lower_bound, 438

map, initialization, 424

upper_bound, 438

multiple inheritance, 802, 817

see also virtual base class

= (assignment), 805

ambiguous conversion, 806

ambiguous names, 808

avoiding ambiguities, 809

class derivation list, 803

conversion, 805

copy control, 805

name lookup, 807

object composition, 803

order of initialization, 804

scope, 807

virtual function, 807

multiplies<T>, 575

multiset, 448

see also ordered container

insert, 433

iterator, 429

key_type requirements, 425

list initialization, 423

lower_bound, 438

override comparison

Basket class, 631

using compareIsbn, 426

upper_bound, 438

used in Basket, 632

mutable

data member, 274

lambda expression, 395

N

(newline character), 39

name lookup, 283, 306

:: (scope operator), overrides, 286

argument-dependent lookup, 797

before type checking, 619

multiple inheritance, 809

block scope, 48

class, 284

class member

declaration, 284

definition, 285, 287

function, 284

depends on static type, 617, 619

multiple inheritance, 806

derived class, 617

name collisions, 618

local class, 853

multiple inheritance, 807

ambiguous names, 808

namespace, 796

nested class, 846

overloaded virtual functions, 621

templates, 657

type checking, 235

virtual base class, 812

named cast, 162

const_cast, 163, 163

dynamic_cast, 163, 825

reinterpret_cast, 163, 164

static_cast, 163, 163

namespace, 7, 27, 785, 817

alias, 792, 817

argument-dependent lookup, 797

candidate function, 800

cplusplus_primer, 787

definition, 785

design, 786

discontiguous definition, 786

friend declaration scope, 799

function matching, 800

global, 789, 817

inline, 790, 817

member, 786

member definition, 788

outside namespace, 788

name lookup, 796

nested, 789

overloaded function, 800

placeholders, 399

scope, 785790

std, 7

template specialization, 709, 788

unnamed, 791, 818

local to file, 791

replace file static, 792

namespace pollution, 785, 817

narrowing conversion, 43

NDEBUG, 241

negate<T>, 575

nested class, 843, 863

access control, 844

class defined outside enclosing class, 845

constructor, QueryResult, 845

in local class, 854

member defined outside class body, 845

name lookup, 846

QueryResult, 844

relationship to enclosing class, 844, 846

scope, 844

static member, 845

nested namespace, 789

nested type, see nested class

new, 458, 458460, 491

execution flow, 820

failure, 460

header, 197, 460, 478, 821

initialization, 458

placement, 460, 491, 824, 863

union with class type member, 851

shared_ptr, 464

unique_ptr, 470

with auto, 459

new[], 477, 477478

initialization, 477

returns pointer to an element, 477

value initialization, 478

newline ( ), character, 39

next_permutation, 879

no match, 234, 252

see also function matching

noboolalpha, manipulator, 754

NoDefault, 293

noexcept

exception specification, 779, 817

argument, 779781

violation, 779

move operations, 535

operator, 780, 817

nonconst reference, see reference

none, bitset, 726

none_of, 871

nonportable, 36, 863

nonprintable character, 39, 79

nonthrowing function, 779, 818

nontype parameter, 654, 714

compare, 654

must be constant expression, 655

type requirements, 655

normal_distribution, 751

noshowbase, manipulator, 755

noshowpoint, manipulator, 758

noskipws, manipulator, 760

not_equal_to<T>, 575

NotQuery, 637

class definition, 642

eval function, 647

nouppercase, manipulator, 755

nth_element, 877

NULL, 54

null (), character, 39

null pointer, 53, 79

delete of, 461

null statement, 172, 200

null-terminated character string, see C-style string

nullptr, 54, 79

numeric header, 376, 881

numeric conversion, to and from string, 367

numeric literal

float (numF or numf), 41

long (numL or numl), 41

long double (ddd.dddL or ddd.dddl), 41

long long(numLL or numll), 41

unsigned (numU or numu), 41

O

object, 42, 79

automatic, 205, 251

dynamically allocated, 458463

const object, 460

delete, 460

factory program, 461

initialization, 459

lifetime, 450

new, 458

lifetime, 204, 252

local static, 205, 252

order of destruction

class type object, 502

derived class object, 627

multiple inheritance, 805

virtual base classes, 815

order of initialization

class type object, 289

derived class object, 598, 623

multiple inheritance, 804

virtual base classes, 814

object code, 252

object file, 208, 252

object-oriented programming, 650

oct, manipulator, 754

octal, literal (0num), 38

octal escape sequence (nnn), 39

off-the-beginning iterator, 351, 373

before_begin, 351

forward_list, 351

off-the-end

iterator, 106, 132, 373

iterator range, 331

pointer, 118

ofstream, 311, 316320, 324

see also ostream

close, 318

file marker, 765

file mode, 319

initialization, 317

off_type, 766

open, 318

pos_type, 766

random access, 765

random IO program, 766

seek and tell, 763768

old-style, cast, 164

open, file stream, 318

operand, 134, 169

conversion, 159

operator, 134, 169

operator alternative name, 46

operator delete

class member, 822

global function, 820, 863

operator delete[]

class member, 822

compared to deallocate, 823

global function, 820

operator new

class member, 822

global function, 820, 863

operator new[]

class member, 822

compared to allocate, 823

global function, 820

operator overloading, see overloaded operator

operators

arithmetic, 139

assignment, 12, 144147

binary, 134, 168

bitwise, 152156

bitset, 725

comma (,), 157

compound assignment, 12

conditional (?:), 151

decrement, 147149

equality, 18, 141

increment, 12, 147149

input, 8

iterator

addition and subtraction, 111

arrow, 110

dereference, 107

equality, 106, 108

increment and decrement, 107

relational, 111

logical, 141

member access, 150

noexcept, 780

output, 7

overloaded, arithmetic, 560

pointer

addition and subtraction, 119

equality, 120

increment and decrement, 118

relational, 120, 123

subscript, 121

relational, 12, 141, 143

Sales_data

+= (compound assignment), 564

+ (addition), 560

== (equality), 561

!= (inequality), 561

>> (input operator), 558

<< (output operator), 557

Sales_item, 20

scope, 82

sizeof, 156

sizeof..., 700

string

addition, 89

equality and relational, 88

IO, 85

subscript, 9395

subscript, 116

typeid, 826, 864

unary, 134, 169

vector

equality and relational, 102

subscript, 103105

options to main, 218

order of destruction

class type object, 502

derived class object, 627

multiple inheritance, 805

virtual base classes, 815

order of evaluation, 134, 169

&& (logical AND), 138

|| (logical OR), 138

, (comma operator), 138

?: (conditional operator), 138

expression, 137

pitfalls, 149

order of initialization

class type object, 289

derived class object, 598

multiple base classes, 816

multiple inheritance, 804

virtual base classes, 814

ordered container

see also container

see also associative container

key_type requirements, 425

lower_bound, 438

override default comparison, 425

upper_bound, 438

ordering, strict weak, 425, 448

OrQuery, 637

class definition, 644

eval function, 645

ostream, 5, 27, 311

see also manipulator

<< (output operator), 7

precedence and associativity, 155

chained output, 7

condition state, 312

explicit conversion to bool, 583

file marker, 765

floating-point notation, 757

flushing output buffer, 314

format state, 753

no copy or assign, 311

not flushed if program crashes, 315

off_type, 766

output format, floating-point, 755

pos_type, 766

precision member, 756

random access, 765

random IO program, 766

seek and tell, 763768

tie member, 315

virtual base class, 810

write, 763

ostream_iterator, 403, 418

<< (output operator), 405

algorithms, 404

initialization, 405

operations, 405

type requirements, 406

ostringstream, 311, 321, 321323

see also ostream

file marker, 765

initialization, 321

off_type, 766

phone number program, 323

pos_type, 766

random access, 765

random IO program, 766

seek and tell, 763768

str, 323

out (file mode), 319

out-of-range value, signed, 35

out_of_range, 197

at function, 348

out_of__stock, 783

outer scope, 48, 79

output, standard, 6

output iterator, 411, 418

overflow, 140

overflow_error, 197

overhead, function call, 238

overload resolution, see function matching

overloaded function, 230, 230235, 252

see also function matching

as friend, 281

compared to redeclaration, 231

compared to template specialization, 708

const parameters, 232

constructor, 262

function template, 694699

linkage directive, 860

member function, 273

const, 276

move-enabled, 545

reference qualified, 547

virtual, 621

move-enabled, 545

namespace, 800

pointer to, 248

scope, 234

derived hides base, 619

using declaration, 800

in derived class, 621

using directive, 801

overloaded operator, 135, 169, 500, 550, 552, 590

++ (increment), 566568

-- (decrement), 566568

* (dereference), 569

StrBlobPtr, 569

& (address-of), 554

-> (arrow operator), 569

StrBlobPtr, 569

[] (subscript), 564

StrVec, 565

() (call operator), 571

absInt, 571

PrintString, 571

= (assignment), 500, 563

StrVec initializer_list, 563

+= (compound assignment), 555, 560

Sales_data, 564

+ (addition), Sales_data, 560

== (equality), 561

Sales_data, 561

!= (inequality), 562

Sales_data, 561

< (less-than), strict weak ordering, 562

>> (input operator), 558559

Sales_data, 558

<< (output operator), 557558

Sales_data, 557

&& (logical AND), 554

|| (logical OR), 554

& (bitwise AND), Query, 644

| (bitwise OR), Query, 644

~ (bitwise NOT), Query, 643

, (comma operator), 554

ambiguous, 588

arithmetic operators, 560

associativity, 553

binary operators, 552

candidate function, 587

consistency between relational and equality operators, 562

definition, 500, 552

design, 554556

equality operators, 561

explicit call to, 553

postfix operators, 568

function matching, 587589

member function, 500, 552

member vs. nonmember function, 552, 555

precedence, 553

relational operators, 562

requires class-type parameter, 552

short-circuit evaluation lost, 553

unary operators, 552

override, virtual function, 595, 650

override specifier, 593, 596, 606

P

pair, 426, 448

default initialization, 427

definition, 426

initialization, 426

list initialization, 427, 431, 527

make_pair, 428

map, * (dereference), 429

operations, 427

public data members, 427

return value, 527

Panda, 803

parameter, 202, 208, 252

array, 214219

buffer overflow, 215

to pointer conversion, 214

C-style string, 216

const, 212

copy constructor, 496

ellipsis, 222

forwarding, 693

function pointer, linkage directive, 859

implicit this, 257

initialization, 203, 208

iterator, 216

lifetime, 205

low-level const, 213

main function, 218

multidimensional array, 218

nonreference, 209

uses copy constructor, 498

uses move constructor, 539

pass by reference, 210, 252

pass by value, 209, 252

passing, 208212

pointer, 209, 214

pointer to const, 246

pointer to array, 218

pointer to function, 249

linkage directive, 859

reference, 210214

to const, 213, 246

to array, 217

reference to const, 211

template, see template parameter

top-level const, 212

parameter list

function, 2, 27, 202

template, 653, 714

parameter pack, 714

expansion, 702, 702704, 714

function template, 713

sizeof..., 700

variadic template, 699

parentheses, override precedence, 136

partial_sort, 877

partial_sort_copy, 877

partial_sum, 882

partition, 876

partition_copy, 876

partition_point, 876

pass by reference, 208, 210, 252

pass by value, 209, 252

uses copy constructor, 498

uses move constructor, 539

pattern, 702, 714

function parameter pack, 704

regular expression, phone number, 739

template parameter pack, 703

peek, istream, 761

PersonInfo, 321

phone number, regular expression

program, 738

reformat program, 742

valid, 740

pitfalls

dynamic memory, 462

order of evaluation, 149

self-assignment, 512

smart pointer, 469

using directive, 795

placeholders, 399

placement new, 460, 491, 824, 863

union, class type member, 851

plus<T>, 575

pointer, 52, 5258, 79

++ (increment), 118

-- (decrement), 118

* (dereference), 53

[] (subscript), 121

= (assignment), 55

+ (addition), 119

- (subtraction), 119

== (equality), 55, 120

!= (inequality), 55, 120

and array, 117

arithmetic, 119, 132

const, 63, 78

const pointer to const, 63

constexpr, 67

conversion

from array, 161

to bool, 162

to const, 62, 162

to void*, 161

dangling, 463, 491

declaration style, 57

definition, 52

delete, 460

derived-to-base conversion, 597

under multiple inheritance, 805

dynamic_cast, 825

implicit this, 257, 306

initialization, 5254

invalid, 52

multidimensional array, 128

null, 53, 79

off-the-end, 118

parameter, 209, 214

relational operators, 123

return type, 204

return value, local variable, 225

smart, 450, 491

to const, 62

and typedef, 68

to array

parameter, 218

return type, 204

return type declaration, 229

to const, 79

overloaded parameter, 232, 246

to pointer, 58

typeid operator, 828

valid, 52

volatile, 856

pointer to function, 247250

auto, 249

callable object, 388

decltype, 249

exception specification, 779, 781

explicit template argument, 686

function template instantiation, 686

linkage directive, 859

overloaded function, 248

parameter, 249

return type, 204, 249

using decltype, 250

template argument deduction, 686

trailing return type, 250

type alias, 249

typedef, 249

pointer to member, 835, 863

arrow (->*), 837

definition, 836

dot (.*), 837

function, 838

and bind, 843

and function, 842

and mem_fn, 843

not callable object, 842

function call, 839

function table, 840

precedence, 838

polymorphism, 605, 650

pop

priority_queue, 371

queue, 371

stack, 371

pop_back

sequential container, 348

StrBlob, 457

pop_front, sequential container, 348

portable, 854

precedence, 134, 136137, 169

= (assignment), 146

?: (conditional operator), 151

assignment and relational operators, 146

dot and dereference, 150

increment and dereference, 148

of IO operator, 156

overloaded operator, 553

parentheses overrides, 136

pointer to member and call operator, 838

precedence table, 166

precision member, ostream, 756

predicate, 386, 418

binary, 386, 417

unary, 386, 418

prefix, smatch, 736

preprocessor, 76, 79

#include, 7

assert macro, 241, 251

header guard, 77

variable, 54, 79

prev_permutation, 879

print, Sales_data, 261

print program

array parameter, 215

array reference parameter, 217

pointer and size parameters, 217

pointer parameter, 216

two pointer parameters, 216

variadic template, 701

print_total

explained, 604

program, 593

PrintString, 571

() (call operator), 571

priority_queue, 371, 373

emplace, 371

empty, 371

equality and relational operators, 370

initialization, 369

pop, 371

push, 371

sequential container, 371

size, 371

swap, 371

top, 371

private

access specifier, 268, 306

copy constructor and assignment, 509

inheritance, 612, 650

program

addition

Sales_data, 74

Sales_item, 21, 23

alternative_sum, 682

biggies, 391

binops desk calculator, 577

book from author version 1, 438

book from author version 2, 439

book from author version 3, 440

bookstore

Sales_data, 255

Sales_data using algorithms, 406

Sales_item, 24

buildMap, 442

children’s story, 383391

compare, 652

count_calls, 206

debug_rep

additional nontemplate versions, 698

general template version, 695

nontemplate version, 697

pointer template version, 696

elimDups, 383391

error_msg, 221

fact, 202

factorial, 227

factory

new, 461

shared_ptr, 453

file extension, 730

version 2, 738

find last word, 408

find_char, 211

findBook, 721

flip, 694

flip1, 692

flip2, 693

grade clusters, 103

grading

bitset, 728

bitwise operators, 154

i before e, 729

version 2, 734

isShorter, 211

letter grade, 175

make_plural, 224

message handling, 519

phone number

istringstream, 321

ostringstream, 323

reformat, 742

regular expression version, 738

valid, 740

print

array parameter, 215

array reference parameter, 217

pointer and size parameters, 217

pointer parameter, 216

two pointer parameters, 216

variadic template, 701

print_total, 593

Query, 635

class design, 636639

random IO, 766

reset

pointer parameters, 209

reference parameters, 210

restricted word_count, 422

sum, 682

swap, 223

TextQuery, 486

design, 485

transform, 442

valid, 740

vector capacity, 357

vowel counting, 179

word_count

map, 421

unordered_map, 444

word_transform, 441

ZooAnimal, 802

promotion, see integral promotion

protected

access specifier, 595, 611, 650

inheritance, 612, 650

member, 611

ptr_fun deprecated, 401

ptrdiff_t, 120, 132

public

access specifier, 268, 306

inheritance, 612, 650

pure virtual function, 609, 650

Disc_quote, 609

Query_base, 636

push

priority_queue, 371

queue, 371

stack, 371

push_back

back_inserter, 382, 402

sequential container, 100, 132, 342

move-enabled, 545

StrVec, 526

move-enabled, 545

push_front

front_inserter, 402

sequential container, 342

put, istream, 761

putback, istream, 761

Q

Query, 638

<< (output operator), 641

& (bitwise AND), 638

definition, 644

| (bitwise OR), 638

definition, 644

~ (bitwise NOT), 638

definition, 643

classes, 636639

definition, 640

interface class, 637

operations, 635

program, 635

recap, 640

Query_base, 636

abstract base class, 636

definition, 639

member function, 636

QueryResult, 485

class definition, 489

nested class, 844

constructor, 845

print, 490

queue, 371, 373

back, 371

emplace, 371

empty, 371

equality and relational operators, 370

front, 371

header, 371

initialization, 369

pop, 371

push, 371

sequential container, 371

size, 371

swap, 371

Quote

class definition, 594

design, 592

R

Raccoon, virtual base class, 812

raise exception, see throw

rand function, drawbacks, 745

random header, 745

random IO, 765

machine-dependent, 763

program, 766

random-access iterator, 412, 418

random-number library, 745

compared to rand function, 745

distribution types, 745, 770

engine, 745, 770

default_random_engine, 745

max, min, 747

retain state, 747

seed, 748, 770

generator, 746, 770

range, 747

random_shuffle, 878

range for statement, 91, 132, 187, 187189, 200

can’t add elements, 101, 188

multidimensional array, 128

not with dynamic array, 477

range_error, 197

rbegin, container, 333, 407

rdstate, stream, 313

read

istream, 763

Sales_data, 261

reallocate, StrVec, 530

move iterator version, 543

recursion loop, 228, 252, 608

recursive function, 227, 252

variadic template, 701

ref, binds reference parameter, 400, 418

refactoring, 611, 650

reference, 50, 79

see also lvalue reference

see also rvalue reference

auto deduces referred to type, 69

collapsing rule, 688

forward, 694

lvalue arguments, 688

move, 691

rvalue reference parameters, 693

const, see reference to const

conversion

not from const, 61

to reference to const, 162

data member, initialization, 289

declaration style, 57

decltype yields reference type, 71

definition, 51

derived-to-base conversion, 597

under multiple inheritance, 805

dynamic_cast operator, 826

initialization, 51

member function, 546

parameter, 210214

bind, 400

limitations, 214

template argument deduction, 687689

remove_reference, 684

return type, 224

assignment operator, 500

is lvalue, 226

return value, local variable, 225

to array parameter, 217

reference, container, 333

reference count, 452, 491, 514, 550

copy assignment, 514

copy constructor, 514

design, 514

destructor, 514

HasPtr class, 514516

reference to const, 61, 80

argument, 211

initialization, 61

parameter, 211, 213

overloaded, 232, 246

return type, 226

regex, 728, 770

error_type, 732

header, 728

regex_error, 732, 770

syntax_option_type, 730

regex_constants, 743

match_flag_type, 743

regex_error, 732, 770

regex_match, 729, 770

regex_replace, 742, 770

format flags, 744

format string, 742

regex_search, 729, 730, 770

regular expression library, 728, 770

case sensitive, 730

compiled at run time, 732

ECMAScript, 730

file extension program, 730

i before e program, 729

version 2, 734

match data, 735737

pattern, 729

phone number, valid, 740

phone number pattern, 739

phone number program, 738

phone number reformat, program, 742

regex iterators, 734

search functions, 729

smatch, provides context for a match, 735

subexpression, 738

file extension program version 2, 738

types, 733

valid, program, 740

reinterpret_cast, 163, 164

machine-dependent, 164

relational operators, 141, 143

arithmetic conversion, 144

container adaptor, 370

container member, 340

function object, 574

iterator, 111

overloaded operator, 562

pointer, 120, 123

Sales_data, 563

string, 88

tuple, 720

vector, 102

release, unique_ptr, 470

remove, 878

list and forward_list, 415

remove_copy, 878

remove_copy_if, 878

remove_from_Folders, Message, 523

remove_if, 878

list and forward_list, 415

remove_pointer, 685

remove_reference, 684

move, 691

rend, container, 333, 407

replace, 383, 875

string, 362

replace_copy, 383, 874

replace_copy_if, 874

replace_if, 875

reserve

string, 356

vector, 356

reserved identifiers, 46

reset

bitset, 727

shared_ptr, 466

unique_ptr, 470

reset program

pointer parameters, 209

reference parameters, 210

resize

invalidates iterator, 352

sequential container, 352

value initialization, 352

restricted word_count program, 422

result, 134, 169

* (dereference), lvalue, 135

[] (subscript), lvalue, 135

, (comma operator), lvalue, 158

?: (conditional operator), lvalue, 151

cast, lvalue, 163

rethrow, 776

exception object, 777

throw, 776, 818

return statement, 222, 222228

from main, 227

implicit return from main, 223

local variable, 224, 225

return type, 2, 27, 202, 204, 252

array, 204

array using decltype, 230

function, 204

function pointer, 249

using decltype, 250

linkage directive, 859

main, 2

member function, 283

nonreference, 224

copy initialized, 498

pointer, 204

pointer to function, 204

reference, 224

reference to const, 226

reference yields lvalue, 226

trailing, 229, 252, 396, 684

virtual function, 606

void, 223

return value

conversion, 223

copy initialized, 498

initialization, 224

list initialization, 226, 427, 527

local variable, pointer, 225

main, 24, 227

pair, 427, 527

reference, local variable, 225

*this, 260, 275

tuple, 721

type checking, 223

unique_ptr, 471

reverse, 878

list and forward_list, 415

reverse iterator, 401, 407409, 418

++ (increment), 407

-- (decrement), 407, 408

base, 409

compared to iterator, 409

reverse_copy, 414, 878

reverse_copy_if, 414

reverse_iterator

compared to iterator, 408

container, 332, 407

rfind, string, 366

right, manipulator, 758

rotate, 878

rotate_copy, 878

rule of three/five, 505, 541

virtual destructor exception, 622

run-time type identification, 825831, 864

compared to virtual functions, 829

dynamic_cast, 825, 825

bad_cast, 826

to poiner, 825

to reference, 826

type-sensitive equality, 829

typeid, 826, 827

returns type_info, 827

runtime binding, 594, 650

runtime_error, 194, 197

initialization from string, 196

rvalue, 135, 169

copy initialization, uses move constructor, 539

result

++ (increment) postfix, 148

-- (decrement) postfix, 148

function nonreference return type, 224

rvalue reference, 532, 550

cast from lvalue, 691

collapsing rule, 688

compared to lvalue reference, 533

function matching, 539

initialization, 532

member function, 546

overloaded, 547

move, 533

parameter

forwarding, 693, 705

member function, 544

preserves argument type information, 693

template argument deduction, 687

variable, 533

S

Sales_data

compareIsbn, 387

+= (compound assignment), 564

+ (addition), 560

== (equality), 561

!= (inequality), 561

>> (input operator), 558

<< (output operator), 557

add, 261

addition program, 74

avg_price, 259

bookstore program, 255

using algorithms, 406

class definition, 72, 268

combine, 259

compareIsbn, 425

with associative container, 426

constructors, 264266

converting constructor, 295

default constructor, 262

exception classes, 783

exception version

+= (compound assignment), 784

+ (addition), 784

explicit constructor, 296

isbn, 257

operations, 254

print, 261

read, 261

relational operators, 563

Sales_data.h header, 76

Sales_item, 20

+ (addition), 22

>> (input operator), 21

<< (output operator), 21

addition program, 21, 23

bookstore program, 24

isbn, 23

operations, 20

Sales_item.h header, 19

scientific manipulator, 757

scope, 48, 80

base class, 617

block, 48, 80, 173

class, 73, 282, 282287, 305

static member, 302

compared to object lifetime, 204

derived class, 617

friend, 270, 281

function, 204

global, 48, 80

inheritance, 617621

member function, 282

parameters and return type, 283

multiple inheritance, 807

name collisions, using directive, 795

namespace, 785790

nested class, 844

overloaded function, 234

statement, 174

template parameter, 668

template specialization, 708

using directive, 794

virtual function, 620

scoped enumeration, 832, 864

enum class, 832

Screen, 271

pos member, 272

concatenating operations, 275

do_display, 276

friends, 279

get, 273, 282

get_cursor, 283

Menu function table, 840

move, 841

move members, 275

set, 275

search, 872

search_n, 871

seed, random-number engine, 748

seekp, seekg, 763768

self-assignment

copy and swap assignment, 519

copy assignment, 512

explicit check, 542

HasPtr

reference counted, 515

valuelike, 512

Message, 523

move assignment, 537

pitfalls, 512

StrVec, 528

semicolon (;), 3

class definition, 73

null statement, 172

separate compilation, 44, 80, 252

compiler options, 207

declaration vs. definition, 44

templates, 656

sequential container, 326, 373

array, 326

deque, 326

forward_list, 326

initialization, 334337

list, 326

list initialization, 336

members

assign, 338

back, 346

clear, 350

emplace, 345

emplace_back, 345

emplace_front, 345

erase, 349

front, 346

insert, 343

pop_back, 348

pop_front, 348

push_back, 132

push_back, 100, 342, 545

push_front, 342

resize, 352

value_type, 333

performance characteristics, 327

priority_queue, 371

queue, 371

stack, 370

value initialization, 336

vector, 326

set, 420, 448

see also ordered container

bitset, 727

header, 420

insert, 431

iterator, 429

key_type requirements, 425

list initialization, 423

lower_bound, 438

TextQuery class, 485

upper_bound, 438

word_count program, 422

set_difference, 880

set_intersection, 647, 880

set_symmetric_difference, 880

set_union, 880

setfill, manipulator, 759

setprecision, manipulator, 756

setstate, stream, 313

setw, manipulator, 758

shared_ptr, 450, 450457, 464469, 491

* (dereference), 451

copy and assignment, 451

definition, 450

deleter, 469, 491

bound at run time, 677

derived-to-base conversion, 630

destructor, 453

dynamically allocated array, 480

exception safety, 467

factory program, 453

initialization, 464

make_shared, 451

pitfalls, 469

reset, 466

StrBlob, 455

TextQuery class, 485

with new, 464

short, 33

short-circuit evaluation, 142, 169

&& (logical AND), 142

|| (logical OR), 142

not in overloaded operator, 553

ShorterString, 573

() (call operator), 573

shorterString, 224

showbase, manipulator, 755

showpoint, manipulator, 758

shrink_to_fit

deque, 357

string, 357

vector, 357

shuffle, 878

signed, 34, 80

char, 34

conversion to unsigned, 34, 160

out-of-range value, 35

signed type, 34

single-line (//), comment, 9, 26

size

container, 88, 102, 132, 340

priority_queue, 371

queue, 371

returns unsigned, 88

stack, 371

StrVec, 526

size_t, 116, 132, 727

array subscript, 116

size_type, container, 88, 102, 132, 332

SizeComp, 573

() (call operator), 573

sizeof, 156, 169

array, 157

data member, 157

sizeof..., parameter pack, 700

skipws, manipulator, 760

sliced, 603, 650

SmallInt

+ (addition), 588

conversion operator, 580

smart pointer, 450, 491

exception safety, 467

pitfalls, 469

smatch, 729, 733, 769, 770

prefix, 736

provide context for a match, 735

suffix, 736

sort, 384, 876

source file, 4, 27

specialization, see template specialization

splice, list, 416

splice_after, forward_list, 416

sregex_iterator, 733, 770

i before e program, 734

sstream

file marker, 765

header, 310, 321

off_type, 766

pos_type, 766

random access, 765

random IO program, 766

seek and tell, 763768

ssub_match, 733, 736, 770

example, 740

stable_partition, 876

stable_sort, 387, 876

stack, 370, 373

emplace, 371

empty, 371

equality and relational operators, 370

header, 370

initialization, 369

pop, 371

push, 371

sequential container, 370

size, 371

swap, 371

top, 371

stack unwinding, exception handling, 773, 818

standard error, 6, 27

standard header, #include, 6, 21

standard input, 6, 27

standard library, 5, 27

standard output, 6, 27

statement, 2, 27

block, see block

break, 190, 199

compound, 173, 199

continue, 191, 199

do while, 189, 200

expression, 172, 200

for, 13, 27, 185, 185187, 200

goto, 192, 200

if, 17, 27, 175, 175178, 200

labeled, 192, 200

null, 172, 200

range for, 91, 187, 187189, 200

return, 222, 222228

scope, 174

switch, 178, 178182, 200

while, 11, 28, 183, 183185, 200

statement label, 192

static (file static), 792, 817

static member

Account, 301

class template, 667

accessed through an instantiation, 667

definition, 667

const data member, initialization, 302

data member, 300

definition, 302

default argument, 304

definition, 302

inheritance, 599

instantiation, 667

member function, 301

nested class, 845

scope, 302

static object, local, 205, 252

static type, 601, 650

determines name lookup, 617, 619

multiple inheritance, 806

static type checking, 46

static_cast, 163, 163

lvalue to rvalue, 691

std, 7, 28

std::forward, see forward

std::move, see move

stdexcept header, 194, 197

stod, 368

stof, 368

stoi, 368

stol, 368

stold, 368

stoll, 368

store, free, 450, 491

stoul, 368

stoull, 368

str, string streams, 323

StrBlob, 456

back, 457

begin, 475

check, 457

constructor, 456

end, 475

front, 457

pop_back, 457

shared_ptr, 455

StrBlobPtr, 474

++ (increment), 566

-- (decrement), 566

* (dereference), 569

-> (arrow operator), 569

check, 474

constructor, 474

deref, 475

incr, 475

weak_ptr, 474

strcat, 123

strcmp, 123

strcpy, 123

stream

as condition, 15, 162, 312

clear, 313

explicit conversion to bool, 583

file marker, 765

flushing buffer, 314

format state, 753

istream_iterator, 403

iterator, 401, 403406, 418

type requirements, 406

not flushed if program crashes, 315

ostream_iterator, 403

random IO, 765

rdstate, 313

setstate, 313

strict weak ordering, 425, 448

string, 80, 8493, 132

see also container

see also sequential container

see also iterator

[] (subscript), 93, 132, 347

+= (compound assignment), 89

+ (addition), 89

>> (input operator), 85, 132

>> (input operator) as condition, 86

<< (output operator), 85, 132

and string literal, 8990

append, 362

assign, 362

at, 348

C-style string, 124

c_str, 124

capacity, 356

case sensitive, 365

compare, 366

concatenation, 89

default initialization, 44

difference_type, 112

equality and relational operators, 88

erase, 362

find, 364

find_first_not_of, 365

find_last_not_of, 366

find_last_of, 366

getline, 87, 321

header, 74, 76, 84

initialization, 8485, 360361

initialization from string literal, 84

insert, 362

move constructor, 529

numeric conversions, 367

random-access iterator, 412

replace, 362

reserve, 356

rfind, 366

subscript range, 95

substr, 361

TextQuery class, 485

string literal, 7, 28, 39

see also C-style string

and string, 8990

concatenation, 39

stringstream, 321, 321323, 324

initialization, 321

strlen, 122

struct

see also class

default access specifier, 268

default inheritance specifier, 616

StrVec, 525

[] (subscript), 565

= (assignment), initializer_list, 563

alloc_n_copy, 527

begin, 526

capacity, 526

chk_n_alloc, 526

copy assignment, 528

copy constructor, 528

default constructor, 526

design, 525

destructor, 528

emplace_back, 704

end, 526

free, 528

memory allocation strategy, 525

move assignment, 536

move constructor, 526

push_back, 526

move-enabled, 545

reallocate, 530

move iterator version, 543

size, 526

subexpression, 770

subscript range, 93

array, 116

string, 95

validating, 104

vector, 105

substr, string, 361

suffix, smatch, 736

sum, program, 682

swap, 516

array, 339

container, 339

container nonmember version, 339

copy and swap assignment operator, 518

priority_queue, 371

queue, 371

stack, 371

typical implementation, 517518

swap program, 223

swap_ranges, 875

switch statement, 178, 178182, 200

default case label, 181

break, 179181, 190

compared to if, 178

execution flow, 180

variable definition, 182

syntax_option_type, regex, 730

synthesized

copy assignment, 500, 550

copy constructor, 497, 550

copy control, 267

as deleted function, 508

as deleted in derived class, 624

Bulk_quote, 623

multiple inheritance, 805

virtual base class, 815

virtual base classes, 815

volatile, 857

default constructor, 263, 306

derived class, 623

members of built-in type, 263

destructor, 503, 550

move operations

deleted function, 538

not always defined, 538

T

(tab character), 39

tellp, tellg, 763768

template

see also class template

see also function template

see also instantiation

declaration, 669

link time errors, 657

overview, 652

parameter, see template parameter

parameter list, 714

template argument, 653, 714

explicit, 660, 713

template member, see member template

type alias, 666

type transformation templates, 684, 714

type-dependencies, 658

variadic, see variadic template

template argument deduction, 678, 714

compare, 680

explicit template argument, 682

function pointer, 686

limited conversions, 679

low-level const, 693

lvalue reference parameter, 687

multiple function parameters, 680

parameter with nontemplate type, 680

reference parameters, 687689

rvalue reference parameter, 687

top-level const, 679

template class, see class template

template function, see function template

template parameter, 653, 714

default template argument, 670

class template, 671

function template, 671

name, 668

restrictions on use, 669

nontype parameter, 654, 714

must be constant expression, 655

type requirements, 655

scope, 668

template argument deduction, 680

type parameter, 654, 654, 714

as friend, 666

used in template class, 660

template parameter pack, 699, 714

expansion, 703

pattern, 703

template specialization, 707, 706712, 714

class template, 709712

class template member, 711

compare function template, 706

compared to overloading, 708

declaration dependencies, 708

function template, 707

hash<key_type>, 709, 788

headers, 708

of namespace member, 709, 788

partial, class template, 711, 714

scope, 708

template<>, 707

template<>

default template argument, 671

template specialization, 707

temporary, 62, 80

terminate function, 773, 818

exception handling, 196, 200

machine-dependent, 196

terminology

const reference, 61

iterator, 109

object, 42

overloaded new and delete, 822

test, bitset, 727

TextQuery, 485

class definition, 487

constructor, 488

main program, 486

program design, 485

query, 489

revisited, 635

this pointer, 257, 306

static members, 301

as argument, 266

in return, 260

overloaded

on const, 276

on lvalue or rvalue reference, 546

throw, 193, 193, 200, 772, 818

execution flow, 196, 773

pointer to local object, 774

rethrow, 776, 818

runtime_error, 194

throw(), exception specification, 780

tie member, ostream, 315

to_string, 368

Token, 849

assignment operators, 850

copy control, 851

copyUnion, 851

default constructor, 850

discriminant, 850

tolower, 92

top

priority_queue, 371

stack, 371

top-level const, 64, 80

and auto, 69

argument and parameter, 212

decltype, 71

parameter, 232

template argument deduction, 679

toupper, 92

ToyAnimal, virtual base class, 815

trailing return type, 229, 252

function template, 684

lambda expression, 396

pointer to array, 229

pointer to function, 250

transform

algorithm, 396, 874

program, 442

translation unit, 4

trunc (file mode), 319

try block, 193, 194, 200, 773, 818

tuple, 718, 770

findBook, program, 721

equality and relational operators, 720

header, 718

initialization, 718

make_tuple, 718

return value, 721

value initialization, 718

type

alias, 67, 80

template, 666

alias declaration, 68

arithmetic, 32, 78

built-in, 2, 26, 3234

checking, 46, 80

argument and parameter, 203

array reference parameter, 217

function return value, 223

name lookup, 235

class, 19, 26

compound, 50, 5058, 78

conversion, see conversion

dynamic, 601, 650

incomplete, 279, 306

integral, 32, 79

literal, 66

class type, 299

specifier, 41, 80

static, 601, 650

type alias declaration, 68, 78, 80

pointer, to array, 229

pointer to function, 249

pointer to member, 839

template type, 666

type independence, algorithms, 377

type member, class, 271

type parameter, see template parameter

type transformation templates, 684, 714

type_traits, 685

type_info, 864

header, 197

name, 831

no copy or assign, 831

operations, 831

returned from typeid, 827

type_traits

header, 684

remove_pointer, 685

remove_reference, 684

and move, 691

type transformation templates, 685

typedef, 67, 80

const, 68

and pointer, to const, 68

pointer, to array, 229

pointer to function, 249

typeid operator, 826, 827, 864

returns type_info, 827

typeinfo header, 826, 827, 831

typename

compared to class, 654

required for type member, 670

template parameter, 654

U

unary operators, 134, 169

overloaded operator, 552

unary predicate, 386, 418

unary_function deprecated, 579

uncaught exception, 773

undefined behavior, 35, 80

base class destructor not virtual, 622

bitwise operators and signed values, 153

caching end() iterator, 355

cstring functions, 122

dangling pointer, 463

default initialized members of built-in type, 263

delete of invalid pointer, 460

destination sequence too small, 382

element access empty container, 346

invalidated iterator, 107, 353

missing return statement, 224

misuse of smart pointer get, 466

omitting [] when deleting array, 479

operand order of evaluation, 138, 149

out-of-range subscript, 93

out-of-range value assigned to signed type, 35

overflow and underflow, 140

pointer casts, 163

pointer comparisons, 123

return reference or pointer to local variable, 225

string invalid initializer, 361

uninitialized

dynamic object, 458

local variable, 205

pointer, 54

variable, 45

using unconstructed memory, 482

using unmatched match object, 737

writing to a const object, 163

wrong deleter with smart pointer, 480

underflow_error, 197

unformatted IO, 761, 770

istream, 761

multi-byte, istream, 763

single-byte, istream, 761

unget, istream, 761

uniform_int_distribution, 746

uniform_real_distribution, 750

uninitialized, 8, 28, 44, 80

pointer, undefined behavior, 54

variable, undefined behavior, 45

uninitialized_copy, 483

move iterator, 543

uninitialized_fill, 483

union, 847, 864

anonymous, 848, 862

class type member, 848

assignment operators, 850

copy control, 851

default constructor, 850

deleted copy control, 849

placement new, 851

definition, 848

discriminant, 850

restrictions, 847

unique, 384, 878

list and forward_list, 415

unique_copy, 403, 878

unique_ptr, 450, 470472, 491

* (dereference), 451

copy and assignment, 470

definition, 470, 472

deleter, 472, 491

bound at compile time, 678

dynamically allocated array, 479

initialization, 470

pitfalls, 469

release, 470

reset, 470

return value, 471

transfer ownership, 470

with new, 470

unitbuf, manipulator, 315

unnamed namespace, 791, 818

local to file, 791

replace file static, 792

unordered container, 443, 448

see also container

see also associative container

bucket management, 444

hash<key_type> specialization, 709, 788

compatible with == (equality), 710

key_type requirements, 445

override default hash, 446

unordered_map, 448

see also unordered container

* (dereference), 429

[] (subscript), 435, 448

adds element, 435

at, 435

definition, 423

header, 420

list initialization, 423

word_count program, 444

unordered_multimap, 448

see also unordered container

* (dereference), 429

definition, 423

has no subscript operator, 435

insert, 433

list initialization, 423

unordered_multiset, 448

see also unordered container

insert, 433

iterator, 429

list initialization, 423

override default hash, 446

unordered_set, 448

see also unordered container

header, 420

iterator, 429

list initialization, 423

unscoped enumeration, 832, 864

as union discriminant, 850

conversion to integer, 834

enum, 832

unsigned, 34, 80

char, 34

conversion, 36

conversion from signed, 34

conversion to signed, 160

literal (numU or numu), 41

size return type, 88

unsigned type, 34

unwinding, stack, 773, 818

upper_bound

algorithm, 873

ordered container, 438

used in Basket, 632

uppercase, manipulator, 755

use count, see reference count

user-defined conversion, see class type conversion

user-defined header, 7677

const and constexpr, 76

default argument, 238

function declaration, 207

#include, 21

inline function, 240

inline member function definition, 273

template definition, 656

template specialization, 708

using =, see type alias declaration

using declaration, 82, 132, 793, 818

access control, 615

not in header files, 83

overloaded function, 800

overloaded inherited functions, 621

scope, 793

using directive, 793, 818

overloaded function, 801

pitfalls, 795

scope, 793, 794

name collisions, 795

utility header, 426, 530, 533, 694

V

valid, program, 740

valid but unspecified, 537

valid pointer, 52

value initialization, 98, 132

dynamically allocated, object, 459

map subscript operator, 435

new[], 478

resize, 352

sequential container, 336

tuple, 718

uses default constructor, 293

vector, 98

value_type

associative container, 428, 448

sequential container, 333

valuelike class, copy control, 512

varargs, 222

variable, 8, 28, 41, 4149, 80

const, 59

constexpr, 66

declaration, 45

class type, 294

define before use, 46

defined after label, 182, 192

definition, 41, 45

extern, 45

extern and const, 60

initialization, 42, 43, 79

is lvalue, 533

lifetime, 204

local, 204, 252

preprocessor, 79

variadic template, 699, 714

declaration dependencies, 702

forwarding, 704

usage pattern, 706

function matching, 702

pack expansion, 702704

parameter pack, 699

print program, 701

recursive function, 701

sizeof..., 700

vector, 96105, 132, 373

see also container

see also sequential container

see also iterator

[] (subscript), 103, 132, 347

= (assignment), list initialization, 145

at, 348

capacity, 356

capacity program, 357

definition, 97

difference_type, 112

erase, changes container size, 385

header, 96, 329

initialization, 97101, 334337

initialization from array, 125

list initialization, 98, 336

memory management, 355

overview, 326

push_back, invalidates iterator, 354

random-access iterator, 412

reserve, 356

subscript range, 105

TextQuery class, 485

value initialization, 98, 336

viable function, 243, 252

see also function matching

virtual base class, 811, 818

ambiguities, 812

Bear, 812

class derivation list, 812

conversion, 812

derived class constructor, 813

iostream, 810

name lookup, 812

order of destruction, 815

order of initialization, 814

ostream, 810

Raccoon, 812

ToyAnimal, 815

ZooAnimal, 811

virtual function, 592, 595, 603610, 650

compared to run-time type identification, 829

default argument, 607

derived class, 596

destructor, 622

exception specification, 781

final specifier, 607

in constructor, destructor, 627

multiple inheritance, 807

overloaded function, 621

override, 595, 650

override specifier, 593, 596, 606

overriding run-time binding, 607

overview, 595

pure, 609

resolved at run time, 604, 605

return type, 606

scope, 620

type-sensitive equality, 829

virtual inheritance, see virtual base class

Visual Studio, 5

void, 32, 80

return type, 223

void*, 56, 80

conversion from pointer, 161

volatile, 856, 864

pointer, 856

synthesized copy-control members, 857

vowel counting, program, 179

W

wcerr, 311

wchar_t, 33

literal, 40

wchar_t streams, 311

wcin, 311

wcout, 311

weak ordering, strict, 448

weak_ptr, 450, 473475, 491

definition, 473

initialization, 473

lock, 473

StrBlobPtr, 474

wfstream, 311

what, exception, 195, 782

while statement, 11, 28, 183, 183185, 200

condition, 12, 183

wide character streams, 311

wifstream, 311

window, console, 6

Window_mgr, 279

wiostream, 311

wistream, 311

wistringstream, 311

wofstream, 311

word, 33, 80

word_count program

map, 421

set, 422

unordered_map, 444

word_transform program, 441

WordQuery, 637, 642

wostream, 311

wostringstream, 311

wregex, 733

write, ostream, 763

wstringstream, 311

X

Xnnn (hexadecimal escape sequence), 39

Z

ZooAnimal

program, 802

virtual base class, 811

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset