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, 122–123, 131
c_str
, 124
call by reference, 208, 210, 251
callable object, 388, 417, 571–572
absInt
, 571bind
, 397call signature, 576
function and function pointers, 388
function objects, 572
pointer to member
and
bind
, 843and
function
, 842and
mem_fn
, 843not callable, 842
PrintString
, 571ShorterString
, 573SizeComp
, 573with algorithms, 390
see alsofunction matching
function template, 695
namespace, 800
overloaded operator, 587
capacity
capture list, seelambda expression
case sensitive, string
, 365
cassert
header, 241
cast, see alsonamed cast, 168
checked, see
dynamic_cast
old-style, 164
to rvalue reference, 691
catch
, 193, 195, 199, 775, 816
catch all (catch(...)
), 777, 816
caution
ambiguous conversion operator, 581
conversions to
unsigned
, 37dynamic 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
cend
chained input, 8
chained output, 7
char
, 32
char16_t
, 33
char32_t
, 33
character
character string literal, seestring literal
check
check_size
, 398
bind
, 398
checked cast, seedynamic_cast
children’s story program, 383–391
chk_n_alloc
, StrVec
, 526
tied to
cout
, 315
cl
, 5
see alsoconstructor
see alsodestructor
see alsomember function
see also
static
memberaccess specifier, 268
default, 268
assignment operator
base, seebase class, 649
const
vs.mutable
, 274const
, initialization, 289in-class initializer, 274
must be complete type, 279
order of destruction, 502
order of initialization, 289
pointer, not deleted, 503
reference, initialization, 289
sizeof
, 157default inheritance specifier, 616
ends with semicolon, 73
derived, seederived class, 649
final
specifier, 600class, 280
function, 269
member function, 280
overloaded function, 281
template class or function, 664
implementation, 254
interface, 254
literal, 299
local, seelocal class
member access, 282
member new and delete, 822
member
:
constant expression, seebit-fieldmultiple base classes, seemultiple inheritance
name lookup, 284
nested, seenested class
pointer to member, seepointer to member
preventing copies, 507
template member, seemember template
type member, 271
::
(scope operator), 282user 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 alsotemplate parameter
see alsoinstantiation
Blob
, 659declaration, 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, seemember template
member, 711
namespace, 788
static
member, 667accessed 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, 848variable vs. function declaration, 294
clear
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
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
composition vs. inheritance, 637
compound assignment (e.g., +=
)
compound expression, seeexpression
concatenation
=
(assignment) in, 146conversion, 159
do while
statement, 189in 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
, 68conversion, 162
template argument deduction, 679
dynamically allocated
destruction, 461
initialization, 460
initialization, 59
class type object, 262
low-level
const
, 64argument and parameter, 213
conversion from, 163
conversion to, 162
overloaded function, 232
template argument deduction, 693
()
(call operator), 573not constructors, 262
overloaded function, 276
reference return, 276
parameter, 212
function matching, 246
overloaded function, 232
conversion from non
const
, 162initialization from non
const
, 62overloaded parameter, 232
reference, seereference to
const
top-level
const
, 64and
auto
, 69argument and parameter, 212
decltype
, 71parameter, 232
template argument deduction, 679
variable, 59
declared in header files, 76
extern
, 60local 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, 179enumerator, 833
integral, 65
nontype template parameter, 655
sizeof
, 156static
data member, 303
constructor, 299
declared in header files, 76
nonconstant return value, 239
function template, 655
pointer, 67
variable, 66
construct
constructor, 262, 264, 262–266, 305
see alsodefault constructor
see alsocopy constructor
see alsomove constructor
calls to virtual function, 627
constexpr
, 299function matching, 585
Sales_data
, 295with 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, 662not
const
, 262order of initialization, 289
multiple inheritance, 804
virtual base classes, 814
overloaded, 262
StrBlob
, 456StrBlobPtr
, 474TextQuery
, 488Blob
, 662initializer_list
, 662iterator parmeters, 673
Disc_quote
, 609
see alsosequential container
see alsoassociative 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 alsoiterator
=
(assignment), 337==
(equality), 341!=
(inequality), 341const_reference
, 333crbegin
, 333crend
, 333reference
, 333relational operators, 341
swap
, 339move operations, 529
moved-from object is valid but unspecified, 537
nonmember
swap
, 339overview, 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
, 35ambiguities, 587
conversion operator, 579
with standard conversion, 581
condition, 159
accessibility, 613
key concepts, 604
shared_ptr
, 630floating-point, 35
function to pointer, 248
exception object, 774
template argument deduction, 679
istream
, 162multiple inheritance, 805
ambiguous, 806
narrowing, 43
operand, 159
pointer to
bool
, 162rank, 245
return value, 223
Sales_data
, 295signed
type, 160signed
tounsigned
, 34to
const
, 162from pointer to non
const
, 62from reference to non
const
, 61template argument deduction, 679
unscoped enumeration to integer, 834
unsigned
, 36virtual base class, 812
conversion operator, 580, 580–587, 590
converting constructor, 294, 305
copy and swap assignment, 518
HasPtr
reference counted, 516
valuelike, 512
memberwise, 500
Message
, 523preventing copies, 507
private
, 509reference count, 514
rule of three/five, 505
virtual destructor exception, 622
self-assignment, 512
StrVec
, 528derived class, 623
multiple inheritance, 805
union
with class type member, 852valuelike class, 512
copy constructor, 496, 496–499, 549
HasPtr
reference counted, 515
valuelike, 512
memberwise, 497
Message
, 522parameter, 496
preventing copies, 507
private
, 509reference count, 514
rule of three/five, 505
virtual destructor exception, 622
StrVec
, 528derived class, 623
multiple inheritance, 805
union
with class type member, 851used 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, 849virtual base class, synthesized, 815
copy initialization, 84, 131, 497, 497–499, 549
array
, 337container, 334
container elements, 342
explicit
constructor, 498invalid 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
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
ctime
header, 749