bool is_equal(const memory_resource& other) const noexcept;
概要
今のオブジェクト(this)で確保(allocate)したメモリ領域が、otherによって解放(deallocate)でき、その逆も可能かをチェックする。
引数
other-- チェックするmemory_resourceオブジェクト
戻り値
return this->do_is_equal(other);
this->allocate()で確保したメモリ領域をother.deallocate()で問題なく解放でき、その逆も可能な場合にtrueとなる。
例
#include <iostream>
#include <memory_resource>
int main()
{
std::pmr::memory_resource* def_mr = std::pmr::get_default_resource();
std::pmr::memory_resource* nul_mr = std::pmr::null_memory_resource();
std::cout << std::boolalpha;
//引数として参照を取ることに注意
std::cout << def_mr->is_equal(*def_mr) << std::endl;
std::cout << def_mr->is_equal(*nul_mr) << std::endl;
}
出力
true
false
バージョン
言語
- C++17
処理系
- Clang: ??
- GCC: 9.1 ✅
- Visual C++: 2017 update 6 ✅