C++ 0X feature summary cheat sheat

copyright (C) 2011-2017 iesensor.com

C++ 0X feature summary cheat sheat

// based on wiki page contents: C++ 0X

2 Extensions to the C++ core language

3 Core language runtime performance enhancements

3.1 Rvalue reference and move semantics => chain function calling

3.2 Generalized constant expressions => constexpr

3.3 Modification to the definition of plain old data => looser POD requirement

4 Core language build time performance enhancements

4.1 Extern template => see detail on wiki, why it is necessary

5 Core language usability enhancements

5.1 Initializer lists => std::initializer_list<T>

5.2 Uniform initialization =>

5.3 Type inference => auto as function return

5.4 Range-based for-loop => for (auto x:{})

5.5 Lambda functions and expressions => C# style

[x, &y](int x, int y) -> int { int z = x + y; return z + x; }

5.6 Alternative function syntax => decltype

5.7 Object construction improvement =>

5.8 Explicit virtual function overrides => override keyword

5.9 Null pointer constant => nullptr

5.10 Strongly typed enumerations => type safety,not int any longer

enum class Color { red, blue, green };

5.11 Right angle bracket => good for template declear

5.12 Explicit conversion operators => explicit keyword

5.13 Template aliases => using TypedefName = SomeType<OtherType, Second, 5>;

5.14 Unrestricted unions => safe union allocated on steak

6 Core language functionality improvements

6.1 Variadic templates => template<typename… Values> class tuple;

6.2 New string literals => u8″” utf8; U”” utf32; raw string R”” ;u”” utf16

6.3 User-defined literals

=> OutputType operator “” _suffix(const char *literal_string);

6.4 Multitasking memory model => asynchronous message std::future

6.5 Thread-local storage => std::thread_local

6.6 Explicitly-defaulted and deleted special member functions

6.7 Type long long int => C99

6.8 Static assertions => static_assert(expr)

6.9 Allow sizeof to work on members of classes without an explicit object

6.10 Allow garbage collected implementations => just ABI

7 C++ standard library changes (std::tr1)

7.1 Upgrades to standard library components

Decltype ; Explicit conversion operators ; Default/Deleted functions

7.2 Threading facilities =>std::thread

7.3 Tuple types =>std::tuple<type1, type2,…>()

7.4 Hash tables => std::unordered_set/map/multimap

7.5 Regular expressions => std::regex_search(string target, std::cmatch, std::regex ) )

7.6 General-purpose smart pointers

=> 5 kinds of smart ptr <memory>, Resource Acquisition Is Initialization (RAII) idiom

7.7 Extensible random number facility => <random>

7.8 Wrapper reference => Boost.Ref <functional>- cref, ref, reference_wrapper

7.9 Polymorphic wrappers for function objects =>

7.10 Type traits for metaprogramming =>

7.11 Uniform method for computing the return type of function objects

=> Future: boost::filesystem boost::result_of Function return types

9 Features to be removed or deprecated

The term sequence point, which is being replaced by specifying that either one operation is sequenced before another, or that two operations are unsequenced.[8]

export ; exception specifications; std::auto_ptr

Function object base classes (std::unary_function, std::binary_function), adapters to pointers to functions and adapters to pointers to members, binder classes.

 

BSD documentation licensed Free for non-commercial usage only
Author: Qingfeng XIA copyright (C) 2011-2013 http://www.iesensor.com
please keep the original link in your reference. http://www.iesensor.com/blog/2011/05/31/c-0x-feature-summary-cheat-sheat/
This entry was posted in Programming. Bookmark the permalink.