Commit 97bfd91d authored by Dominik Charousset's avatar Dominik Charousset

Merge pull request #104 from mavam/unstable

Tweaks to optional<T> to comply with the interface of std::optional<T>.
parents fced2111 c5d5a108
......@@ -62,7 +62,7 @@ class optional {
/**
* @post <tt>valid() == false</tt>
*/
optional(const none_t&) : m_valid(false) { }
optional(const none_t& = none) : m_valid(false) { }
/**
* @brief Creates an @p option from @p value.
......@@ -141,6 +141,22 @@ class optional {
return m_value;
}
/**
* @brief Returns the value.
*/
inline const T* operator->() const {
CPPA_REQUIRE(valid());
return &m_value;
}
/**
* @brief Returns the value.
*/
inline T* operator->() {
CPPA_REQUIRE(valid());
return &m_value;
}
/**
* @brief Returns the value.
*/
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment