stdex
Additional custom or not Standard C++ covered algorithms
Loading...
Searching...
No Matches
include
stdex
compat.hpp
1
/*
2
SPDX-License-Identifier: MIT
3
Copyright © 2022-2023 Amebis
4
*/
5
6
#pragma once
7
8
#include <assert.h>
9
#include <stddef.h>
10
#ifdef _WIN32
11
#include <sal.h>
12
#endif
13
#include <type_traits>
14
15
#ifndef _In_
16
#define _In_
17
#endif
18
#ifndef _In_bytecount_
19
#define _In_bytecount_(p)
20
#endif
21
#ifndef _In_count_
22
#define _In_count_(p)
23
#endif
24
#ifndef _In_opt_
25
#define _In_opt_
26
#endif
27
#ifndef _In_opt_count_
28
#define _In_opt_count_(p)
29
#endif
30
#ifndef _In_opt_z_count_
31
#define _In_opt_z_count_(p)
32
#endif
33
#ifndef _In_z_
34
#define _In_z_
35
#endif
36
#ifndef _In_opt_z_
37
#define _In_opt_z_
38
#endif
39
#ifndef _In_z_count_
40
#define _In_z_count_(p)
41
#endif
42
#ifndef _In_reads_
43
#define _In_reads_(p)
44
#endif
45
#ifndef _In_reads_z_
46
#define _In_reads_z_(p)
47
#endif
48
#ifndef _In_reads_opt_
49
#define _In_reads_opt_(p)
50
#endif
51
#ifndef _In_reads_opt_z_
52
#define _In_reads_opt_z_(p)
53
#endif
54
#ifndef _In_reads_or_z_
55
#define _In_reads_or_z_(p)
56
#endif
57
#ifndef _In_reads_or_z_opt_
58
#define _In_reads_or_z_opt_(p)
59
#endif
60
#ifndef _In_reads_bytes_opt_
61
#define _In_reads_bytes_opt_(p)
62
#endif
63
#ifndef _Printf_format_string_params_
64
#define _Printf_format_string_params_(n)
65
#endif
66
67
#ifndef _Inout_
68
#define _Inout_
69
#endif
70
#ifndef _Inout_opt_
71
#define _Inout_opt_
72
#endif
73
#ifndef _Inout_z_
74
#define _Inout_z_
75
#endif
76
#ifndef _Inout_cap_
77
#define _Inout_cap_(p)
78
#endif
79
#ifndef _Inout_count_
80
#define _Inout_count_(p)
81
#endif
82
#ifndef _Inout_updates_z_
83
#define _Inout_updates_z_(p)
84
#endif
85
86
#ifndef _Use_decl_annotations_
87
#define _Use_decl_annotations_
88
#endif
89
90
#ifndef _Out_
91
#define _Out_
92
#endif
93
#ifndef _Out_opt_
94
#define _Out_opt_
95
#endif
96
#ifndef _Out_z_cap_
97
#define _Out_z_cap_(p)
98
#endif
99
#ifndef _Out_writes_
100
#define _Out_writes_(p)
101
#endif
102
#ifndef _Out_writes_opt_
103
#define _Out_writes_opt_(p)
104
#endif
105
#ifndef _Out_writes_opt_z_
106
#define _Out_writes_opt_z_(p)
107
#endif
108
#ifndef _Out_writes_bytes_
109
#define _Out_writes_bytes_(p)
110
#endif
111
#ifndef _Out_writes_to_
112
#define _Out_writes_to_(p, q)
113
#endif
114
#ifndef _Out_writes_all_
115
#define _Out_writes_all_(p)
116
#endif
117
#ifndef _Out_writes_z_
118
#define _Out_writes_z_(p)
119
#endif
120
#ifndef _Out_writes_bytes_to_opt_
121
#define _Out_writes_bytes_to_opt_(p, q)
122
#endif
123
124
#ifndef _Success_
125
#define _Success_(p)
126
#endif
127
#ifndef _Ret_maybenull_
128
#define _Ret_maybenull_
129
#endif
130
#ifndef _Ret_maybenull_z_
131
#define _Ret_maybenull_z_
132
#endif
133
#ifndef _Ret_notnull_
134
#define _Ret_notnull_
135
#endif
136
#ifndef _Ret_z_
137
#define _Ret_z_
138
#endif
139
#ifndef _Must_inspect_result_
140
#define _Must_inspect_result_
141
#endif
142
#ifndef _Check_return_
143
#define _Check_return_
144
#endif
145
#ifndef _Post_maybez_
146
#define _Post_maybez_
147
#endif
148
#ifndef _Null_terminated_
149
#define _Null_terminated_
150
#endif
151
152
#ifndef _Likely_
153
#if _HAS_CXX20
154
#define _Likely_ [[likely]]
155
#else
156
#define _Likely_
157
#endif
158
#endif
159
160
#ifndef _Unlikely_
161
#if _HAS_CXX20
162
#define _Unlikely_ [[unlikely]]
163
#else
164
#define _Unlikely_
165
#endif
166
#endif
167
168
#if _HAS_CXX17
169
#define _Constexpr_ constexpr
170
#else
171
#define _Constexpr_
172
#endif
173
174
#ifdef _MSC_VER
175
#define _Deprecated_(message) __declspec(deprecated(message))
176
#else
177
#define _Deprecated_(message) [[deprecated(message)]]
178
#endif
179
180
#ifdef _WIN32
181
#define _Unreferenced_(x) UNREFERENCED_PARAMETER(x)
182
#else
183
#define _Unreferenced_(x)
184
#endif
185
186
#ifndef _WIN32
187
template
<
typename
T,
size_t
N>
188
size_t
_countof(T (&arr)[N])
189
{
190
return
std::extent<T[N]>::value;
191
}
192
#endif
193
194
#ifndef _Analysis_assume_
195
#define _Analysis_assume_(p)
196
#endif
197
#ifdef NDEBUG
198
#define _Assume_(p) _Analysis_assume_(p)
199
#else
200
#define _Assume_(p) assert(p)
201
#endif
202
203
#ifdef __APPLE__
204
#define off64_t off_t
205
#define lseek64 lseek
206
#define lockf64 lockf
207
#define ftruncate64 ftruncate
208
#endif
209
Generated on Wed Oct 18 2023 06:14:50 for stdex by
1.9.8