From d711fcd0f16b7180a29e0eb4195faaea853d821c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Patrick=20L=C3=BChne?= Date: Fri, 12 May 2017 14:31:26 +0200 Subject: [PATCH] Removed unneeded class. --- lib/pddlparse/include/pddlparse/Variant.h | 49 ----------------------- 1 file changed, 49 deletions(-) diff --git a/lib/pddlparse/include/pddlparse/Variant.h b/lib/pddlparse/include/pddlparse/Variant.h index 8e10e86..6482187 100644 --- a/lib/pddlparse/include/pddlparse/Variant.h +++ b/lib/pddlparse/include/pddlparse/Variant.h @@ -127,55 +127,6 @@ struct VariantHolder : VariantHolder{ } -template -class Optional { -public: - Optional() { } - Optional(T const &x) : data_(new T(x)) { } - Optional(T &x) : data_(new T(x)) { } - Optional(T &&x) : data_(new T(std::move(x))) { } - template - Optional(Args&&... x) : data_(new T{std::forward(x)...}) { } - Optional(Optional &&opt) noexcept : data_(opt.data_.release()) { } - Optional(Optional const &opt) : data_(opt ? new T(*opt.get()) : nullptr) { } - Optional &operator=(T const &x) { - clear(); - data_.reset(new T(x)); - } - Optional &operator=(T &x) { - clear(); - data_.reset(new T(x)); - } - Optional &operator=(T &&x) { - clear(); - data_.reset(new T(std::move(x))); - } - Optional &operator=(Optional &&opt) noexcept { - data_ = std::move(opt.data_); - } - Optional &operator=(Optional const &opt) { - clear(); - data_.reset(opt ? new T(*opt.get()) : nullptr); - } - T *get() { return data_.get(); } - T const *get() const { return data_.get(); } - T *operator->() { return get(); } - T const *operator->() const { return get(); } - T &operator*() & { return *get(); } - T const &operator*() const & { return *get(); } - T &&operator*() && { return std::move(*get()); } - T const &&operator*() const && { return std::move(*get()); } - template - void emplace(Args&&... x) { - clear(); - data_(new T{std::forward(x)...}); - } - void clear() { data_.reset(nullptr); } - explicit operator bool() const { return data_.get() != nullptr; } -private: - std::unique_ptr data_; -}; - template class Variant { using Holder = detail::VariantHolder<1, T...>;