diff options
author | Dino Radakovic <dinor@google.com> | 2024-03-15 12:55:53 -0700 |
---|---|---|
committer | Copybara-Service <copybara-worker@google.com> | 2024-03-15 12:56:47 -0700 |
commit | 153186b6931d0755448da8d200e1b8e43acede48 (patch) | |
tree | b91c01c7d46937add450d983f51e119a4e245b32 /absl/container | |
parent | 16e21953352993faeb83d16d4bce99718e6e9d9c (diff) |
`layout`: Use auto return type for functions that explicitly instantiate std::tuple in return statements
This improves readability by avoiding spelling the same type twice, the first time with even more boilerplate (e.g. `typename`).
Return type deduction is a C++14 feature, and Abseil [currently supports](https://github.com/google/oss-policies-info/blob/9a9bfe8a4a12be20757497074fc2f0ecb77438ad/foundational-cxx-support-matrix.md) C++ >= 14.
PiperOrigin-RevId: 616218396
Change-Id: I82aeec878dd69001d2cf822db6512f5a62baec02
Diffstat (limited to 'absl/container')
-rw-r--r-- | absl/container/internal/layout.h | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/absl/container/internal/layout.h b/absl/container/internal/layout.h index 1bf739cc..aa42a8ec 100644 --- a/absl/container/internal/layout.h +++ b/absl/container/internal/layout.h @@ -504,9 +504,7 @@ class LayoutImpl<std::tuple<Elements...>, absl::index_sequence<SizeSeq...>, // Note: We're not using ElementType alias here because it does not compile // under MSVC. template <class Char> - std::tuple<CopyConst< - Char, typename std::tuple_element<OffsetSeq, ElementTypes>::type>*...> - Pointers(Char* p) const { + auto Pointers(Char* p) const { return std::tuple<CopyConst<Char, ElementType<OffsetSeq>>*...>( Pointer<OffsetSeq>(p)...); } @@ -562,9 +560,7 @@ class LayoutImpl<std::tuple<Elements...>, absl::index_sequence<SizeSeq...>, // Note: We're not using ElementType alias here because it does not compile // under MSVC. template <class Char> - std::tuple<SliceType<CopyConst< - Char, typename std::tuple_element<SizeSeq, ElementTypes>::type>>...> - Slices(Char* p) const { + auto Slices(Char* p) const { // Workaround for https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63875 (fixed // in 6.1). (void)p; |