<s>
C++11	B-Language
is	O
a	O
version	O
of	O
the	O
ISO/IEC	O
14882	O
standard	O
for	O
the	O
C++	B-Language
programming	I-Language
language	I-Language
.	O
</s>
<s>
C++11	B-Language
replaced	O
the	O
prior	O
version	O
of	O
the	O
C++	B-Language
standard	O
,	O
called	O
C++03	B-Language
,	O
and	O
was	O
later	O
replaced	O
by	O
C++14	B-Language
.	O
</s>
<s>
The	O
name	O
follows	O
the	O
tradition	O
of	O
naming	O
language	O
versions	O
by	O
the	O
publication	O
year	O
of	O
the	O
specification	O
,	O
though	O
it	O
was	O
formerly	O
named	O
C++0x	B-Language
because	O
it	O
was	O
expected	O
to	O
be	O
published	O
before	O
2010	O
.	O
</s>
<s>
Although	O
one	O
of	O
the	O
design	O
goals	O
was	O
to	O
prefer	O
changes	O
to	O
the	O
libraries	B-Library
over	O
changes	O
to	O
the	O
core	O
language	O
,	O
C++11	B-Language
does	O
make	O
several	O
additions	O
to	O
the	O
core	O
language	O
.	O
</s>
<s>
Areas	O
of	O
the	O
core	O
language	O
that	O
were	O
significantly	O
improved	O
include	O
multithreading	B-Operating_System
support	O
,	O
generic	B-Language
programming	I-Language
support	O
,	O
uniform	O
initialization	O
,	O
and	O
performance	O
.	O
</s>
<s>
Significant	O
changes	O
were	O
also	O
made	O
to	O
the	O
C++	B-Language
Standard	I-Language
Library	I-Language
,	O
incorporating	O
most	O
of	O
the	O
C++	B-Language
Technical	I-Language
Report	I-Language
1	I-Language
(	O
TR1	O
)	O
libraries	B-Library
,	O
except	O
the	O
library	O
of	O
mathematical	O
special	O
functions	O
.	O
</s>
<s>
C++11	B-Language
was	O
published	O
as	O
ISO/IEC	O
14882:2011	O
in	O
September	O
2011	O
and	O
is	O
available	O
for	O
a	O
fee	O
.	O
</s>
<s>
The	O
working	O
draft	O
most	O
similar	O
to	O
the	O
published	O
C++11	B-Language
standard	O
is	O
N3337	O
,	O
dated	O
16	O
January	O
2012	O
;	O
it	O
has	O
only	O
editorial	O
corrections	O
from	O
the	O
C++11	B-Language
standard	O
.	O
</s>
<s>
The	O
design	O
committee	O
attempted	O
to	O
stick	O
to	O
a	O
number	O
of	O
goals	O
in	O
designing	O
C++11	B-Language
:	O
</s>
<s>
One	O
function	O
of	O
the	O
C++	B-Language
committee	O
is	O
the	O
development	O
of	O
the	O
language	O
core	O
.	O
</s>
<s>
Areas	O
of	O
the	O
core	O
language	O
that	O
were	O
significantly	O
improved	O
include	O
multithreading	B-Operating_System
support	O
,	O
generic	B-Language
programming	I-Language
support	O
,	O
uniform	O
initialization	O
,	O
and	O
performance	O
.	O
</s>
<s>
In	O
C++03	B-Language
(	O
and	O
before	O
)	O
,	O
temporaries	O
(	O
termed	O
"	O
rvalues	O
"	O
,	O
as	O
they	O
often	O
lie	O
on	O
the	O
right	O
side	O
of	O
an	O
assignment	O
)	O
were	O
intended	O
to	O
never	O
be	O
modifiable	O
—	O
just	O
as	O
in	O
C	B-Language
—	O
and	O
were	O
considered	O
to	O
be	O
indistinguishable	O
from	O
const	O
T&	O
types	O
;	O
nevertheless	O
,	O
in	O
some	O
cases	O
,	O
temporaries	O
could	O
have	O
been	O
modified	O
,	O
a	O
behavior	O
that	O
was	O
even	O
considered	O
to	O
be	O
a	O
useful	O
loophole	O
.	O
</s>
<s>
C++11	B-Language
adds	O
a	O
new	O
non-const	O
reference	B-Language
type	I-Language
called	O
an	O
,	O
identified	O
by	O
T&&	O
.	O
</s>
<s>
A	O
chronic	O
performance	O
problem	O
with	O
C++03	B-Language
is	O
the	O
costly	O
and	O
unneeded	O
deep	O
copies	O
that	O
can	O
happen	O
implicitly	O
when	O
objects	O
are	O
passed	O
by	O
value	O
.	O
</s>
<s>
To	O
illustrate	O
the	O
issue	O
,	O
consider	O
that	O
an	O
std::vectorxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx1	O
is	O
,	O
internally	O
,	O
a	O
wrapper	O
around	O
a	O
C-style	O
array	O
with	O
a	O
defined	O
size	O
.	O
</s>
<s>
In	O
C++11	B-Language
,	O
a	O
of	O
std::vectorxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx1	O
,	O
then	O
set	O
the	O
pointer	O
inside	O
the	O
rvalue	O
to	O
null	O
.	O
</s>
<s>
(	O
However	O
,	O
if	O
std::vectorxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx1	O
&	O
,	O
incurring	O
a	O
significant	O
memory	O
allocation	O
.	O
)	O
</s>
<s>
To	O
get	O
an	O
rvalue	O
,	O
the	O
function	O
template	B-Application
std::move( )	O
should	O
be	O
used	O
.	O
</s>
<s>
Due	O
to	O
the	O
nature	O
of	O
the	O
wording	O
of	O
rvalue	O
references	O
,	O
and	O
to	O
some	O
modification	O
to	O
the	O
wording	O
for	O
lvalue	B-Language
references	I-Language
(	O
regular	O
references	O
)	O
,	O
rvalue	O
references	O
allow	O
developers	O
to	O
provide	O
perfect	O
function	O
forwarding	O
.	O
</s>
<s>
When	O
combined	O
with	O
variadic	B-Language
templates	I-Language
,	O
this	O
ability	O
allows	O
for	O
function	O
templates	B-Application
that	O
can	O
perfectly	O
forward	O
arguments	O
to	O
another	O
function	O
that	O
takes	O
those	O
particular	O
arguments	O
.	O
</s>
<s>
This	O
is	O
seen	O
in	O
the	O
set	O
of	O
the	O
C++	B-Language
standard	I-Language
library	I-Language
methods	O
.	O
</s>
<s>
C++	B-Language
has	O
always	O
had	O
the	O
concept	O
of	O
constant	O
expressions	O
.	O
</s>
<s>
Also	O
,	O
in	O
several	O
places	O
,	O
the	O
C++	B-Language
specification	O
requires	O
using	O
constant	O
expressions	O
.	O
</s>
<s>
This	O
was	O
not	O
valid	O
in	O
C++03	B-Language
,	O
because	O
get_five( )	O
+	O
7	O
is	O
not	O
a	O
constant	O
expression	O
.	O
</s>
<s>
A	O
C++03	B-Language
compiler	O
has	O
no	O
way	O
of	O
knowing	O
if	O
get_five( )	O
actually	O
is	O
constant	O
at	O
runtime	O
.	O
</s>
<s>
C++11	B-Language
introduced	O
the	O
keyword	O
constexpr	O
,	O
which	O
allows	O
the	O
user	O
to	O
guarantee	O
that	O
a	O
function	O
or	O
object	O
constructor	O
is	O
a	O
compile-time	O
constant	O
.	O
</s>
<s>
Before	O
C++11	B-Language
,	O
the	O
values	O
of	O
variables	O
could	O
be	O
used	O
in	O
constant	O
expressions	O
only	O
if	O
the	O
variables	O
are	O
declared	O
const	O
,	O
have	O
an	O
initializer	O
which	O
is	O
a	O
constant	O
expression	O
,	O
and	O
are	O
of	O
integral	O
or	O
enumeration	O
type	O
.	O
</s>
<s>
C++11	B-Language
removes	O
the	O
restriction	O
that	O
the	O
variables	O
must	O
be	O
of	O
integral	O
or	O
enumeration	O
type	O
if	O
they	O
are	O
defined	O
with	O
the	O
constexpr	O
keyword	O
:	O
</s>
<s>
Any	O
member	O
function	O
of	O
a	O
class	O
,	O
such	O
as	O
copy	O
constructors	O
,	O
operator	O
overloads	B-Language
,	O
etc.	O
,	O
can	O
be	O
declared	O
as	O
constexpr	O
,	O
so	O
long	O
as	O
they	O
meet	O
the	O
requirements	O
for	O
constexpr	O
functions	O
.	O
</s>
<s>
constexpr	O
differs	O
from	O
consteval	O
,	O
introduced	O
in	O
C++20	B-Language
,	O
in	O
that	O
the	O
latter	O
must	O
always	O
produce	O
a	O
compile	O
time	O
constant	O
,	O
while	O
constexpr	O
does	O
not	O
have	O
this	O
restriction	O
.	O
</s>
<s>
In	O
C++03	B-Language
,	O
a	O
class	O
or	O
struct	O
must	O
follow	O
a	O
number	O
of	O
rules	O
for	O
it	O
to	O
be	O
considered	O
a	O
plain	B-Language
old	I-Language
data	I-Language
(	O
POD	O
)	O
type	O
.	O
</s>
<s>
Types	O
that	O
fit	O
this	O
definition	O
produce	O
object	O
layouts	O
that	O
are	O
compatible	O
with	O
C	B-Language
,	O
and	O
they	O
could	O
also	O
be	O
initialized	O
statically	O
.	O
</s>
<s>
The	O
C++03	B-Language
standard	O
has	O
restrictions	O
on	O
what	O
types	O
are	O
compatible	O
with	O
C	B-Language
or	O
can	O
be	O
statically	O
initialized	O
despite	O
there	O
being	O
no	O
technical	O
reason	O
a	O
compiler	O
could	O
n't	O
accept	O
the	O
program	O
;	O
if	O
someone	O
were	O
to	O
create	O
a	O
C++03	B-Language
POD	O
type	O
and	O
add	O
a	O
non-virtual	O
member	O
function	O
,	O
this	O
type	O
would	O
no	O
longer	O
be	O
a	O
POD	O
type	O
,	O
could	O
not	O
be	O
statically	O
initialized	O
,	O
and	O
would	O
be	O
incompatible	O
with	O
C	B-Language
despite	O
no	O
change	O
to	O
the	O
memory	O
layout	O
.	O
</s>
<s>
C++11	B-Language
relaxed	O
several	O
of	O
the	O
POD	O
rules	O
,	O
by	O
dividing	O
the	O
POD	O
concept	O
into	O
two	O
separate	O
concepts	B-Language
:	O
trivial	O
and	O
standard-layout	O
.	O
</s>
<s>
A	O
type	O
that	O
is	O
standard-layout	O
means	O
that	O
it	O
orders	O
and	O
packs	O
its	O
members	O
in	O
a	O
way	O
that	O
is	O
compatible	O
with	O
C	B-Language
.	O
A	O
class	O
or	O
struct	O
is	O
standard-layout	O
,	O
by	O
definition	O
,	O
provided	O
:	O
</s>
<s>
By	O
separating	O
these	O
concepts	B-Language
,	O
it	O
becomes	O
possible	O
to	O
give	O
up	O
one	O
without	O
losing	O
the	O
other	O
.	O
</s>
<s>
A	O
class	O
with	O
complex	O
move	O
and	O
copy	O
constructors	O
may	O
not	O
be	O
trivial	O
,	O
but	O
it	O
could	O
be	O
standard-layout	O
and	O
thus	O
interoperate	O
with	O
C	B-Language
.	O
Similarly	O
,	O
a	O
class	O
with	O
public	O
and	O
private	O
non-static	O
data	O
members	O
would	O
not	O
be	O
standard-layout	O
,	O
but	O
it	O
could	O
be	O
trivial	O
and	O
thus	O
memcpy-able	O
.	O
</s>
<s>
In	O
C++03	B-Language
,	O
the	O
compiler	O
must	O
instantiate	O
a	O
template	B-Application
whenever	O
a	O
fully	O
specified	O
template	B-Application
is	O
encountered	O
in	O
a	O
translation	O
unit	O
.	O
</s>
<s>
If	O
the	O
template	B-Application
is	O
instantiated	O
with	O
the	O
same	O
types	O
in	O
many	O
translation	O
units	O
,	O
this	O
can	O
dramatically	O
increase	O
compile	O
times	O
.	O
</s>
<s>
There	O
is	O
no	O
way	O
to	O
prevent	O
this	O
in	O
C++03	B-Language
,	O
so	O
C++11	B-Language
introduced	O
extern	O
template	B-Application
declarations	O
,	O
analogous	O
to	O
extern	O
data	O
declarations	O
.	O
</s>
<s>
C++03	B-Language
has	O
this	O
syntax	O
to	O
oblige	O
the	O
compiler	O
to	O
instantiate	O
a	O
template	B-Application
:	O
</s>
<s>
C++11	B-Language
now	O
provides	O
this	O
syntax	O
:	O
</s>
<s>
which	O
tells	O
the	O
compiler	O
not	O
to	O
instantiate	O
the	O
template	B-Application
in	O
this	O
translation	O
unit	O
.	O
</s>
<s>
C++03	B-Language
inherited	O
the	O
initializer-list	O
feature	O
from	O
C	B-Language
.	O
A	O
struct	O
or	O
array	O
is	O
given	O
a	O
list	O
of	O
arguments	O
in	O
braces	O
,	O
in	O
the	O
order	O
of	O
the	O
members	O
 '	O
