aboutsummaryrefslogtreecommitdiff
path: root/src/crepe/util/OptionalRef.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/crepe/util/OptionalRef.h')
-rw-r--r--src/crepe/util/OptionalRef.h36
1 files changed, 10 insertions, 26 deletions
diff --git a/src/crepe/util/OptionalRef.h b/src/crepe/util/OptionalRef.h
index 8417a25..3201667 100644
--- a/src/crepe/util/OptionalRef.h
+++ b/src/crepe/util/OptionalRef.h
@@ -23,20 +23,7 @@ public:
*
* \return Reference to this (required for operator)
*/
- OptionalRef<T> & operator=(T & ref);
- /**
- * \brief Check if this reference is not empty
- *
- * \returns `true` if reference is set, or `false` if it is not
- */
- explicit operator bool() const noexcept;
-
- /**
- * \brief Assign new reference
- *
- * \param ref Reference to assign
- */
- void set(T &) noexcept;
+ OptionalRef<T> & operator=(T & ref);
/**
* \brief Retrieve this reference
*
@@ -44,21 +31,19 @@ public:
*
* \throws std::runtime_error if this function is called while the reference it not set
*/
- T & get() const;
+ operator T &() const;
+ /**
+ * \brief Check if this reference is not empty
+ *
+ * \returns `true` if reference is set, or `false` if it is not
+ */
+ explicit operator bool() const noexcept;
+
/**
* \brief Make this reference empty
*/
void clear() noexcept;
- //! Copy constructor
- OptionalRef(const OptionalRef<T> &);
- //! Move constructor
- OptionalRef(OptionalRef<T> &&);
- //! Copy assignment
- OptionalRef<T> & operator=(const OptionalRef<T> &);
- //! Move assignment
- OptionalRef<T> & operator=(OptionalRef<T> &&);
-
private:
/**
* \brief Reference to the value of type \c T
@@ -68,7 +53,6 @@ private:
T * ref = nullptr;
};
-}
+} // namespace crepe
#include "OptionalRef.hpp"
-