C++: New and Improved!
C++ : New and Improved!
!
A little about me '
% ()
'
0
'
(/ )
! )) /
$
3
'
/
'
0 ) ! )) ! ))
/ +
)
/ 667, 99 /
0
$
%
!
&
)
00 0
/ ) / ))
! & ! )) !
!
!
8
&
)
/ :
0
5/ )
&
>
99 ? 0
$
)
99 99
$
0 &
! )
/ /
$ ) *
+
' & / 0 $ /
$
$
&
/ )
/ ' & $
99 99
/ )
2
! !
/
!
/
/
!
& /
2
5.
8
$ & $ / ) ! ; $ <
'
,
& / 0 =
& !
99
!) $
& $ =
&
! )) 0 /
!
'
1
./ , , ! 5)
! 5) 0 )
' % 3 ) $ / 8 !
/
0
/
) 4
-
#
What do I mean by “new” new” and “improved” improved” C++?
* +, - .
2
"
) / +
) *
(
/
!
/
&
0
(
&
*
3
WG21’ WG21’s approach to C++ evolution ' @
Goals
/ & . 4
'3
/ / ) $ & / ( &/ 2 ! )) $
' ' A
/ 8
' A '
+ ! )
* /
$ ) & $
$
* /
E
99 $ $ &
0 ! ! )) !
) C / / 0
$
FG &
& 5
2 - D
D ! )
/ ! ) 0 $ ! $ , & ! ! 2
)
0 )
$ :)
$
! & *&
! ! 99
'3
/
0 / )
/ - D - D - D 0
0 &
' B ) & ! 0 . $ :* & ) $
4
$ 0
/
/
! )) !) ( ) ! ! /
! + !
/ ,
)
H
E
FG 5
6
Features’ Features’ status ' %
Planned timeline
& $ -
// $
2
-
!
)
'
/ )
@
5$
2 /
I
&
)
)
$
0 )
/
*
$
!
I
/
D !
/
/
0J
0J >
/
!/
/
( 6
/
/
/ )
0 0J $
99 .
/
!
D$
))
&
+
$
/
6
/
/
/
= /
0 ! I3
! $ :.K ) ) $ 0 5)
&
' 4
)
0
D !
0 0
0
'
/ /
!//
%0
' -
/
/
$
!
!
7
Also forthcoming … ' . ) )
! 0
Final disclaimers
$ /D 0 )
50
'
99 ?
&
D
)
0
-
& .)
0 ) >
00
K)
$ $
D /
:
99 ?
+
0 /
)
$
$ 3 )
: & $
/
!
)
0
(
& !
/
>+ O 1 7
0 )
! )) ! ))
0
! 2
/ >
*
D
! )) ! ! ! / / 0 J
! )) N
0
5
! 99
!
)
$, C/
!
!
I02J
) & !5 2
IL=M
& *
!5C / 5 / 5 ! 5 / 5
*
:*
$
0
/
55
' ! !
8
) $ /D!
&
! ! + / (/
)
0 0
=B*
)
& /
)
/ B
' =
0/ ) )
(/ /)
' % )
& $ )
D = /
%0
8
% B 4
6#
9
New types and corresponding literals ' O
! 8 0(
! !
! !+ !
' O
!
&
) 0 / 0
P / %/ / %/ 7E / E R4 R R4 R P R4 R
/
O
E
)
&
&
B H
00 )
G
E
O
E 8 5$
S
&
2 ) 2 /
P =3
O
/ /
F/ 0 )
1
/ / / P =3 7 / P =3 / ! , ! , !
$
O ) O
>
/
Q2Q P Q2Q P =3 P =3 7 P =3
' % 0
!+ 1 P
0 % =
' O
New integer type aliases (from C99)
! 8 0(
10
, 1 6
11
71E
-
) )
3
)
@
E
E ) )
E0
71E 71E
) 2E
E E0
E E ) 2E
12
Syntax to improve utility of existing features '
/
& /
!
0
' O
& /
0
F
)
& /
O
D F
# S #
GG = $ ,
&
LM T U 0 ( W 2 2 XT ,
'
! $ /D &
/ )
!
O
V, +
New flexibility in declaration syntax ' O
)
0 /
/
0(
$ + YG
& /
F
0 )
8
&
' =
/ & /
6 1
/
0
) )$
0 /
O
' =
T T W + T
W + T(
/
0
1 7
,
/
/
(2X +
'
(I
0
!
/ )
/
1
F/ = / / (= P
)
0J+
O
E, / D
0
V,
6
0
& /
, ,
O
/
H
S 1
$ G,
T & $ ! ( +, T & $ ! ( +,
) 0
(+ ( / W
G
$
P
/ U
F
O
2
! ))
1
! ! ))
PG + YG
/
( X + U
X , V
13
14
Feature completion: compilecompile-time assertions
Feature extension: template aliases
' A
'
/E :
(
R R +,
$ 5 !) / ) ) Z
) / &
)
/ $ /D
&
/ )
' = D !
/
!
/0
&
F /
/
) ,
/ )
(+) /
#
/ !
0 52 )
/ /
! / 00
'
2(
0
O
+ T
2
S
,
)
, ) 0
/ )
O
2
' %
)
F/ G / % U V, F/ =G ! T %F=G,
)
=G
/D
%
U /E
( 8 0( R /D
+ FT 8 0( = + $! ! R +,
V, 15
Enhancements to constructors '
!
Feature completion: new reference types
! /*
B
O
/ 5&
% /* )
/
)
I
)
!
16
J$
! /*
/
& D !
/*
' = WW
7
0
' %
0 %0
0 /
/* !
/ &
) )$
0 /
,
$ '
!/
!
0 )
' :
8
8
! /*
) ' /
/
&
/ !
/*
)
$ / ,
U
$
0 )
$
O
/
S 1
! "
# $
! (& ) & / /
! /* /
&
0
O
/
=W
/ /
8
)
0
99
6
U ( W W +, W
$
) )
/
(&
+
+
)
/ (
&
) & (++
!
2
& /
0
$
T ( W W +,
V,
%
$
0/ 0
!(
&
0
(++
$
V, 17
18
Generalization: compilecompile-time constant expressions ' -
0 / +$ &
!
/ / /
'
! $ /
2
2 2
$ $
& &
&
H( ! ))
/ ) / ) $ / 2
/ 2 /
2 / )
) )
$
)
$ 2+ U T H ( S +,
00
O
' 4
$ S
+0 /
/
/
8
=
0$
0 % =
%
+,
"
0= 0
U
)
V
8
S
)
$ ) H / 0&
FG
( +
19
20
Uniform initialization syntax at work
New language feature: concepts
' = & T U =X T
' :
=U
' =W =/ = WW
T U T U T U
' & & & &
1V,
W
U
' /
*
&
' =
1 V +, 1 V +, 1 V +, 1 V +,
/
)
*
)
/ )
0
' =
$ /= U 1V ) U
1V U V
) /
)
5/
H
!
O
0
>
!
/
H
)
S
>
)
&
0 ! $
) 0 ! ) )*
)
)
$ % $ 2 /
V,
& 0 H
:)
*
/ $ ! / ) / !
&
! !
% /
1V,V
= ), (+ =U
$
/
0 ( = +, 0 (U 0 (=/ W +, 0 ( U 0 ( = W +, 0 (U 01( = W W +, 01( U
' = !( + U
$
1V, 1V, 1V, 1V,
/ / ) )
/ H H
() $ 0
/ ! + /
*
> !
)
21
Concepts at work '
'
=*
. $ F ( = W = W +, V,
+
" " ) F ) =G & ) E (=X 0 ) =X H . $ F=G U , ( X XH +, , V
)
/ / U & '
+ ) E
' :
=G
" E)
. (
F
W
" G( 9
" "
'
' %
$
)
/
! ! 4
+, V V .
' . $ *
23
/
K. (
5
-
K
/ 2/
-
>+
5 &
00 / &
$ 4 4
!
C ) )
* (
0
/ & ! )) K .:? ) ) > /
" '
)
+
" . $ F G W + U " 9 +,
8 -
)
"
'
22
New language feature: concurrency
) / / U &
O
2
& & /
1
F=G> $C / >
) )$
0 /
=
/ &<
// 8 E
/ 8 !
#
1
0 $
&[ )
(
8
8 0
=
& $
& "
/ )
99 ?
%
& % '
= !
=
0
&
0
( %
0
&
$ ( (
00
' +,
&
= T &, = ( & +, = T U & V, = 1 T =( & +,
2 X 2, V
! )
$ , $ ! )) T H ($ ! )) T H ($ +,
2 $ /
Generalization: uniform initialization syntax
/ &
(
T S, ! )) T H(
$ $
(
!) ) $
[
[
5/
0/
85 $
)
[ [ 24
1
Concurrency in the core language ' I
/ = * - ) / +
/ () & D
0
& $ +
/D
) /
$
O
/
! ! ) )
$
$
8
8
/ / $
.
/
00 / 8
/
/
0 8
/
O
/ 0/
1 6 #
)
2
>
$
) =
(+ K.
8
0 &
&
. /
) / / /
$
$
\ /
&
C
//
/
/
/ 0 D( +
.
' =
!
/
$
\ &
5/ ) )
$
/
& $ .
&
/
$
&
' =
1
&
$
) /
' % C ) =
J ! !
% ) /(
&
Concurrency in the standard library
) )
/
/
)
) &
0 )
0 /
/
25
And there’ there’s still more! ' \
Monomorphic lambda expressions and closures
/ )
)
O 0 )
$
P
)
' .
O
0
) ( I
)
0
)
!
$
) /
*
! )) ) =
F/
/
) +
T
&
)
$
(
!
!
=T
)
X5 V,
'
! $ G 1 S6 7S S 6#6
$
/
O
(
+
$
%
S S
/
8
/ *
/ /
L 6 7M
2 )
1 #
0 ) ( &$ ! (+ & (+ &$ ! (+ LM( $ 2+ U 2 9 1 S6 7 V +, E E T LM( $ 2+ U 29 0 ) ( &$ ! (+ & (+ &$ ! (+ E E +,
0
1 S6 7 V ,
Z
,,-.
17 71
+
0
/0
&
$C / ( ) $
$
3 O
+
)
0 /
0 -
1 5X T
/
)
(+ U
' %
)$ FG
)
&
)
D ! & /DJ+
0/
! U 2/
' %
)
) (
)
26
,V
7 27
And yet more language additions, improvements, … ' B
2
0 K
' O
/
,
! )
' B
And I’I’ve barely mentioned the standard library
0 & !
0( +
!
' B ( +
2
'
2
8
$ ( 8
' :) '
0 $
& )
2
'
66
0
) )$
&
8 0
'
+
' @
/
' .)
(I=
&
'
)$
-
0/ P
J+
0 /
' /
' O 29
5
$
)
)
! ))
/ ) //
$
0 / FG
$ / &
FG
FG
H
FG
0
E) /
$ E
( + ) 2( +
$
E ) )
FG
FG E
FG
) /F G /)
!+ 2/
E
' 4
/ )
(0 2
'
2 /
!
2
' = $
' @
)
' B !
!
'
28
FG FG 2
) 2( + !
) 30
S
Summary '
0 -
@
'
) &
0
! 0
)
& )
0
) (
)
( )
!
!//+ 0
0 5 !0
+ >
+
&
3:O
$ 0
! )) ! ))
99 ? /
C++ : New and Improved!
( &
/
!
0 )
$
/
' I 99 ! 0 C $
/ ) ! $ ! /
!
!$ N C
! ! ! )) .
>
J 66 !
"
#
$
%
!
&
31
7