Rebase std::is_trivially_* with absl::is_trivially_*

std::is_trivially_* is not available on certain old STL
implementations. Using absl implementation will allow
maximized compatibility.

Bug: webrtc:10054
Change-Id: I17ed0fff44328b3d7c51d14e8c4470f1df0e66ad
Reviewed-on: https://webrtc-review.googlesource.com/c/111728
Commit-Queue: Jiawei Ou <ouj@fb.com>
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Reviewed-by: Qingsi Wang <qingsi@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#25788}
This commit is contained in:
Jiawei Ou 2018-11-24 20:59:41 -08:00 committed by Commit Bot
parent 622eedaf0f
commit a6e034adb9
4 changed files with 11 additions and 4 deletions

1
DEPS
View file

@ -1447,6 +1447,7 @@ include_rules = [
# Abseil whitelist. Keep this in sync with abseil-in-webrtc.md.
"+absl/container/inlined_vector.h",
"+absl/memory/memory.h",
"+absl/meta/type_traits.h",
"+absl/strings/ascii.h",
"+absl/strings/match.h",
"+absl/strings/string_view.h",

View file

@ -16,6 +16,9 @@ adds the first use.
* `absl::optional` and related stuff from `absl/types/optional.h`.
* `absl::string_view`
* The functions in `absl/strings/ascii.h` and `absl/strings/match.h`
* `absl::is_trivially_copy_constructible`,
`absl::is_trivially_copy_assignable`, and
`absl::is_trivially_destructible` from `absl/meta/type_traits.h`.
* `absl::variant` and related stuff from `absl/types/variant.h`.
## **Disallowed**

View file

@ -379,6 +379,9 @@ rtc_source_set("sanitizer") {
sources = [
"sanitizer.h",
]
deps = [
"//third_party/abseil-cpp/absl/meta:type_traits",
]
}
rtc_source_set("safe_compare") {

View file

@ -14,7 +14,7 @@
#include <stddef.h> // For size_t.
#ifdef __cplusplus
#include <type_traits>
#include "absl/meta/type_traits.h"
#endif
#if defined(__has_feature)
@ -98,10 +98,10 @@ namespace sanitizer_impl {
template <typename T>
constexpr bool IsTriviallyCopyable() {
return static_cast<bool>(std::is_trivially_copy_constructible<T>::value &&
(std::is_trivially_copy_assignable<T>::value ||
return static_cast<bool>(absl::is_trivially_copy_constructible<T>::value &&
(absl::is_trivially_copy_assignable<T>::value ||
!std::is_copy_assignable<T>::value) &&
std::is_trivially_destructible<T>::value);
absl::is_trivially_destructible<T>::value);
}
} // namespace sanitizer_impl