|
| | Optional ()=default |
| |
| | Optional (const Optional &)=default |
| |
| | Optional (Optional &&)=default |
| |
| Optional & | operator= (const Optional &)=default |
| |
| Optional & | operator= (Optional &&)=default |
| |
| | Optional (Nullopt) noexcept |
| |
| template<typename Head , typename... Tail, std::enable_if_t<! IsOptional< std::decay_t< Head > >::value, int > = 0> |
| | Optional (Head &&head, Tail &&... tail) noexcept(std::is_nothrow_constructible_v< std::optional< Value >, Head, Tail... >) |
| |
| template<typename Other > |
| | Optional (const Optional< Other > &other) noexcept(std::is_nothrow_constructible_v< std::optional< Value >, const std::optional< Other > & >) |
| |
| template<typename Other > |
| | Optional (Optional< Other > &&other) noexcept(std::is_nothrow_constructible_v< std::optional< Value >, std::optional< Other > && >) |
| |
| template<typename Other , std::enable_if_t<! IsOptional< std::decay_t< Other > >::value, int > = 0> |
| Optional & | operator= (Other &&other) noexcept(std::is_nothrow_assignable_v< std::optional< Value >, Other >) |
| |
| template<typename Other > |
| Optional & | operator= (const Optional< Other > &other) noexcept(std::is_nothrow_assignable_v< std::optional< Value >, const std::optional< Other > & >) |
| |
| template<typename Other > |
| Optional & | operator= (Optional< Other > &&other) noexcept(std::is_nothrow_assignable_v< std::optional< Value >, std::optional< Other > && >) |
| |
| template<typename... Other> |
| auto & | emplace (Other &&... other) |
| |
| void | reset () noexcept |
| |
| void | swap (Optional &other) noexcept(std::is_nothrow_swappable_v< std::optional< Value > >) |
| |
| decltype(auto) | operator-> () |
| |
| decltype(auto) | operator-> () const |
| |
| decltype(auto) | operator* () |
| |
| decltype(auto) | operator* () const |
| |
| | operator bool () const noexcept |
| |
| bool | hasValue () const noexcept |
| |
| template<typename U > |
| decltype(auto) | orFallback (U &&fallback) const & |
| |
| template<typename U > |
| decltype(auto) | orFallback (U &&fallback) & |
| |
template<typename
Value>
class Optional< Value >
A simple optional type.
In new code, you should probably prefer using std::optional directly.
This is intended to stand-in for std::optional while JUCE's minimum supported language standard is lower than C++17. When the minimum language standard moves to C++17, this class will probably be deprecated, in much the same way that juce::ScopedPointer was deprecated in favour of std::unique_ptr after C++11.
This isn't really intended to be used by JUCE clients. Instead, it's to be used internally in JUCE code, with an API close-enough to std::optional that the types can be swapped with fairly minor disruption at some point in the future, but without breaking any public APIs.