• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright 2020 The Chromium Authors
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 #ifdef UNSAFE_BUFFERS_BUILD
6 // TODO(crbug.com/40284755): Remove this and spanify to fix the errors.
7 #pragma allow_unsafe_buffers
8 #endif
9 
10 #ifndef BASE_RANGES_RANGES_H_
11 #define BASE_RANGES_RANGES_H_
12 
13 #include <array>
14 #include <iterator>
15 #include <type_traits>
16 #include <utility>
17 
18 namespace base::ranges {
19 
20 // Implementation of C++20's std::ranges::iterator_t.
21 //
22 // Reference: https://wg21.link/ranges.syn#:~:text=iterator_t
23 template <typename Range>
24 using iterator_t = decltype(std::begin(std::declval<Range&>()));
25 
26 // Implementation of C++20's std::ranges::range_value_t.
27 //
28 // Reference: https://wg21.link/ranges.syn#:~:text=range_value_t
29 template <typename Range>
30 using range_value_t = std::iter_value_t<iterator_t<Range>>;
31 
32 }  // namespace base::ranges
33 
34 #endif  // BASE_RANGES_RANGES_H_
35