definitions	O
in	O
the	O
struct	O
.	O
</s>
<s>
C++	B-Language
also	O
provides	O
constructors	O
to	O
initialize	O
an	O
object	O
,	O
but	O
they	O
are	O
often	O
not	O
as	O
convenient	O
as	O
the	O
initializer	O
list	O
.	O
</s>
<s>
However	O
,	O
C++03	B-Language
allows	O
initializer-lists	O
only	O
on	O
structs	O
and	O
classes	O
that	O
conform	O
to	O
the	O
Plain	B-Language
Old	I-Language
Data	I-Language
(	O
POD	O
)	O
definition	O
;	O
C++11	B-Language
extends	O
initializer-lists	O
,	O
so	O
they	O
can	O
be	O
used	O
for	O
all	O
classes	O
including	O
standard	O
containers	O
like	O
std::vector	O
.	O
</s>
<s>
C++11	B-Language
binds	O
the	O
concept	O
to	O
a	O
template	B-Application
,	O
called	O
std::initializer_list	O
.	O
</s>
<s>
The	O
template	B-Language
class	I-Language
std::initializer_listxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx1	O
is	O
a	O
first-class	O
C++11	B-Language
standard	O
library	O
type	O
.	O
</s>
<s>
They	O
can	O
be	O
constructed	O
statically	O
by	O
the	O
C++11	B-Language
compiler	O
via	O
use	O
of	O
the	O
 {  } 	O
