#pragma once #include namespace NKikimr { namespace NMiniKQL { template > class TStateWrapper; template class TStateWrapper { public: TStateWrapper(const void* ptr) : State_(ReadUnaligned::type>(ptr)) { } T* Get() { return &State_; } T* operator->() { return Get(); } private: T State_; }; template class TStateWrapper { public: TStateWrapper(void* ptr) : State_(ReadUnaligned(ptr)) , Ptr_(ptr) { } ~TStateWrapper() { WriteUnaligned(Ptr_, State_); } T* Get() { return &State_; } T* operator->() { return Get(); } private: T State_; void* Ptr_; }; template inline TStateWrapper MakeStateWrapper(void* ptr) { return TStateWrapper(ptr); } template inline TStateWrapper MakeStateWrapper(const void* ptr) { return TStateWrapper(ptr); } template inline T Cast(T t) { return t; } inline NYql::NDecimal::TDecimal Cast(const std::shared_ptr& buffer) { return *reinterpret_cast(buffer->data()); } } }