OpenShot Audio Library | OpenShotAudio 0.4.0
Loading...
Searching...
No Matches
juce::Optional< Value > Class Template Reference

#include <juce_Optional.h>

Public Member Functions

 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) &

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.

Definition at line 56 of file juce_Optional.h.

Constructor & Destructor Documentation

◆ Optional() [1/4]

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

Definition at line 68 of file juce_Optional.h.

◆ Optional() [2/4]

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

Definition at line 71 of file juce_Optional.h.

◆ Optional() [3/4]

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

Definition at line 76 of file juce_Optional.h.

◆ Optional() [4/4]

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

Definition at line 81 of file juce_Optional.h.

Member Function Documentation

◆ emplace()

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

Definition at line 110 of file juce_Optional.h.

◆ hasValue()

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

Definition at line 132 of file juce_Optional.h.

◆ operator bool()

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

Definition at line 131 of file juce_Optional.h.

◆ operator*() [1/2]

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

Definition at line 128 of file juce_Optional.h.

◆ operator*() [2/2]

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

Definition at line 129 of file juce_Optional.h.

◆ operator->() [1/2]

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

Definition at line 126 of file juce_Optional.h.

◆ operator->() [2/2]

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

Definition at line 127 of file juce_Optional.h.

◆ operator=() [1/3]

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

Definition at line 94 of file juce_Optional.h.

◆ operator=() [2/3]

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

Definition at line 102 of file juce_Optional.h.

◆ operator=() [3/3]

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

Definition at line 86 of file juce_Optional.h.

◆ orFallback() [1/2]

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

Definition at line 138 of file juce_Optional.h.

◆ orFallback() [2/2]

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

Definition at line 135 of file juce_Optional.h.

◆ reset()

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

Definition at line 115 of file juce_Optional.h.

◆ swap()

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

Definition at line 120 of file juce_Optional.h.


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