| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
/// \file |
|
2
|
|
|
|
|
|
|
// Range v3 library |
|
3
|
|
|
|
|
|
|
// |
|
4
|
|
|
|
|
|
|
// Copyright Eric Niebler 2014-present |
|
5
|
|
|
|
|
|
|
// |
|
6
|
|
|
|
|
|
|
// Use, modification and distribution is subject to the |
|
7
|
|
|
|
|
|
|
// Boost Software License, Version 1.0. (See accompanying |
|
8
|
|
|
|
|
|
|
// file LICENSE_1_0.txt or copy at |
|
9
|
|
|
|
|
|
|
// http://www.boost.org/LICENSE_1_0.txt) |
|
10
|
|
|
|
|
|
|
// |
|
11
|
|
|
|
|
|
|
// Project home: https://github.com/ericniebler/range-v3 |
|
12
|
|
|
|
|
|
|
// |
|
13
|
|
|
|
|
|
|
#ifndef RANGES_V3_VIEW_FACADE_HPP |
|
14
|
|
|
|
|
|
|
#define RANGES_V3_VIEW_FACADE_HPP |
|
15
|
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
#include |
|
17
|
|
|
|
|
|
|
#include |
|
18
|
|
|
|
|
|
|
#include |
|
19
|
|
|
|
|
|
|
#include |
|
20
|
|
|
|
|
|
|
#include |
|
21
|
|
|
|
|
|
|
#include |
|
22
|
|
|
|
|
|
|
#include |
|
23
|
|
|
|
|
|
|
#include |
|
24
|
|
|
|
|
|
|
#include |
|
25
|
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
namespace ranges |
|
27
|
|
|
|
|
|
|
{ |
|
28
|
|
|
|
|
|
|
inline namespace v3 |
|
29
|
|
|
|
|
|
|
{ |
|
30
|
|
|
|
|
|
|
/// \cond |
|
31
|
|
|
|
|
|
|
namespace detail |
|
32
|
|
|
|
|
|
|
{ |
|
33
|
|
|
|
|
|
|
template |
|
34
|
|
|
|
|
|
|
using begin_cursor_t = |
|
35
|
|
|
|
|
|
|
detail::decay_t()))>; |
|
36
|
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
template |
|
38
|
|
|
|
|
|
|
using end_cursor_t = |
|
39
|
|
|
|
|
|
|
detail::decay_t()))>; |
|
40
|
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
template |
|
42
|
|
|
|
|
|
|
using facade_iterator_t = basic_iterator>; |
|
43
|
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
template |
|
45
|
|
|
|
|
|
|
using facade_sentinel_t = |
|
46
|
|
|
|
|
|
|
meta::if_< |
|
47
|
|
|
|
|
|
|
Same, end_cursor_t>, |
|
48
|
|
|
|
|
|
|
facade_iterator_t, |
|
49
|
|
|
|
|
|
|
end_cursor_t>; |
|
50
|
|
|
|
|
|
|
} |
|
51
|
|
|
|
|
|
|
/// \endcond |
|
52
|
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
/// \addtogroup group-core |
|
54
|
|
|
|
|
|
|
/// @{ |
|
55
|
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
/// \brief A utility for constructing a view from a (derived) type that |
|
57
|
|
|
|
|
|
|
/// implements begin and end cursors. |
|
58
|
|
|
|
|
|
|
/// \tparam Derived A type that derives from `view_facade` and implements |
|
59
|
|
|
|
|
|
|
/// begin and end cursors. This type is permitted to be incomplete. |
|
60
|
|
|
|
|
|
|
/// \tparam Cardinality The cardinality of this view: `finite`, `infinite`, |
|
61
|
|
|
|
|
|
|
/// or `unknown`. See `ranges::v3::cardinality`. |
|
62
|
|
|
|
|
|
|
template |
|
63
|
1276
|
|
|
|
|
|
struct view_facade |
|
64
|
|
|
|
|
|
|
: view_interface |
|
65
|
|
|
|
|
|
|
{ |
|
66
|
|
|
|
|
|
|
protected: |
|
67
|
|
|
|
|
|
|
friend range_access; |
|
68
|
|
|
|
|
|
|
using view_interface::derived; |
|
69
|
|
|
|
|
|
|
// Default implementations |
|
70
|
|
|
|
|
|
|
Derived begin_cursor() const |
|
71
|
|
|
|
|
|
|
{ |
|
72
|
|
|
|
|
|
|
return derived(); |
|
73
|
|
|
|
|
|
|
} |
|
74
|
|
|
|
|
|
|
constexpr default_sentinel end_cursor() const |
|
75
|
|
|
|
|
|
|
{ |
|
76
|
|
|
|
|
|
|
return {}; |
|
77
|
|
|
|
|
|
|
} |
|
78
|
|
|
|
|
|
|
public: |
|
79
|
|
|
|
|
|
|
/// Let `d` be `static_cast(*this)`. Let `b` be |
|
80
|
|
|
|
|
|
|
/// `std::as_const(d).begin_cursor()` if that expression is well-formed; |
|
81
|
|
|
|
|
|
|
/// otherwise, let `b` be `d.begin_cursor()`. Let `B` be the type of |
|
82
|
|
|
|
|
|
|
/// `b`. |
|
83
|
|
|
|
|
|
|
/// \return `ranges::v3::basic_iterator(b)` |
|
84
|
|
|
|
|
|
|
template())> |
|
85
|
638
|
|
|
|
|
|
detail::facade_iterator_t begin() |
|
86
|
|
|
|
|
|
|
{ |
|
87
|
|
|
|
|
|
|
return detail::facade_iterator_t{ |
|
88
|
638
|
|
|
|
|
|
range_access::begin_cursor(derived())}; |
|
89
|
|
|
|
|
|
|
} |
|
90
|
|
|
|
|
|
|
/// \overload |
|
91
|
|
|
|
|
|
|
template())> |
|
92
|
|
|
|
|
|
|
detail::facade_iterator_t begin() const |
|
93
|
|
|
|
|
|
|
{ |
|
94
|
|
|
|
|
|
|
return detail::facade_iterator_t{ |
|
95
|
|
|
|
|
|
|
range_access::begin_cursor(derived())}; |
|
96
|
|
|
|
|
|
|
} |
|
97
|
|
|
|
|
|
|
/// Let `d` be `static_cast(*this)`. Let `e` be |
|
98
|
|
|
|
|
|
|
/// `std::as_const(d).end_cursor()` if that expression is well-formed; |
|
99
|
|
|
|
|
|
|
/// otherwise, let `e` be `d.end_cursor()`. Let `E` be the type of |
|
100
|
|
|
|
|
|
|
/// `e`. |
|
101
|
|
|
|
|
|
|
/// \return `ranges::v3::basic_iterator(e)` if `E` is the same |
|
102
|
|
|
|
|
|
|
/// as `B` computed above for `begin()`; otherwise, return `e`. |
|
103
|
|
|
|
|
|
|
template())> |
|
104
|
638
|
|
|
|
|
|
detail::facade_sentinel_t end() |
|
105
|
|
|
|
|
|
|
{ |
|
106
|
|
|
|
|
|
|
return static_cast>( |
|
107
|
638
|
|
|
|
|
|
range_access::end_cursor(derived())); |
|
108
|
|
|
|
|
|
|
} |
|
109
|
|
|
|
|
|
|
/// \overload |
|
110
|
|
|
|
|
|
|
template())> |
|
111
|
|
|
|
|
|
|
detail::facade_sentinel_t end() const |
|
112
|
|
|
|
|
|
|
{ |
|
113
|
|
|
|
|
|
|
return static_cast>( |
|
114
|
|
|
|
|
|
|
range_access::end_cursor(derived())); |
|
115
|
|
|
|
|
|
|
} |
|
116
|
|
|
|
|
|
|
}; |
|
117
|
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
/// @} |
|
119
|
|
|
|
|
|
|
} |
|
120
|
|
|
|
|
|
|
} |
|
121
|
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
#endif |