#ifndef TRIE_SRC_UTILITY_H_ #define TRIE_SRC_UTILITY_H_ namespace detail { template < typename Type > class optional_ptr { public: typedef typename std::add_pointer::type pointer; typedef Type element_type; optional_ptr(): value_(false, nullptr) { } optional_ptr(pointer ptr): value_(true, ptr) { } operator bool() const { return this->value_.first; } pointer get() const { return this->value_.second; } private: const std::pair value_; }; } #endif // TRIE_SRC_UTILITY_H_