7template <
typename T,
bool Predicate>
10struct type_if<T, false>
13 type_if(
const type_if&) =
default;
14 type_if(type_if&&) =
default;
15 type_if& operator=(
const type_if&) =
default;
16 type_if& operator=(type_if&&) =
default;
23 T& operator=(U&& u)
noexcept
30struct type_if<T, true>
32 [[no_unique_address]] T value;
35 type_if(
const type_if&) =
default;
36 type_if(type_if&&) =
default;
37 type_if& operator=(
const type_if&) =
default;
38 type_if& operator=(type_if&&) =
default;
42 : value{std::forward<U>(other)}
46 operator const T&()
const noexcept {
return value; }
47 operator T&()
noexcept {
return value; }
48 operator T&&() &&
noexcept {
return std::move(value); }
51 T& operator=(U&& u)
noexcept
53 return value = std::forward<U>(u);