OpenShot Audio Library | OpenShotAudio  0.6.0
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.


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