projects
/
folly.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Improve performance of enumerate() with optimization disabled
[folly.git]
/
folly
/
Replaceable.h
diff --git
a/folly/Replaceable.h
b/folly/Replaceable.h
index 011b1f8b9582261a0c8586a6173c90209130f3a8..92d1ec6f6bc3d6402642bbc718dc833467c9a00a 100644
(file)
--- a/
folly/Replaceable.h
+++ b/
folly/Replaceable.h
@@
-21,9
+21,10
@@
#include <type_traits>
#include <utility>
#include <type_traits>
#include <utility>
-#include <folly/
Launder
.h>
+#include <folly/
Portability
.h>
#include <folly/Traits.h>
#include <folly/Utility.h>
#include <folly/Traits.h>
#include <folly/Utility.h>
+#include <folly/lang/Launder.h>
/**
* An instance of `Replaceable<T>` wraps an instance of `T`.
/**
* An instance of `Replaceable<T>` wraps an instance of `T`.
@@
-450,7
+451,7
@@
class alignas(T) Replaceable
template <
class... Args,
std::enable_if_t<std::is_constructible<T, Args&&...>::value, int> = 0>
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
// clang-format off
noexcept(std::is_nothrow_constructible<T, Args&&...>::value)
// clang-format on
@@
-464,7
+465,7
@@
class alignas(T) Replaceable
std::enable_if_t<
std::is_constructible<T, std::initializer_list<U>, Args&&...>::value,
int> = 0>
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)
in_place_t,
std::initializer_list<U> il,
Args&&... args)
@@
-486,7
+487,7
@@
class alignas(T) Replaceable
!std::is_same<Replaceable<T>, std::decay_t<U>>::value &&
std::is_convertible<U&&, T>::value,
int> = 0>
!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
// clang-format off
noexcept(std::is_nothrow_constructible<T, U&&>::value)
// clang-format on
@@
-502,7
+503,7
@@
class alignas(T) Replaceable
!std::is_same<Replaceable<T>, std::decay_t<U>>::value &&
!std::is_convertible<U&&, T>::value,
int> = 0>
!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
// clang-format off
noexcept(std::is_nothrow_constructible<T, U&&>::value)
// clang-format on
@@
-622,7
+623,7
@@
class alignas(T) Replaceable
return launder(reinterpret_cast<T const*>(storage_));
}
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*>(storage_));
}
@@
-630,11
+631,11
@@
class alignas(T) Replaceable
return *launder(reinterpret_cast<T const*>(storage_));
}
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*>(storage_));
}
-
constexpr
T&& operator*() && {
+
FOLLY_CPP14_CONSTEXPR
T&& operator*() && {
return std::move(*launder(reinterpret_cast<T*>(storage_)));
}
return std::move(*launder(reinterpret_cast<T*>(storage_)));
}