#include <type_traits>
#include <utility>
-#include <folly/Launder.h>
+#include <folly/Portability.h>
#include <folly/Traits.h>
#include <folly/Utility.h>
+#include <folly/lang/Launder.h>
/**
* An instance of `Replaceable<T>` wraps an instance of `T`.
template <
class... Args,
std::enable_if_t<std::is_constructible<T, Args&&...>::value, int> = 0>
- constexpr explicit Replaceable(in_place_t, Args&&... args)
+ FOLLY_CPP14_CONSTEXPR explicit Replaceable(in_place_t, Args&&... args)
// clang-format off
noexcept(std::is_nothrow_constructible<T, Args&&...>::value)
// clang-format on
std::enable_if_t<
std::is_constructible<T, std::initializer_list<U>, Args&&...>::value,
int> = 0>
- constexpr explicit Replaceable(
+ FOLLY_CPP14_CONSTEXPR explicit Replaceable(
in_place_t,
std::initializer_list<U> il,
Args&&... args)
!std::is_same<Replaceable<T>, std::decay_t<U>>::value &&
std::is_convertible<U&&, T>::value,
int> = 0>
- constexpr /* implicit */ Replaceable(U&& other)
+ FOLLY_CPP14_CONSTEXPR /* implicit */ Replaceable(U&& other)
// clang-format off
noexcept(std::is_nothrow_constructible<T, U&&>::value)
// clang-format on
!std::is_same<Replaceable<T>, std::decay_t<U>>::value &&
!std::is_convertible<U&&, T>::value,
int> = 0>
- explicit constexpr Replaceable(U&& other)
+ FOLLY_CPP14_CONSTEXPR explicit Replaceable(U&& other)
// clang-format off
noexcept(std::is_nothrow_constructible<T, U&&>::value)
// clang-format on
return launder(reinterpret_cast<T const*>(storage_));
}
- constexpr T* operator->() {
+ FOLLY_CPP14_CONSTEXPR T* operator->() {
return launder(reinterpret_cast<T*>(storage_));
}
return *launder(reinterpret_cast<T const*>(storage_));
}
- constexpr T& operator*() & {
+ FOLLY_CPP14_CONSTEXPR T& operator*() & {
return *launder(reinterpret_cast<T*>(storage_));
}
- constexpr T&& operator*() && {
+ FOLLY_CPP14_CONSTEXPR T&& operator*() && {
return std::move(*launder(reinterpret_cast<T*>(storage_)));
}