alternative representations, 270

AND (&&), 262

example, 263–265

precedence, 269–270

ranges, 265–267

functor equivalents, 1031–1032

NOT (!), 267–269

OR (||), 260–262

Example, 261–262

logical OR operator (||), 260–262

alternative representations, 270

example, 261–262

precedence, 269

logic_error exception, 918

long data type, 68–70

long double data type, 94–96

long long type, 1153

LONG_MAX constant, 72

LONG_MIN constant, 72

loops, 195

break statement, 280–282

continue statement, 280–282

do while, 231–233

entry-condition loops, 198

for loops

blocks, 212–214

body, 196–197

combination assignment operators, 211–212

comma operator, 214–217

compared to while loops, 227–228

decrement operator (—), 207–211

example, 196–197

expressions, 200–202

factorials, calculating, 203–205

increment operator (++), 207–211

initialization, 196–197

loop test, 196–197

loop updates, 196–198, 205–206

nonexpressions, 202

sequence points, 208–209

side effects, 201, 208–209

step size, 205–206

strings, 206–207

syntax, 197–199

forever loops, 232

nested loops, 244–249

number-reading loops, 283–286

range-based, C++11, 233–234

text input234, cin object, 234–235

cin.get() function, 235–237, 241–244

end-of-file conditions, 237–241

sentinel characters, 234

while loops, 224–227

compared to for loops, 227–228

example, 225–226

syntax, 224

time-delay loops, 229–230

lotto probabilities, calculating, 317–320

lotto.cpp, 319

low-level languages, 11

low-level programming, 1203–1204

lower_bound() function, 1024, 1304, 1309

lower_bound() method, 1021, 1283

lvalue reference, 1162

M

machine language, definition of, 18

Macintosh, C++, 25

macros, compared to inline functions, 382

magval() method, 602

main() function, 29–30

calling, 30

importance of, 32

int main() header, 30–31

make_heap() function, 1305, 1314

malloc() function, 160

mangling names, 418

manip.cpp, 1079

manipulators, 38, 1090–1091

endl, 37–38

iomanip header file, 1091

number base display, 1078–1079

mantissas, 93

manyfrnd.cpp, 865

mapped_type type, 1281, 1284

maps, methods, 1281–1284

math operators, 97. See also arithmetic operators

max() function, 1305, 1316

max() method, 787, 1046

maxsize() method, 1275

max_element() function, 1305, 1317

max_size() method, 1251

mean, harmonic, 896

means() function, 909–914

member dereferencing operators, 1242–1246

member functions. See also constructors

const member functions, 537

constructors, 524, 538–539

calling, 526–527

declaring, 525–526

default constructors, 527–528, 638–639

defining, 525–526

new operator, 659–661, 677–678

copy constructors, 639

deep copying, 642–644

limitations, 640–642

shallow copying, 640

when to use, 639–640

definitions, 509, 514, 516, 523

destructors, 528–529, 538–539

friend member functions, 578–580, 883

compared to friend classes, 886

example, 885–886

forward declaration, 884

shared friends, 888–889

implicit member functions, 637–638

inline functions, 517–518

invoking, 523

object membership, 518

objects, returning, 662–664

const objects, 662–665

non-const objects, 663

private, 513

properties, 777–778

public, 513

qualified names, 514

template classes, list, 1014–1016

this pointer, 539–546

unqualified names, 514

member in-class initialization, 1160

member initializer lists, 683, 715

member templates, 854–855

members, structures, 141

memberwise assignment, 145

memberwise copying, 640

memb_pt.cpp, 1244–1245

memory. See also buffers

allocating

bad_alloc exceptions, 921

new operator, 160–162

automatic storage, 182

cv-qualifiers, 472–474

dynamic, 476–482

dynamic memory allocation, 757

derived class does use new, 758–760

derived class doesn’t use new, 757–758

example, 761–766

free store, 182–183

freezing delete operator, 163–164

function linkage, 474–475

language linking, 475–476

leaks, 183

memory-related methods, 1258

multifile programs, compiling separately, 447–453

named, 160

stack, 458–459

unwinding, 909–914

static storage, 183

storage class specifiers, 472–473

storage duration, 453–454

Перейти на страницу:

Все книги серии Developer's Library

Похожие книги