Loading...
Searching...
No Matches
juce::Optional< Value > Class Template Reference

Detailed Description

template<typename Value>
class juce::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.


The documentation for this class was generated from the following file:

Public Member Functions

 Optional ()=default
 Optional (const Optional &)=default
 Optional (Optional &&)=default
Optionaloperator= (const Optional &)=default
Optionaloperator= (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>
Optionaloperator= (Other &&other) noexcept(std::is_nothrow_assignable_v< std::optional< Value >, Other >)
template<typename Other>
Optionaloperator= (const Optional< Other > &other) noexcept(std::is_nothrow_assignable_v< std::optional< Value >, const std::optional< Other > & >)
template<typename Other>
Optionaloperator= (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) &

Constructors and Destructors

◆ Optional() [1/7]

template<typename Value>
juce::Optional< Value >::Optional ( )
default

◆ Optional() [2/7]

template<typename Value>
juce::Optional< Value >::Optional ( const Optional< Value > & )
default

References Optional.

◆ Optional() [3/7]

template<typename Value>
juce::Optional< Value >::Optional ( Optional< Value > && )
default

References Optional.

◆ Optional() [4/7]

template<typename Value>
juce::Optional< Value >::Optional ( Nullopt )
inlinenoexcept

◆ Optional() [5/7]

template<typename Value>
template<typename Head, typename... Tail, std::enable_if_t<! IsOptional< std::decay_t< Head > >::value, int > = 0>
juce::Optional< Value >::Optional ( Head && head,
Tail &&... tail )
inlinenoexcept

◆ Optional() [6/7]

template<typename Value>
template<typename Other>
juce::Optional< Value >::Optional ( const Optional< Other > & other)
inlinenoexcept

References Optional.

◆ Optional() [7/7]

template<typename Value>
template<typename Other>
juce::Optional< Value >::Optional ( Optional< Other > && other)
inlinenoexcept

References Optional.

Member Functions

◆ operator=() [1/5]

template<typename Value>
Optional & juce::Optional< Value >::operator= ( const Optional< Value > & )
default

References Optional.

◆ operator=() [2/5]

template<typename Value>
Optional & juce::Optional< Value >::operator= ( Optional< Value > && )
default

References Optional.

◆ operator=() [3/5]

template<typename Value>
template<typename Other, std::enable_if_t<! IsOptional< std::decay_t< Other > >::value, int > = 0>
Optional & juce::Optional< Value >::operator= ( Other && other)
inlinenoexcept

References Optional.

◆ operator=() [4/5]

template<typename Value>
template<typename Other>
Optional & juce::Optional< Value >::operator= ( const Optional< Other > & other)
inlinenoexcept

References Optional.

◆ operator=() [5/5]

template<typename Value>
template<typename Other>
Optional & juce::Optional< Value >::operator= ( Optional< Other > && other)
inlinenoexcept

References Optional.

◆ emplace()

template<typename Value>
template<typename... Other>
auto & juce::Optional< Value >::emplace ( Other &&... other)
inline

◆ reset()

template<typename Value>
void juce::Optional< Value >::reset ( )
inlinenoexcept

◆ swap()

template<typename Value>
void juce::Optional< Value >::swap ( Optional< Value > & other)
inlinenoexcept

References Optional.

◆ operator->() [1/2]

template<typename Value>
decltype(auto) juce::Optional< Value >::operator-> ( )
inline

◆ operator->() [2/2]

template<typename Value>
decltype(auto) juce::Optional< Value >::operator-> ( ) const
inline

◆ operator*() [1/2]

template<typename Value>
decltype(auto) juce::Optional< Value >::operator* ( )
inline

◆ operator*() [2/2]

template<typename Value>
decltype(auto) juce::Optional< Value >::operator* ( ) const
inline

◆ operator bool()

template<typename Value>
juce::Optional< Value >::operator bool ( ) const
inlineexplicitnoexcept

◆ hasValue()

template<typename Value>
bool juce::Optional< Value >::hasValue ( ) const
inlinenoexcept

◆ orFallback() [1/2]

template<typename Value>
template<typename U>
decltype(auto) juce::Optional< Value >::orFallback ( U && fallback) const &
inline

References orFallback().

Referenced by orFallback(), and orFallback().

◆ orFallback() [2/2]

template<typename Value>
template<typename U>
decltype(auto) juce::Optional< Value >::orFallback ( U && fallback) &
inline

References orFallback().

linkedin facebook pinterest youtube rss twitter instagram facebook-blank rss-blank linkedin-blank pinterest youtube twitter instagram