| 745 | |
| 746 | template <class T, class TRefCountedPtr> |
| 747 | void TPointerTest::TestRefCountedPtrsInHashSetImpl() { |
| 748 | THashSet<TRefCountedPtr> hashSet; |
| 749 | TRefCountedPtr p1(new T()); |
| 750 | UNIT_ASSERT(!IsIn(hashSet, p1)); |
| 751 | UNIT_ASSERT(hashSet.insert(p1).second); |
| 752 | UNIT_ASSERT(IsIn(hashSet, p1)); |
| 753 | UNIT_ASSERT_VALUES_EQUAL(hashSet.size(), 1); |
| 754 | UNIT_ASSERT(!hashSet.insert(p1).second); |
| 755 | |
| 756 | TRefCountedPtr p2(new T()); |
| 757 | UNIT_ASSERT(!IsIn(hashSet, p2)); |
| 758 | UNIT_ASSERT(hashSet.insert(p2).second); |
| 759 | UNIT_ASSERT(IsIn(hashSet, p2)); |
| 760 | UNIT_ASSERT_VALUES_EQUAL(hashSet.size(), 2); |
| 761 | } |
| 762 | |
| 763 | struct TCustomIntrusivePtrOps: TDefaultIntrusivePtrOps<A> { |
| 764 | }; |