2009-12-26

C++0xの新機能のリスト

どうやら、C++0xの本を執筆することになった。

ふと思えば、今まで一度も、C++0xの新機能がどのくらいあるのかということを考えたことがなかった。規格の変更は、もちろん大量にあるのだが、その中で、特に知っておくべき変更や追加というのは、どのくらいあるのか。整理するために、リストアップしてみた。このリストに載っていない機能や、既存の規格に対する変更で、特にユーザーも知っておくべきものがあれば、知らせて欲しい。

C++0xはまだドラフト段階だが、確実にこれは大きく変わらないだろうという機能は、かなりある。逆に、これはちょっとまだ分からないという機能もある。

言語機能

  • Rvalue Reference
  • auto
  • delctype
  • static_assert
  • Template Aliases
  • extern template
  • Variadic Templates
  • Initializer lists
  • Strongly Typed Enums
  • constexpr
  • inline namespace
  • attribute
  • alignment
    (alignof, aligned_storage, aligned_union, Alignment attribute)
  • Extending move semantics to *this
    (ref-qualifer for non-static member functions)
  • Making Local Classes more Useful
    (local class can be used as template arguments)
  • Extended friend Declarations
    (allows template argument to friend declaration)
  • Delegating Constructors
  • Explicit Conversion Operators
  • New Character Types in C++/UTF8 Literals
    (u8"...", u"...", U"...")
  • Universal Character Names in Literals
  • Right Angle Brackets
    makes std::vector< std::vector<int>> valid.
  • Default template argument for function template
  • Inheriting Constructors
  • lambda
  • Raw String Literals
  • Extending sizeof to apply to non-static data members without an object
  • Defaulted and Deleted Functions
  • Unrestricted Unions
  • Non-static data member initializers
    (allows initialization of non-static member variable with assign)
  • Forward declaration of enumerations
  • New function declaration syntax for deduced return types
    (maybe replaced by Unified Function Syntax)
  • Thread-Local Storage
    (should be explained with thread library)

言語機能に近いライブラリ

  • Move semantics
  • Adding extended integer types to C++.
    (<cstdint>)
  • thread
  • atomic
  • Exception Propagation
  • nested_exception
  • type_index
  • initializer_list
    (should be explained with core language feature)
  • type_index

ライブラリ

  • type traits
  • System error support
  • Compile-time rational arithmetic
  • Tuples
  • Function objects
    function, bind, ref, hash etc.
  • allocator
  • Time utilities
  • Container
    unordered associative containers and other changes.
  • Algorithms
  • Numerics library
    random, Generalized numeric operations, C Library etc...
  • Regular expression library

たぶん解説した方が良い項目

  • Synchronizing the C++ preprocessor with C99
    (steals C99's useful but ugly and evil preprocessor feature)
  • Changing Undefined Behavior into Diagnosable Errors
    for "if the Integer literal cannot be represented as a long int", "If the character following a backslash is not Character Escapes", and "Passing Non-POD Objects to Ellipsis"
  • Adding the long long type to C++
    (ugly way to declare 64bit integer for the sake of C99 compatibility)
  • Proposed addition of __func__ predefined identifier from C99
  • Reserved namespaces for POSIX
    just a reserved namespace. no more.
  • user defined literals
    (personaly I don't like it.)

現行ドラフトにまだ入っていないか、不安のある項目。

  • Unified Function Syntax
  • range-based for
    (drop of concept may affect this. current draft use ADL. A bit unstable I guess.)

現行C++と、表面上はほとんど変わっていないが、解説すべき項目

  • class
    (grammer)
  • template
    grammer, Name(Dependant name), Instantiation(Two phase lookup), Argument deduction, SFINAE
  • meta programming
  • Function Object
  • Iterator
  • ADL
  • overload resolution

4 comments:

  1. おめでとう!(まだ早い?)

    ReplyDelete
  2. どうやらC++0x標準化委員会の人にも名前を覚えてもらえたようですね
    おめでとう人柱さん!
    そうやって有名な人の輪が拡がってその中に入って行って人生が大きく
    変わる事もありますから

    ReplyDelete
  3. おめでとうございます!

    ReplyDelete

You can use some HTML elements, such as <b>, <i>, <a>, also, some characters need to be entity referenced such as <, > and & Your comment may need to be confirmed by blog author. Your comment will be published under GFDL 1.3 or later license with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts.