Iros
 
Loading...
Searching...
No Matches
data.h
Go to the documentation of this file.
1#pragma once
2
8#include "di/meta/core.h"
9#include "di/meta/language.h"
10#include "di/meta/operations.h"
11#include "di/util/forward.h"
12#include "di/util/to_address.h"
13
14namespace di::container {
15struct DataFunction;
16
17namespace detail {
18 template<typename T>
20
21 template<typename T>
22 concept MemberData = requires(T&& container) {
23 {
24 util::forward<T>(container).data()
26 };
27
28 template<typename T>
34}
35
37 template<typename T>
41 if constexpr (detail::CustomData<T>) {
42 return function::tag_invoke(*this, util::forward<T>(container));
43 } else if constexpr (detail::MemberData<T>) {
44 return util::forward<T>(container).data();
45 } else {
46 return util::to_address(container::begin(util::forward<T>(container)));
47 }
48 }
49};
50
51constexpr inline auto data = DataFunction {};
52}
53
54namespace di {
55using container::data;
56}
Definition contiguous_iterator.h:9
Implicit conversion for this test refers to the ability to return a value of function from a type.
Definition operations.h:89
Definition tag_invoke.h:45
Definition sequence.h:13
Definition sequence.h:12
constexpr struct di::container::EnableBorrowedContainer enable_borrowed_container
constexpr auto data
Definition data.h:51
constexpr auto begin
Definition begin.h:44
constexpr tag_invoke_detail::TagInvokeFn tag_invoke
Definition tag_invoke.h:22
RemoveConst< RemoveVolatile< T > > RemoveCV
Definition core.h:57
Type< detail::AddPointerHelper< T > > AddPointer
This is a helper template which will convert reference types into their corresponding pointer type,...
Definition language.h:427
constexpr auto in_place_type
Definition in_place_type.h:12
constexpr auto to_address
Definition to_address.h:22
Definition zstring_parser.h:9
Definition data.h:36
constexpr auto operator()(T &&container) const -> meta::AddPointer< meta::ContainerReference< T > >
Definition data.h:40