From 936b2390d89f4e20380c060b39a670dc9fae873f Mon Sep 17 00:00:00 2001 From: ljfa-ag Date: Sun, 23 Aug 2015 10:24:00 +0200 Subject: Inline some methods --- include/value.h | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'include/value.h') diff --git a/include/value.h b/include/value.h index 4865c8fd1c..c51a862b4d 100644 --- a/include/value.h +++ b/include/value.h @@ -62,7 +62,7 @@ class value public: //Constructors value() noexcept {} - explicit value(std::unique_ptr&& t) noexcept; + explicit value(std::unique_ptr&& t) noexcept: tag_(std::move(t)) {} explicit value(tag&& t); //Moving @@ -87,10 +87,10 @@ public: * * If the value is uninitialized, the behavior is undefined. */ - operator tag&(); - operator const tag&() const; - tag& get(); - const tag& get() const; + operator tag&() { return get(); } + operator const tag&() const { return get(); } + tag& get() { return *tag_; } + const tag& get() const { return *tag_; } /** * @brief Returns a reference to the contained tag as an instance of T @@ -143,7 +143,7 @@ public: explicit operator const std::string&() const; ///Returns true if the value is not uninitialized - explicit operator bool() const; + explicit operator bool() const { return tag_ != nullptr; } /** * @brief In case of a tag_compound, accesses a tag by key with bounds checking @@ -189,10 +189,10 @@ public: const value& operator[](size_t i) const; ///Returns a reference to the underlying std::unique_ptr - std::unique_ptr& get_ptr(); - const std::unique_ptr& get_ptr() const; + std::unique_ptr& get_ptr() { return tag_; } + const std::unique_ptr& get_ptr() const { return tag_; } ///Resets the underlying std::unique_ptr to a different value - void set_ptr(std::unique_ptr&& t); + void set_ptr(std::unique_ptr&& t) { tag_ = std::move(t); } ///@sa tag::get_type tag_type get_type() const; -- cgit 0.0.5-2-1-g0f52