Skip to content

Commit a6e034a

Browse files
Jiawei OuCommit Bot
Jiawei Ou
authored and
Commit Bot
committed
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 <[email protected]> Reviewed-by: Karl Wiberg <[email protected]> Reviewed-by: Qingsi Wang <[email protected]> Cr-Commit-Position: refs/heads/master@{#25788}
1 parent 622eeda commit a6e034a

File tree

4 files changed

+11
-4
lines changed

4 files changed

+11
-4
lines changed

DEPS

+1
Original file line numberDiff line numberDiff line change
@@ -1447,6 +1447,7 @@ include_rules = [
14471447
# Abseil whitelist. Keep this in sync with abseil-in-webrtc.md.
14481448
"+absl/container/inlined_vector.h",
14491449
"+absl/memory/memory.h",
1450+
"+absl/meta/type_traits.h",
14501451
"+absl/strings/ascii.h",
14511452
"+absl/strings/match.h",
14521453
"+absl/strings/string_view.h",

abseil-in-webrtc.md

+3
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@ adds the first use.
1616
* `absl::optional` and related stuff from `absl/types/optional.h`.
1717
* `absl::string_view`
1818
* The functions in `absl/strings/ascii.h` and `absl/strings/match.h`
19+
* `absl::is_trivially_copy_constructible`,
20+
`absl::is_trivially_copy_assignable`, and
21+
`absl::is_trivially_destructible` from `absl/meta/type_traits.h`.
1922
* `absl::variant` and related stuff from `absl/types/variant.h`.
2023

2124
## **Disallowed**

rtc_base/BUILD.gn

+3
Original file line numberDiff line numberDiff line change
@@ -379,6 +379,9 @@ rtc_source_set("sanitizer") {
379379
sources = [
380380
"sanitizer.h",
381381
]
382+
deps = [
383+
"//third_party/abseil-cpp/absl/meta:type_traits",
384+
]
382385
}
383386

384387
rtc_source_set("safe_compare") {

rtc_base/sanitizer.h

+4-4
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
#include <stddef.h> // For size_t.
1515

1616
#ifdef __cplusplus
17-
#include <type_traits>
17+
#include "absl/meta/type_traits.h"
1818
#endif
1919

2020
#if defined(__has_feature)
@@ -98,10 +98,10 @@ namespace sanitizer_impl {
9898

9999
template <typename T>
100100
constexpr bool IsTriviallyCopyable() {
101-
return static_cast<bool>(std::is_trivially_copy_constructible<T>::value &&
102-
(std::is_trivially_copy_assignable<T>::value ||
101+
return static_cast<bool>(absl::is_trivially_copy_constructible<T>::value &&
102+
(absl::is_trivially_copy_assignable<T>::value ||
103103
!std::is_copy_assignable<T>::value) &&
104-
std::is_trivially_destructible<T>::value);
104+
absl::is_trivially_destructible<T>::value);
105105
}
106106

107107
} // namespace sanitizer_impl

0 commit comments

Comments
 (0)