the future of c ++
DESCRIPTION
The future of C ++. Herb Sutter Partner Program Manager 2-306. The future of C++. Herb Sutter Partner Program Manager 2-306. Agenda. C++ at ISO: ISO C++ Update C++ at MSFT: Visual C++ Update. ISO C++ Update. WG21 and {concurrency, parallelism}. Approval Detailed Specification - PowerPoint PPT PresentationTRANSCRIPT
![Page 1: The future of C ++](https://reader036.vdocument.in/reader036/viewer/2022081604/56815f5f550346895dce4682/html5/thumbnails/1.jpg)
The future of C++
Herb SutterPartner Program Manager2-306
![Page 2: The future of C ++](https://reader036.vdocument.in/reader036/viewer/2022081604/56815f5f550346895dce4682/html5/thumbnails/2.jpg)
The future of C++
Herb SutterPartner Program Manager2-306
![Page 3: The future of C ++](https://reader036.vdocument.in/reader036/viewer/2022081604/56815f5f550346895dce4682/html5/thumbnails/3.jpg)
C++ at ISO: ISO C++ UpdateC++ at MSFT: Visual C++ Update
Agenda
![Page 4: The future of C ++](https://reader036.vdocument.in/reader036/viewer/2022081604/56815f5f550346895dce4682/html5/thumbnails/4.jpg)
ISO C++ Update
![Page 5: The future of C ++](https://reader036.vdocument.in/reader036/viewer/2022081604/56815f5f550346895dce4682/html5/thumbnails/5.jpg)
Library Evolution WG
Library WG
WG21 and {concurrency, parallelism}
WG21 – Full Committee
Evolution WG
Core WG
SG5Tx. Memory
SG2Modules
SG1Concurrency
SG6Numerics
SG4Networking
SG3Filesystem
SG7Reflection
SG8Concepts
SG9Ranges
SG10Feature Test
Approval
Detailed Specification
Design
InvestigationSG11
DatabasesSG12
U. Behavior
![Page 6: The future of C ++](https://reader036.vdocument.in/reader036/viewer/2022081604/56815f5f550346895dce4682/html5/thumbnails/6.jpg)
Thanks to all the volunteers!
ISO C++ committee (WG21) attendance
Sep 2008
Mar 2009
Jul 2009
Oct 2009
Mar 2010
Aug 2010
Nov 2010
Mar 2011
Aug 2011
Feb 2012
Oct 2012
Apr 2013
0
20
40
60
80
100
Meeting size (#attendees)
CompletedC++11
![Page 7: The future of C ++](https://reader036.vdocument.in/reader036/viewer/2022081604/56815f5f550346895dce4682/html5/thumbnails/7.jpg)
Thanks to all the volunteers!
ISO C++ committee (WG21) attendance
Sep 2008
Mar 2009
Jul 2009
Oct 2009
Mar 2010
Aug 2010
Nov 2010
Mar 2011
Aug 2011
Feb 2012
Oct 2012
Apr 2013
0
20
40
60
80
100
Meeting size (#attendees)
CompletedC++11
CompletedC++14
CD
MilestoneIn April 2013, for the first time C++14’s feature set
is known: C++14 is feature-complete!
Now in primary international comment
ballot
![Page 8: The future of C ++](https://reader036.vdocument.in/reader036/viewer/2022081604/56815f5f550346895dce4682/html5/thumbnails/8.jpg)
You arehere
ISO C++ timeline: The “C++14 wave”
98 99 00 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18
C++98(major)
Library TR1 (aka TS) Performance TR
C++03(TC, bug fixes only)
C++11(major)
C++17(major)
C++14(minor)
FileSysTSNetTS1Concepts
TS
14
2014 cadenceThis ISO C++ revision
cycle: faster, more predictable
Less monolithic: Delivering concurrent
and decoupled library & language extensions
![Page 9: The future of C ++](https://reader036.vdocument.in/reader036/viewer/2022081604/56815f5f550346895dce4682/html5/thumbnails/9.jpg)
“C++14 completes C++11”
VC++ target: C++14
We will implement all of C++11 and 14, but some
high-value ’14 features should come before others from ’11
![Page 10: The future of C ++](https://reader036.vdocument.in/reader036/viewer/2022081604/56815f5f550346895dce4682/html5/thumbnails/10.jpg)
Visual C++ Roadmap
![Page 11: The future of C ++](https://reader036.vdocument.in/reader036/viewer/2022081604/56815f5f550346895dce4682/html5/thumbnails/11.jpg)
As each new ISO C++ language feature implementation reaches the stream’s bar, it will appear in the stream’s next planned drop — CTP or (usually major) release
Two streams: Release + CTPVisual Studio
Release StreamOut of Band (OOB)
CTP Stream
Ship vehicleNormally: Major release on new
cadenceMaybe: Some might appear in an
UpdateSeparate CTP drop
Batch compiler support Yes Yes — SxS
Use in standard library
Yes (but no breaking changes in Updates) Maybe
Intellisense support Yes NoStatic analysis support Yes Maybe
Go-live license Yes No
![Page 12: The future of C ++](https://reader036.vdocument.in/reader036/viewer/2022081604/56815f5f550346895dce4682/html5/thumbnails/12.jpg)
As each new ISO C++ language feature implementation reaches the stream’s bar, it will appear in the stream’s next planned drop — CTP or (usually major) release
Two streams: Release + CTPVisual Studio
Release StreamOut of Band (OOB)
CTP Stream
Ship vehicleNormally: Major release on new
cadenceMaybe: Some might appear in an
UpdateSeparate CTP drop
Batch compiler support Yes Yes — SxS
Use in standard library
Yes (but no breaking changes in Updates) Maybe
Intellisense support Yes NoStatic analysis support Yes Maybe
Go-live license Yes No
2013 RoadmapVS 2013 Preview today
VS 2013 RTM later this yearCTP following VS 2013 RTM
![Page 13: The future of C ++](https://reader036.vdocument.in/reader036/viewer/2022081604/56815f5f550346895dce4682/html5/thumbnails/13.jpg)
Continue to deliver C++11More batches coming in 1H13
Continue to investin platform supportWindows Store apps• Continue to bring C++/CX forward to solve
problems like asynchrony• Continue to make extensions/rewrite less
intrusive to existing C++ code• Example of both: await
Phone apps• See also: Writing C++ components on
Windows 8 & Windows Phone 8Azure (e.g., Casablanca)
VC++ next steps
from Nov 2012
![Page 14: The future of C ++](https://reader036.vdocument.in/reader036/viewer/2022081604/56815f5f550346895dce4682/html5/thumbnails/14.jpg)
Visual C++ 2013 Preview
![Page 15: The future of C ++](https://reader036.vdocument.in/reader036/viewer/2022081604/56815f5f550346895dce4682/html5/thumbnails/15.jpg)
Core languageEverything in Nov 2012 CTP, with IDE/debugger/static analysis support• explicit conversion operators• Raw string literals• Function template default arguments• Delegating constructors• Uniform initialization and initializer_lists• Variadic templates
Standard libraryStandard library support for the above, incl. vector<int>{ 1, 2, 3, 4 }Faster compiles & reduced memory compiling stdlib (variadics help here)Some Draft C++14 improvements (approved in Portland and Bristol):• make_unique, cbegin/cend/etc., simplified functors (e.g., greater<>)
From CTP quality to RTM quality
Available today: VC++ 2013 Preview
![Page 16: The future of C ++](https://reader036.vdocument.in/reader036/viewer/2022081604/56815f5f550346895dce4682/html5/thumbnails/16.jpg)
Conformance roadmap: The road to C++14VC++ 2013
Previewtoday
Explicit conversion operators
Raw string literals
Function template default arguments
Delegating constructors
Uniform init & initializer_lists
Variadic templates
C++14 libs: cbegin/ greater<>/make_uni
que
![Page 17: The future of C ++](https://reader036.vdocument.in/reader036/viewer/2022081604/56815f5f550346895dce4682/html5/thumbnails/17.jpg)
Visual C++ 2013 RTM
![Page 18: The future of C ++](https://reader036.vdocument.in/reader036/viewer/2022081604/56815f5f550346895dce4682/html5/thumbnails/18.jpg)
class widget { int a = 42; string b = “xyzzy”; vector<int> c = { 1, 2, 3, 4 };public: widget() { } // 42 xyzzy 1 2 3 4 explicit widget(int val) : a{val} { } // valxyzzy 1 2 3 4 widget(int i, int j) : c{i, i, i, i, j, j} { } // 42 xyzzy i i i i j j};
“… to increase maintainability, reduce the risk of subtle errors in complex program code, and to make the use of initializers more consistent.”
— N2628, Michael Spertus and Bill
Seymour
Non-static data member initializers
![Page 19: The future of C ++](https://reader036.vdocument.in/reader036/viewer/2022081604/56815f5f550346895dce4682/html5/thumbnails/19.jpg)
Why is =default better than writing it yourself?• =default is shorter and less redundant.• Default implementations can be more efficient than manual
implementations.• Default implementations can be “trivial,” so preserve POD-ness.• Provides an easy way to get an otherwise implicitly-suppressed generated
function.
Exampleclass value { // … possibly lots of members …public: value& operator=( const value& ); // provide custom value( const value& ); // copying behavior value() = default; // unsuppress default constructor w/o rewriting it};Note: Not initially on move construction/assignment• Part of another feature: Will be added when we support implicit move
generation
“The definition form ‘=default;’ indicates that the function’s default definition should be used.”
— N2210, Lawrence Crowl
= default
![Page 20: The future of C ++](https://reader036.vdocument.in/reader036/viewer/2022081604/56815f5f550346895dce4682/html5/thumbnails/20.jpg)
Example: Disabling copying, better diagnosticclass type {public: type( const type& ) = delete; type& operator=( const type& ) = delete; type() = default; // restore suppressed default constructor};Example: Eliminating undesirable conversions/overloadsvoid bar( long long ); // accept long long…void bar( long ) = delete; // … but nothing elseclass custom_regex_iterator { // stores a pointer to its regexpublic: // … custom_regex_iterator( const regex& ); // lvalues only please custom_regex_iterator( const regex&& ) = delete; // no rvalues need apply};
“… use of default language facilities [and problematic conversions] can be made an error by deleting the definition… [This] achieves the goal of making a bad overload visible.”
— N2210, Lawrence Crowl
= delete
![Page 21: The future of C ++](https://reader036.vdocument.in/reader036/viewer/2022081604/56815f5f550346895dce4682/html5/thumbnails/21.jpg)
C++98 codetemplate<class T> struct Vec { typedef vector<T, MyAlloc<T>> type; };Vec<int>::type v; // sample usagetemplate<class T> void f( typename Vec<T>::type& ); // non-deduciblef<int>( v );C++11 codetemplate<class T> using Vec = vector<T, MyAlloc<T>>;Vec<int> v; // sample usagetemplate<class T> void f( Vec<T>& ); // deduciblef( v );Draft C++14 (approved in Bristol)Standard library type aliases – thanks, Walter Brown! Examples:• remove_reference_t<T> vs. typename remove_reference<T>::type• make_unsigned_t<T> vs. typename make_unsigned<T>::type
“… it will not be possible to call the function foo below without explicitly specifying template arguments. … Also, the syntax is somewhat ugly.”
— N1449, Gabriel Dos Reis and Mat Marcus
using aliases
![Page 22: The future of C ++](https://reader036.vdocument.in/reader036/viewer/2022081604/56815f5f550346895dce4682/html5/thumbnails/22.jpg)
Conformance roadmap: The road to C++14VC++ 2013
Previewtoday
VC++ 2013 RTMlater this year
Explicit conversion operators
Non-static data member initializers
Raw string literals = default
Function template default arguments = delete
Delegating constructors
“using” aliasesC++14 libs: type
aliasesUniform init & initializer_lists
Variadic templates
C++14 libs: cbegin/ greater<>/make_uni
que
![Page 23: The future of C ++](https://reader036.vdocument.in/reader036/viewer/2022081604/56815f5f550346895dce4682/html5/thumbnails/23.jpg)
And now for something completely different…
![Page 24: The future of C ++](https://reader036.vdocument.in/reader036/viewer/2022081604/56815f5f550346895dce4682/html5/thumbnails/24.jpg)
Adding a few “tactical” C99/C11 featuresvoid func() { _Bool b = whatever(); // _Bool can be 0 or 1 if( b ) { … } int val = 42; // variable declarations within blocks // …}Compound literals: “Cast an initializer to a type”struct mystruct { char tag[3]; int value; };struct mystruct x;x = (struct mystruct) { ‘A’, ‘B’, 0, 42*func() };
Note: not an intent to conform to C99/C11
May not have full Intellisense
C99 variable decls, _Bool, compound literals
![Page 25: The future of C ++](https://reader036.vdocument.in/reader036/viewer/2022081604/56815f5f550346895dce4682/html5/thumbnails/25.jpg)
Initialize elements of an aggregate (array, struct, union) in any orderunion { int a; short b; } uab = { .b = 13 };struct mystruct { int m1; int m2; int m3;};struct mystruct x = { .m1 = 42, .m3 = 84 }; // .m2==0int arr[][2] = { [0][0]=1, [1][1]=1 }; // 22, other values == 0
Note: not an intent to conform to C99/C11
May not have full Intellisense
C99 designated initializers
![Page 26: The future of C ++](https://reader036.vdocument.in/reader036/viewer/2022081604/56815f5f550346895dce4682/html5/thumbnails/26.jpg)
Example: Enables FFmpeg (ffmpeg.org)
![Page 27: The future of C ++](https://reader036.vdocument.in/reader036/viewer/2022081604/56815f5f550346895dce4682/html5/thumbnails/27.jpg)
Conformance roadmap: The road to C++14VC++ 2013
Previewtoday
VC++ 2013 RTMlater this year
Explicit conversion operators
Non-static data member initializers
Raw string literals = default
Function template default arguments = delete
Delegating constructors
“using” aliasesC++14 libs: type
aliasesUniform init & initializer_lists
C99 variable declsC99 _Bool
Variadic templates C99 compound literals
C++14 libs: cbegin/ greater<>/make_uni
queC99 designated
initializers
![Page 28: The future of C ++](https://reader036.vdocument.in/reader036/viewer/2022081604/56815f5f550346895dce4682/html5/thumbnails/28.jpg)
Post-RTM: What we’re implementing now (some in next VC++ OOB CTP)
![Page 29: The future of C ++](https://reader036.vdocument.in/reader036/viewer/2022081604/56815f5f550346895dce4682/html5/thumbnails/29.jpg)
Minor tweaks that can be helpful#define ENTER_FUNC std::cout << “Entering “ << __func__ << std::endl;void f() { ENTER_FUNC; // print f’s name}And eliminate surprising “you can’t do that”sclass widget { int member; static void f() { size_t s = sizeof(member); // ok in C++11 }};size_t s = sizeof(widget::member); // ok in C++11
__func__ is not quite the same as in C
Now sizeof can be applied to a member without needing to fake up an object
Misc.: __func__, extended sizeof
![Page 30: The future of C ++](https://reader036.vdocument.in/reader036/viewer/2022081604/56815f5f550346895dce4682/html5/thumbnails/30.jpg)
Consider this codeclass myclass { vector<widget> vw; string s;};myclass factory();auto instance = factory();
C++98: OK, but inefficient• myclass is implicitly memberwise copyable
C++11: OK, fast by default• myclass is implicitly memberwise copyable and movable
Note: Enables =default for move construction and assignment
a.k.a. “rvalue references v3”
— Stephan T. Lavavej
Implicit move generation
![Page 31: The future of C ++](https://reader036.vdocument.in/reader036/viewer/2022081604/56815f5f550346895dce4682/html5/thumbnails/31.jpg)
If you want to take &&, just say so on the parameter…class widget { };void f( const widget& ); // w is a const&void g( widget& w ); // w is a & – must be lvaluevoid h( widget&& w ); // w is a && – must be rvalueh( widget() ); // ok for && (note: temporary widget)… but what about the “invisible” implicit this?class widget { void f() const; // *this is const (implicitly ref-like) void g() &; // *this is an lvalue void h() &&; // *this is an rvalue};widget().h(); // ok for && (note: temporary widget)
Decorating “implicit this” with & and &&, just like we already do with const and volatile
Example: Overload on & vs. && so in the latter you can “move your guts out”
Ref-qualifiers: & and && for *this
![Page 32: The future of C ++](https://reader036.vdocument.in/reader036/viewer/2022081604/56815f5f550346895dce4682/html5/thumbnails/32.jpg)
C++11[=]() -> some_type { return foo() * 42; } // ok[=] { return foo() * 42; } // ok, deduces “-> some_type”Draft C++14 (approved in Bristol)(Already supported in Visual Studio 2012)[=] { // ok, deduces “-> some_type” while( something() ) { if( expr ) { return foo() * 42; // with arbitrary control flow } } return bar.baz(84); // & multiple returns} // (types must be the same)
In the “quit repeating repeating yourself” category…
C++14 lambda return type deduction
![Page 33: The future of C ++](https://reader036.vdocument.in/reader036/viewer/2022081604/56815f5f550346895dce4682/html5/thumbnails/33.jpg)
C++11, explicitly named return typesome_type f() { return foo() * 42; } // okauto f() -> some_type { return foo() * 42; } // okDraft C++14, deduced return type (approved in Bristol)auto f() { return foo() * 42; } // ok, deduces “-> some_type”auto g() { // ok, deduces “-> some_type” while( something() ) { if( expr ) { return foo() * 42; // with arbitrary control flow } } return bar.baz(84);// & multiple returns} // (types must be the same)
What’s good for the [goose]{} is good for the gander();
Someone will ask: “Can it be recursive?”
Yes. As long as a return precedes the recursive call.
C++14 function return type deduction
![Page 34: The future of C ++](https://reader036.vdocument.in/reader036/viewer/2022081604/56815f5f550346895dce4682/html5/thumbnails/34.jpg)
C++11: no move capturevoid sink( unique_ptr<widget> upw ) { pool.run([??]{ use(*upw); }); // can’t do this pool.run( bind([](unique_ptr<widget>& w){ use(*w); }, move(upw)) );} // this is an important & — extremely nonobvious
C++14: (not just) move capture (approved in Bristol)void sink( unique_ptr<widget> upw ) { pool.run([w = move(upw)]{ use(*w); });}More than move: Renaming + arbitrary extra stateint x = 4;int z = [&r = x, y = x+1] { r += 2; // ::x = 6; “R is for Renamed Ref”
return y+2; // return 7 to initialize z} ( );
Getting C++ out of a “bind”…
C++14 Generalized lambda capture
![Page 35: The future of C ++](https://reader036.vdocument.in/reader036/viewer/2022081604/56815f5f550346895dce4682/html5/thumbnails/35.jpg)
C++11for_each( begin(v), end(v), [](const decltype(*begin(v))& x) { cout << x; } );sort( begin(w), end(w), [](const shared_ptr<some_type>& a,
const shared_ptr<some_type>& b) { return *a<*b; } );auto size = [](const unordered_map<wstring, vector<string>>& m)
{ return m.size(); };Draft C++14: Deduce C++11 cases + reuse with different types (approved in Bristol)for_each( cbegin(v), cend(v), [](const auto& x) { cout << x; } );sort( begin(w), end(w), [](const auto& a, const auto& b){ return *a<*b; });auto size = [](const auto& m) { return m.size(); };
// bonus: now works with any container that supports .size()
Probably the #1 requested C++14 feature
Someone will ask: “Can two autos in one signature deduce differently?”
Yes. And if you change sort to lower_bound, that’s what you want.
C++14 generic lambdas
![Page 36: The future of C ++](https://reader036.vdocument.in/reader036/viewer/2022081604/56815f5f550346895dce4682/html5/thumbnails/36.jpg)
Conformance roadmap: The road to C++14VC++ 2013
Previewtoday
VC++ 2013 RTMlater this year
Explicit conversion operators
Non-static data member initializers
__func__Extended sizeof
Raw string literals = default Implicit move generation
Function template default arguments = delete Ref-qualifiers:
& and && for *this
Delegating constructors
“using” aliasesC++14 libs: type
aliasesC++14 generalized
lambda capture
Uniform init & initializer_lists
C99 variable declsC99 _Bool
C++14 auto function return type
deduction
Variadic templates C99 compound literals
C++14 generic lambdas
C++14 libs: cbegin/ greater<>/make_uni
queC99 designated
initializers
Post-RTM OOB CTPWhat we’re currently implementing, roughly in order… some subset in
CTP
![Page 37: The future of C ++](https://reader036.vdocument.in/reader036/viewer/2022081604/56815f5f550346895dce4682/html5/thumbnails/37.jpg)
Conformance roadmap: The road to C++14VC++ 2013
Previewtoday
VC++ 2013 RTMlater this year
Explicit conversion operators
Non-static data member initializers
__func__Extended sizeof
Thread-safe function local static
init
Raw string literals = default Implicit move generation User-defined literals
Function template default arguments = delete Ref-qualifiers:
& and && for *this noexcept
Delegating constructors
“using” aliasesC++14 libs: type
aliasesC++14 generalized
lambda capturealignofalignas
Uniform init & initializer_lists
C99 variable declsC99 _Bool
C++14 auto function return type
deductionconstexpr (except
ctors / literal types)
Variadic templates C99 compound literals
C++14 generic lambdas
C++14 decltype(auto)
C++14 libs: cbegin/ greater<>/make_uni
queC99 designated
initializersC++14 libs: std::
user-defined literals
Post-RTM OOB CTPWhat we’re currently implementing, roughly in order… some subset in
CTP
![Page 38: The future of C ++](https://reader036.vdocument.in/reader036/viewer/2022081604/56815f5f550346895dce4682/html5/thumbnails/38.jpg)
The road to C++14: What’s left beyond VC++ 2013 and the next CTP?
![Page 39: The future of C ++](https://reader036.vdocument.in/reader036/viewer/2022081604/56815f5f550346895dce4682/html5/thumbnails/39.jpg)
Conformance roadmap: The road to C++14VC++ 2013
Previewtoday
VC++ 2013 RTMlater this year
Explicit conversion operators
Non-static data member initializers
__func__Extended sizeof
Thread-safe function local static
initUnrestricted
unions Attributes
Raw string literals = default Implicit move generation User-defined literals
Universal character
names in literalsthread_local
Function template default arguments = delete Ref-qualifiers:
& and && for *this noexcept Expression SFINAE
Delegating constructors
“using” aliasesC++14 libs: type
aliasesC++14 generalized
lambda capturealignofalignas
Inheriting constructors
Uniform init & initializer_lists
C99 variable declsC99 _Bool
C++14 auto function return type
deductionconstexpr (except
ctors / literal types)constexpr
(literal types)
Variadic templates C99 compound literals
C++14 generic lambdas
C++14 decltype(auto)
Inline namespaces
C++14 libs: cbegin/ greater<>/make_uni
queC99 designated
initializersC++14 libs: std::
user-defined literalschar16_t, char32_t
Post-RTM OOB CTPWhat we’re currently implementing, roughly in order… some subset in
CTP
PlannedWhat’s next for full conformance
![Page 40: The future of C ++](https://reader036.vdocument.in/reader036/viewer/2022081604/56815f5f550346895dce4682/html5/thumbnails/40.jpg)
Conformance roadmap: The road to C++14VC++ 2013
Previewtoday
VC++ 2013 RTMlater this year
Explicit conversion operators
Non-static data member initializers
__func__Extended sizeof
Thread-safe function local static
initUnrestricted
unions Attributes
Raw string literals = default Implicit move generation User-defined literals
Universal character
names in literalsthread_local
Function template default arguments = delete Ref-qualifiers:
& and && for *this noexcept Expression SFINAE
C++11 preprocessor
(incl. C++98 & C11)
Delegating constructors
“using” aliasesC++14 libs: type
aliasesC++14 generalized
lambda capturealignofalignas
Inheriting constructors
C++98 two-phase lookup
Uniform init & initializer_lists
C99 variable declsC99 _Bool
C++14 auto function return type
deductionconstexpr (except
ctors / literal types)constexpr
(literal types)
Variadic templates C99 compound literals
C++14 generic lambdas
C++14 decltype(auto)
Inline namespaces
C++14 libs: cbegin/ greater<>/make_uni
queC99 designated
initializersC++14 libs: std::
user-defined literalschar16_t, char32_t
Post-RTM OOB CTPWhat we’re currently implementing, roughly in order… some subset in
CTP
PlannedWhat’s next for full conformance
![Page 41: The future of C ++](https://reader036.vdocument.in/reader036/viewer/2022081604/56815f5f550346895dce4682/html5/thumbnails/41.jpg)
Conformance roadmap: The road to C++14VC++ 2013
Previewtoday
VC++ 2013 RTMlater this year
Explicit conversion operators
Non-static data member initializers
__func__Extended sizeof
Thread-safe function local static
initUnrestricted
unions Attributes
Raw string literals = default Implicit move generation User-defined literals
Universal character
names in literalsthread_local
Function template default arguments = delete Ref-qualifiers:
& and && for *this noexcept Expression SFINAE
C++11 preprocessor
(incl. C++98 & C11)
Delegating constructors
“using” aliasesC++14 libs: type
aliasesC++14 generalized
lambda capturealignofalignas
Inheriting constructors
C++98 two-phase lookup
Uniform init & initializer_lists
C99 variable declsC99 _Bool
C++14 auto function return type
deductionconstexpr (except
ctors / literal types)constexpr
(literal types)C++14
generalized constexpr
Variadic templates C99 compound literals
C++14 generic lambdas
C++14 decltype(auto)
Inline namespaces
C++14 dyn. arraysC++14 var templates
C++14 libs: cbegin/ greater<>/make_uni
queC99 designated
initializersC++14 libs: std::
user-defined literalschar16_t, char32_t
Post-RTM OOB CTPWhat we’re currently implementing, roughly in order… some subset in
CTP
PlannedWhat’s next for full conformance
![Page 42: The future of C ++](https://reader036.vdocument.in/reader036/viewer/2022081604/56815f5f550346895dce4682/html5/thumbnails/42.jpg)
You arehere
ISO C++ timeline: The “C++14 wave”
98 99 00 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18
C++98(major)
Library TR1 (aka TS) Performance TR
C++03(TC, bug fixes only)
C++11(major)
C++17(major)
C++14(minor)
FileSysTSNetTS1Concepts
TS
14
![Page 43: The future of C ++](https://reader036.vdocument.in/reader036/viewer/2022081604/56815f5f550346895dce4682/html5/thumbnails/43.jpg)
Conformance roadmap: The road to C++14 waveVC++ 2013
Previewtoday
VC++ 2013 RTMlater this year
Explicit conversion operators
Non-static data member initializers
__func__Extended sizeof
Thread-safe function local static
initUnrestricted
unions Attributes
Raw string literals = default Implicit move generation User-defined literals
Universal character
names in literalsthread_local
Function template default arguments = delete Ref-qualifiers:
& and && for *this noexcept Expression SFINAE
C++11 preprocessor
(incl. C++98 & C11)
Delegating constructors
“using” aliasesC++14 libs: type
aliasesC++14 generalized
lambda capturealignofalignas
Inheriting constructors
C++98 two-phase lookup
Uniform init & initializer_lists
C99 variable declsC99 _Bool
C++14 auto function return type
deductionconstexpr (except
ctors / literal types)constexpr
(literal types)C++14
generalized constexpr
Variadic templates C99 compound literals
C++14 generic lambdas
C++14 decltype(auto)
Inline namespaces
C++14 dyn. arraysC++14 var templates
C++14 libs: cbegin/ greater<>/make_uni
queC99 designated
initializersC++14 libs: std::
user-defined literalschar16_t, char32_t
C++TS concepts lite
Post-RTM OOB CTPWhat we’re currently implementing, roughly in order… some subset in
CTP
PlannedWhat’s next for full conformance
![Page 44: The future of C ++](https://reader036.vdocument.in/reader036/viewer/2022081604/56815f5f550346895dce4682/html5/thumbnails/44.jpg)
One more thing for the next OOB CTP
![Page 45: The future of C ++](https://reader036.vdocument.in/reader036/viewer/2022081604/56815f5f550346895dce4682/html5/thumbnails/45.jpg)
Continue to deliver C++11More batches coming in 1H13
Continue to investin platform supportWindows Store apps• Continue to bring C++/CX forward to solve
problems like asynchrony• Continue to make extensions/rewrite less
intrusive to existing C++ code• Example of both: await
Phone apps• See also: Writing C++ components on
Windows 8 & Windows Phone 8Azure (e.g., Casablanca)
VC++ next steps
from Nov 2012
![Page 46: The future of C ++](https://reader036.vdocument.in/reader036/viewer/2022081604/56815f5f550346895dce4682/html5/thumbnails/46.jpg)
Conformance roadmap: The road to C++14 waveVC++ 2013
Previewtoday
VC++ 2013 RTMlater this year
Explicit conversion operators
Non-static data member initializers
__func__Extended sizeof
Thread-safe function local static
initUnrestricted
unions Attributes
Raw string literals = default Implicit move generation User-defined literals
Universal character
names in literalsthread_local
Function template default arguments = delete Ref-qualifiers:
& and && for *this noexcept Expression SFINAE
C++11 preprocessor
(incl. C++98 & C11)
Delegating constructors
“using” aliasesC++14 libs: type
aliasesC++14 generalized
lambda capturealignofalignas
Inheriting constructors
C++98 two-phase lookup
Uniform init & initializer_lists
C99 variable declsC99 _Bool
C++14 auto function return type
deductionconstexpr (except
ctors / literal types)constexpr
(literal types)C++14
generalized constexpr
Variadic templates C99 compound literals
C++14 generic lambdas
C++14 decltype(auto)
Inline namespaces
C++14 dyn. arraysC++14 var templates
C++14 libs: cbegin/ greater<>/make_uni
queC99 designated
initializersC++TS?
async/awaitC++14 libs: std::
user-defined literalschar16_t, char32_t
C++TS concepts lite
Post-RTM OOB CTPWhat we’re currently implementing, roughly in order… some subset in
CTP
PlannedWhat’s next for full conformance
![Page 47: The future of C ++](https://reader036.vdocument.in/reader036/viewer/2022081604/56815f5f550346895dce4682/html5/thumbnails/47.jpg)
It’s very helpful when implementers step up to create prototype versions of proposed featuresGCC (partial list)• (Dos Reis) Variable templates: Voted into draft C++14• (Sutton) Concepts Lite: Prototype underway to complete library, active in
Study Group 8 “Concepts,” Technical Specification expected in 2014
Clang (partial list)• (Smith) Generalized constexpr: Voted into draft C++14• (Vali) Generic lambdas: Voted into draft C++14• (Gregor) Modules: Prototype underway, active in Study Group 2 “Modules”
Visual C++ (partial list)• (various) enum class, nullptr, lambda syntax, delegating ctors:
Included in C++11• (Gustafsson) async/await: Next VC++ CTP, active in Study Group 1,
“Concurrency”
Contributing to “existing practice”
Prototypeville: Laying groundwork for C++14/17/…
![Page 48: The future of C ++](https://reader036.vdocument.in/reader036/viewer/2022081604/56815f5f550346895dce4682/html5/thumbnails/48.jpg)
Example: Concurrent waiting.get .thensize_tfile_sizes( string file1, string file2 ) { task<file> f1 = open(file1), f2 = open(file2); return f1.get().size() + f2.get().size();}
task<size_t> file_sizes( string file1, string file2 ) { task<file> f1 = open(file1), f2 = open(file2); return when_all(f1,f2) .then([=](tuple<file,file> fs) { return get<1>(fs).size() + get<2>(fs).size(); });}.then + await
task<size_t> file_sizes( string file1, string file2 ) __async { task<file> f1 = open(file1), f2 = open(file2); return (__await f1).size() + (__await f2).size();}
![Page 49: The future of C ++](https://reader036.vdocument.in/reader036/viewer/2022081604/56815f5f550346895dce4682/html5/thumbnails/49.jpg)
Real payoff: Branches and loops.get .thenstringread( string file, string suffix ) { istream fi = open(file).get(); string ret, chunk; while( (chunk = fi.read().get()).size() ) ret += chunk + suffix; return ret;}
task<string> read( string file, string suffix ) { return open(file) .then([=](istream fi) { string ret, chunk; while(
?
![Page 50: The future of C ++](https://reader036.vdocument.in/reader036/viewer/2022081604/56815f5f550346895dce4682/html5/thumbnails/50.jpg)
Real payoff: Branches and loops.get .thenstring read( string file, string suffix ) { istream fi = open(file).get(); string ret, chunk; while( (chunk = fi.read().get()).size() ) ret += chunk + suffix; return ret;}
task<string> read( string file, string suffix ) { return open(file) .then([=](istream fi) { auto ret = make_shared<string>(); auto next = make_shared<function<task<string>()>>( [=]{ fi.read() .then([=](string chunk) { if( chunk.size() ) { *ret += chunk + suffix; return (*next)(); } return *ret; }); }); return (*next)(); });}
.then + awaittask<string> read( string file, string suffix ) __async { istream fi = __await open(file); string ret, chunk; while( (chunk = __await fi.read()).size() ) ret += chunk + suffix; return ret;}
![Page 51: The future of C ++](https://reader036.vdocument.in/reader036/viewer/2022081604/56815f5f550346895dce4682/html5/thumbnails/51.jpg)
WinRT + Ref Class on the Stack.get .then{ DataReader rdr(stream); auto bytesRead = rdr.LoadAsync((int)stream->Size).get(); txtBox->Text = rdr.ReadString(bytesRead);}// Re-open file here.
auto rdr = ref new DataReader(stream);task<uint32>(rdr->LoadAsync((int)stream->Size)).then([=](uint32 bytesRead) { txtBox->Text = rdr->ReadString(bytesRead); delete rdr; // Re-open file here});
.then + await{ DataReader rdr(stream); auto bytesRead = __await rdr.LoadAsync((int)stream->Size); txtBox->Text = rdr.ReadString(bytesRead);}// Re-open file here.
![Page 52: The future of C ++](https://reader036.vdocument.in/reader036/viewer/2022081604/56815f5f550346895dce4682/html5/thumbnails/52.jpg)
Conformance roadmap: The road to C++14 waveVC++ 2013
Previewtoday
VC++ 2013 RTMlater this year
Explicit conversion operators
Non-static data member initializers
__func__Extended sizeof
Thread-safe function local static
initUnrestricted
unions Attributes
Raw string literals = default Implicit move generation User-defined literals
Universal character
names in literalsthread_local
Function template default arguments = delete Ref-qualifiers:
& and && for *this noexcept Expression SFINAE
C++11 preprocessor
(incl. C++98 & C11)
Delegating constructors
“using” aliasesC++14 libs: type
aliasesC++14 generalized
lambda capturealignofalignas
Inheriting constructors
C++98 two-phase lookup
Uniform init & initializer_lists
C99 variable declsC99 _Bool
C++14 auto function return type
deductionconstexpr (except
ctors / literal types)constexpr
(literal types)C++14
generalized constexpr
Variadic templates C99 compound literals
C++14 generic lambdas
C++14 decltype(auto)
Inline namespaces
C++14 dyn. arraysC++14 var templates
C++14 libs: cbegin/ greater<>/make_uni
queC99 designated
initializersC++TS?
async/awaitC++14 libs: std::
user-defined literalschar16_t, char32_t
C++TS concepts lite
Post-RTM OOB CTPWhat we’re currently implementing, roughly in order… some subset in
CTP
PlannedWhat’s next for full conformance
![Page 53: The future of C ++](https://reader036.vdocument.in/reader036/viewer/2022081604/56815f5f550346895dce4682/html5/thumbnails/53.jpg)
When is the next roadmap update?“Let’s get together / Before we get much older”
![Page 54: The future of C ++](https://reader036.vdocument.in/reader036/viewer/2022081604/56815f5f550346895dce4682/html5/thumbnails/54.jpg)
GoingNative 2012
![Page 55: The future of C ++](https://reader036.vdocument.in/reader036/viewer/2022081604/56815f5f550346895dce4682/html5/thumbnails/55.jpg)
September 4-6, 2013Redmond, WA, USA
Bjarne Stroustrup (Texas A&M) Chandler Carruth (Google)Scott Meyers Stephan T. Lavavej (Microsoft)Andrei Alexandrescu (Facebook) Sean Parent (Adobe)Michael Wong (IBM) & more…
GoingNative 2013
GoingNative 2013
+ RTM/CTProadmap update
Registration open todayhttp://is.gd/goingnative
![Page 56: The future of C ++](https://reader036.vdocument.in/reader036/viewer/2022081604/56815f5f550346895dce4682/html5/thumbnails/56.jpg)
© 2013 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries.The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.