.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, 122–123, 131
buffer overflow, 123
initialization, 122
parameter, 216
string
, 124
c_str
, 124
call by reference, 208, 210, 251
uses copy constructor, 498
uses move constructor, 539
callable object, 388, 417, 571–572
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 algorithms, 390
see also function matching
function template, 695
namespace, 800
overloaded operator, 587
capacity
string
, 356
StrVec
, 526
vector
, 356
capture list, see lambda expression
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
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
cctype
header, 91
cend
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 (
\n
), 39
null (
\0
), 39
tab (
\t)
, 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, 383–391
chk_n_alloc
, StrVec
, 526
tied to
cout
, 315
cl
, 5
see also constructor
see also destructor
see also member function
see also
static
member
access specifier, 268
default, 268
assignment operator
see copy assignment
see move assignment
base, see base class, 649
const
vs.mutable
, 274
const
, initialization, 289
in-class initializer, 274
must be complete type, 279
order of destruction, 502
order of initialization, 289
pointer, not deleted, 503
reference, initialization, 289
sizeof
, 157
default inheritance specifier, 616
ends with semicolon, 73
derived, see derived class, 649
final
specifier, 600
class, 280
function, 269
member function, 280
overloaded function, 281
template class or function, 664
implementation, 254
interface, 254
literal, 299
local, see local class
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
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, 658–667, 713
see also template parameter
see also instantiation
Blob
, 659
declaration, 669
default template argument, 671
definition, 659
error detection, 657
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
member, 711
namespace, 788
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
ambiguities, 587
conversion operator, 579
converting constructor, 294
impact on function matching, 584
overloaded function, 586
with standard conversion, 581
default initialization, 44
union
member of, 848
variable vs. function declaration, 294
clear
sequential container, 350
stream, 313
close
, file stream, 318
cmatch
, 733
collapsing rule, reference, 688
combine
, Sales_data
, 259
comma (,
) operator, 157
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
compiler
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
array, 113
declaration style, 57
understanding complicated declarations, 115
concatenation
string
, 89
string literal, 39
=
(assignment) in, 146
conversion, 159
do while
statement, 189
in IO expression, 156
logical operators, 141
smart pointer as, 451
condition state, IO classes, 312, 324
conditional compilation, 240
conditional operator (?:
), 151
connection
, 468
console window, 6
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
()
(call operator), 573
not constructors, 262
overloaded function, 276
reference return, 276
parameter, 212
function matching, 246
overloaded function, 232
conversion from non
const
, 162
initialization from non
const
, 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_iterator
, container, 108, 332
const_reference
, container, 333
const_reverse_iterator
, container, 332, 407
array dimension, 113
bit-field, 854
case
label, 179
enumerator, 833
integral, 65
nontype template parameter, 655
sizeof
, 156
static
data member, 303
constructor, 299
declared in header files, 76
nonconstant return value, 239
function template, 655
pointer, 67
variable, 66
construct
allocator
, 482
forwards to constructor, 527
constructor, 262, 264, 262–266, 305
see also default constructor
see also copy constructor
see also move constructor
calls to virtual function, 627
constexpr
, 299
function matching, 585
Sales_data
, 295
with standard conversion, 580
default argument, 290
derived class, 598
initializes direct base class, 610
initializes virtual base, 813
inherited, 628
class member initialization, 274
compared to assignment, 288
derived class, 598
sometimes required, 288
virtual base class, 814
initializer_list
parameter, 662
not
const
, 262
order of initialization, 289
multiple inheritance, 804
virtual base classes, 814
overloaded, 262
StrBlob
, 456
StrBlobPtr
, 474
TextQuery
, 488
Blob
, 662
initializer_list
, 662
iterator parmeters, 673
Disc_quote
, 609
see also sequential container
see also associative container
equality and relational operators, 370
initialization, 369
requirements on container, 369
and inheritance, 630
copy initialization, 334
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
const_reference
, 333
crbegin
, 333
crend
, 333
reference
, 333
relational operators, 341
swap
, 339
move operations, 529
moved-from object is valid but unspecified, 537
nonmember
swap
, 339
overview, 328
type members,
::
(scope operator), 333
control, flow of, 11, 172, 200
argument, 203
array to pointer, 117
argument, 214
exception object, 774
multidimensional array, 128
template argument deduction, 679
base-to-derived, not automatic, 602
bool
, 35
ambiguities, 587
conversion operator, 579
with standard conversion, 581
condition, 159
accessibility, 613
key concepts, 604
shared_ptr
, 630
floating-point, 35
function to pointer, 248
exception object, 774
template argument deduction, 679
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
tounsigned
, 34
to
const
, 162
from pointer to non
const
, 62
from reference to non
const
, 61
template argument deduction, 679
unscoped enumeration to integer, 834
unsigned
, 36
virtual base class, 812
conversion operator, 580, 580–587, 590
design, 581
bool
, 583
SmallInt
, 580
used implicitly, 580
with standard conversion, 580
converting constructor, 294, 305
function matching, 585
with standard conversion, 580
copy and swap assignment, 518
move assignment, 540
self-assignment, 519
= default
, 506
= delete
, 507
base from derived, 603
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
derived class, 623
multiple inheritance, 805
union
with class type member, 852
valuelike class, 512
copy constructor, 496, 496–499, 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
derived class, 623
multiple inheritance, 805
union
with class type member, 851
used for copy-initialization, 498
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
union
s, 849
virtual base class, synthesized, 815
copy initialization, 84, 131, 497, 497–499, 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
bitset
, 727
count_calls
, program, 206
count_if
, 871
tied to
cin
, 315
cplusplus_primer
, namespace, 787
crbegin
, container, 333
cref
, binds reference parameter, 400, 417
crend
, container, 333
cstdlib
header, 54, 227, 778, 823
cstring
header, 122
ctime
header, 749