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-2024 Amebis
4
*/
5
6
#pragma once
7
8
#include <stddef.h>
9
#ifdef _WIN32
10
#include "windows.h"
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_
64
#define _Printf_format_string_
65
#endif
66
#ifndef _Printf_format_string_params_
67
#define _Printf_format_string_params_(n)
68
#endif
69
70
#ifndef _Inout_
71
#define _Inout_
72
#endif
73
#ifndef _Inout_opt_
74
#define _Inout_opt_
75
#endif
76
#ifndef _Inout_z_
77
#define _Inout_z_
78
#endif
79
#ifndef _Inout_z_count_
80
#define _Inout_z_count_(p)
81
#endif
82
#ifndef _Inout_cap_
83
#define _Inout_cap_(p)
84
#endif
85
#ifndef _Inout_count_
86
#define _Inout_count_(p)
87
#endif
88
#ifndef _Inout_updates_z_
89
#define _Inout_updates_z_(p)
90
#endif
91
92
#ifndef _Use_decl_annotations_
93
#define _Use_decl_annotations_
94
#endif
95
96
#ifndef _Out_
97
#define _Out_
98
#endif
99
#ifndef _Out_opt_
100
#define _Out_opt_
101
#endif
102
#ifndef _Out_z_cap_
103
#define _Out_z_cap_(p)
104
#endif
105
#ifndef _Out_writes_
106
#define _Out_writes_(p)
107
#endif
108
#ifndef _Out_writes_opt_
109
#define _Out_writes_opt_(p)
110
#endif
111
#ifndef _Out_writes_opt_z_
112
#define _Out_writes_opt_z_(p)
113
#endif
114
#ifndef _Out_writes_bytes_
115
#define _Out_writes_bytes_(p)
116
#endif
117
#ifndef _Out_writes_to_
118
#define _Out_writes_to_(p, q)
119
#endif
120
#ifndef _Out_writes_all_
121
#define _Out_writes_all_(p)
122
#endif
123
#ifndef _Out_writes_z_
124
#define _Out_writes_z_(p)
125
#endif
126
#ifndef _Out_writes_bytes_to_opt_
127
#define _Out_writes_bytes_to_opt_(p, q)
128
#endif
129
130
#ifndef _Success_
131
#define _Success_(p)
132
#endif
133
#ifndef _Ret_maybenull_
134
#define _Ret_maybenull_
135
#endif
136
#ifndef _Ret_maybenull_z_
137
#define _Ret_maybenull_z_
138
#endif
139
#ifndef _Ret_notnull_
140
#define _Ret_notnull_
141
#endif
142
#ifndef _Ret_z_
143
#define _Ret_z_
144
#endif
145
#ifndef _Must_inspect_result_
146
#define _Must_inspect_result_
147
#endif
148
#ifndef _Check_return_
149
#define _Check_return_
150
#endif
151
#ifndef _Post_maybez_
152
#define _Post_maybez_
153
#endif
154
#ifndef _Null_terminated_
155
#define _Null_terminated_
156
#endif
157
158
#ifndef _L
159
#define __L(x) L ## x
160
#define _L(x) __L(x)
161
#endif
162
#ifndef _T
163
#define _T(x) x
164
#endif
165
166
#ifndef _Likely_
167
#if _HAS_CXX20
168
#define _Likely_ [[likely]]
169
#else
170
#define _Likely_
171
#endif
172
#endif
173
174
#ifndef _Unlikely_
175
#if _HAS_CXX20
176
#define _Unlikely_ [[unlikely]]
177
#else
178
#define _Unlikely_
179
#endif
180
#endif
181
182
#ifdef _MSC_VER
183
#define _Deprecated_(message) __declspec(deprecated(message))
184
#define _NoReturn_ __declspec(noreturn)
185
#else
186
#define _Deprecated_(message) [[deprecated(message)]]
187
#define _NoReturn_ [[noreturn]]
188
#endif
189
190
#ifdef _WIN32
191
#define _Unreferenced_(x) UNREFERENCED_PARAMETER(x)
192
#else
193
#define _Unreferenced_(x) (void)(x)
194
#endif
195
196
#ifndef _WIN32
197
template
<
class
T,
size_t
N>
198
size_t
_countof(
const
T (&arr)[N])
199
{
200
_Unreferenced_(arr);
201
return
std::extent<T[N]>::value;
202
}
203
#endif
204
205
#ifndef _Analysis_assume_
206
#define _Analysis_assume_(p)
207
#endif
208
209
#ifdef __APPLE__
210
#define off64_t off_t
211
#define lseek64 lseek
212
#define lockf64 lockf
213
#define ftruncate64 ftruncate
214
#endif
Generated on Tue May 28 2024 08:26:17 for stdex by
1.11.0