Iros
 
Loading...
Searching...
No Matches
as_const.h
Go to the documentation of this file.
1#pragma once
2
8#include "di/util/forward.h"
9
10namespace di::container::view {
11namespace 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
20 template<concepts::ViewableContainer 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
32constexpr inline auto as_const = detail::AsConstFunction {};
33}
Definition as_const_view.h:18
Definition constant_container.h:9
Definition view.h:10
Definition adjacent.h:9
Definition adjacent.h:8
constexpr auto all
Definition all.h:35
constexpr auto as_const
Definition as_const.h:32
Definition sequence.h:12