Skip to content

Commit 89d52e3

Browse files
committed
add OptionalReference::has_value
1 parent 0d15ad8 commit 89d52e3

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

include/MGIS/Utilities/OptionalReference.hxx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ namespace mgis {
2222
* \brief a class that may contain a reference to a class
2323
*
2424
* \note this class was introduced by of the lack of optional
25-
* references befor to C++-26.
25+
* references prior to C++-26.
2626
* \note the design of the class is loosely modeled by the
2727
* std::experimental::observer_ptr proposal
2828
*/
@@ -66,6 +66,10 @@ namespace mgis {
6666

6767
constexpr pointer operator->() const noexcept { return this->ptr; }
6868

69+
[[nodiscard]] constexpr bool has_value() const noexcept {
70+
return this->ptr != nullptr;
71+
}
72+
6973
[[nodiscard]] constexpr operator bool() const noexcept {
7074
return this->ptr != nullptr;
7175
}

0 commit comments

Comments
 (0)