di 0.1.0
Loading...
Searching...
No Matches
intrusive_ptr_cpo.h
Go to the documentation of this file.
1#pragma once
2
4#include "di/types/prelude.h"
5
6namespace di::vocab {
7namespace detail {
8 struct IntrusivePtrIncrement {
9 template<typename Tag, typename T>
10 requires(concepts::TagInvocable<IntrusivePtrIncrement, InPlaceType<Tag>, T*>)
11 constexpr void operator()(InPlaceType<Tag>, T* ptr) const {
12 return function::tag_invoke(*this, in_place_type<Tag>, ptr);
13 }
14 };
15
16 struct IntrusivePtrDecrement {
17 template<typename Tag, typename T>
18 requires(concepts::TagInvocable<IntrusivePtrDecrement, InPlaceType<Tag>, T*>)
19 constexpr void operator()(InPlaceType<Tag>, T* ptr) const {
20 return function::tag_invoke(*this, in_place_type<Tag>, ptr);
21 }
22 };
23}
24
25constexpr inline auto intrusive_ptr_increment = detail::IntrusivePtrIncrement {};
26constexpr inline auto intrusive_ptr_decrement = detail::IntrusivePtrDecrement {};
27
28namespace detail {
29 template<typename T, typename Tag>
30 concept IntrusivePtrValid = requires(T* pointer) {
33 };
34}
35}
constexpr tag_invoke_detail::TagInvokeFn tag_invoke
Definition tag_invoke.h:22
Definition lazy.h:165
constexpr auto intrusive_ptr_decrement
Definition intrusive_ptr_cpo.h:26
constexpr auto intrusive_ptr_increment
Definition intrusive_ptr_cpo.h:25
constexpr auto in_place_type
Definition in_place_type.h:12