Your SlideShare is downloading. ×
0
20130110 prs presentation ncim c++ 11
20130110 prs presentation ncim c++ 11
20130110 prs presentation ncim c++ 11
20130110 prs presentation ncim c++ 11
20130110 prs presentation ncim c++ 11
20130110 prs presentation ncim c++ 11
20130110 prs presentation ncim c++ 11
20130110 prs presentation ncim c++ 11
20130110 prs presentation ncim c++ 11
20130110 prs presentation ncim c++ 11
20130110 prs presentation ncim c++ 11
20130110 prs presentation ncim c++ 11
20130110 prs presentation ncim c++ 11
20130110 prs presentation ncim c++ 11
20130110 prs presentation ncim c++ 11
20130110 prs presentation ncim c++ 11
20130110 prs presentation ncim c++ 11
20130110 prs presentation ncim c++ 11
20130110 prs presentation ncim c++ 11
20130110 prs presentation ncim c++ 11
20130110 prs presentation ncim c++ 11
20130110 prs presentation ncim c++ 11
20130110 prs presentation ncim c++ 11
20130110 prs presentation ncim c++ 11
20130110 prs presentation ncim c++ 11
20130110 prs presentation ncim c++ 11
20130110 prs presentation ncim c++ 11
20130110 prs presentation ncim c++ 11
20130110 prs presentation ncim c++ 11
20130110 prs presentation ncim c++ 11
20130110 prs presentation ncim c++ 11
20130110 prs presentation ncim c++ 11
20130110 prs presentation ncim c++ 11
20130110 prs presentation ncim c++ 11
20130110 prs presentation ncim c++ 11
20130110 prs presentation ncim c++ 11
20130110 prs presentation ncim c++ 11
20130110 prs presentation ncim c++ 11
20130110 prs presentation ncim c++ 11
20130110 prs presentation ncim c++ 11
20130110 prs presentation ncim c++ 11
20130110 prs presentation ncim c++ 11
20130110 prs presentation ncim c++ 11
20130110 prs presentation ncim c++ 11
20130110 prs presentation ncim c++ 11
20130110 prs presentation ncim c++ 11
20130110 prs presentation ncim c++ 11
20130110 prs presentation ncim c++ 11
20130110 prs presentation ncim c++ 11
20130110 prs presentation ncim c++ 11
20130110 prs presentation ncim c++ 11
20130110 prs presentation ncim c++ 11
20130110 prs presentation ncim c++ 11
20130110 prs presentation ncim c++ 11
20130110 prs presentation ncim c++ 11
20130110 prs presentation ncim c++ 11
20130110 prs presentation ncim c++ 11
20130110 prs presentation ncim c++ 11
20130110 prs presentation ncim c++ 11
20130110 prs presentation ncim c++ 11
20130110 prs presentation ncim c++ 11
20130110 prs presentation ncim c++ 11
20130110 prs presentation ncim c++ 11
20130110 prs presentation ncim c++ 11
20130110 prs presentation ncim c++ 11
20130110 prs presentation ncim c++ 11
20130110 prs presentation ncim c++ 11
20130110 prs presentation ncim c++ 11
20130110 prs presentation ncim c++ 11
20130110 prs presentation ncim c++ 11
20130110 prs presentation ncim c++ 11
20130110 prs presentation ncim c++ 11
20130110 prs presentation ncim c++ 11
20130110 prs presentation ncim c++ 11
20130110 prs presentation ncim c++ 11
20130110 prs presentation ncim c++ 11
20130110 prs presentation ncim c++ 11
20130110 prs presentation ncim c++ 11
20130110 prs presentation ncim c++ 11
20130110 prs presentation ncim c++ 11
20130110 prs presentation ncim c++ 11
20130110 prs presentation ncim c++ 11
20130110 prs presentation ncim c++ 11
20130110 prs presentation ncim c++ 11
20130110 prs presentation ncim c++ 11
20130110 prs presentation ncim c++ 11
20130110 prs presentation ncim c++ 11
20130110 prs presentation ncim c++ 11
20130110 prs presentation ncim c++ 11
20130110 prs presentation ncim c++ 11
20130110 prs presentation ncim c++ 11
20130110 prs presentation ncim c++ 11
20130110 prs presentation ncim c++ 11
20130110 prs presentation ncim c++ 11
20130110 prs presentation ncim c++ 11
20130110 prs presentation ncim c++ 11
20130110 prs presentation ncim c++ 11
20130110 prs presentation ncim c++ 11
20130110 prs presentation ncim c++ 11
20130110 prs presentation ncim c++ 11
20130110 prs presentation ncim c++ 11
20130110 prs presentation ncim c++ 11
20130110 prs presentation ncim c++ 11
20130110 prs presentation ncim c++ 11
20130110 prs presentation ncim c++ 11
20130110 prs presentation ncim c++ 11
20130110 prs presentation ncim c++ 11
20130110 prs presentation ncim c++ 11
20130110 prs presentation ncim c++ 11
20130110 prs presentation ncim c++ 11
20130110 prs presentation ncim c++ 11
20130110 prs presentation ncim c++ 11
20130110 prs presentation ncim c++ 11
20130110 prs presentation ncim c++ 11
20130110 prs presentation ncim c++ 11
20130110 prs presentation ncim c++ 11
20130110 prs presentation ncim c++ 11
20130110 prs presentation ncim c++ 11
20130110 prs presentation ncim c++ 11
20130110 prs presentation ncim c++ 11
20130110 prs presentation ncim c++ 11
20130110 prs presentation ncim c++ 11
20130110 prs presentation ncim c++ 11
20130110 prs presentation ncim c++ 11
20130110 prs presentation ncim c++ 11
20130110 prs presentation ncim c++ 11
20130110 prs presentation ncim c++ 11
20130110 prs presentation ncim c++ 11
20130110 prs presentation ncim c++ 11
20130110 prs presentation ncim c++ 11
20130110 prs presentation ncim c++ 11
20130110 prs presentation ncim c++ 11
20130110 prs presentation ncim c++ 11
20130110 prs presentation ncim c++ 11
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

20130110 prs presentation ncim c++ 11

620

Published on

NCIM Techtalk presentation about C++11 by Ralph Langendam

NCIM Techtalk presentation about C++11 by Ralph Langendam

