Location via proxy:
[ UP ]
[Report a bug]
[Manage cookies]
No cookies
No scripts
No ads
No referrer
Show this form
25
Ranges library
[ranges]
25.7
Range adaptors
[range.adaptors]
25.7.20
Common view
[range.common]
25.7.20.2
Class template
common_
view
[range.common.view]
🔗
namespace
std
::
ranges
{
template
<
view
V
>
requires
(
!
common_
range
<
V
>
&
&
copyable
<
iterator_t
<
V
>
>
)
class
common_view
:
public
view_interface
<
common_view
<
V
>
>
{
private
:
V
base_
=
V
(
)
;
//
exposition only
public
:
common_view
(
)
requires
default_
initializable
<
V
>
=
default
;
constexpr
explicit
common_view
(
V r
)
;
constexpr
V base
(
)
const
&
requires
copy_
constructible
<
V
>
{
return
base_
;
}
constexpr
V base
(
)
&
&
{
return
std
::
move
(
base_
)
;
}
constexpr
auto
begin
(
)
requires
(
!
simple-view
<
V
>
)
{
if
constexpr
(
random_
access_
range
<
V
>
&
&
sized_
range
<
V
>
)
return
ranges
::
begin
(
base_
)
;
else
return
common_iterator
<
iterator_t
<
V
>
, sentinel_t
<
V
>
>
(
ranges
::
begin
(
base_
)
)
;
}
constexpr
auto
begin
(
)
const
requires
range
<
const
V
>
{
if
constexpr
(
random_
access_
range
<
const
V
>
&
&
sized_
range
<
const
V
>
)
return
ranges
::
begin
(
base_
)
;
else
return
common_iterator
<
iterator_t
<
const
V
>
, sentinel_t
<
const
V
>
>
(
ranges
::
begin
(
base_
)
)
;
}
constexpr
auto
end
(
)
requires
(
!
simple-view
<
V
>
)
{
if
constexpr
(
random_
access_
range
<
V
>
&
&
sized_
range
<
V
>
)
return
ranges
::
begin
(
base_
)
+
ranges
::
distance
(
base_
)
;
else
return
common_iterator
<
iterator_t
<
V
>
, sentinel_t
<
V
>
>
(
ranges
::
end
(
base_
)
)
;
}
constexpr
auto
end
(
)
const
requires
range
<
const
V
>
{
if
constexpr
(
random_
access_
range
<
const
V
>
&
&
sized_
range
<
const
V
>
)
return
ranges
::
begin
(
base_
)
+
ranges
::
distance
(
base_
)
;
else
return
common_iterator
<
iterator_t
<
const
V
>
, sentinel_t
<
const
V
>
>
(
ranges
::
end
(
base_
)
)
;
}
constexpr
auto
size
(
)
requires
sized_
range
<
V
>
{
return
ranges
::
size
(
base_
)
;
}
constexpr
auto
size
(
)
const
requires
sized_
range
<
const
V
>
{
return
ranges
::
size
(
base_
)
;
}
constexpr
auto
reserve_hint
(
)
requires
approximately_
sized_
range
<
V
>
{
return
ranges
::
reserve_hint
(
base_
)
;
}
constexpr
auto
reserve_hint
(
)
const
requires
approximately_
sized_
range
<
const
V
>
{
return
ranges
::
reserve_hint
(
base_
)
;
}
}
;
template
<
class
R
>
common_view
(
R
&
&
)
-
>
common_view
<
views
::
all_t
<
R
>
>
;
}
🔗
constexpr
explicit
common_view
(
V base
)
;
1
#
Effects
: Initializes
base_
with
std
::
move
(
base
)
.