#pragma once #include #include #include namespace NYql { template class TLazyInitHolder : public TPointerBase, T> { public: using TFactory = std::function()>; TLazyInitHolder(TFactory&& factory) : Factory(std::move(factory)) { } T* Get() const noexcept { if (!Value) { Value = Factory(); } return Value.Get(); } inline explicit operator bool() const noexcept { return !!Value.Get(); } private: TFactory Factory; mutable THolder Value; }; } // NYql