GREM 3.12.0
Game/Rendering Engine Modules for C++
Loading...
Searching...
No Matches
Optional.hpp File Reference

Go to the source code of this file.

Classes

struct  grem::Nullopt
 Unit type for representing an empty Optional. More...
struct  grem::BadOptionalAccess
 Exception type that is thrown on an attempt to erroneously access an empty Optional when using a safe access function such as Optional::value(). More...
class  grem::Optional< T >
 Optional value type that holds either a value or no value. More...
struct  std::hash< grem::Optional< T > >

Namespaces

namespace  grem

Functions

template<typename T, typename U>
requires equality_comparable<T, U>
constexpr bool grem::operator== (const Optional< T > &a, const Optional< U > &b)
 Compare two optionals for equality.
template<typename T>
constexpr bool grem::operator== (Nullopt value, const Optional< T > &opt)
 Check if an optional is empty.
template<typename T>
constexpr bool grem::operator== (const Optional< T > &opt, Nullopt value)
 Check if an optional is empty.
template<typename T, typename U>
requires (!template_specialization_of<std::remove_cvref_t<U>, Optional> && equality_comparable<T, U>)
constexpr bool grem::operator== (const Optional< T > &opt, const U &value)
 Compare an optional to a value for equality.
template<typename T, typename U>
requires (!template_specialization_of<std::remove_cvref_t<U>, Optional> && equality_comparable<U, T>)
constexpr bool grem::operator== (const U &value, const Optional< T > &opt)
 Compare an optional to a value for equality.
template<typename T, typename U>
requires three_way_comparable<T, U>
constexpr std::compare_three_way_result_t< T, U > grem::operator<=> (const Optional< T > &a, const Optional< U > &b)
 Compare two optionals.
template<typename T>
constexpr std::strong_ordering grem::operator<=> (const Optional< T > &opt, Nullopt value)
 Compare an optional against an empty optional.
template<typename T, typename U>
requires (!template_specialization_of<std::remove_cvref_t<U>, Optional> && three_way_comparable<T, U>)
constexpr std::compare_three_way_result_t< T, U > grem::operator<=> (const Optional< T > &opt, const U &value)
 Compare an optional to a value.
template<typename T, typename U>
requires (!template_specialization_of<std::remove_cvref_t<U>, Optional> && three_way_comparable<U, T>)
constexpr std::compare_three_way_result_t< U, T > grem::operator<=> (const U &value, const Optional< T > &opt)
 Compare an optional to a value.

Variables

constexpr Nullopt grem::nullopt {0}
 Unit value representing an empty Optional.