proxygen
|
#include <Replaceable.h>
Public Types | |
using | value_type = T |
Public Member Functions | |
constexpr | Replaceable ()=default |
constexpr | Replaceable (const Replaceable &)=default |
constexpr | Replaceable (Replaceable &&)=default |
Replaceable & | operator= (const Replaceable &)=default |
Replaceable & | operator= (Replaceable &&)=default |
~Replaceable ()=default | |
template<class... Args, std::enable_if_t< std::is_constructible< T, Args &&... >::value, int > = 0> | |
FOLLY_CPP14_CONSTEXPR | Replaceable (in_place_t, Args &&...args) noexcept(std::is_nothrow_constructible< T, Args &&... >::value) |
template<class U , class... Args, std::enable_if_t< std::is_constructible< T, std::initializer_list< U >, Args &&... >::value, int > = 0> | |
FOLLY_CPP14_CONSTEXPR | Replaceable (in_place_t, std::initializer_list< U > il, Args &&...args) noexcept(std::is_nothrow_constructible< T, std::initializer_list< U >, Args &&... >::value) |
template<class U = T, std::enable_if_t< std::is_constructible< T, U && >::value &&!std::is_same< std::decay_t< U >, in_place_t >::value &&!std::is_same< Replaceable< T >, std::decay_t< U >>::value &&std::is_convertible< U &&, T >::value, int > = 0> | |
FOLLY_CPP14_CONSTEXPR | Replaceable (U &&other) noexcept(std::is_nothrow_constructible< T, U && >::value) |
template<class U = T, std::enable_if_t< std::is_constructible< T, U && >::value &&!std::is_same< std::decay_t< U >, in_place_t >::value &&!std::is_same< Replaceable< T >, std::decay_t< U >>::value &&!std::is_convertible< U &&, T >::value, int > = 0> | |
FOLLY_CPP14_CONSTEXPR | Replaceable (U &&other) noexcept(std::is_nothrow_constructible< T, U && >::value) |
template<class U , std::enable_if_t< std::is_constructible< T, const U & >::value &&!replaceable_detail::is_constructible_from_replaceable< T >::value &&!replaceable_detail::is_convertible_from_replaceable< T >::value &&std::is_convertible< const U &, T >::value, int > = 0> | |
Replaceable (const Replaceable< U > &other) noexcept(std::is_nothrow_constructible< T, U const & >::value) | |
template<class U , std::enable_if_t< std::is_constructible< T, const U & >::value &&!replaceable_detail::is_constructible_from_replaceable< T >::value &&!replaceable_detail::is_convertible_from_replaceable< T >::value &&!std::is_convertible< const U &, T >::value, int > = 0> | |
Replaceable (const Replaceable< U > &other) noexcept(std::is_nothrow_constructible< T, U const & >::value) | |
template<class U , std::enable_if_t< std::is_constructible< T, U && >::value &&!replaceable_detail::is_constructible_from_replaceable< T >::value &&!replaceable_detail::is_convertible_from_replaceable< T >::value &&std::is_convertible< U &&, T >::value, int > = 0> | |
Replaceable (Replaceable< U > &&other) noexcept(std::is_nothrow_constructible< T, U && >::value) | |
template<class U , std::enable_if_t< std::is_constructible< T, U && >::value &&!replaceable_detail::is_constructible_from_replaceable< T >::value &&!replaceable_detail::is_convertible_from_replaceable< T >::value &&!std::is_convertible< U &&, T >::value, int > = 0> | |
Replaceable (Replaceable< U > &&other) noexcept(std::is_nothrow_constructible< T, U && >::value) | |
template<class... Args> | |
T & | emplace (Args &&...args) noexcept |
template<class U , class... Args> | |
T & | emplace (std::initializer_list< U > il, Args &&...args) noexcept |
void | swap (Replaceable &other) |
constexpr const T * | operator-> () const |
FOLLY_CPP14_CONSTEXPR T * | operator-> () |
constexpr const T & | operator* () const & |
FOLLY_CPP14_CONSTEXPR T & | operator* ()& |
FOLLY_CPP14_CONSTEXPR T && | operator* ()&& |
constexpr const T && | operator* () const && |
Private Types | |
using | ctor_base = replaceable_detail::default_and_move_ctor_mixin< T > |
Private Attributes | |
std::aligned_storage_t< sizeof(T), alignof(T)> | storage_ [1] |
Definition at line 125 of file Replaceable.h.
|
private |
Definition at line 408 of file Replaceable.h.
using folly::Replaceable< T >::value_type = T |
Definition at line 411 of file Replaceable.h.
|
default |
|
default |
|
default |
|
default |
|
inlineexplicitnoexcept |
Constructors; these are modeled very closely on the definition of std::optional
in C++17.
Definition at line 442 of file Replaceable.h.
References testing::Args(), folly::T, and folly::value().
|
inlineexplicitnoexcept |
Definition at line 456 of file Replaceable.h.
References folly::T, value, and folly::value().
|
inlinenoexcept |
Definition at line 478 of file Replaceable.h.
References folly::T, value, and folly::value().
|
inlineexplicitnoexcept |
Definition at line 494 of file Replaceable.h.
References folly::T, value, and folly::value().
|
inlinenoexcept |
Definition at line 511 of file Replaceable.h.
References folly::T, value, and folly::value().
|
inlineexplicitnoexcept |
Definition at line 528 of file Replaceable.h.
References folly::T, value, and folly::value().
|
inlinenoexcept |
Definition at line 545 of file Replaceable.h.
References folly::gen::move, folly::T, value, and folly::value().
|
inlineexplicitnoexcept |
Definition at line 562 of file Replaceable.h.
References testing::Args(), folly::gen::move, and folly::T.
|
inlinenoexcept |
emplace
destructs the contained object and in-place constructs the replacement.
The destructor must not throw (as usual). The constructor must not throw because that would violate the invariant that a Replaceable<T>
always contains a T instance.
As these methods are noexcept
the program will be terminated if an exception is thrown. If you are encountering this issue you should look at using Optional
instead.
Definition at line 583 of file Replaceable.h.
References testing::Args(), folly::launder(), and folly::T.
|
inlinenoexcept |
Definition at line 590 of file Replaceable.h.
References folly::launder(), and folly::T.
|
inline |
Definition at line 618 of file Replaceable.h.
References folly::launder().
|
inline |
Definition at line 622 of file Replaceable.h.
References folly::launder().
|
inline |
Definition at line 626 of file Replaceable.h.
References folly::launder(), and folly::gen::move.
|
inline |
Definition at line 630 of file Replaceable.h.
References folly::launder(), and folly::gen::move.
|
inline |
Methods to access the contained object. Intended to be very unsurprising.
Definition at line 610 of file Replaceable.h.
References folly::launder().
|
inline |
Definition at line 614 of file Replaceable.h.
References folly::launder().
|
default |
|
default |
|
inline |
swap
just calls swap(T&, T&)
.
Should be noexcept(std::is_nothrow_swappable<T>value)
but we don't depend on C++17 features.
Definition at line 602 of file Replaceable.h.
References folly::f14::swap(), and folly::swap().
|
friend |
Definition at line 639 of file Replaceable.h.
|
friend |
Definition at line 637 of file Replaceable.h.
|
friend |
Definition at line 636 of file Replaceable.h.
|
friend |
Definition at line 635 of file Replaceable.h.
|
friend |
Definition at line 638 of file Replaceable.h.
|
private |
Definition at line 640 of file Replaceable.h.