LoginSignup
1
0

More than 5 years have passed since last update.

std::functionからアロケータが消える

Posted at

 今現在、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 はアロケータを引数に取るコンストラクタをいくつか持っているが、そのセマンティクスは不明瞭である。また型消去を用いる都合上、アロケータを保持しその後コピー代入の際にアロケータを再び用いるなどの操作に技術的な問題がある。よってこれらのコンストラクタは除いてしまうべきである。

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0