| 515 | } |
| 516 | |
| 517 | TMutableRef TSharedRefArrayBuilder::AllocateAndAdd(size_t size) |
| 518 | { |
| 519 | YT_ASSERT(CurrentPartIndex_ < Impl_->Size()); |
| 520 | YT_ASSERT(CurrentAllocationPtr_ + size <= Impl_->GetBeginAllocationPtr() + AllocationCapacity_); |
| 521 | TMutableRef ref(CurrentAllocationPtr_, size); |
| 522 | CurrentAllocationPtr_ += size; |
| 523 | TSharedRangeHolderPtr holder(Impl_.Get(), false); |
| 524 | TSharedRef sharedRef(ref, std::move(holder)); |
| 525 | Add(std::move(sharedRef)); |
| 526 | return ref; |
| 527 | } |
| 528 | |
| 529 | TSharedRefArray TSharedRefArrayBuilder::Finish() |
| 530 | { |