今現在、C++1zのドラフトを読みながらC++17に備えているところなのですが、なんとn4618によるとstd::function
のコンストラクタからアロケータが削除されるようですね。これを見て私はもしやstd::function
が動的なメモリ確保をしなくなるのかと思いましたが、ドラフトとproposalを見るとどうやら動的なメモリ確保自体はする可能性が残るようです。
これは……実装依存に悩まされることの多いC++愛好家としてはどうなんでしょうかねぇ……。
quote from: proposal p0302r1
The class template std::function has several constructors that take an allocator argument, but the semantics are unclear, and there are technical issues with storing an allocator in a type-erased context and then recovering that allocator later for any allocations needed during copy assignment. Those constructors should be removed.
// 超訳
クラステンプレート std::function はアロケータを引数に取るコンストラクタをいくつか持っているが、そのセマンティクスは不明瞭である。また型消去を用いる都合上、アロケータを保持しその後コピー代入の際にアロケータを再び用いるなどの操作に技術的な問題がある。よってこれらのコンストラクタは除いてしまうべきである。