From 9d57e5b16843759ca97d3cdc6f0310cf4527810a Mon Sep 17 00:00:00 2001 From: zheng_wenlong Date: Fri, 30 Nov 2018 13:23:46 +0900 Subject: add aw navigation --- include/mapbox/optional.hpp | 74 --------------------------------------------- 1 file changed, 74 deletions(-) delete mode 100644 include/mapbox/optional.hpp (limited to 'include/mapbox/optional.hpp') diff --git a/include/mapbox/optional.hpp b/include/mapbox/optional.hpp deleted file mode 100644 index d84705c..0000000 --- a/include/mapbox/optional.hpp +++ /dev/null @@ -1,74 +0,0 @@ -#ifndef MAPBOX_UTIL_OPTIONAL_HPP -#define MAPBOX_UTIL_OPTIONAL_HPP - -#pragma message("This implementation of optional is deprecated. See https://github.com/mapbox/variant/issues/64.") - -#include -#include - -#include - -namespace mapbox { -namespace util { - -template -class optional -{ - static_assert(!std::is_reference::value, "optional doesn't support references"); - - struct none_type - { - }; - - variant variant_; - -public: - optional() = default; - - optional(optional const& rhs) - { - if (this != &rhs) - { // protect against invalid self-assignment - variant_ = rhs.variant_; - } - } - - optional(T const& v) { variant_ = v; } - - explicit operator bool() const noexcept { return variant_.template is(); } - - T const& get() const { return variant_.template get(); } - T& get() { return variant_.template get(); } - - T const& operator*() const { return this->get(); } - T operator*() { return this->get(); } - - optional& operator=(T const& v) - { - variant_ = v; - return *this; - } - - optional& operator=(optional const& rhs) - { - if (this != &rhs) - { - variant_ = rhs.variant_; - } - return *this; - } - - template - void emplace(Args&&... args) - { - variant_ = T{std::forward(args)...}; - } - - void reset() { variant_ = none_type{}; } - -}; // class optional - -} // namespace util -} // namespace mapbox - -#endif // MAPBOX_UTIL_OPTIONAL_HPP -- cgit 1.2.3-korg