0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
620
On Slideshare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
7
Comments
0
Likes
0
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

  • 1. C++ 11 Ralph Langendam NCIM-Groep Januari 9th, 2013Ralph Langendam (NCIM-Groep) C++ 11 Januari 9th, 2013 1 / 39
  • 2. Overview Anonymous functions1 Timeline Override and Final History Alias templates Present and Future Enumerations and Unions2 C++11 Development 5 New functionality Directives Variadic templates Enhancement categories Defaulted and deleted special3 Run-time performance methods enhancements 6 Standard library enhancements Move semantics Threading facilities Constant expression Smart pointers4 Usability enhancements Type traits Static assertions 7 Compiler support Type inference 8 Further readingRalph Langendam (NCIM-Groep) C++ 11 Januari 9th, 2013 2 / 39
  • 3. TimelineOutline1 Timeline History Present and Future2 C++11 Development3 Run-time performance enhancements4 Usability enhancements5 New functionality6 Standard library enhancements7 Compiler support Ralph Langendam (NCIM-Groep) C++ 11 Januari 9th, 2013 3 / 39
  • 4. Timeline HistoryHistory Ralph Langendam (NCIM-Groep) C++ 11 Januari 9th, 2013 4 / 39
  • 5. Timeline HistoryHistory ≈ 1979 C with classes (CFront): C, classes, inheritance, inline, default argument values, strong type checking. Ralph Langendam (NCIM-Groep) C++ 11 Januari 9th, 2013 4 / 39
  • 6. Timeline HistoryHistory ≈ 1979 C with classes (CFront): C, classes, inheritance, inline, default argument values, strong type checking. 1983 C++ : exceptions, virtual functions, function overloading, const, references, comment (//). Ralph Langendam (NCIM-Groep) C++ 11 Januari 9th, 2013 4 / 39
  • 7. Timeline HistoryHistory ≈ 1979 C with classes (CFront): C, classes, inheritance, inline, default argument values, strong type checking. 1983 C++ : exceptions, virtual functions, function overloading, const, references, comment (//). 1985 Publication of Bjarne Stroustrup - The C++ Programming Language. Ralph Langendam (NCIM-Groep) C++ 11 Januari 9th, 2013 4 / 39
  • 8. Timeline HistoryHistory ≈ 1979 C with classes (CFront): C, classes, inheritance, inline, default argument values, strong type checking. 1983 C++ : exceptions, virtual functions, function overloading, const, references, comment (//). 1985 Publication of Bjarne Stroustrup - The C++ Programming Language. 1989 protected and static members. Ralph Langendam (NCIM-Groep) C++ 11 Januari 9th, 2013 4 / 39
  • 9. Timeline HistoryHistory ≈ 1979 C with classes (CFront): C, classes, inheritance, inline, default argument values, strong type checking. 1983 C++ : exceptions, virtual functions, function overloading, const, references, comment (//). 1985 Publication of Bjarne Stroustrup - The C++ Programming Language. 1989 protected and static members. 1990 Publication of The Annotated C++ Reference Manual, Borland Turbo C++. Ralph Langendam (NCIM-Groep) C++ 11 Januari 9th, 2013 4 / 39
  • 10. Timeline HistoryHistory ≈ 1979 C with classes (CFront): C, classes, inheritance, inline, default argument values, strong type checking. 1983 C++ : exceptions, virtual functions, function overloading, const, references, comment (//). 1985 Publication of Bjarne Stroustrup - The C++ Programming Language. 1989 protected and static members. 1990 Publication of The Annotated C++ Reference Manual, Borland Turbo C++. 1998 Standardization by ISO (C++98) and development of STL. Ralph Langendam (NCIM-Groep) C++ 11 Januari 9th, 2013 4 / 39
  • 11. Timeline HistoryHistory ≈ 1979 C with classes (CFront): C, classes, inheritance, inline, default argument values, strong type checking. 1983 C++ : exceptions, virtual functions, function overloading, const, references, comment (//). 1985 Publication of Bjarne Stroustrup - The C++ Programming Language. 1989 protected and static members. 1990 Publication of The Annotated C++ Reference Manual, Borland Turbo C++. 1998 Standardization by ISO (C++98) and development of STL. 2003 C++03 Ralph Langendam (NCIM-Groep) C++ 11 Januari 9th, 2013 4 / 39
  • 12. Timeline HistoryHistory ≈ 1979 C with classes (CFront): C, classes, inheritance, inline, default argument values, strong type checking. 1983 C++ : exceptions, virtual functions, function overloading, const, references, comment (//). 1985 Publication of Bjarne Stroustrup - The C++ Programming Language. 1989 protected and static members. 1990 Publication of The Annotated C++ Reference Manual, Borland Turbo C++. 1998 Standardization by ISO (C++98) and development of STL. 2003 C++03 2005 TR1 with features for C++0x. Ralph Langendam (NCIM-Groep) C++ 11 Januari 9th, 2013 4 / 39
  • 13. Timeline HistoryHistory ≈ 1979 C with classes (CFront): C, classes, inheritance, inline, default argument values, strong type checking. 1983 C++ : exceptions, virtual functions, function overloading, const, references, comment (//). 1985 Publication of Bjarne Stroustrup - The C++ Programming Language. 1989 protected and static members. 1990 Publication of The Annotated C++ Reference Manual, Borland Turbo C++. 1998 Standardization by ISO (C++98) and development of STL. 2003 C++03 2005 TR1 with features for C++0x. 2011 C++11 Ralph Langendam (NCIM-Groep) C++ 11 Januari 9th, 2013 4 / 39
  • 14. Timeline Present and FuturePresent and Future Ralph Langendam (NCIM-Groep) C++ 11 Januari 9th, 2013 5 / 39
  • 15. Timeline Present and FuturePresent and Future Ralph Langendam (NCIM-Groep) C++ 11 Januari 9th, 2013 5 / 39
  • 16. Timeline Present and FuturePresent and Future The Boost library project was a large source of inspiration to TR1. Ralph Langendam (NCIM-Groep) C++ 11 Januari 9th, 2013 5 / 39
  • 17. Timeline Present and FuturePresent and Future The Boost library project was a large source of inspiration to TR1. Nowadays Boost is the main incubator for new C++ features. Ralph Langendam (NCIM-Groep) C++ 11 Januari 9th, 2013 5 / 39
  • 18. Timeline Present and FuturePresent and Future The Boost library project was a large source of inspiration to TR1. Nowadays Boost is the main incubator for new C++ features. Bugfixes for C++14. Ralph Langendam (NCIM-Groep) C++ 11 Januari 9th, 2013 5 / 39
  • 19. Timeline Present and FuturePresent and Future The Boost library project was a large source of inspiration to TR1. Nowadays Boost is the main incubator for new C++ features. Bugfixes for C++14. TR2 for C++17. Ralph Langendam (NCIM-Groep) C++ 11 Januari 9th, 2013 5 / 39
  • 20. C++11 DevelopmentOutline1 Timeline2 C++11 Development Directives Enhancement categories3 Run-time performance enhancements4 Usability enhancements5 New functionality6 Standard library enhancements7 Compiler support Ralph Langendam (NCIM-Groep) C++ 11 Januari 9th, 2013 6 / 39
  • 21. C++11 Development DirectivesDirectives Ralph Langendam (NCIM-Groep) C++ 11 Januari 9th, 2013 7 / 39
  • 22. C++11 Development DirectivesDirectives Backwards compatibility with C++98 and C. Ralph Langendam (NCIM-Groep) C++ 11 Januari 9th, 2013 7 / 39
  • 23. C++11 Development DirectivesDirectives Backwards compatibility with C++98 and C. Extend primarily through STL and less through C++ core language. Ralph Langendam (NCIM-Groep) C++ 11 Januari 9th, 2013 7 / 39
  • 24. C++11 Development DirectivesDirectives Backwards compatibility with C++98 and C. Extend primarily through STL and less through C++ core language. Focus on programming techniques, systems and library design. Ralph Langendam (NCIM-Groep) C++ 11 Januari 9th, 2013 7 / 39
  • 25. C++11 Development DirectivesDirectives Backwards compatibility with C++98 and C. Extend primarily through STL and less through C++ core language. Focus on programming techniques, systems and library design. Increase type safety. Ralph Langendam (NCIM-Groep) C++ 11 Januari 9th, 2013 7 / 39
  • 26. C++11 Development DirectivesDirectives Backwards compatibility with C++98 and C. Extend primarily through STL and less through C++ core language. Focus on programming techniques, systems and library design. Increase type safety. Increase performance and ability to work directly with hardware. Ralph Langendam (NCIM-Groep) C++ 11 Januari 9th, 2013 7 / 39
  • 27. C++11 Development DirectivesDirectives Backwards compatibility with C++98 and C. Extend primarily through STL and less through C++ core language. Focus on programming techniques, systems and library design. Increase type safety. Increase performance and ability to work directly with hardware. Implement the zero overhead principle. Ralph Langendam (NCIM-Groep) C++ 11 Januari 9th, 2013 7 / 39
  • 28. C++11 Development DirectivesDirectives Backwards compatibility with C++98 and C. Extend primarily through STL and less through C++ core language. Focus on programming techniques, systems and library design. Increase type safety. Increase performance and ability to work directly with hardware. Implement the zero overhead principle. Make C++ easier to learn. Ralph Langendam (NCIM-Groep) C++ 11 Januari 9th, 2013 7 / 39
  • 29. C++11 Development Enhancement categoriesEnhancement categories Ralph Langendam (NCIM-Groep) C++ 11 Januari 9th, 2013 8 / 39
  • 30. C++11 Development Enhancement categoriesEnhancement categories Run-time performance enhancements Ralph Langendam (NCIM-Groep) C++ 11 Januari 9th, 2013 8 / 39
  • 31. C++11 Development Enhancement categoriesEnhancement categories Run-time performance enhancements Build-time performance enhancements Ralph Langendam (NCIM-Groep) C++ 11 Januari 9th, 2013 8 / 39
  • 32. C++11 Development Enhancement categoriesEnhancement categories Run-time performance enhancements Build-time performance enhancements Usability enhancements Ralph Langendam (NCIM-Groep) C++ 11 Januari 9th, 2013 8 / 39
  • 33. C++11 Development Enhancement categoriesEnhancement categories Run-time performance enhancements Build-time performance enhancements Usability enhancements New functionality Ralph Langendam (NCIM-Groep) C++ 11 Januari 9th, 2013 8 / 39
  • 34. C++11 Development Enhancement categoriesEnhancement categories Run-time performance enhancements Build-time performance enhancements Usability enhancements New functionality Standard library enhancements Ralph Langendam (NCIM-Groep) C++ 11 Januari 9th, 2013 8 / 39
  • 35. Run-time performance enhancementsOutline1 Timeline2 C++11 Development3 Run-time performance enhancements Move semantics Constant expression4 Usability enhancements5 New functionality6 Standard library enhancements7 Compiler support Ralph Langendam (NCIM-Groep) C++ 11 Januari 9th, 2013 9 / 39
  • 36. Run-time performance enhancements Move semanticsR-value references Ralph Langendam (NCIM-Groep) C++ 11 Januari 9th, 2013 10 / 39
  • 37. Run-time performance enhancements Move semanticsR-value references C++ distinguishes between l-values and r-values. int l ; l = 3 // Assign r - value 3 to l - value l 4 = l // Error : 4 is not an l - value Ralph Langendam (NCIM-Groep) C++ 11 Januari 9th, 2013 10 / 39
  • 38. Run-time performance enhancements Move semanticsR-value references C++ distinguishes between l-values and r-values. int l ; l = 3 // Assign r - value 3 to l - value l 4 = l // Error : 4 is not an l - value Now, consider int PlusOne ( int n ) { return n +1; } int result ( PlusOne (3+4) ) ; Ralph Langendam (NCIM-Groep) C++ 11 Januari 9th, 2013 10 / 39
  • 39. Run-time performance enhancements Move semanticsR-value references C++ distinguishes between l-values and r-values. int l ; l = 3 // Assign r - value 3 to l - value l 4 = l // Error : 4 is not an l - value Now, consider int PlusOne ( int n ) { return n +1; } int result ( PlusOne (3+4) ) ; 1 3+4 is evaluated and copied to a new int n (7) in PlusOne. Ralph Langendam (NCIM-Groep) C++ 11 Januari 9th, 2013 10 / 39
  • 40. Run-time performance enhancements Move semanticsR-value references C++ distinguishes between l-values and r-values. int l ; l = 3 // Assign r - value 3 to l - value l 4 = l // Error : 4 is not an l - value Now, consider int PlusOne ( int n ) { return n +1; } int result ( PlusOne (3+4) ) ; 1 3+4 is evaluated and copied to a new int n (7) in PlusOne. 2 n+1 is evaluated and copied to a new int result (8). Ralph Langendam (NCIM-Groep) C++ 11 Januari 9th, 2013 10 / 39
  • 41. Run-time performance enhancements Move semanticsR-value references Ralph Langendam (NCIM-Groep) C++ 11 Januari 9th, 2013 11 / 39
  • 42. Run-time performance enhancements Move semanticsR-value references Using r-value references we can get rid of the first copy: int PlusOne ( int && n ) { return n +1; } Ralph Langendam (NCIM-Groep) C++ 11 Januari 9th, 2013 11 / 39
  • 43. Run-time performance enhancements Move semanticsR-value references Using r-value references we can get rid of the first copy: int PlusOne ( int && n ) { return n +1; } The evaluated integer instance 7 is used in evaluating n+1. Ralph Langendam (NCIM-Groep) C++ 11 Januari 9th, 2013 11 / 39
  • 44. Run-time performance enhancements Move semanticsR-value references Using r-value references we can get rid of the first copy: int PlusOne ( int && n ) { return n +1; } The evaluated integer instance 7 is used in evaluating n+1. STL containers benefit from this too: std :: vector <int > v ; // Use void std :: vector <T , A >:: push_back ( T &&) v . push_back (3+4) ; int r (7) ; // Use void std :: vector <T , A >:: push_back ( T const &) v . push_back (r); Ralph Langendam (NCIM-Groep) C++ 11 Januari 9th, 2013 11 / 39
  • 45. Run-time performance enhancements Constant expressionConstant expression Ralph Langendam (NCIM-Groep) C++ 11 Januari 9th, 2013 12 / 39
  • 46. Run-time performance enhancements Constant expressionConstant expression Compile time calculations are ill-formed. int Two () { return 2; } double array [ Two () + 3]; // Ill - formed Ralph Langendam (NCIM-Groep) C++ 11 Januari 9th, 2013 12 / 39
  • 47. Run-time performance enhancements Constant expressionConstant expression Compile time calculations are ill-formed. int Two () { return 2; } double array [ Two () + 3]; // Ill - formed The compiler is not aware of Two being constant. Ralph Langendam (NCIM-Groep) C++ 11 Januari 9th, 2013 12 / 39
  • 48. Run-time performance enhancements Constant expressionConstant expression Compile time calculations are ill-formed. int Two () { return 2; } double array [ Two () + 3]; // Ill - formed The compiler is not aware of Two being constant. We resolve this with constexpr. constexpr int Two () { return 2; } Ralph Langendam (NCIM-Groep) C++ 11 Januari 9th, 2013 12 / 39
  • 49. Run-time performance enhancements Constant expressionConstant class expressions Ralph Langendam (NCIM-Groep) C++ 11 Januari 9th, 2013 13 / 39
  • 50. Run-time performance enhancements Constant expressionConstant class expressions This can be applied to classes as well struct Square { explicit constexpr Square ( unsigned side ) : _side ( side ) { } constexpr unsigned Area () const { return _side * _side ; } void SetSide ( unsigned side ) { _side = side ; } private : unsigned _side ; }; Ralph Langendam (NCIM-Groep) C++ 11 Januari 9th, 2013 13 / 39
  • 51. Run-time performance enhancements Constant expressionConstant class expressions Ralph Langendam (NCIM-Groep) C++ 11 Januari 9th, 2013 14 / 39
  • 52. Run-time performance enhancements Constant expressionConstant class expressionsconstexpr Square ces (3) ;const Square cs (4) ; Square s (5) ; Ralph Langendam (NCIM-Groep) C++ 11 Januari 9th, 2013 14 / 39
  • 53. Run-time performance enhancements Constant expressionConstant class expressionsconstexpr Square ces (3) ;const Square cs (4) ; Square s (5) ;double cesArray [ ces . Area () ];// Error : cs . Area () is not constexprdouble csArray [ cs . Area () ];// Error : s . Area () is not constexprdouble sArray [ s . Area () ]; Ralph Langendam (NCIM-Groep) C++ 11 Januari 9th, 2013 14 / 39
  • 54. Run-time performance enhancements Constant expressionConstant class expressionsconstexpr Square ces (3) ;const Square cs (4) ; Square s (5) ;double cesArray [ ces . Area () ];// Error : cs . Area () is not constexprdouble csArray [ cs . Area () ];// Error : s . Area () is not constexprdouble sArray [ s . Area () ];ces . SetSide (6) ; // Error : this is Square const * cs . SetSide (6) ; // Error : this is Square const * s . SetSide (6) ; Ralph Langendam (NCIM-Groep) C++ 11 Januari 9th, 2013 14 / 39
  • 55. Usability enhancementsOutline1 Timeline2 C++11 Development3 Run-time performance enhancements4 Usability enhancements Static assertions Type inference Anonymous functions Override and Final Alias templates Enumerations and Unions5 New functionality6 Ralph Langendam library enhancements Standard (NCIM-Groep) C++ 11 Januari 9th, 2013 15 / 39
  • 56. Usability enhancements Static assertionsStatic assertions Ralph Langendam (NCIM-Groep) C++ 11 Januari 9th, 2013 16 / 39
  • 57. Usability enhancements Static assertionsStatic assertions We can perform compile time checks on constexpr. constexpr bool b ( false ) ; // Error : static assertion failed : b is false static_assert (b , " b is false . " ) ; Ralph Langendam (NCIM-Groep) C++ 11 Januari 9th, 2013 16 / 39
  • 58. Usability enhancements Static assertionsStatic assertions We can perform compile time checks on constexpr. constexpr bool b ( false ) ; // Error : static assertion failed : b is false static_assert (b , " b is false . " ) ; constexpr Square ces (3) ; static_assert ( ces . Area () == 9 , " Oops . " ) ; Ralph Langendam (NCIM-Groep) C++ 11 Januari 9th, 2013 16 / 39
  • 59. Usability enhancements Static assertionsStatic assertions We can perform compile time checks on constexpr. constexpr bool b ( false ) ; // Error : static assertion failed : b is false static_assert (b , " b is false . " ) ; constexpr Square ces (3) ; static_assert ( ces . Area () == 9 , " Oops . " ) ; This allows for static (unit) testing. Ralph Langendam (NCIM-Groep) C++ 11 Januari 9th, 2013 16 / 39
  • 60. Usability enhancements Static assertionsStatic assertions We can perform compile time checks on constexpr. constexpr bool b ( false ) ; // Error : static assertion failed : b is false static_assert (b , " b is false . " ) ; constexpr Square ces (3) ; static_assert ( ces . Area () == 9 , " Oops . " ) ; This allows for static (unit) testing. TMP and revised constexpr are T¨ring complete. u Ralph Langendam (NCIM-Groep) C++ 11 Januari 9th, 2013 16 / 39
  • 61. Usability enhancements Static assertionsStatic assertions We can perform compile time checks on constexpr. constexpr bool b ( false ) ; // Error : static assertion failed : b is false static_assert (b , " b is false . " ) ; constexpr Square ces (3) ; static_assert ( ces . Area () == 9 , " Oops . " ) ; This allows for static (unit) testing. TMP and revised constexpr are T¨ring complete. u All unit tests can be static unit tests! Ralph Langendam (NCIM-Groep) C++ 11 Januari 9th, 2013 16 / 39
  • 62. Usability enhancements Type inferenceAutomatic type deduction Ralph Langendam (NCIM-Groep) C++ 11 Januari 9th, 2013 17 / 39
  • 63. Usability enhancements Type inferenceAutomatic type deduction Inability to overload function based on return type opens up the possibility for type inference. Ralph Langendam (NCIM-Groep) C++ 11 Januari 9th, 2013 17 / 39
  • 64. Usability enhancements Type inferenceAutomatic type deduction Inability to overload function based on return type opens up the possibility for type inference. Bonus: syntactic sugar std :: set < float >:: const_iterator b ( s . begin () ) ; auto b ( s . begin () ) ; Ralph Langendam (NCIM-Groep) C++ 11 Januari 9th, 2013 17 / 39
  • 65. Usability enhancements Type inferenceAutomatic type deduction Inability to overload function based on return type opens up the possibility for type inference. Bonus: syntactic sugar std :: set < float >:: const_iterator b ( s . begin () ) ; auto b ( s . begin () ) ; Drawback: implicitness obfuscates bugs. auto x ( f () ) ; // Could be integer or float division . // Even any matching division operator . auto z = 1 / y ; Ralph Langendam (NCIM-Groep) C++ 11 Januari 9th, 2013 17 / 39
  • 66. Usability enhancements Anonymous functionsCallbacks and closures Ralph Langendam (NCIM-Groep) C++ 11 Januari 9th, 2013 18 / 39
  • 67. Usability enhancements Anonymous functionsCallbacks and closures std::function makes callbacks more readable then conventional function pointers. Ralph Langendam (NCIM-Groep) C++ 11 Januari 9th, 2013 18 / 39
  • 68. Usability enhancements Anonymous functionsCallbacks and closures std::function makes callbacks more readable then conventional function pointers. # include < functional > struct S { int TimesTwo ( short s ) const { return 2 * s ; } }; Ralph Langendam (NCIM-Groep) C++ 11 Januari 9th, 2013 18 / 39
  • 69. Usability enhancements Anonymous functionsCallbacks and closures std::function makes callbacks more readable then conventional function pointers. # include < functional > struct S { int TimesTwo ( short s ) const { return 2 * s ; } }; // Using function pointers typedef int ( S ::* Method ) ( short ) const ; Method p (& S :: TimesTwo ) ; S const s ; int const x (( s .* p ) (3) ) ; // x == 6 Ralph Langendam (NCIM-Groep) C++ 11 Januari 9th, 2013 18 / 39
  • 70. Usability enhancements Anonymous functionsCallbacks and closures std::function makes callbacks more readable then conventional function pointers. # include < functional > struct S { int TimesTwo ( short s ) const { return 2 * s ; } }; // Using function pointers typedef int ( S ::* Method ) ( short ) const ; Method p (& S :: TimesTwo ) ; S const s ; int const x (( s .* p ) (3) ) ; // x == 6 // Using std :: function std :: function < int ( S const & , short ) > q (& S :: TimesTwo ) ; int const y ( q (s , 4) ) ; // y == 8 Ralph Langendam (NCIM-Groep) C++ 11 Januari 9th, 2013 18 / 39
  • 71. Usability enhancements Anonymous functionsLambda expressions Ralph Langendam (NCIM-Groep) C++ 11 Januari 9th, 2013 19 / 39
  • 72. Usability enhancements Anonymous functionsLambda expressions Syntax: [capture clause] (parameter list)-> returnvalue {body} Ralph Langendam (NCIM-Groep) C++ 11 Januari 9th, 2013 19 / 39
  • 73. Usability enhancements Anonymous functionsLambda expressions Syntax: [capture clause] (parameter list)-> returnvalue {body} # include < functional > double g ( std :: function < double ( int ) > const & f ) { return f (4) ; } { double x (2.) ; std :: function < double ( int ) > const f ( [& x ] ( int n ) -> double { return x * n ; } ); double const y ( g ( f ) ) ; // y == 8. x = 3.; double const z ( g ( f ) ) ; // z == 12. } Ralph Langendam (NCIM-Groep) C++ 11 Januari 9th, 2013 19 / 39
  • 74. Usability enhancements Override and FinalOverride and Final Ralph Langendam (NCIM-Groep) C++ 11 Januari 9th, 2013 20 / 39
  • 75. Usability enhancements Override and FinalOverride and Final Use override to avoid accidental creation of new virtual function. Ralph Langendam (NCIM-Groep) C++ 11 Januari 9th, 2013 20 / 39
  • 76. Usability enhancements Override and FinalOverride and Final Use override to avoid accidental creation of new virtual function. Use final to prevent further specialization. Ralph Langendam (NCIM-Groep) C++ 11 Januari 9th, 2013 20 / 39
  • 77. Usability enhancements Override and FinalOverride and Final Use override to avoid accidental creation of new virtual function. Use final to prevent further specialization. struct Interface { virtual void f () = 0; virtual void g () = 0; }; struct Base : Interface { virtual void f () override ; virtual void g () final ; }; struct final Derived : Base { // Error : Signature of f doesn ’t match virtual void f ( int ) override ; // Error : g finally overridden in Base virtual void g () override ; }; // Error : Derived is final struct Derived2 : Derived { ... }; Ralph Langendam (NCIM-Groep) C++ 11 Januari 9th, 2013 20 / 39
  • 78. Usability enhancements Alias templatesAlias templates Ralph Langendam (NCIM-Groep) C++ 11 Januari 9th, 2013 21 / 39
  • 79. Usability enhancements Alias templatesAlias templates Templated typedefs were illegal in C++03. // Error : templated typedef not allowed . template < typename T > typedef std :: vector <T , std :: allocator <T > > Vector ; Ralph Langendam (NCIM-Groep) C++ 11 Januari 9th, 2013 21 / 39
  • 80. Usability enhancements Alias templatesAlias templates Templated typedefs were illegal in C++03. // Error : templated typedef not allowed . template < typename T > typedef std :: vector <T , std :: allocator <T > > Vector ; Possible workaround can lead to difficulties. template < typename T > class Vector : public std :: vector <T , std :: allocator <T > > {}; Ralph Langendam (NCIM-Groep) C++ 11 Januari 9th, 2013 21 / 39
  • 81. Usability enhancements Alias templatesAlias templates Templated typedefs were illegal in C++03. // Error : templated typedef not allowed . template < typename T > typedef std :: vector <T , std :: allocator <T > > Vector ; Possible workaround can lead to difficulties. template < typename T > class Vector : public std :: vector <T , std :: allocator <T > > {}; C++11 allows us to solve it like this. template < typename T > using Vector = std :: vector <T , std :: allocator <T > >; Ralph Langendam (NCIM-Groep) C++ 11 Januari 9th, 2013 21 / 39
  • 82. Usability enhancements Enumerations and UnionsEnumerations and Unions Ralph Langendam (NCIM-Groep) C++ 11 Januari 9th, 2013 22 / 39
  • 83. Usability enhancements Enumerations and UnionsEnumerations and UnionsStrongly typed enumerations Enumeration classes can no longer be implicitly converted to int. enum E ; // Error : unknown underlying type enum class E : unsigned long ; enum class E { A = 3 , B , C }; Ralph Langendam (NCIM-Groep) C++ 11 Januari 9th, 2013 22 / 39
  • 84. Usability enhancements Enumerations and UnionsEnumerations and UnionsStrongly typed enumerations Enumeration classes can no longer be implicitly converted to int. enum E ; // Error : unknown underlying type enum class E : unsigned long ; enum class E { A = 3 , B , C };Unrestricted unions Union members can be non-trivially constructible types, but the union constructor needs to be manually defined then. Ralph Langendam (NCIM-Groep) C++ 11 Januari 9th, 2013 22 / 39
  • 85. New functionalityOutline1 Timeline2 C++11 Development3 Run-time performance enhancements4 Usability enhancements5 New functionality Variadic templates Defaulted and deleted special methods6 Standard library enhancements7 Compiler support Ralph Langendam (NCIM-Groep) C++ 11 Januari 9th, 2013 23 / 39
  • 86. New functionality Variadic templatesVariadic templates Ralph Langendam (NCIM-Groep) C++ 11 Januari 9th, 2013 24 / 39
  • 87. New functionality Variadic templatesVariadic templates Templated types can have a variadic template parameter list. Ralph Langendam (NCIM-Groep) C++ 11 Januari 9th, 2013 24 / 39
  • 88. New functionality Variadic templatesVariadic templates Templated types can have a variadic template parameter list. Unlike variadic macros and functions, variadic templates are type-safe. Ralph Langendam (NCIM-Groep) C++ 11 Januari 9th, 2013 24 / 39
  • 89. New functionality Variadic templatesVariadic templates Templated types can have a variadic template parameter list. Unlike variadic macros and functions, variadic templates are type-safe. template < typename T , typename ... O > struct Tuple { T _value ; Tuple <O ... > _others ; explicit Tuple ( T value , O ... others ) : _value ( value ) , _others ( others ...) { } }; Ralph Langendam (NCIM-Groep) C++ 11 Januari 9th, 2013 24 / 39
  • 90. New functionality Variadic templatesVariadic templates Specialization: template < typename T > struct Tuple <T > { T _value ; explicit Tuple ( T value ) : _value ( value ) { } }; Ralph Langendam (NCIM-Groep) C++ 11 Januari 9th, 2013 25 / 39
  • 91. New functionality Variadic templatesVariadic templates Specialization: template < typename T > struct Tuple <T > { T _value ; explicit Tuple ( T value ) : _value ( value ) { } }; Usage: Tuple <int , double , bool > tuple (3 , 2. , true ) ; tuple . _value ; // == 3 tuple . _others . _value ; // == 2. tuple . _others . _others . _value ; // == true Ralph Langendam (NCIM-Groep) C++ 11 Januari 9th, 2013 25 / 39
  • 92. New functionality Variadic templatesstd::tuple Ralph Langendam (NCIM-Groep) C++ 11 Januari 9th, 2013 26 / 39
  • 93. New functionality Variadic templatesstd::tuple Better version provided by STL. # include < tuple > std :: tuple <int , double > idTuple (3 , 5.) ; std :: get <1 > ( idTuple ) ; // == 5. Ralph Langendam (NCIM-Groep) C++ 11 Januari 9th, 2013 26 / 39
  • 94. New functionality Variadic templatesstd::tuple Better version provided by STL. # include < tuple > std :: tuple <int , double > idTuple (3 , 5.) ; std :: get <1 > ( idTuple ) ; // == 5. std :: tuple <int , bool > ibTuple (4 , false ) ; idTuple = ibTuple ; // Error : different tuple types . Ralph Langendam (NCIM-Groep) C++ 11 Januari 9th, 2013 26 / 39
  • 95. New functionality Variadic templatesstd::tuple Better version provided by STL. # include < tuple > std :: tuple <int , double > idTuple (3 , 5.) ; std :: get <1 > ( idTuple ) ; // == 5. std :: tuple <int , bool > ibTuple (4 , false ) ; idTuple = ibTuple ; // Error : different tuple types . bool inserted ; std :: set <int >:: iterator i ; std :: set <int > s ; std :: tie (i , inserted ) = s . insert (3) ; Ralph Langendam (NCIM-Groep) C++ 11 Januari 9th, 2013 26 / 39
  • 96. New functionality Defaulted and deleted special methodsDefaulted special methods Ralph Langendam (NCIM-Groep) C++ 11 Januari 9th, 2013 27 / 39
  • 97. New functionality Defaulted and deleted special methodsDefaulted special methods Definition like class C { int i; }; defaults to class C { int i ; public : C () {} // Empty constructor C ( C const & c ) : i ( c . i ) {} // Copy constructor ~ C () {} // Default destructor C & operator = ( C const & c ) { // Assignment operator if ( this != & c ) { i = c.i; } return * this ; } }; Ralph Langendam (NCIM-Groep) C++ 11 Januari 9th, 2013 27 / 39
  • 98. New functionality Defaulted and deleted special methodsDefault and Delete Ralph Langendam (NCIM-Groep) C++ 11 Januari 9th, 2013 28 / 39
  • 99. New functionality Defaulted and deleted special methodsDefault and Delete C++11 allows control over these default methods. Ralph Langendam (NCIM-Groep) C++ 11 Januari 9th, 2013 28 / 39
  • 100. New functionality Defaulted and deleted special methodsDefault and Delete C++11 allows control over these default methods. class C { int i ; public : // Don ’t allow implicit empty construction C () = delete ; // Generate default implicit copy constructor C ( C const &) = default ; // Destructor and assignment operator left // implicitly default . }; Ralph Langendam (NCIM-Groep) C++ 11 Januari 9th, 2013 28 / 39
  • 101. New functionality Defaulted and deleted special methodsProhibit method calls Ralph Langendam (NCIM-Groep) C++ 11 Januari 9th, 2013 29 / 39
  • 102. New functionality Defaulted and deleted special methodsProhibit method calls deletecan also be used to prohibit calling methods with specific arguments. Ralph Langendam (NCIM-Groep) C++ 11 Januari 9th, 2013 29 / 39
  • 103. New functionality Defaulted and deleted special methodsProhibit method calls deletecan also be used to prohibit calling methods with specific arguments. struct S { void f ( double d ) ; // Prohibit calling f with float argument void f ( float ) = delete ; // Prohibit calling f with any argument // except double template < typename T > void f ( T ) = delete ; }; Ralph Langendam (NCIM-Groep) C++ 11 Januari 9th, 2013 29 / 39
  • 104. Standard library enhancementsOutline1 Timeline2 C++11 Development3 Run-time performance enhancements4 Usability enhancements5 New functionality6 Standard library enhancements Threading facilities Smart pointers Type traits7 Compiler support Ralph Langendam (NCIM-Groep) C++ 11 Januari 9th, 2013 30 / 39
  • 105. Standard library enhancements Threading facilitiesThreading facilities Ralph Langendam (NCIM-Groep) C++ 11 Januari 9th, 2013 31 / 39
  • 106. Standard library enhancements Threading facilitiesThreading facilities C++11 provides platform independent threading facilities. # include < thread > auto f ([] ( int & out , short in ) { out = 2* in ; }) ; int result (0) ; std :: thread t (f , std :: ref ( result ) , 3) ; t . join () ; // result == 6 Ralph Langendam (NCIM-Groep) C++ 11 Januari 9th, 2013 31 / 39
  • 107. Standard library enhancements Threading facilitiesThreading facilities C++11 provides platform independent threading facilities. # include < thread > auto f ([] ( int & out , short in ) { out = 2* in ; }) ; int result (0) ; std :: thread t (f , std :: ref ( result ) , 3) ; t . join () ; // result == 6 They’re accompanied by objects like mutexes, conditional variables and RAII locks. Ralph Langendam (NCIM-Groep) C++ 11 Januari 9th, 2013 31 / 39
  • 108. Standard library enhancements Threading facilitiesThreading facilities C++11 provides platform independent threading facilities. # include < thread > auto f ([] ( int & out , short in ) { out = 2* in ; }) ; int result (0) ; std :: thread t (f , std :: ref ( result ) , 3) ; t . join () ; // result == 6 They’re accompanied by objects like mutexes, conditional variables and RAII locks. Mutexes can be avoided by using atomic operations and memory barriers. Ralph Langendam (NCIM-Groep) C++ 11 Januari 9th, 2013 31 / 39
  • 109. Standard library enhancements Threading facilitiesThreading facilities C++11 provides platform independent threading facilities. # include < thread > auto f ([] ( int & out , short in ) { out = 2* in ; }) ; int result (0) ; std :: thread t (f , std :: ref ( result ) , 3) ; t . join () ; // result == 6 They’re accompanied by objects like mutexes, conditional variables and RAII locks. Mutexes can be avoided by using atomic operations and memory barriers. Asynchronous thread communication is facilitated by futures and promises. Ralph Langendam (NCIM-Groep) C++ 11 Januari 9th, 2013 31 / 39
  • 110. Standard library enhancements Threading facilitiesThreading facilities C++11 provides platform independent threading facilities. # include < thread > auto f ([] ( int & out , short in ) { out = 2* in ; }) ; int result (0) ; std :: thread t (f , std :: ref ( result ) , 3) ; t . join () ; // result == 6 They’re accompanied by objects like mutexes, conditional variables and RAII locks. Mutexes can be avoided by using atomic operations and memory barriers. Asynchronous thread communication is facilitated by futures and promises. Thread pools are planned for upcoming C++ standards. Ralph Langendam (NCIM-Groep) C++ 11 Januari 9th, 2013 31 / 39
  • 111. Standard library enhancements Smart pointersMemory leaksRalph Langendam (NCIM-Groep) C++ 11 Januari 9th, 2013 32 / 39
  • 112. Standard library enhancements Smart pointersMemory leaks How to avoid memory leaks? int * i ( new int (0) ) ; f ( i ) ; // Could throw delete i ; // Might be too lateRalph Langendam (NCIM-Groep) C++ 11 Januari 9th, 2013 32 / 39
  • 113. Standard library enhancements Smart pointersMemory leaks How to avoid memory leaks? int * i ( new int (0) ) ; f ( i ) ; // Could throw delete i ; // Might be too late Cumbersome alternative. int * i ( new int (1) ) ; try { f (i); } catch ( fException const & e ) { ... } delete i ;Ralph Langendam (NCIM-Groep) C++ 11 Januari 9th, 2013 32 / 39
  • 114. Standard library enhancements Smart pointersRAII as a solution Ralph Langendam (NCIM-Groep) C++ 11 Januari 9th, 2013 33 / 39
  • 115. Standard library enhancements Smart pointersRAII as a solution The problem doesn’t occur on the stack int i ; f (& i ) ; // May throw ; i is cleaned up Ralph Langendam (NCIM-Groep) C++ 11 Januari 9th, 2013 33 / 39
  • 116. Standard library enhancements Smart pointersRAII as a solution The problem doesn’t occur on the stack int i ; f (& i ) ; // May throw ; i is cleaned up Solution: Make a stack object responsible for deprecation of dynamically allocated space. Ralph Langendam (NCIM-Groep) C++ 11 Januari 9th, 2013 33 / 39
  • 117. Standard library enhancements Smart pointersRAII as a solution The problem doesn’t occur on the stack int i ; f (& i ) ; // May throw ; i is cleaned up Solution: Make a stack object responsible for deprecation of dynamically allocated space. RAII: Resource Acquisition Is Initialization. Ralph Langendam (NCIM-Groep) C++ 11 Januari 9th, 2013 33 / 39
  • 118. Standard library enhancements Smart pointersRAII as a solution The problem doesn’t occur on the stack int i ; f (& i ) ; // May throw ; i is cleaned up Solution: Make a stack object responsible for deprecation of dynamically allocated space. RAII: Resource Acquisition Is Initialization. C++11 improves on smart pointers implementing RAII. Ralph Langendam (NCIM-Groep) C++ 11 Januari 9th, 2013 33 / 39
  • 119. Standard library enhancements Smart pointersSmart pointers Ralph Langendam (NCIM-Groep) C++ 11 Januari 9th, 2013 34 / 39
  • 120. Standard library enhancements Smart pointersSmart pointers std::unique_ptr deprecates std::auto_ptr. # include < memory > std :: unique_ptr <int > i ( new int (0) ) ; // Error : no copy constructor std :: unique_ptr <int > j ( i ) ; Ralph Langendam (NCIM-Groep) C++ 11 Januari 9th, 2013 34 / 39
  • 121. Standard library enhancements Smart pointersSmart pointers std::unique_ptr deprecates std::auto_ptr. # include < memory > std :: unique_ptr <int > i ( new int (0) ) ; // Error : no copy constructor std :: unique_ptr <int > j ( i ) ; Joint ownership is facilitated by std::shared_ptr and std::weak_ptr. std :: shared_ptr <int > i ( new int (1) ) ; std :: shared_ptr <int > j ( i ) ; // Joint ownership // Doesn ’t contribute to reference counting std :: weak_ptr <int > w (i); std :: shared_ptr <int > k (w); Ralph Langendam (NCIM-Groep) C++ 11 Januari 9th, 2013 34 / 39
  • 122. Standard library enhancements Smart pointersSmart pointers std::unique_ptr deprecates std::auto_ptr. # include < memory > std :: unique_ptr <int > i ( new int (0) ) ; // Error : no copy constructor std :: unique_ptr <int > j ( i ) ; Joint ownership is facilitated by std::shared_ptr and std::weak_ptr. std :: shared_ptr <int > i ( new int (1) ) ; std :: shared_ptr <int > j ( i ) ; // Joint ownership // Doesn ’t contribute to reference counting std :: weak_ptr <int > w (i); std :: shared_ptr <int > k (w); Behaviour is similar to a real pointer. e.g. casting: std :: shared_ptr < Derived > d ( new Derived () ) ; std :: shared_ptr < Base > b ( std :: d y n a m i c _ pointer_cast < Base , Derived > ( d ) ) ; Ralph Langendam (NCIM-Groep) C++ 11 Januari 9th, 2013 34 / 39
  • 123. Standard library enhancements Type traitsType traits for TMP Ralph Langendam (NCIM-Groep) C++ 11 Januari 9th, 2013 35 / 39
  • 124. Standard library enhancements Type traitsType traits for TMP C++11 elaborates on type computation and transformation at compile time. Ralph Langendam (NCIM-Groep) C++ 11 Januari 9th, 2013 35 / 39
  • 125. Standard library enhancements Type traitsType traits for TMP C++11 elaborates on type computation and transformation at compile time. struct Base {}; struct Derived : Base {}; static_assert ( std :: is_base_of < Base , Derived >:: value , " Oops " ) ; Ralph Langendam (NCIM-Groep) C++ 11 Januari 9th, 2013 35 / 39
  • 126. Standard library enhancements Type traitsType traits for TMP C++11 elaborates on type computation and transformation at compile time. struct Base {}; struct Derived : Base {}; static_assert ( std :: is_base_of < Base , Derived >:: value , " Oops " ) ; template < typename T > struct Algorithm { static int Execute ( typename std :: conditional < std :: is_arithmetic <T >:: value , T , typename std :: add_lvalue_reference <T >:: type >:: type ); }; // int Execute ( int ) ; Algorithm <int >:: Execute (5) ; // int Execute ( std :: vector <int >&) ; Algorithm < std :: vector <int > >:: Execute ( v ) ; Ralph Langendam (NCIM-Groep) C++ 11 Januari 9th, 2013 35 / 39
  • 127. Compiler supportOutline1 Timeline2 C++11 Development3 Run-time performance enhancements4 Usability enhancements5 New functionality6 Standard library enhancements7 Compiler support8 Further reading Ralph Langendam (NCIM-Groep) C++ 11 Januari 9th, 2013 36 / 39
  • 128. Compiler supportCompiler support Ralph Langendam (NCIM-Groep) C++ 11 Januari 9th, 2013 37 / 39
  • 129. Compiler supportCompiler support C++11 covers about 40 subjects. Ralph Langendam (NCIM-Groep) C++ 11 Januari 9th, 2013 37 / 39
  • 130. Compiler supportCompiler support C++11 covers about 40 subjects. MSVC 2012 supports about half of them, while GCC 4.8 and CLang 3.1 are almost feature complete. Ralph Langendam (NCIM-Groep) C++ 11 Januari 9th, 2013 37 / 39
  • 131. Compiler supportCompiler support C++11 covers about 40 subjects. MSVC 2012 supports about half of them, while GCC 4.8 and CLang 3.1 are almost feature complete. Enabling C++ 11 is automatic for MSVC, but requires an additional commandline option -std=c++11 for GCC and CLang. Ralph Langendam (NCIM-Groep) C++ 11 Januari 9th, 2013 37 / 39
  • 132. Compiler supportCompiler support C++11 covers about 40 subjects. MSVC 2012 supports about half of them, while GCC 4.8 and CLang 3.1 are almost feature complete. Enabling C++ 11 is automatic for MSVC, but requires an additional commandline option -std=c++11 for GCC and CLang. TR2 is already being implemented in GCC. Ralph Langendam (NCIM-Groep) C++ 11 Januari 9th, 2013 37 / 39
  • 133. Further readingOutline1 Timeline2 C++11 Development3 Run-time performance enhancements4 Usability enhancements5 New functionality6 Standard library enhancements7 Compiler support8 Further reading Ralph Langendam (NCIM-Groep) C++ 11 Januari 9th, 2013 38 / 39
  • 134. Further readingFurther reading Thank you for your attention.Some resources for further reading. C++ Reference ISO C++ Boost C++ 11 Compiler support C++ 11 Wiki TR1 and TR2 Ralph Langendam (NCIM-Groep) C++ 11 Januari 9th, 2013 39 / 39

×