Iros
Loading...
Searching...
No Matches
as_const.h
Go to the documentation of this file.
1
#pragma once
2
3
#include "
di/container/meta/container_reference.h
"
4
#include "
di/container/meta/container_rvalue.h
"
5
#include "
di/container/view/all.h
"
6
#include "
di/container/view/as_const_view.h
"
7
#include "
di/function/pipeable.h
"
8
#include "
di/util/forward.h
"
9
10
namespace
di::container::view
{
11
namespace
detail
{
12
template
<
typename
T>
13
concept
AllAsConst
=
14
requires
(T&&
container
) {
all
(util::forward<T>(
container
)); } &&
concepts::ConstantContainer<meta::AsView<T>
>;
15
16
template
<
typename
T>
17
concept
AsConstViewAsConst
=
requires
(T&&
container
) {
AsConstView
{ util::forward<T>(
container
) }; };
18
19
struct
AsConstFunction
:
public
function::pipeline::EnablePipeline
{
20
template
<concepts::ViewableContainer Con>
21
requires
(
AllAsConst<Con>
||
AsConstViewAsConst<Con>
)
22
constexpr
auto
operator
()(Con&&
container
)
const
->
concepts::View
auto
{
23
if
constexpr
(
AllAsConst<Con>
) {
24
return
all
(util::forward<Con>(
container
));
25
}
else
{
26
return
AsConstView
{ util::forward<Con>(
container
) };
27
}
28
}
29
};
30
}
31
32
constexpr
inline
auto
as_const
=
detail::AsConstFunction
{};
33
}
all.h
as_const_view.h
di::container::AsConstView
Definition
as_const_view.h:18
di::concepts::ConstantContainer
Definition
constant_container.h:9
di::concepts::View
Definition
view.h:10
di::container::view::detail::AllAsConst
Definition
as_const.h:13
di::container::view::detail::AsConstViewAsConst
Definition
as_const.h:17
container_reference.h
container_rvalue.h
forward.h
di::container::view::detail
Definition
adjacent.h:9
di::container::view
Definition
adjacent.h:8
di::container::view::all
constexpr auto all
Definition
all.h:35
di::container::view::as_const
constexpr auto as_const
Definition
as_const.h:32
di::container
Definition
sequence.h:12
pipeable.h
di::container::view::detail::AsConstFunction
Definition
as_const.h:19
di::function::pipeline::EnablePipeline
Definition
pipeable.h:8
libs
di
include
di
container
view
as_const.h
Generated by
1.13.0