From abafb52f37beb5659efc2105ccd1568e1f754898 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Konstantin=20Ka=CC=88fer?= Date: Thu, 4 Dec 2014 18:29:42 +0100 Subject: make most headers private --- include/mbgl/util/optional.hpp | 69 ------------------------------------------ 1 file changed, 69 deletions(-) delete mode 100644 include/mbgl/util/optional.hpp (limited to 'include/mbgl/util/optional.hpp') diff --git a/include/mbgl/util/optional.hpp b/include/mbgl/util/optional.hpp deleted file mode 100644 index 133e2c8f97..0000000000 --- a/include/mbgl/util/optional.hpp +++ /dev/null @@ -1,69 +0,0 @@ -#ifndef MAPBOX_UTIL_OPTIONAL_HPP -#define MAPBOX_UTIL_OPTIONAL_HPP - -#include - -#include "variant.hpp" - -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{}; } -}; -} -} - -#endif -- cgit v1.2.1