syntax	O
without	O
a	O
type	O
name	O
in	O
contexts	O
where	O
such	O
braces	O
will	O
deduce	O
to	O
an	O
std::initializer_list	O
,	O
or	O
by	O
explicitly	O
specifying	O
the	O
type	O
like	O
std::initializer_listxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx1{args}	O
(	O
and	O
so	O
on	O
for	O
other	O
varieties	O
of	O
construction	O
syntax	O
)	O
.	O
</s>
<s>
Examples	O
of	O
this	O
in	O
the	O
standard	O
library	O
include	O
the	O
std::min( )	O
and	O
std::max( )	O
templates	B-Application
taking	O
std::initializer_lists	O
of	O
numeric	O
type	O
.	O
</s>
<s>
C++03	B-Language
has	O
a	O
number	O
of	O
problems	O
with	O
initializing	O
types	O
.	O
</s>
<s>
The	O
traditional	O
constructor	O
syntax	O
,	O
for	O
example	O
,	O
can	O
look	O
like	O
a	O
function	O
declaration	O
,	O
and	O
steps	O
must	O
be	O
taken	O
to	O
ensure	O
that	O
the	O
compiler	O
's	O
most	B-Language
vexing	I-Language
parse	I-Language
rule	O
will	O
not	O
mistake	O
it	O
for	O
such	O
.	O
</s>
<s>
C++11	B-Language
provides	O
a	O
syntax	O
that	O
allows	O
for	O
fully	O
uniform	O
type	O
initialization	O
that	O
works	O
on	O
any	O
object	O
.	O
</s>
<s>
The	O
C++11	B-Language
version	O
of	O
std::vector	O
has	O
an	O
initializer	O
list	O
constructor	O
for	O
its	O
template	B-Application
type	O
.	O
</s>
<s>
In	O
C++03	B-Language
(	O
and	O
C	B-Language
)	O
,	O
to	O
use	O
a	O
variable	O
,	O
its	O
type	O
must	O
be	O
specified	O
explicitly	O
.	O
</s>
<s>
However	O
,	O
with	O
the	O
advent	O
of	O
template	B-Application
types	O
and	O
template	B-Application
metaprogramming	B-Application
techniques	O
,	O
the	O
type	O
of	O
something	O
,	O
particularly	O
the	O
well-defined	O
return	O
value	O
of	O
a	O
function	O
,	O
may	O
not	O
be	O
easily	O
expressed	O
.	O
</s>
<s>
Thus	O
,	O
storing	O
intermediates	O
in	O
variables	O
is	O
difficult	O
,	O
possibly	O
needing	O
knowledge	O
of	O
the	O
internals	O
of	O
a	O
given	O
metaprogramming	B-Application
library	O
.	O
</s>
<s>
C++11	B-Language
allows	O
this	O
to	O
be	O
mitigated	O
in	O
two	O
ways	O
.	O
</s>
<s>
The	O
type	O
of	O
some_strange_callable_type	O
is	O
simply	O
whatever	O
the	O
particular	O
template	B-Application
function	O
override	O
of	O
std::bind	O
returns	O
for	O
those	O
particular	O
arguments	O
.	O
</s>
<s>
This	O
use	O
of	O
the	O
keyword	O
auto	O
in	O
C++	B-Language
re-purposes	O
the	O
semantics	O
of	O
this	O
keyword	O
,	O
which	O
was	O
originally	O
used	O
in	O
the	O
typeless	O
predecessor	O
language	O
B	O
in	O
a	O
related	O
role	O
of	O
denoting	O
an	O
untyped	O
automatic	B-General_Concept
variable	I-General_Concept
definition	O
.	O
</s>
<s>
Further	O
,	O
the	O
keyword	O
decltype	B-Language
can	O
be	O
used	O
to	O
determine	O
the	O
type	O
of	O
expression	O
at	O
compile-time	O
.	O
</s>
<s>
However	O
,	O
decltype	B-Language
can	O
also	O
be	O
very	O
useful	O
for	O
expressions	O
in	O
code	O
that	O
makes	O
heavy	O
use	O
of	O
operator	O
overloading	B-Application
and	O
specialized	O
types	O
.	O
</s>
<s>
The	O
type	O
denoted	O
by	O
decltype	B-Language
can	O
be	O
different	O
from	O
the	O
type	O
deduced	O
by	O
auto	O
.	O
</s>
<s>
C++11	B-Language
extends	O
the	O
syntax	O
of	O
the	O
for	O
statement	O
to	O
allow	O
for	O
easy	O
iteration	O
over	O
a	O
range	O
of	O
elements	O
:	O
</s>
<s>
It	O
will	O
work	O
for	O
C-style	O
arrays	O
,	O
initializer	O
lists	O
,	O
and	O
any	O
type	O
that	O
has	O
begin( )	O
and	O
end( )	O
functions	O
defined	O
for	O
it	O
that	O
return	O
iterators	O
.	O
</s>
<s>
C++11	B-Language
provides	O
the	O
ability	O
to	O
create	O
anonymous	B-General_Concept
functions	I-General_Concept
,	O
called	O
lambda	B-General_Concept
functions	I-General_Concept
.	O
</s>
<s>
A	O
lambda	B-General_Concept
can	O
optionally	O
be	O
a	O
closure	B-Language
.	O
</s>
<s>
Standard	B-Language
C	I-Language
function	O
declaration	O
syntax	O
was	O
perfectly	O
adequate	O
for	O
the	O
feature	O
set	O
of	O
the	O
C	B-Language
language	I-Language
.	O
</s>
<s>
As	O
C++	B-Language
evolved	O
from	O
C	B-Language
,	O
it	O
kept	O
the	O
basic	O
syntax	O
and	O
extended	O
it	O
where	O
needed	O
.	O
</s>
<s>
However	O
,	O
as	O
C++	B-Language
grew	O
more	O
complex	O
,	O
it	O
exposed	O
several	O
limits	O
,	O
especially	O
regarding	O
template	B-Application
function	O
declarations	O
.	O
</s>
<s>
For	O
example	O
,	O
in	O
C++03	B-Language
this	O
is	O
invalid	O
:	O
</s>
<s>
Even	O
with	O
the	O
aforementioned	O
C++11	B-Language
functionality	O
of	O
decltype	B-Language
,	O
this	O
is	O
not	O
possible	O
:	O
</s>
<s>
This	O
is	O
not	O
valid	O
C++	B-Language
because	O
lhs	O
and	O
rhs	O
have	O
not	O
yet	O
been	O
defined	O
;	O
they	O
will	O
not	O
be	O
valid	O
identifiers	O
until	O
after	O
the	O
parser	O
has	O
parsed	O
the	O
rest	O
of	O
the	O
function	O
prototype	O
.	O
</s>
<s>
To	O
work	O
around	O
this	O
,	O
C++11	B-Language
introduced	O
a	O
new	O
function	O
declaration	O
syntax	O
,	O
with	O
a	O
trailing-return-type	O
:	O
</s>
<s>
The	O
use	O
of	O
the	O
“	O
auto	O
”	O
keyword	O
in	O
this	O
case	O
is	O
just	O
part	O
of	O
the	O
syntax	O
and	O
does	O
not	O
perform	O
automatic	O
type	O
deduction	O
in	O
C++11	B-Language
.	I-Language
</s>
<s>
However	O
,	O
starting	O
with	O
C++14	B-Language
,	O
the	O
trailing	O
return	O
type	O
can	O
be	O
removed	O
entirely	O
and	O
the	O
compiler	O
will	O
deduce	O
the	O
return	O
type	O
automatically	O
.	O
</s>
<s>
In	O
C++03	B-Language
,	O
constructors	O
of	O
a	O
class	O
are	O
not	O
allowed	O
to	O
call	O
other	O
constructors	O
in	O
an	O
initializer	O
list	O
of	O
that	O
class	O
.	O
</s>
<s>
C++11	B-Language
provides	O
solutions	O
to	O
all	O
of	O
these	O
problems	O
.	O
</s>
<s>
C++11	B-Language
allows	O
constructors	O
to	O
call	O
other	O
peer	O
constructors	O
(	O
termed	O
delegation	O
)	O
.	O
</s>
<s>
Delegation	O
has	O
been	O
used	O
in	O
other	O
languages	O
e.g.	O
,	O
Java	B-Language
and	O
Objective-C	B-Language
.	O
</s>
<s>
This	O
comes	O
with	O
a	O
caveat	O
:	O
C++03	B-Language
considers	O
an	O
object	O
to	O
be	O
constructed	O
when	O
its	O
constructor	O
finishes	O
executing	O
,	O
but	O
C++11	B-Language
considers	O
an	O
object	O
constructed	O
once	O
any	O
constructor	O
finishes	O
execution	O
.	O
</s>
<s>
For	O
base-class	O
constructors	O
,	O
C++11	B-Language
allows	O
a	O
class	O
to	O
specify	O
that	O
base	O
class	O
constructors	O
will	O
be	O
inherited	O
.	O
</s>
<s>
Thus	O
,	O
the	O
C++11	B-Language
compiler	O
will	O
generate	O
code	O
to	O
perform	O
the	O
inheritance	O
and	O
the	O
forwarding	O
of	O
the	O
derived	O
class	O
to	O
the	O
base	O
class	O
.	O
</s>
<s>
For	O
member	O
initialization	O
,	O
C++11	B-Language
allows	O
this	O
syntax	O
:	O
</s>
<s>
In	O
C++03	B-Language
,	O
it	O
is	O
possible	O
to	O
accidentally	O
create	O
a	O
new	O
virtual	B-Application
function	I-Application
,	O
when	O
one	O
intended	O
to	O
override	O
a	O
base	O
class	O
function	O
.	O
</s>
<s>
But	O
instead	O
,	O
because	O
it	O
has	O
a	O
different	O
signature	O
,	O
it	O
creates	O
a	O
second	O
virtual	B-Application
function	I-Application
.	O
</s>
<s>
C++11	B-Language
provides	O
syntax	O
to	O
solve	O
this	O
problem	O
.	O
</s>
<s>
The	O
override	O
special	O
identifier	O
means	O
that	O
the	O
compiler	O
will	O
check	O
the	O
base	O
class(es )	O
to	O
see	O
if	O
there	O
is	O
a	O
virtual	B-Application
function	I-Application
with	O
this	O
exact	O
signature	O
.	O
</s>
<s>
C++11	B-Language
also	O
adds	O
the	O
ability	O
to	O
prevent	O
inheriting	O
from	O
classes	O
or	O
simply	O
preventing	O
overriding	O
methods	O
in	O
derived	O
classes	O
.	O
</s>
<s>
In	O
this	O
example	O
,	O
the	O
virtual	O
void	O
f( )	O
final	O
;	O
statement	O
declares	O
a	O
new	O
virtual	B-Application
function	I-Application
,	O
but	O
it	O
also	O
prevents	O
derived	O
classes	O
from	O
overriding	O
it	O
.	O
</s>
<s>
the	O
recognized	O
and	O
accepted	O
declarator	O
attributes	O
may	O
be	O
extended	O
in	O
future	O
versions	O
of	O
C++	B-Language
(	O
some	O
compiler-specific	O
extensions	O
already	O
recognize	O
added	O
declarator	O
attributes	O
,	O
to	O
provide	O
code	O
generation	O
options	O
or	O
optimization	O
hints	O
to	O
the	O
compiler	O
,	O
or	O
to	O
generate	O
added	O
data	O
into	O
the	O
compiled	O
code	O
,	O
intended	O
for	O
debuggers	O
,	O
linkers	O
,	O
and	O
deployment	O
of	O
the	O
compiled	O
code	O
,	O
or	O
to	O
provide	O
added	O
system-specific	O
security	O
attributes	O
,	O
or	O
to	O
enhance	O
reflection	B-Language
abilities	O
at	O
runtime	O
,	O
or	O
to	O
provide	O
added	O
binding	O
information	O
for	O
interoperability	O
with	O
other	O
programming	O
languages	O
and	O
runtime	O
systems	O
;	O
these	O
extensions	O
may	O
take	O
parameters	O
between	O
parentheses	O
after	O
the	O
declarator	O
attribute	O
identifier	O
;	O
for	O
ANSI	O
conformance	O
,	O
these	O
compiler-specific	O
extensions	O
should	O
use	O
the	O
double	O
underscore	O
prefix	O
convention	O
)	O
.	O
</s>
<s>
Since	O
the	O
dawn	O
of	O
C	B-Language
in	O
1972	O
,	O
the	O
constant	O
0	O
has	O
had	O
the	O
double	O
role	O
of	O
constant	O
integer	O
and	O
null	O
pointer	O
constant	O
.	O
</s>
<s>
The	O
ambiguity	O
inherent	O
in	O
the	O
double	O
meaning	O
of	O
0	O
was	O
dealt	O
with	O
in	O
C	B-Language
by	O
using	O
the	O
preprocessor	O
macro	O
NULL	O
,	O
which	O
commonly	O
expands	O
to	O
either	O
( ( 	O
void*	O
)	O
0	O
)	O
or	O
0	O
.	O
</s>
<s>
C++	B-Language
forbids	O
implicit	O
conversion	O
from	O
void	O
*	O
to	O
other	O
pointer	O
types	O
,	O
thus	O
removing	O
the	O
benefit	O
of	O
casting	O
0	O
to	O
void	O
*	O
.	O
</s>
<s>
This	O
interacts	O
poorly	O
with	O
function	B-Language
overloading	I-Language
:	O
</s>
<s>
If	O
NULL	O
is	O
defined	O
as	O
0	O
(	O
which	O
is	O
usually	O
the	O
case	O
in	O
C++	B-Language
)	O
,	O
the	O
statement	O
foo(NULL )	O
;	O
will	O
call	O
foo(int )	O
,	O
which	O
is	O
almost	O
certainly	O
not	O
what	O
the	O
programmer	O
intended	O
,	O
and	O
not	O
what	O
a	O
superficial	O
reading	O
of	O
the	O
code	O
suggests	O
.	O
</s>
<s>
C++11	B-Language
corrects	O
this	O
by	O
introducing	O
a	O
new	O
keyword	O
to	O
serve	O
as	O
a	O
distinguished	O
null	O
pointer	O
constant	O
:	O
nullptr	O
.	O
</s>
<s>
A	O
similar	O
proposal	O
is	O
also	O
brought	O
to	O
the	O
C	B-Language
standard	O
working	O
group	O
.	O
</s>
<s>
In	O
C++03	B-Language
,	O
enumerations	O
are	O
not	O
type-safe	O
.	O
</s>
<s>
The	O
only	O
safety	O
that	O
C++03	B-Language
provides	O
is	O
that	O
an	O
integer	O
or	O
a	O
value	O
of	O
one	O
enum	O
type	O
does	O
not	O
convert	O
implicitly	O
to	O
another	O
enum	O
type	O
.	O
</s>
<s>
C++11	B-Language
allows	O
a	O
special	O
classification	O
of	O
enumeration	O
that	O
has	O
none	O
of	O
these	O
issues	O
.	O
</s>
<s>
Forward-declaring	O
enums	O
is	O
also	O
possible	O
in	O
C++11	B-Language
.	I-Language
</s>
<s>
03	O
's	O
parser	O
defines	O
“	O
>>	O
”	O
as	O
the	O
right	O
shift	O
operator	O
or	O
stream	O
extraction	O
operator	O
in	O
all	O
cases	O
.	O
</s>
<s>
However	O
,	O
with	O
nested	O
template	B-Application
declarations	O
,	O
there	O
is	O
a	O
tendency	O
for	O
the	O
programmer	O
to	O
neglect	O
to	O
place	O
a	O
space	O
between	O
the	O
two	O
right	O
angle	O
brackets	O
,	O
thus	O
causing	O
a	O
compiler	O
syntax	O
error	O
.	O
</s>
<s>
C++11	B-Language
improves	O
the	O
specification	O
of	O
the	O
parser	O
so	O
that	O
multiple	O
right	O
angle	O
brackets	O
will	O
be	O
interpreted	O
as	O
closing	O
the	O
template	B-Application
argument	O
list	O
where	O
it	O
is	O
reasonable	O
.	O
</s>
<s>
C++98	O
added	O
the	O
explicit	O
keyword	O
as	O
a	O
modifier	O
on	O
constructors	O
to	O
prevent	O
single-argument	O
constructors	O
from	O
being	O
used	O
as	O
implicit	O
type	O
conversion	O
operators	O
.	O
</s>
<s>
Because	O
C++	B-Language
bool	O
is	O
defined	O
as	O
an	O
arithmetic	O
type	O
,	O
it	O
can	O
be	O
implicitly	O
converted	O
to	O
integral	O
or	O
even	O
floating-point	O
types	O
,	O
which	O
allows	O
for	O
mathematical	O
operations	O
that	O
are	O
not	O
intended	O
by	O
the	O
user	O
.	O
</s>
<s>
In	O
C++11	B-Language
,	O
the	O
explicit	O
keyword	O
can	O
now	O
be	O
applied	O
to	O
conversion	O
operators	O
.	O
</s>
<s>
In	O
C++03	B-Language
,	O
it	O
is	O
possible	O
to	O
define	O
a	O
typedef	O
only	O
as	O
a	O
synonym	O
for	O
another	O
type	O
,	O
including	O
a	O
synonym	O
for	O
a	O
template	B-Application
specialization	O
with	O
all	O
actual	O
template	B-Application
arguments	O
specified	O
.	O
</s>
<s>
It	O
is	O
not	O
possible	O
to	O
create	O
a	O
typedef	O
template	B-Application
.	O
</s>
<s>
C++11	B-Language
adds	O
this	O
ability	O
with	O
this	O
syntax	O
:	O
</s>
<s>
The	O
using	O
syntax	O
can	O
also	O
be	O
used	O
as	O
type	O
aliasing	O
in	O
C++11	B-Language
:	O
</s>
<s>
In	O
C++03	B-Language
,	O
there	O
are	O
restrictions	O
on	O
what	O
types	O
of	O
objects	O
can	O
be	O
members	O
of	O
a	O
union	O
.	O
</s>
<s>
C++11	B-Language
lifts	O
some	O
of	O
these	O
restrictions	O
.	O
</s>
<s>
If	O
a	O
union	O
member	O
has	O
a	O
non	O
trivial	O
special	B-Language
member	I-Language
function	I-Language
,	O
the	O
compiler	O
will	O
not	O
generate	O
the	O
equivalent	O
member	O
function	O
for	O
the	O
union	O
and	O
it	O
must	O
be	O
manually	O
defined	O
.	O
</s>
<s>
This	O
is	O
a	O
simple	O
example	O
of	O
a	O
union	O
permitted	O
in	O
C++11	B-Language
:	O
</s>
<s>
These	O
features	O
allow	O
the	O
language	O
to	O
do	O
things	O
that	O
were	O
formerly	O
impossible	O
,	O
exceedingly	O
verbose	O
,	O
or	O
needed	O
non-portable	O
libraries	B-Library
.	O
</s>
<s>
In	O
C++11	B-Language
,	O
templates	B-Application
can	O
take	O
variable	O
numbers	O
of	O
template	B-Application
parameters	O
.	O
</s>
<s>
This	O
also	O
allows	O
the	O
definition	O
of	O
type-safe	O
variadic	B-Language
functions	I-Language
.	O
</s>
<s>
C++03	B-Language
offers	O
two	O
kinds	O
of	O
string	B-Language
literals	I-Language
.	O
</s>
<s>
Neither	O
literal	O
type	O
offers	O
support	O
for	O
string	B-Language
literals	I-Language
with	O
UTF-8	O
,	O
UTF-16	O
,	O
or	O
any	O
other	O
kind	O
of	O
Unicode	O
encodings	O
.	O
</s>
<s>
C++11	B-Language
supports	O
three	O
Unicode	O
encodings	O
:	O
UTF-8	O
,	O
UTF-16	O
,	O
and	O
UTF-32	O
.	O
</s>
<s>
It	O
was	O
formerly	O
defined	O
as	O
only	O
the	O
latter	O
in	O
the	O
C++	B-Language
standard	O
itself	O
,	O
then	O
relying	O
on	O
the	O
C	B-Language
standard	O
to	O
guarantee	O
at	O
least	O
8	O
bits	O
.	O
</s>
<s>
Furthermore	O
,	O
C++11	B-Language
adds	O
two	O
new	O
character	O
types	O
:	O
char16_t	O
and	O
char32_t	O
.	O
</s>
<s>
Creating	O
string	B-Language
literals	I-Language
for	O
each	O
of	O
the	O
supported	O
encodings	O
can	O
be	O
done	O
thus	O
:	O
</s>
<s>
When	O
building	O
Unicode	O
string	B-Language
literals	I-Language
,	O
it	O
is	O
often	O
useful	O
to	O
insert	O
Unicode	O
code	O
points	O
directly	O
into	O
the	O
string	O
.	O
</s>
<s>
To	O
do	O
this	O
,	O
C++11	B-Language
allows	O
this	O
syntax	O
:	O
</s>
<s>
It	O
is	O
also	O
sometimes	O
useful	O
to	O
avoid	O
escaping	O
strings	O
manually	O
,	O
particularly	O
for	O
using	O
literals	O
of	O
XML	B-Protocol
files	O
,	O
scripting	O
languages	O
,	O
or	O
regular	B-Language
expressions	I-Language
.	O
</s>
<s>
C++11	B-Language
provides	O
a	O
raw	O
string	B-Language
literal	I-Language
:	O
</s>
<s>
Using	O
this	O
delimiter	O
string	O
,	O
the	O
user	O
can	O
have	O
)	O
characters	O
within	O
raw	O
string	B-Language
literals	I-Language
.	O
</s>
<s>
Raw	O
string	B-Language
literals	I-Language
can	O
be	O
combined	O
with	O
the	O
wide	O
literal	O
or	O
any	O
of	O
the	O
Unicode	O
literal	O
prefixes	O
:	O
</s>
<s>
C++03	B-Language
provides	O
a	O
number	O
of	O
literals	O
.	O
</s>
<s>
The	O
suffix	O
modifiers	O
for	O
literals	O
are	O
fixed	O
by	O
the	O
C++	B-Language
specification	O
,	O
and	O
C++03	B-Language
code	O
cannot	O
create	O
new	O
literal	O
modifiers	O
.	O
</s>
<s>
By	O
contrast	O
,	O
C++11	B-Language
enables	O
the	O
user	O
to	O
define	O
new	O
kinds	O
of	O
literal	O
modifiers	O
that	O
will	O
construct	O
objects	O
based	O
on	O
the	O
string	O
of	O
characters	O
that	O
the	O
literal	O
modifies	O
.	O
</s>
<s>
The	O
C++	B-Language
literal	O
1234	O
,	O
as	O
a	O
raw	O
literal	O
,	O
is	O
this	O
sequence	O
of	O
characters	O
'	O
1	O
 '	O
