From 5d98ec36d66db8897f7e3e5120b43c50f379baea Mon Sep 17 00:00:00 2001 From: zheng_wenlong Date: Wed, 14 Nov 2018 12:50:56 +0900 Subject: Add tbtnavi for vertical mode Add tbtnavi for vertical mode. This application use waltham transmitter send video to horizontal mode. Change-Id: Icc8bb14f9c83439d90f28d0960e435a43a5e5245 Signed-off-by: zheng_wenlong --- .../tbtnavi_demo/include/mapbox/optional.hpp | 74 ++++++++++++++++++++++ 1 file changed, 74 insertions(+) create mode 100644 demo3/vertical/tbtnavi_demo/include/mapbox/optional.hpp (limited to 'demo3/vertical/tbtnavi_demo/include/mapbox/optional.hpp') diff --git a/demo3/vertical/tbtnavi_demo/include/mapbox/optional.hpp b/demo3/vertical/tbtnavi_demo/include/mapbox/optional.hpp new file mode 100644 index 0000000..d84705c --- /dev/null +++ b/demo3/vertical/tbtnavi_demo/include/mapbox/optional.hpp @@ -0,0 +1,74 @@ +#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