- memory_resource[meta header]
- function[meta id-type]
- std::pmr[meta namespace]
- memory_resource[meta class]
- cpp17[meta cpp]
virtual bool do_is_equal(const memory_resource& other) const noexcept = 0;今のオブジェクト(this)で確保(allocate)したメモリ領域が、otherによって解放(deallocate)でき、その逆も可能かをチェックする。
other-- チェックするmemory_resourceオブジェクト
this->allocate()で確保したメモリ領域をother.deallocate()で問題なく解放でき、その逆も可能な場合にtrueを返す。
thisとotherの指すオブジェクトは必ずしも同じ型ではない可能性があるので、実装ではdynamic_castによってthisとotherの指すオブジェクトの型が一致することをチェックし、さもなければ直ちにfalseを返す必要がある。
つまり、あるmemory_resourceの実装(派生クラス)Dはこの関数実装内で最初にdynamic_cast<const D*>(&other) == nullptrをチェックし、結果がtrueならば直ちにfalseを返すようにする必要がある。
- C++17
- Clang: ??
- GCC: 9.1 [mark verified]
- Visual C++: 2017 update 6 [mark verified]