,	O
'	O
2	O
 '	O
,	O
'	O
3	O
 '	O
,	O
'	O
4	O
 '	O
.	O
</s>
<s>
The	O
C++	B-Language
literal	O
0xA	O
in	O
raw	O
form	O
is	O
'	O
0	O
 '	O
,	O
'	O
x	O
 '	O
,	O
'	O
A	O
 '	O
,	O
while	O
in	O
cooked	O
form	O
it	O
is	O
the	O
integer	O
10	O
.	O
</s>
<s>
Literals	O
can	O
be	O
extended	O
in	O
both	O
raw	O
and	O
cooked	O
forms	O
,	O
with	O
the	O
exception	O
of	O
string	B-Language
literals	I-Language
,	O
which	O
can	O
be	O
processed	O
only	O
in	O
cooked	O
form	O
.	O
</s>
<s>
This	O
function	O
is	O
passed	O
"	O
1234	O
"	O
as	O
a	O
C-style	O
string	O
,	O
so	O
it	O
has	O
a	O
null	O
terminator	O
.	O
</s>
<s>
An	O
alternative	O
mechanism	O
for	O
processing	O
integer	O
and	O
floating	O
point	O
raw	O
literals	O
is	O
via	O
a	O
variadic	B-Language
template	I-Language
:	O
</s>
<s>
The	O
main	O
purpose	O
for	O
doing	O
this	O
is	O
to	O
use	O
11	O
's	O
constexpr	O
keyword	O
to	O
ensure	O
that	O
the	O
compiler	O
will	O
transform	O
the	O
literal	O
entirely	O
at	O
compile	O
time	O
,	O
assuming	O
OutputType	O
is	O
a	O
constexpr-constructible	O
and	O
copyable	O
type	O
,	O
and	O
the	O
literal	O
processing	O
function	O
is	O
a	O
constexpr	O
function	O
.	O
</s>
<s>
There	O
is	O
no	O
alternative	O
template	B-Application
form	O
:	O
</s>
<s>
In	O
accord	O
with	O
the	O
formerly	O
mentioned	O
new	O
string	O
prefixes	O
,	O
for	O
string	B-Language
literals	I-Language
,	O
these	O
are	O
used	O
:	O
</s>
<s>
There	O
is	O
no	O
alternative	O
template	B-Application
form	O
.	O
</s>
<s>
C++11	B-Language
standardizes	O
support	O
for	O
multithreaded	B-Operating_System
programming	I-Operating_System
.	O
</s>
<s>
There	O
are	O
two	O
parts	O
involved	O
:	O
a	O
memory	O
model	O
which	O
allows	O
multiple	O
threads	B-Operating_System
to	O
co-exist	O
in	O
a	O
program	O
and	O
library	O
support	O
for	O
interaction	O
between	O
threads	B-Operating_System
.	O
</s>
<s>
The	O
memory	O
model	O
defines	O
when	O
multiple	O
threads	B-Operating_System
may	O
access	O
the	O
same	O
memory	O
location	O
,	O
and	O
specifies	O
when	O
updates	O
by	O
one	O
thread	B-Operating_System
become	O
visible	O
to	O
other	O
threads	B-Operating_System
.	O
</s>
<s>
In	O
a	O
multi-threaded	B-Operating_System
environment	O
,	O
it	O
is	O
common	O
for	O
every	O
thread	B-Operating_System
to	O
have	O
some	O
unique	O
variables	O
.	O
</s>
<s>
A	O
new	O
thread-local	O
storage	O
duration	O
(	O
in	O
addition	O
to	O
the	O
existing	O
static	O
,	O
dynamic	O
and	O
automatic	O
)	O
is	O
indicated	O
by	O
the	O
storage	O
specifier	O
thread_local	O
.	O
</s>
<s>
Any	O
object	O
which	O
could	O
have	O
static	O
storage	O
duration	O
(	O
i.e.	O
,	O
lifetime	O
spanning	O
the	O
entire	O
execution	O
of	O
the	O
program	O
)	O
may	O
be	O
given	O
thread-local	O
duration	O
instead	O
.	O
</s>
<s>
The	O
intent	O
is	O
that	O
like	O
any	O
other	O
static-duration	O
variable	O
,	O
a	O
thread-local	O
object	O
can	O
be	O
initialized	O
using	O
a	O
constructor	O
and	O
destroyed	O
using	O
a	O
destructor	O
.	O
</s>
<s>
In	O
C++03	B-Language
,	O
the	O
compiler	O
provides	O
,	O
for	O
classes	O
that	O
do	O
not	O
provide	O
them	O
for	O
themselves	O
,	O
a	O
default	O
constructor	O
,	O
a	O
copy	O
constructor	O
,	O
a	O
copy	O
assignment	O
operator	O
(	O
operator	O
=	O
)	O
,	O
and	O
a	O
destructor	O
.	O
</s>
<s>
C++	B-Language
also	O
defines	O
several	O
global	O
operators	O
(	O
such	O
as	O
operator	O
new	O
)	O
that	O
work	O
on	O
all	O
classes	O
,	O
which	O
the	O
programmer	O
can	O
override	O
.	O
</s>
<s>
Attempting	O
to	O
use	O
these	O
functions	O
is	O
a	O
violation	O
of	O
the	O
One	B-Language
Definition	I-Language
Rule	I-Language
(	O
ODR	O
)	O
.	O
</s>
<s>
C++11	B-Language
allows	O
the	O
explicit	O
defaulting	O
and	O
deleting	O
of	O
these	O
special	B-Language
member	I-Language
functions	I-Language
.	O
</s>
<s>
It	O
is	O
possible	O
to	O
prohibit	O
calling	O
the	O
function	O
with	O
any	O
type	O
other	O
than	O
double	O
by	O
using	O
a	O
template	B-Application
:	O
</s>
<s>
In	O
C++03	B-Language
,	O
the	O
largest	O
integer	O
type	O
is	O
long	O
int	O
.	O
</s>
<s>
C++11	B-Language
adds	O
a	O
new	O
integer	O
type	O
long	O
long	O
int	O
to	O
address	O
this	O
issue	O
.	O
</s>
<s>
The	O
type	O
was	O
originally	O
introduced	O
by	O
C99	B-Language
to	O
the	O
standard	B-Language
C	I-Language
,	O
and	O
most	O
C++	B-Language
compilers	O
supported	O
it	O
as	O
an	O
extension	O
already	O
.	O
</s>
<s>
C++03	B-Language
provides	O
two	O
methods	O
to	O
test	O
assertions	O
:	O
the	O
macro	O
assert	O
and	O
the	O
preprocessor	O
directive	O
#error	O
.	O
</s>
<s>
However	O
,	O
neither	O
is	O
appropriate	O
for	O
use	O
in	O
templates	B-Application
:	O
the	O
macro	O
tests	O
the	O
assertion	O
at	O
execution-time	O
,	O
while	O
the	O
preprocessor	O
directive	O
tests	O
the	O
assertion	O
during	O
preprocessing	O
,	O
which	O
happens	O
before	O
instantiation	O
of	O
templates	B-Application
.	O
</s>
<s>
Neither	O
is	O
appropriate	O
for	O
testing	O
properties	O
that	O
are	O
dependent	O
on	O
template	B-Application
parameters	O
.	O
</s>
<s>
In	O
contrast	O
,	O
in	O
the	O
second	O
example	O
the	O
assertion	O
is	O
checked	O
at	O
every	O
instantiation	O
of	O
the	O
template	B-Language
class	I-Language
Check	O
.	O
</s>
<s>
Static	O
assertions	O
are	O
useful	O
outside	O
of	O
templates	B-Application
also	O
.	O
</s>
<s>
In	O
C++03	B-Language
,	O
the	O
sizeof	B-Language
operator	O
can	O
be	O
used	O
on	O
types	O
and	O
objects	O
.	O
</s>
<s>
C++03	B-Language
disallows	O
this	O
,	O
so	O
it	O
is	O
a	O
compile	O
error	O
.	O
</s>
<s>
C++11	B-Language
allows	O
it	O
.	O
</s>
<s>
It	O
is	O
also	O
allowed	O
for	O
the	O
alignof	O
operator	O
introduced	O
in	O
C++11	B-Language
.	I-Language
</s>
<s>
C++11	B-Language
allows	O
variable	O
alignment	O
to	O
be	O
queried	O
and	O
controlled	O
with	O
alignof	O
and	O
alignas	O
.	O
</s>
<s>
When	O
given	O
a	O
reference	B-Language
type	I-Language
alignof	O
returns	O
the	O
referenced	O
type	O
's	O
alignment	O
;	O
for	O
arrays	O
it	O
returns	O
the	O
element	O
type	O
's	O
alignment	O
.	O
</s>
<s>
Prior	O
C++	B-Language
standards	O
provided	O
for	O
programmer-driven	O
garbage	O
collection	O
via	O
set_new_handler	O
,	O
but	O
gave	O
no	O
definition	O
of	O
object	O
reachability	O
for	O
the	O
purpose	O
of	O
automatic	O
garbage	O
collection	O
.	O
</s>
<s>
C++11	B-Language
defines	O
conditions	O
under	O
which	O
pointer	O
values	O
are	O
"	O
safely	O
derived	O
"	O
from	O
other	O
values	O
.	O
</s>
<s>
C++11	B-Language
provides	O
a	O
standardized	O
syntax	O
for	O
compiler/tool	O
extensions	O
to	O
the	O
language	O
.	O
</s>
<s>
C++11	B-Language
provides	O
two	O
standard	O
attributes	O
itself	O
:	O
noreturn	O
to	O
specify	O
that	O
a	O
function	O
does	O
not	O
return	O
,	O
and	O
carries_dependency	O
to	O
help	O
optimizing	O
multi-threaded	B-Operating_System
code	O
by	O
indicating	O
that	O
function	O
arguments	O
or	O
return	O
value	O
carry	O
a	O
dependency	O
.	O
</s>
<s>
A	O
number	O
of	O
new	O
features	O
were	O
introduced	O
in	O
the	O
C++11	B-Language
standard	O
library	O
.	O
</s>
<s>
Many	O
of	O
these	O
could	O
have	O
been	O
implemented	O
under	O
the	O
old	O
standard	O
,	O
but	O
some	O
rely	O
(	O
to	O
a	O
greater	O
or	O
lesser	O
extent	O
)	O
on	O
new	O
C++11	B-Language
core	O
features	O
.	O
</s>
<s>
A	O
large	O
part	O
of	O
the	O
new	O
libraries	B-Library
was	O
defined	O
in	O
the	O
document	O
C++	B-Language
Standards	I-Language
Committee	I-Language
's	I-Language
Library	I-Language
Technical	I-Language
Report	I-Language
(	O
called	O
TR1	O
)	O
,	O
which	O
was	O
published	O
in	O
2005	O
.	O
</s>
<s>
For	O
C++11	B-Language
they	O
were	O
moved	O
to	O
namespace	O
std	O
.	O
</s>
<s>
However	O
,	O
as	O
TR1	O
features	O
were	O
brought	O
into	O
the	O
C++11	B-Language
standard	O
library	O
,	O
they	O
were	O
upgraded	O
where	O
appropriate	O
with	O
C++11	B-Language
language	O
features	O
that	O
were	O
not	O
available	O
in	O
the	O
initial	O
TR1	O
version	O
.	O
</s>
<s>
Also	O
,	O
they	O
may	O
have	O
been	O
enhanced	O
with	O
features	O
that	O
were	O
possible	O
under	O
C++03	B-Language
,	O
but	O
were	O
not	O
part	O
of	O
the	O
original	O
TR1	O
specification	O
.	O
</s>
<s>
C++11	B-Language
offers	O
a	O
number	O
of	O
new	O
language	O
features	O
that	O
the	O
currently	O
existing	O
standard	O
library	O
components	O
can	O
benefit	O
from	O
.	O
</s>
<s>
The	O
standard	O
library	O
components	O
were	O
upgraded	O
with	O
new	O
C++11	B-Language
language	O
features	O
where	O
appropriate	O
.	O
</s>
<s>
Further	O
,	O
much	O
time	O
has	O
passed	O
since	O
the	O
prior	O
C++	B-Language
standard	O
.	O
</s>
<s>
This	O
has	O
revealed	O
parts	O
of	O
the	O
standard	O
libraries	B-Library
that	O
could	O
use	O
some	O
improving	O
.	O
</s>
<s>
Among	O
the	O
many	O
areas	O
of	O
improvement	O
considered	O
were	O
standard	O
library	O
allocators	B-Application
.	O
</s>
<s>
A	O
new	O
scope-based	O
model	O
of	O
allocators	B-Application
was	O
included	O
in	O
C++11	B-Language
to	O
supplement	O
the	O
prior	O
model	O
.	O
</s>
<s>
While	O
the	O
C++03	B-Language
language	O
provides	O
a	O
memory	O
model	O
that	O
supports	O
threading	O
,	O
the	O
primary	O
support	O
for	O
actually	O
using	O
threading	O
comes	O
with	O
the	O
C++11	B-Language
standard	O
library	O
.	O
</s>
<s>
A	O
thread	B-Operating_System
class	O
(	O
std::thread	O
)	O
is	O
provided	O
,	O
which	O
takes	O
a	O
function	B-Language
object	I-Language
(	O
and	O
an	O
optional	O
series	O
of	O
arguments	O
to	O
pass	O
to	O
it	O
)	O
to	O
run	O
in	O
the	O
new	O
thread	B-Operating_System
.	O
</s>
<s>
It	O
is	O
possible	O
to	O
cause	O
a	O
thread	B-Operating_System
to	O
halt	O
until	O
another	O
executing	O
thread	B-Operating_System
completes	O
,	O
providing	O
thread	B-Operating_System
joining	O
support	O
via	O
the	O
std::thread::join( )	O
member	O
function	O
.	O
</s>
<s>
Access	O
is	O
provided	O
,	O
where	O
feasible	O
,	O
to	O
the	O
underlying	O
native	O
thread	B-Operating_System
object(s )	O
for	O
platform-specific	O
operations	O
by	O
the	O
std::thread::native_handle( )	O
member	O
function	O
.	O
</s>
<s>
For	O
synchronization	O
between	O
threads	B-Operating_System
,	O
appropriate	O
mutexes	B-Operating_System
(	O
std::mutex	O
,	O
std::recursive_mutex	O
,	O
etc	O
.	O
)	O
</s>
<s>
These	O
are	O
accessible	O
via	O
Resource	B-Application
Acquisition	I-Application
Is	I-Application
Initialization	I-Application
(	O
RAII	B-Application
)	O
locks	O
(	O
std::lock_guard	O
and	O
std::unique_lock	O
)	O
and	O
locking	O
algorithms	O
for	O
easy	O
use	O
.	O
</s>
<s>
For	O
high-performance	O
,	O
low-level	O
work	O
,	O
communicating	O
between	O
threads	B-Operating_System
is	O
sometimes	O
needed	O
without	O
the	O
overhead	O
of	O
mutexes	B-Operating_System
.	O
</s>
<s>
This	O
is	O
done	O
using	O
atomic	B-General_Concept
operations	I-General_Concept
on	O
memory	O
locations	O
.	O
</s>
<s>
Explicit	O
memory	B-General_Concept
barriers	I-General_Concept
may	O
also	O
be	O
used	O
for	O
this	O
purpose	O
.	O
</s>
<s>
The	O
C++11	B-Language
thread	B-Operating_System
library	O
also	O
includes	O
futures	B-Operating_System
and	I-Operating_System
promises	I-Operating_System
for	O
passing	O
asynchronous	O
results	O
between	O
threads	B-Operating_System
,	O
and	O
std::packaged_task	O
for	O
wrapping	O
up	O
a	O
function	O
call	O
that	O
can	O
generate	O
such	O
an	O
asynchronous	O
result	O
.	O
</s>
<s>
Further	O
high-level	O
threading	O
facilities	O
such	O
as	O
thread	B-Operating_System
pools	I-Operating_System
have	O
been	O
remanded	O
to	O
a	O
future	O
C++	B-Language
technical	B-Language
report	I-Language
.	O
</s>
<s>
They	O
are	O
not	O
part	O
of	O
C++11	B-Language
,	O
but	O
their	O
eventual	O
implementation	O
is	O
expected	O
to	O
be	O
built	O
entirely	O
on	O
top	O
of	O
the	O
thread	B-Operating_System
library	O
features	O
.	O
</s>
<s>
The	O
user	O
can	O
choose	O
whether	O
the	O
task	O
is	O
to	O
be	O
run	O
asynchronously	O
on	O
a	O
separate	O
thread	B-Operating_System
or	O
synchronously	O
on	O
a	O
thread	B-Operating_System
that	O
waits	O
for	O
the	O
value	O
.	O
</s>
<s>
By	O
default	O
,	O
the	O
implementation	O
can	O
choose	O
,	O
which	O
provides	O
an	O
easy	O
way	O
to	O
take	O
advantage	O
of	O
hardware	O
concurrency	O
without	O
oversubscription	O
,	O
and	O
provides	O
some	O
of	O
the	O
advantages	O
of	O
a	O
thread	B-Operating_System
pool	I-Operating_System
for	O
simple	O
usages	O
.	O
</s>
<s>
Tuples	B-Application
are	O
collections	O
composed	O
of	O
heterogeneous	O
objects	O
of	O
pre-arranged	O
dimensions	O
.	O
</s>
<s>
A	O
tuple	B-Application
can	O
be	O
considered	O
a	O
generalization	O
of	O
a	O
struct	O
's	O
member	O
variables	O
.	O
</s>
<s>
The	O
C++11	B-Language
version	O
of	O
the	O
TR1	O
tuple	B-Application
type	O
benefited	O
from	O
C++11	B-Language
features	O
like	O
variadic	B-Language
templates	I-Language
.	O
</s>
<s>
By	O
contrast	O
,	O
the	O
implementation	O
of	O
the	O
C++11	B-Language
version	O
requires	O
no	O
explicit	O
implementation-defined	O
maximum	O
number	O
of	O
types	O
.	O
</s>
<s>
Though	O
compilers	O
will	O
have	O
an	O
internal	O
maximum	O
recursion	O
depth	O
for	O
template	B-Application
instantiation	O
(	O
which	O
is	O
normal	O
)	O
,	O
the	O
C++11	B-Language
version	O
of	O
tuples	B-Application
will	O
not	O
expose	O
this	O
value	O
to	O
the	O
user	O
.	O
</s>
<s>
Using	O
variadic	B-Language
templates	I-Language
,	O
the	O
declaration	O
of	O
the	O
tuple	B-Application
class	O
looks	O
as	O
follows	O
:	O
</s>
<s>
An	O
example	O
of	O
definition	O
and	O
use	O
of	O
the	O
tuple	B-Application
type	O
:	O
</s>
<s>
It	O
's	O
possible	O
to	O
create	O
the	O
tuple	B-Application
proof	O
without	O
defining	O
its	O
contents	O
,	O
but	O
only	O
if	O
the	O
tuple	B-Application
elements	O
 '	O
