std::experi...do_is_equal(3)

πŸ“¦ version 2024.07.05, in nixpkgs unstable, opensuse-leap 16.0

hii bestie πŸ’– welcome to std::experi...do_is_equal(3), a page from the C++ Standard Libary manual (yes, that's the spelling from the page, I don't make the rules πŸ’…). this one is short, iconic, and fully about vibe-checking equality between memory resources. let's get into it 🫢

✨ NAME ✨

std::experimental::pmr::memory_resource::do_is_equal β€” std::experimental::pmr::memory_resource::do_is_equal

(yes bestie, the page literally names it twice; not me making that up πŸ’…)

🌸 Synopsis 🌸

virtual bool is_equal( const memory_resource& other )      (library
fundamentals TS)
const noexcept = 0;

okay so this is the library fundamentals TS version, and the (library fundamentals TS) note is just hanging out there β€” still, the signature is the signature. also: = 0 means it's pure virtual, so a derived class has to bring the actual implementation. no cap.

Compares *this for equality with other. Two memory_resources compare equal if and only if memory allocated from one memory_resource can be deallocated from the other and vice versa. that's the whole equality contract, and it's honestly kind of iconic πŸ”₯

🧠 Notes 🧠

The most-derived type of other may not match the most derived type of *this. so a derived class implementation therefore must typically check whether the most derived types of *this and other match using dynamic_cast, and immediately return false if the cast fails. like, do not pass go, do not collect vibes, just false πŸ’€

bestie reminder: dynamic_cast check first, early false if it fails. that's the vibe check.

πŸ‘€ See also πŸ‘€

  • is_equal β€” compare for equality with another memory_resource (public member function)

🏷️ Category: 🏷️

  • Noindexed pages

source: http://cppreference.com Β· version/date: 2024.06.10 Β· page: std::experi...do_is_equal(3) β€” bye bestie, go deallocate responsibly and slay πŸ’–βœ¨πŸŽ€

πŸ“¦ where this page comes from