<feed xmlns='http://www.w3.org/2005/Atom'>
<title>ydb/library/cpp/yt/memory/exact_ref_counted_cast.h, branch main</title>
<subtitle>Mirror of YDB github repos</subtitle>
<id>https://code.mastervirt.ru/ydb/atom?h=main</id>
<link rel='self' href='https://code.mastervirt.ru/ydb/atom?h=main'/>
<link rel='alternate' type='text/html' href='https://code.mastervirt.ru/ydb/'/>
<updated>2026-06-24T09:39:10Z</updated>
<entry>
<title>Add ExactRefCountedCast and TRef::Contains</title>
<updated>2026-06-24T09:39:10Z</updated>
<author>
<name>babenko</name>
<email>babenko@yandex-team.com</email>
</author>
<published>2026-06-24T08:20:18Z</published>
<link rel='alternate' type='text/html' href='https://code.mastervirt.ru/ydb/commit/?id=7493b7938546308fc8ead81e411e05c73b1ce9e4'/>
<id>urn:sha1:7493b7938546308fc8ead81e411e05c73b1ce9e4</id>
<content type='text'>
Some handy helpers.

`ExactRefCountedCast&lt;T&gt;(p)`: exact-type downcast for `New&lt;T&gt;()`-allocated objects. `New&lt;T&gt;(`) builds a final `TRefCountedWrapper&lt;T&gt;`, so this casts to the wrapper and upcasts back to `T*`; being final, the `dynamic_cast` lowers to a single `type_info` compare (~2ns vs ~20ns for the is-a path).

`TRef::Contains(other)`: true iff other's range lies within this range.
commit_hash:138e8719b8ecbd953437b81380e54f736db029ef
</content>
</entry>
</feed>
