#pragma once #ifndef NON_NULL_PTR_H_ #error "Direct inclusion of this file is not allowed, include helpers.h" // For the sake of sane code completion. #include "non_null_ptr.h" #endif #include namespace NYT { //////////////////////////////////////////////////////////////////////////////// template TNonNullPtrBase::TNonNullPtrBase(T* ptr) noexcept : Ptr_(ptr) { YT_VERIFY(ptr); } template T* TNonNullPtrBase::operator->() const noexcept { return Ptr_; } template T& TNonNullPtrBase::operator*() const noexcept { return *Ptr_; } template TNonNullPtrBase::TNonNullPtrBase() noexcept : Ptr_(nullptr) { } template TNonNullPtr GetPtr(T& ref) noexcept { TNonNullPtr ptr; ptr.Ptr_ = &ref; return ptr; } //////////////////////////////////////////////////////////////////////////////// } // namespace NYT