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