#pragma once #include template struct TStdIAllocator { using value_type = Type; using pointer = Type*; using const_pointer = const Type*; using reference = Type&; using const_reference = const Type&; using size_type = size_t; using difference_type = ptrdiff_t; template // NOLINTNEXTLINE(google-explicit-constructor) TStdIAllocator(const TStdIAllocator& other) noexcept : Allocator(other.Allocator) { } template struct rebind { // NOLINT(readability-identifier-naming) using other = TStdIAllocator; }; template bool operator==(const TStdIAllocator& other) const { return Allocator == other.Allocator; } template bool operator!=(const TStdIAllocator& other) const { return Allocator != other.Allocator; } pointer allocate(size_type n, const void* = nullptr) // NOLINT(readability-identifier-naming) { return (pointer)Allocator->Allocate(n * sizeof(value_type)).Data; } void deallocate(const_pointer p, size_type n) noexcept // NOLINT(readability-identifier-naming) { return Allocator->Release(IAllocator::TBlock{.Data = (void*)p, .Len = n * sizeof(value_type)}); } // NOLINTNEXTLINE(google-explicit-constructor) TStdIAllocator(IAllocator* allocator) : Allocator(allocator) { } IAllocator* Allocator; };