#pragma once #include "glog/logging.h" // Like option just for pointers. More efficent than option. template class OptionPtr { public: OptionPtr() {} OptionPtr(T *ptr) : ptr(ptr) {} bool is_present() { return ptr != nullptr; } T *get() { DCHECK(is_present()) << "Data is not present."; return ptr; } private: T *ptr = nullptr; }; template auto make_option_ptr(T *t) { return OptionPtr(t); }