yohhoyの日記

技術的メモをしていきたい日記

bind placeholderの最大数

C++11標準ライブラリに新しく追加された std::bind で利用する、引数のプレースホルダ( std::placeholders::_1 とか)の最大数についてメモ。

  • C++11標準規格では少なくとも _1,... _10 まで定義される。処理系定義。
  • Boost.Bindでは _1,... _9 まで提供する。(boost 1.48.0)

N3337 20.8.9.1.3, Annex B Implementation quantitiesより引用。

namespace std { namespace placeholders {
 // M is the implementation-defined number of placeholders
 extern unspecified _1;
 ...
 extern unspecified _M;
}}

- Number of placeholders (20.8.9.1.3) [10].