FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
cpp_event_framework/include/cpp_event_framework/Concepts.hxx at main · dziegel/cpp_event_framework · GitHub
dziegel
/
cpp_event_framework
Public
Notifications
You must be signed in to change notification settings
Fork
2
Star
12
Code
Issues
0
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
cpp_event_framework
/
include
/
cpp_event_framework
/
Concepts.hxx
Copy path
More file actions
More file actions
Latest commit
History
History
History
65 lines (58 loc) · 1.41 KB
Breadcrumbs
cpp_event_framework
/
include
/
cpp_event_framework
/
Concepts.hxx
Copy path
File metadata and controls
65 lines (58 loc) · 1.41 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
/*
*
* @file Concepts.hxx
* @author Dirk Ziegelmeier (dirk@ziegelmeier.net)
* @brief
* @date 16-10-2021
*
* @copyright SPDX-License-Identifier: Apache-2.0
*
*/
#
pragma
once
#
include
<
cassert
>
#
include
<
cstddef
>
#
include
<
memory_resource
>
#
include
<
type_traits
>
namespace
cpp_event_framework
{
/*
*
* @brief Concept for Mutex: DefaultConstructible, DefaultDesctructible, BasicLockable
*/
template
<
typename
T>
concept
Mutex = std::is_constructible_v<T> && std::is_destructible_v<T> &&
requires
(T a) {
{ a.
lock
() };
{ a.
unlock
() };
};
/*
*
* @brief Concept for semaphore: DefaultConstructible, DefaultDesctructible
*/
template
<
typename
T>
concept
Semaphore = std::is_constructible_v<T, std::
ptrdiff_t
> && std::is_destructible_v<T> &&
requires
(T a) {
{ a.
acquire
() };
{ a.
release
() };
};
/*
*
* @brief Concept for assertion function
*/
template
<
typename
T>
concept
AssertionProvider =
requires
(T) {
{
T::Assert
(
bool
()) };
};
/*
*
* @brief Default assertion provider that uses C-library assert()
*/
class
DefaultAssertionProvider
{
public:
static
void
Assert
(
bool
condition)
{
assert
(condition);
}
};
/*
*
* @brief Concept for a provider of a polymorphic allocator (std::pmr::memory_resource)
*/
template
<
typename
T>
concept
PolymorphicAllocatorProvider =
requires
(T a) {
{ a.
GetAllocator
() } -> std::convertible_to<std::pmr::memory_resource*>;
};
}
//
namespace cpp_event_framework
Back
|
FazBrowse Home
|
New Git URL