C++0x Committee Draftに対するコメント

12/5(金)に開催されるC++WGアドホック会議ですが、
この会議ではCommittee Draftに対する日本のコメントを決めるための議論を行います。


そこで、Committee Draftに対するコメントを募集します。

いただいたコメントはアドホック会議にて議論しますので、問題点見つけたら教えてください。


Comittee Draftは以下からダウンロードできます。

N2798 Working Draft, Standard for Programming Language C++


コメントは以下のようなフォーマットになります。

1)章番号,パラグラフ番号
2)指摘内容
3)どのように修正を要求するか

全般に関わるコメントについては、章番号とパラグラフは不要です。


コメントは12/2(火)までに、このエントリに対してコメント、トラックバックもしくは私に直接メールください。


ちなみに、私からは今のところ以下のようなコメントを出しています。




1) 5.1 パラグラフ7, 7.1.6.2 パラグラフ1
2) decltypeにスコープ解決演算子(::)を使用できない。
decltypeはインスタンスの型を取得することができるので、
decltypeを使用してインスタンスからメンバの型(nested-type)を取得したいです。

vector<int> v;
decltype(v)::value_type i = 0; // int i = 0;

現在のCDではdecltypeに対して::を使用することが許可されていないため、
std::identityとdecltypeを組み合わせた以下のようなマクロが多用されてしまうでしょう。

   #define TYPEOF(X) std::identity<decltype(X)>::type

   vector<int> v;
   TYPEOF(v)::value_type i = 0;

インスタンスからメンバの型(nested-type)を取得することは、autoよりも型の明示性を上げることにもつながるため有用になるでしょう。


3) 型の分類を以下のように修正していただきたいです

  7.1.6.2 パラグラフ1

  simple-type-specifier:
    ::opt nested-name-specifier opt type-name
    ::opt nested-name-specifier template simple-template-id
    ...
    void
    auto
    decltype ( expression ) // 削除

  type-name
    class-name
    enum-name
    typedef-name

  5.1 パラグラフ7

  nested-name-specifier:
    type-name ::
    namespace-name ::
    nested-name-specifier identifier ::
    nested-name-specifier templateopt simple-template-id ::
    nested-name-specifieropt concept-id ::
    decltype ( expression ) // 追加

1) 14.8.2 パラグラフ6
2) SFINAEの説明に誤字
3) it is isとなっていて、isが多いです。


変更前

At certain points in the template argument deduction process it is is necessary to take a function type that makes use of template parameters and replace those template parameters with the corresponding template arguments.

変更後

At certain points in the template argument deduction process it is necessary to take a function type that makes use of template parameters and replace those template parameters with the corresponding template arguments.

テンプレート引数推論プロセスでのあるポイントでは、テンプレートパラメータを利用する関数型をとり、それらのテンプレートパラメーターを対応するテンプレート引数に置き換えることが必要です。


1) 26.4.8.5.1
2) discrete_distributionにinitializer_list版のコンストラクタがほしい
3) discrete_distributionは、範囲(イテレータ)によって分布を作成しますが
イテレータを渡すためにはコンテナや配列の一時変数が必要になってしまいます。

int ar[] = {1, 2, 3};
discrete_distribution<> dist(ar, ar+3);

このような初期化は、他のライブラリではinitializer_listも受け取れるオーバーロードを用意しているので、discrete_distributionにも同様にinitializer_list版のコンストラクタがほしいです。

namespace std {
 template <class IntType = int>
 class discrete_distribution {
 public:
   typedef IntType result_type;
   typedef unspecified param_type;

   discrete_distribution();
   template <class InputIterator>
   discrete_distribution(InputIterator firstW, InputIterator lastW);
   discrete_distribution(initializer_list<result_type>); // 追加
   explicit discrete_distribution(const param_type& parm);
   ...
 };
}

1) ライブラリ全般
2) char16_t/char32_t対応が不十分
3) , , のbasic_xxx系クラスのtypedefがchar16_t/char32_tに対応していません。
21.4 Numeric Conversionのstoi, to_string系の関数がchar16_t/char32_tに対応していません。

長いので省略・・・