types	O
possess	O
default	O
constructors	O
.	O
</s>
<s>
Moreover	O
,	O
it	O
's	O
possible	O
to	O
assign	O
a	O
tuple	B-Application
to	O
another	O
tuple	B-Application
:	O
if	O
the	O
two	O
tuples’	O
types	O
are	O
the	O
same	O
,	O
each	O
element	O
type	O
must	O
possess	O
a	O
copy	O
constructor	O
;	O
otherwise	O
,	O
each	O
element	O
type	O
of	O
the	O
right-side	O
tuple	B-Application
must	O
be	O
convertible	O
to	O
that	O
of	O
the	O
corresponding	O
element	O
type	O
of	O
the	O
left-side	O
tuple	B-Application
or	O
that	O
the	O
corresponding	O
element	O
type	O
of	O
the	O
left-side	O
tuple	B-Application
has	O
a	O
suitable	O
constructor	O
.	O
</s>
<s>
Just	O
like	O
std::make_pair	O
for	O
std::pair	O
,	O
there	O
exists	O
std::make_tuple	O
to	O
automatically	O
create	O
std::tuples	O
using	O
type	O
deduction	O
and	O
auto	O
helps	O
to	O
declare	O
such	O
a	O
tuple	B-Application
.	O
</s>
<s>
std::tie	O
creates	O
tuples	B-Application
of	O
lvalue	B-Language
references	I-Language
to	O
help	O
unpack	O
tuples	B-Application
.	O
</s>
<s>
Relational	O
operators	O
are	O
available	O
(	O
among	O
tuples	B-Application
with	O
the	O
same	O
number	O
of	O
elements	O
)	O
,	O
and	O
two	O
expressions	O
are	O
available	O
to	O
check	O
a	O
tuple	B-Application
's	O
characteristics	O
(	O
only	O
during	O
compilation	O
)	O
:	O
</s>
<s>
std::tuple_sizexxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx1::value	O
returns	O
the	O
number	O
of	O
elements	O
in	O
the	O
tuple	B-Application
T	O
,	O
</s>
<s>
std::tuple_elementxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx1::type	O
returns	O
the	O
type	O
of	O
the	O
object	O
number	O
I	O
of	O
the	O
tuple	B-Application
T	O
.	O
</s>
<s>
Including	O
hash	B-Algorithm
tables	I-Algorithm
(	O
unordered	B-Language
associative	I-Language
containers	I-Language
)	O
in	O
the	O
C++	B-Language
standard	I-Language
library	I-Language
is	O
one	O
of	O
the	O
most	O
recurring	O
requests	O
.	O
</s>
<s>
It	O
was	O
not	O
adopted	O
in	O
C++03	B-Language
due	O
to	O
time	O
constraints	O
only	O
.	O
</s>
<s>
Although	O
hash	B-Algorithm
tables	I-Algorithm
are	O
less	O
efficient	O
than	O
a	O
balanced	B-Data_Structure
tree	I-Data_Structure
in	O
the	O
worst	O
case	O
(	O
in	O
the	O
presence	O
of	O
many	O
collisions	O
)	O
,	O
they	O
perform	O
better	O
in	O
many	O
real	O
applications	O
.	O
</s>
<s>
Collisions	O
are	O
managed	O
only	O
via	O
linear	O
chaining	O
because	O
the	O
committee	O
did	O
n't	O
consider	O
it	O
to	O
be	O
opportune	O
to	O
standardize	O
solutions	O
of	O
open	B-Algorithm
addressing	I-Algorithm
that	O
introduce	O
quite	O
a	O
lot	O
of	O
intrinsic	O
problems	O
(	O
above	O
all	O
when	O
erasure	O
of	O
elements	O
is	O
admitted	O
)	O
.	O
</s>
<s>
To	O
avoid	O
name	O
clashes	O
with	O
non-standard	O
libraries	B-Library
that	O
developed	O
their	O
own	O
hash	B-Algorithm
table	I-Algorithm
implementations	O
,	O
the	O
prefix	O
“	O
unordered	O
”	O
was	O
used	O
instead	O
of	O
“	O
hash	O
”	O
.	O
</s>
<s>
The	O
new	O
library	O
has	O
four	O
types	O
of	O
hash	B-Algorithm
tables	I-Algorithm
,	O
differentiated	O
by	O
whether	O
or	O
not	O
they	O
accept	O
elements	O
with	O
the	O
same	O
key	O
(	O
unique	O
keys	O
or	O
equivalent	O
keys	O
)	O
,	O
and	O
whether	O
they	O
map	O
each	O
key	O
to	O
an	O
associated	O
value	O
.	O
</s>
<s>
They	O
correspond	O
to	O
the	O
four	O
existing	O
binary	B-Language
search	I-Language
tree	I-Language
based	O
associative	O
containers	O
,	O
with	O
an	O
prefix	O
.	O
</s>
<s>
This	O
new	O
feature	O
did	O
n't	O
need	O
any	O
C++	B-Language
language	I-Language
core	O
extensions	O
(	O
though	O
implementations	O
will	O
take	O
advantage	O
of	O
various	O
C++11	B-Language
language	O
features	O
)	O
,	O
only	O
a	O
small	O
extension	O
of	O
the	O
header	O
<functional> and the introduction of headers <unordered_set> and <unordered_map>	O
.	O
</s>
<s>
The	O
new	O
library	O
,	O
defined	O
in	O
the	O
new	O
header	O
<regex>	O
,	O
is	O
made	O
of	O
a	O
couple	O
of	O
new	O
classes	O
:	O
</s>
<s>
regular	B-Language
expressions	I-Language
are	O
represented	O
by	O
instance	O
of	O
the	O
template	B-Language
class	I-Language
std::regex	O
;	O
</s>
<s>
occurrences	O
are	O
represented	O
by	O
instance	O
of	O
the	O
template	B-Language
class	I-Language
std::match_results	O
,	O
</s>
<s>
The	O
library	O
<regex>	O
requires	O
neither	O
alteration	O
of	O
any	O
existing	O
header	O
(	O
though	O
it	O
will	O
use	O
them	O
where	O
appropriate	O
)	O
nor	O
an	O
extension	O
of	O
the	O
core	O
language	O
.	O
</s>
<s>
In	O
POSIX	O
C	B-Language
,	O
regular	B-Language
expressions	I-Language
are	O
also	O
available	O
via	O
the	O
C	B-Language
POSIX	O
library	O
#regex	O
.h	O
.	O
</s>
<s>
C++11	B-Language
provides	O
,	O
and	O
improvements	O
to	O
and	O
from	O
TR1	O
.	O
</s>
<s>
The	O
C	B-Language
standard	O
library	O
provides	O
the	O
ability	O
to	O
generate	O
pseudorandom	B-Error_Name
numbers	I-Error_Name
via	O
the	O
function	O
rand	O
.	O
</s>
<s>
C++	B-Language
inherited	O
this	O
functionality	O
with	O
no	O
changes	O
,	O
but	O
C++11	B-Language
provides	O
a	O
new	O
method	O
for	O
generating	O
pseudorandom	B-Error_Name
numbers	I-Error_Name
.	O
</s>
<s>
11	O
's	O
random	O
number	O
functionality	O
is	O
split	O
into	O
two	O
parts	O
:	O
a	O
generator	O
engine	O
that	O
contains	O
the	O
random	O
number	O
generator	O
's	O
state	O
and	O
produces	O
the	O
pseudorandom	B-Error_Name
numbers	I-Error_Name
;	O
and	O
a	O
distribution	O
,	O
which	O
determines	O
the	O
range	O
and	O
mathematical	O
distribution	O
of	O
the	O
outcome	O
.	O
</s>
<s>
Unlike	O
the	O
C	B-Language
standard	O
rand	O
,	O
the	O
C++11	B-Language
mechanism	O
will	O
come	O
with	O
three	O
base	O
generator	O
engine	O
algorithms	O
:	O
</s>
<s>
linear_congruential_engine	B-Algorithm
,	O
</s>
<s>
mersenne_twister_engine	B-Algorithm
.	O
</s>
<s>
C++11	B-Language
also	O
provides	O
a	O
number	O
of	O
standard	O
distributions	O
:	O
</s>
<s>
fisher_f_distribution	B-General_Concept
,	O
</s>
<s>
A	O
wrapper	O
reference	O
is	O
obtained	O
from	O
an	O
instance	O
of	O
the	O
template	B-Language
class	I-Language
reference_wrapper	O
.	O
</s>
<s>
Wrapper	O
references	O
are	O
similar	O
to	O
normal	O
references	O
( ‘&’	O
)	O
of	O
the	O
C++	B-Language
language	I-Language
.	O
</s>
<s>
To	O
obtain	O
a	O
wrapper	O
reference	O
from	O
any	O
object	O
the	O
function	O
template	B-Application
ref	O
is	O
used	O
(	O
for	O
a	O
constant	O
reference	O
cref	O
is	O
used	O
)	O
.	O
</s>
<s>
Wrapper	O
references	O
are	O
useful	O
above	O
all	O
for	O
function	O
templates	B-Application
,	O
where	O
references	O
to	O
parameters	O
rather	O
than	O
copies	O
are	O
needed	O
:	O
</s>
<s>
This	O
new	O
utility	O
was	O
added	O
to	O
the	O
existing	O
<functional>	O
header	O
and	O
did	O
n't	O
need	O
further	O
extensions	O
of	O
the	O
C++	B-Language
language	I-Language
.	O
</s>
<s>
Polymorphic	B-Application
wrappers	O
for	O
function	B-Language
objects	I-Language
are	O
similar	O
to	O
function	B-Language
pointers	I-Language
in	O
semantics	O
and	O
syntax	O
,	O
but	O
are	O
less	O
tightly	O
bound	O
and	O
can	O
indiscriminately	O
refer	O
to	O
anything	O
which	O
can	O
be	O
called	O
(	O
function	B-Language
pointers	I-Language
,	O
member	O
function	B-Language
pointers	I-Language
,	O
or	O
functors	B-Language
)	O
whose	O
arguments	O
are	O
compatible	O
with	O
those	O
of	O
the	O
wrapper	O
.	O
</s>
<s>
The	O
template	B-Language
class	I-Language
function	O
was	O
defined	O
inside	O
the	O
header	O
<functional>	O
,	O
without	O
needing	O
any	O
change	O
to	O
the	O
C++	B-Language
language	I-Language
.	O
</s>
<s>
Metaprogramming	B-Application
consists	O
of	O
creating	O
a	O
program	O
that	O
creates	O
or	O
modifies	O
another	O
program	O
(	O
or	O
itself	O
)	O
.	O
</s>
<s>
The	O
C++	B-Language
Standards	O
Committee	O
has	O
decided	O
to	O
introduce	O
a	O
library	O
for	O
metaprogramming	B-Application
during	O
compiling	O
via	O
templates	B-Application
.	O
</s>
<s>
Here	O
is	O
an	O
example	O
of	O
a	O
meta-program	O
using	O
the	O
C++03	B-Language
standard	O
:	O
a	O
recursion	O
of	O
template	B-Application
instances	O
for	O
calculating	O
integer	O
exponents	O
:	O
</s>
<s>
Many	O
algorithms	O
can	O
operate	O
on	O
different	O
types	O
of	O
data	O
;	O
C++'s	O
templates	B-Application
support	O
generic	B-Language
programming	I-Language
and	O
make	O
code	O
more	O
compact	O
and	O
useful	O
.	O
</s>
<s>
This	O
information	O
can	O
be	O
extracted	O
during	O
instantiation	O
of	O
a	O
template	B-Language
class	I-Language
using	O
type	O
traits	O
.	O
</s>
<s>
In	O
the	O
next	O
example	O
there	O
is	O
the	O
template	B-Application
function	O
‘	O
elaborate’	O
which	O
,	O
depending	O
on	O
the	O
given	O
data	O
types	O
,	O
will	O
instantiate	O
one	O
of	O
the	O
two	O
proposed	O
algorithms	O
(	O
algorithm.do_it	O
)	O
.	O
</s>
<s>
Via	O
type	O
traits	O
,	O
defined	O
in	O
header	O
<type_traits>	O
,	O
it	O
's	O
also	O
possible	O
to	O
create	O
type	O
transformation	O
operations	O
(	O
static_cast	O
and	O
const_cast	O
are	O
insufficient	O
inside	O
a	O
template	B-Application
)	O
.	O
</s>
<s>
Determining	O
the	O
return	O
type	O
of	O
a	O
template	B-Application
function	B-Language
object	I-Language
at	O
compile-time	O
is	O
not	O
intuitive	O
,	O
particularly	O
if	O
the	O
return	O
value	O
depends	O
on	O
the	O
parameters	O
of	O
the	O
function	O
.	O
</s>
<s>
Instantiating	O
the	O
class	O
template	B-Application
Calculusxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx1	O
,	O
the	O
function	B-Language
object	I-Language
of	O
calculus	O
will	O
have	O
always	O
the	O
same	O
return	O
type	O
as	O
the	O
function	B-Language
object	I-Language
of	O
Clear	O
.	O
</s>
<s>
TR1	O
introduces	O
,	O
and	O
C++11	B-Language
adopts	O
,	O
the	O
template	B-Language
class	I-Language
std::result_of	O
that	O
allows	O
one	O
to	O
determine	O
and	O
use	O
the	O
return	O
type	O
of	O
a	O
function	B-Language
object	I-Language
for	O
every	O
declaration	O
.	O
</s>
<s>
The	O
object	O
CalculusVer2	O
uses	O
the	O
std::result_of	O
object	O
to	O
derive	O
the	O
return	O
type	O
of	O
the	O
function	B-Language
object	I-Language
:	O
</s>
<s>
In	O
this	O
way	O
in	O
instances	O
of	O
function	B-Language
object	I-Language
of	O
CalculusVer2xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx1	O
there	O
are	O
no	O
conversions	O
,	O
warnings	O
,	O
or	O
errors	O
.	O
</s>
<s>
Due	O
to	O
changes	O
to	O
C++	B-Language
for	O
supporting	O
decltype	B-Language
,	O
the	O
C++11	B-Language
version	O
of	O
std::result_of	O
no	O
longer	O
needs	O
these	O
special	O
cases	O
;	O
implementations	O
are	O
required	O
to	O
compute	O
a	O
type	O
in	O
all	O
cases	O
.	O
</s>
<s>
For	O
compatibility	O
with	O
C	B-Language
,	O
from	O
C99	B-Language
,	O
these	O
were	O
added	O
:	O
</s>
<s>
variadic	B-Language
macros	I-Language
,	O
</s>
<s>
concatenation	O
of	O
adjacent	O
narrow/wide	O
string	B-Language
literals	I-Language
,	O
</s>
<s>
The	O
term	O
sequence	B-Application
point	I-Application
was	O
removed	O
,	O
being	O
replaced	O
by	O
specifying	O
that	O
either	O
one	O
operation	O
is	O
sequenced	O
before	O
another	O
,	O
or	O
that	O
two	O
operations	O
are	O
unsequenced	O
.	O
</s>
<s>
std::auto_ptr	B-Language
is	O
deprecated	O
,	O
having	O
been	O
superseded	O
by	O
std::unique_ptr	O
.	O
</s>
<s>
Function	B-Language
object	I-Language
base	O
classes	O
(	O
std::unary_function	O
,	O
std::binary_function	O
)	O
,	O
adapters	O
to	O
pointers	O
to	O
functions	O
and	O
adapters	O
to	O
pointers	O
to	O
members	O
,	O
and	O
binder	O
classes	O
are	O
all	O
deprecated	O
.	O
</s>
